Skip to content

Commit 2cd5ec4

Browse files
authored
Merge pull request #1037 from zhwanng/feat-v3.0.6
Feat v3.0.6
2 parents 4f39727 + 1f8630a commit 2cd5ec4

File tree

305 files changed

+3397
-2239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

305 files changed

+3397
-2239
lines changed

app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ android {
1414
targetSdkVersion rootProject.ext.targetSdkVersion
1515
compileSdk rootProject.ext.compileSdkVersion
1616

17-
versionCode 156
18-
versionName "3.0.5"
17+
versionCode 157
18+
versionName "3.0.6"
1919
multiDexEnabled true
2020

2121
resValue "string", "authorities", defaultConfig.applicationId + '.debug.cameraupload.provider'
@@ -114,7 +114,7 @@ android {
114114
if (output.outputFile != null && output.outputFile.name.endsWith('.apk')) {
115115
def versionName = defaultConfig.versionName
116116

117-
def outputFileName = "${versionName}_snapshot_build_temp.apk"
117+
def outputFileName = "${versionName}_patch_build_temp.apk"
118118
outputFileName = outputFileName.replace(" ", "_")
119119
output.outputFileName = outputFileName
120120

@@ -135,7 +135,7 @@ android {
135135
versionName = prefix + "(" + suffix + ")"
136136
}
137137

138-
def newOutputFileName = "seafile_${versionName}_build${versionCode}_snapshot${buildCount}.apk"
138+
def newOutputFileName = "seafile_${versionName}_build${versionCode}_patch${buildCount}.apk"
139139
newOutputFileName = newOutputFileName.replace(" ", "_").replace("-", "_")
140140
def apkFile = output.outputFile
141141
def newApkFile = new File(apkFile.parent, newOutputFileName)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.seafile.seadroid2.annotation;
2+
3+
4+
import static java.lang.annotation.ElementType.CONSTRUCTOR;
5+
import static java.lang.annotation.ElementType.FIELD;
6+
import static java.lang.annotation.ElementType.METHOD;
7+
import static java.lang.annotation.ElementType.TYPE;
8+
9+
import java.lang.annotation.Target;
10+
11+
/**
12+
* In this project, this feature is not yet complete, and will continue to be maintained in the future
13+
*/
14+
15+
@Target({TYPE, METHOD, CONSTRUCTOR, FIELD})
16+
public @interface Todo {
17+
}

app/src/main/java/com/seafile/seadroid2/bottomsheetmenu/BottomSheetMenuAdapter.java

Lines changed: 0 additions & 71 deletions
This file was deleted.

app/src/main/java/com/seafile/seadroid2/config/AbsLayoutItemType.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class AbsLayoutItemType {
1111
public static final int DIRENT_GRID = 12;
1212
public static final int DIRENT_GALLERY = 13;
1313

14+
public static final int SEARCH = 50;
15+
1416
public static final int ACTIVITY = 20;
1517

1618
public static final int GROUP_ITEM = 30;

app/src/main/java/com/seafile/seadroid2/context/NavContext.java

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
public class NavContext {
1313
private final Stack<BaseModel> navStack = new Stack<>();
1414

15-
// repoId = xxx, path = /
15+
/**
16+
* repoId = xxx, path = /
17+
*/
1618
public boolean inRepoRoot() {
1719
return navStack.size() == 1;
1820
}
@@ -54,7 +56,7 @@ public void pop() {
5456
navStack.pop();
5557
}
5658

57-
public void navToPath(RepoModel repoModel, String full_path) {
59+
public void switchToPath(RepoModel repoModel, String full_path) {
5860
navStack.clear();
5961

6062
navStack.push(repoModel);
@@ -97,27 +99,26 @@ public DirentModel getTopDirentModel() {
9799
return (DirentModel) navStack.peek();
98100
}
99101

100-
/**
101-
* Get the parents model of the current Dirent, maybe RepoModel
102-
*/
103-
public boolean isParentHasWritePermission() {
104-
if (!inRepo()) {
105-
//repo list page should not have permission verification
106-
throw new IllegalArgumentException("Please check your code");
107-
}
108-
109-
if (inRepoRoot()) {
110-
return getRepoModel().hasWritePermission();
111-
}
112-
113-
BaseModel bd = navStack.elementAt(navStack.size() - 1);
114-
DirentModel d = (DirentModel) bd;
115-
if (d == null) {
116-
return false;
117-
}
118-
119-
return d.hasWritePermission();
120-
}
102+
// /**
103+
// * Get the parents model of the current Dirent, maybe RepoModel
104+
// */
105+
// public boolean isParentHasWritePermission() {
106+
// if (!inRepo()) {
107+
// //repo list page should not have permission verification
108+
// throw new IllegalArgumentException("Please check your code");
109+
// }
110+
//
111+
// if (inRepoRoot()) {
112+
// return getRepoModel().hasWritePermission();
113+
// }
114+
//
115+
// BaseModel bd = navStack.elementAt(navStack.size() - 1);
116+
// if (bd instanceof DirentModel d) {
117+
// return d.hasWritePermission();
118+
// } else {
119+
// return false;
120+
// }
121+
// }
121122

122123
public RepoModel getRepoModel() {
123124
if (navStack.empty()) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.seafile.seadroid2.enums;
2+
3+
public enum ActionModeCallbackType {
4+
CREATE, DESTORY, SELECT_ALL, SELECT_NONE
5+
}

app/src/main/java/com/seafile/seadroid2/enums/RepoSelectType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public enum RepoSelectType {
1111
NOT_SELECTABLE(-1),
1212
ONLY_ACCOUNT(0),
1313
ONLY_REPO(1),
14-
DIRENT(2);
14+
FOLDER(2);
1515

1616
RepoSelectType(int i) {
1717

app/src/main/java/com/seafile/seadroid2/framework/data/db/AppDatabase.java

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
package com.seafile.seadroid2.framework.data.db;
22

33
import androidx.annotation.NonNull;
4-
import androidx.room.Dao;
54
import androidx.room.Database;
65
import androidx.room.Room;
76
import androidx.room.RoomDatabase;
87
import androidx.room.migration.Migration;
98
import androidx.sqlite.db.SupportSQLiteDatabase;
109

1110
import com.seafile.seadroid2.SeadroidApplication;
12-
import com.seafile.seadroid2.framework.data.db.dao.CertCacheDAO;
1311
import com.seafile.seadroid2.framework.data.db.dao.DirentDAO;
1412
import com.seafile.seadroid2.framework.data.db.dao.EncKeyCacheDAO;
1513
import com.seafile.seadroid2.framework.data.db.dao.FileTransferDAO;
1614
import com.seafile.seadroid2.framework.data.db.dao.FolderBackupMonitorDAO;
15+
import com.seafile.seadroid2.framework.data.db.dao.PermissionDAO;
1716
import com.seafile.seadroid2.framework.data.db.dao.RepoDAO;
1817
import com.seafile.seadroid2.framework.data.db.dao.StarredDirentDAO;
19-
import com.seafile.seadroid2.framework.data.db.entities.CertEntity;
2018
import com.seafile.seadroid2.framework.data.db.entities.DirentModel;
2119
import com.seafile.seadroid2.framework.data.db.entities.EncKeyCacheEntity;
2220
import com.seafile.seadroid2.framework.data.db.entities.FolderBackupMonitorEntity;
21+
import com.seafile.seadroid2.framework.data.db.entities.PermissionEntity;
2322
import com.seafile.seadroid2.framework.data.db.entities.RepoModel;
2423
import com.seafile.seadroid2.framework.data.db.entities.FileTransferEntity;
2524
import com.seafile.seadroid2.framework.data.db.entities.StarredModel;
25+
import com.seafile.seadroid2.framework.util.SLogs;
2626

2727
@Database(entities = {
2828
RepoModel.class,
2929
DirentModel.class,
3030
FolderBackupMonitorEntity.class,
3131
EncKeyCacheEntity.class,
32-
CertEntity.class,
3332
FileTransferEntity.class,
34-
StarredModel.class
35-
}, version = 2, exportSchema = false)
33+
StarredModel.class,
34+
PermissionEntity.class,
35+
}, version = 3, exportSchema = false)
3636
public abstract class AppDatabase extends RoomDatabase {
3737
private static final String DATABASE_NAME = "seafile_room.db";
3838
private static volatile AppDatabase _instance;
39-
4039
public static AppDatabase getInstance() {
4140
if (_instance == null) {
4241
synchronized (AppDatabase.class) {
4342
if (_instance == null) {
4443
_instance = Room
4544
.databaseBuilder(SeadroidApplication.getAppContext(), AppDatabase.class, DATABASE_NAME)
4645
.addMigrations(MIGRATION_1_2)
46+
.addMigrations(MIGRATION_2_3)
4747
.build();
4848
}
4949
}
@@ -63,6 +63,33 @@ public void migrate(@NonNull SupportSQLiteDatabase database) {
6363
};
6464

6565

66+
static final Migration MIGRATION_2_3 = new Migration(2, 3) {
67+
68+
@Override
69+
public void migrate(@NonNull SupportSQLiteDatabase database) {
70+
database.execSQL("DROP TABLE IF EXISTS cert_cache");
71+
72+
database.execSQL("DROP TABLE IF EXISTS permissions");
73+
database.execSQL("CREATE TABLE permissions (" +
74+
"id INTEGER NOT NULL DEFAULT 0, " +
75+
"repo_id TEXT NOT NULL DEFAULT '', " +
76+
"description TEXT, " +
77+
"name TEXT DEFAULT '', " +
78+
"'create' INTEGER NOT NULL DEFAULT 0, " +
79+
"upload INTEGER NOT NULL DEFAULT 0, " +
80+
"download INTEGER NOT NULL DEFAULT 0, " +
81+
"preview INTEGER NOT NULL DEFAULT 0, " +
82+
"copy INTEGER NOT NULL DEFAULT 0, " +
83+
"'delete' INTEGER NOT NULL DEFAULT 0, " +
84+
"modify INTEGER NOT NULL DEFAULT 0, " +
85+
"download_external_link INTEGER NOT NULL DEFAULT 0, " +
86+
"'v' INTEGER NOT NULL DEFAULT 1, " +
87+
"data_status INTEGER NOT NULL DEFAULT 0, " +
88+
"PRIMARY KEY(repo_id, id))");
89+
}
90+
};
91+
92+
6693
public abstract RepoDAO repoDao();
6794

6895
public abstract DirentDAO direntDao();
@@ -71,11 +98,9 @@ public void migrate(@NonNull SupportSQLiteDatabase database) {
7198

7299
public abstract EncKeyCacheDAO encKeyCacheDAO();
73100

74-
@Deprecated
75-
public abstract CertCacheDAO certDAO();
76-
77101
public abstract FolderBackupMonitorDAO folderBackupMonitorDAO();
78102

79103
public abstract FileTransferDAO fileTransferDAO();
80104

105+
public abstract PermissionDAO permissionDAO();
81106
}

app/src/main/java/com/seafile/seadroid2/framework/data/db/dao/CertCacheDAO.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

app/src/main/java/com/seafile/seadroid2/framework/data/db/dao/DirentDAO.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public interface DirentDAO {
3838
@Query("select * from dirents where uid in ( :uids )")
3939
List<DirentModel> getListByIdsSync(List<String> uids);
4040

41+
@Query("select * from dirents where uid in ( :uids )")
42+
Single<List<DirentModel>> getListByIdsAsync(List<String> uids);
43+
4144
@Insert(onConflict = OnConflictStrategy.REPLACE)
4245
void insert(DirentModel model);
4346

0 commit comments

Comments
 (0)