Skip to content

Commit

Permalink
Merge pull request #1037 from zhwanng/feat-v3.0.6
Browse files Browse the repository at this point in the history
Feat v3.0.6
  • Loading branch information
zhwanng authored Nov 26, 2024
2 parents 4f39727 + 1f8630a commit 2cd5ec4
Show file tree
Hide file tree
Showing 305 changed files with 3,397 additions and 2,239 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
compileSdk rootProject.ext.compileSdkVersion

versionCode 156
versionName "3.0.5"
versionCode 157
versionName "3.0.6"
multiDexEnabled true

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

def outputFileName = "${versionName}_snapshot_build_temp.apk"
def outputFileName = "${versionName}_patch_build_temp.apk"
outputFileName = outputFileName.replace(" ", "_")
output.outputFileName = outputFileName

Expand All @@ -135,7 +135,7 @@ android {
versionName = prefix + "(" + suffix + ")"
}

def newOutputFileName = "seafile_${versionName}_build${versionCode}_snapshot${buildCount}.apk"
def newOutputFileName = "seafile_${versionName}_build${versionCode}_patch${buildCount}.apk"
newOutputFileName = newOutputFileName.replace(" ", "_").replace("-", "_")
def apkFile = output.outputFile
def newApkFile = new File(apkFile.parent, newOutputFileName)
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/java/com/seafile/seadroid2/annotation/Todo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.seafile.seadroid2.annotation;


import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;

import java.lang.annotation.Target;

/**
* In this project, this feature is not yet complete, and will continue to be maintained in the future
*/

@Target({TYPE, METHOD, CONSTRUCTOR, FIELD})
public @interface Todo {
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class AbsLayoutItemType {
public static final int DIRENT_GRID = 12;
public static final int DIRENT_GALLERY = 13;

public static final int SEARCH = 50;

public static final int ACTIVITY = 20;

public static final int GROUP_ITEM = 30;
Expand Down
47 changes: 24 additions & 23 deletions app/src/main/java/com/seafile/seadroid2/context/NavContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
public class NavContext {
private final Stack<BaseModel> navStack = new Stack<>();

// repoId = xxx, path = /
/**
* repoId = xxx, path = /
*/
public boolean inRepoRoot() {
return navStack.size() == 1;
}
Expand Down Expand Up @@ -54,7 +56,7 @@ public void pop() {
navStack.pop();
}

public void navToPath(RepoModel repoModel, String full_path) {
public void switchToPath(RepoModel repoModel, String full_path) {
navStack.clear();

navStack.push(repoModel);
Expand Down Expand Up @@ -97,27 +99,26 @@ public DirentModel getTopDirentModel() {
return (DirentModel) navStack.peek();
}

/**
* Get the parents model of the current Dirent, maybe RepoModel
*/
public boolean isParentHasWritePermission() {
if (!inRepo()) {
//repo list page should not have permission verification
throw new IllegalArgumentException("Please check your code");
}

if (inRepoRoot()) {
return getRepoModel().hasWritePermission();
}

BaseModel bd = navStack.elementAt(navStack.size() - 1);
DirentModel d = (DirentModel) bd;
if (d == null) {
return false;
}

return d.hasWritePermission();
}
// /**
// * Get the parents model of the current Dirent, maybe RepoModel
// */
// public boolean isParentHasWritePermission() {
// if (!inRepo()) {
// //repo list page should not have permission verification
// throw new IllegalArgumentException("Please check your code");
// }
//
// if (inRepoRoot()) {
// return getRepoModel().hasWritePermission();
// }
//
// BaseModel bd = navStack.elementAt(navStack.size() - 1);
// if (bd instanceof DirentModel d) {
// return d.hasWritePermission();
// } else {
// return false;
// }
// }

public RepoModel getRepoModel() {
if (navStack.empty()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.seafile.seadroid2.enums;

public enum ActionModeCallbackType {
CREATE, DESTORY, SELECT_ALL, SELECT_NONE
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public enum RepoSelectType {
NOT_SELECTABLE(-1),
ONLY_ACCOUNT(0),
ONLY_REPO(1),
DIRENT(2);
FOLDER(2);

RepoSelectType(int i) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
package com.seafile.seadroid2.framework.data.db;

import androidx.annotation.NonNull;
import androidx.room.Dao;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import androidx.room.migration.Migration;
import androidx.sqlite.db.SupportSQLiteDatabase;

import com.seafile.seadroid2.SeadroidApplication;
import com.seafile.seadroid2.framework.data.db.dao.CertCacheDAO;
import com.seafile.seadroid2.framework.data.db.dao.DirentDAO;
import com.seafile.seadroid2.framework.data.db.dao.EncKeyCacheDAO;
import com.seafile.seadroid2.framework.data.db.dao.FileTransferDAO;
import com.seafile.seadroid2.framework.data.db.dao.FolderBackupMonitorDAO;
import com.seafile.seadroid2.framework.data.db.dao.PermissionDAO;
import com.seafile.seadroid2.framework.data.db.dao.RepoDAO;
import com.seafile.seadroid2.framework.data.db.dao.StarredDirentDAO;
import com.seafile.seadroid2.framework.data.db.entities.CertEntity;
import com.seafile.seadroid2.framework.data.db.entities.DirentModel;
import com.seafile.seadroid2.framework.data.db.entities.EncKeyCacheEntity;
import com.seafile.seadroid2.framework.data.db.entities.FolderBackupMonitorEntity;
import com.seafile.seadroid2.framework.data.db.entities.PermissionEntity;
import com.seafile.seadroid2.framework.data.db.entities.RepoModel;
import com.seafile.seadroid2.framework.data.db.entities.FileTransferEntity;
import com.seafile.seadroid2.framework.data.db.entities.StarredModel;
import com.seafile.seadroid2.framework.util.SLogs;

@Database(entities = {
RepoModel.class,
DirentModel.class,
FolderBackupMonitorEntity.class,
EncKeyCacheEntity.class,
CertEntity.class,
FileTransferEntity.class,
StarredModel.class
}, version = 2, exportSchema = false)
StarredModel.class,
PermissionEntity.class,
}, version = 3, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {
private static final String DATABASE_NAME = "seafile_room.db";
private static volatile AppDatabase _instance;

public static AppDatabase getInstance() {
if (_instance == null) {
synchronized (AppDatabase.class) {
if (_instance == null) {
_instance = Room
.databaseBuilder(SeadroidApplication.getAppContext(), AppDatabase.class, DATABASE_NAME)
.addMigrations(MIGRATION_1_2)
.addMigrations(MIGRATION_2_3)
.build();
}
}
Expand All @@ -63,6 +63,33 @@ public void migrate(@NonNull SupportSQLiteDatabase database) {
};


static final Migration MIGRATION_2_3 = new Migration(2, 3) {

@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("DROP TABLE IF EXISTS cert_cache");

database.execSQL("DROP TABLE IF EXISTS permissions");
database.execSQL("CREATE TABLE permissions (" +
"id INTEGER NOT NULL DEFAULT 0, " +
"repo_id TEXT NOT NULL DEFAULT '', " +
"description TEXT, " +
"name TEXT DEFAULT '', " +
"'create' INTEGER NOT NULL DEFAULT 0, " +
"upload INTEGER NOT NULL DEFAULT 0, " +
"download INTEGER NOT NULL DEFAULT 0, " +
"preview INTEGER NOT NULL DEFAULT 0, " +
"copy INTEGER NOT NULL DEFAULT 0, " +
"'delete' INTEGER NOT NULL DEFAULT 0, " +
"modify INTEGER NOT NULL DEFAULT 0, " +
"download_external_link INTEGER NOT NULL DEFAULT 0, " +
"'v' INTEGER NOT NULL DEFAULT 1, " +
"data_status INTEGER NOT NULL DEFAULT 0, " +
"PRIMARY KEY(repo_id, id))");
}
};


public abstract RepoDAO repoDao();

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

public abstract EncKeyCacheDAO encKeyCacheDAO();

@Deprecated
public abstract CertCacheDAO certDAO();

public abstract FolderBackupMonitorDAO folderBackupMonitorDAO();

public abstract FileTransferDAO fileTransferDAO();

public abstract PermissionDAO permissionDAO();
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public interface DirentDAO {
@Query("select * from dirents where uid in ( :uids )")
List<DirentModel> getListByIdsSync(List<String> uids);

@Query("select * from dirents where uid in ( :uids )")
Single<List<DirentModel>> getListByIdsAsync(List<String> uids);

@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(DirentModel model);

Expand Down
Loading

0 comments on commit 2cd5ec4

Please sign in to comment.