Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BackupFolder #958

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e5999d2
Selecting a Backup Directory
maxiaoping Sep 22, 2022
e030f77
Add a folder backup module
maxiaoping Nov 11, 2022
a4dd5d3
The backup upload information is added to Settings
maxiaoping Dec 9, 2022
629c872
Update Select or cancel a backup folder
maxiaoping Jan 6, 2023
8c52068
Updating a backup folder
maxiaoping Jan 6, 2023
762fbbb
Updated the folder backup
maxiaoping Jan 6, 2023
04e0870
Update backup folder
maxiaoping Feb 1, 2023
0d2e842
update backup folder
maxiaoping Feb 1, 2023
f078f02
Updated folder backup and added global exception capture
maxiaoping Feb 8, 2023
ea8929a
Updated the backup folder name
maxiaoping Feb 10, 2023
c79956a
Folder backup reconstruction
maxiaoping Feb 11, 2023
793341d
Update folder backup
maxiaoping Feb 16, 2023
5fb7f9c
Updated the backup folder name
maxiaoping Feb 17, 2023
351d3cf
Update folder backup message notification
maxiaoping Feb 20, 2023
b4c6886
Update the display of folder backup status
maxiaoping Feb 25, 2023
7c07fcd
Update folder backup
maxiaoping Feb 25, 2023
1e1e1ac
Update folder backup
maxiaoping Feb 25, 2023
334f227
Update the folder backup logic
maxiaoping Feb 27, 2023
8a09388
Update the display of folder backup status
maxiaoping Mar 2, 2023
2eab112
Updated the folder backup and photo sync display status logic
maxiaoping Mar 2, 2023
1d18bbd
Update backup folder FileAlterationMonitor
maxiaoping Mar 2, 2023
114c7ba
Updated the folder backup interface
maxiaoping Mar 13, 2023
2d24915
Update folder backup observer
maxiaoping Mar 14, 2023
0ac4f40
Update the folder backup upload link
maxiaoping Mar 16, 2023
cbad36e
Update the folder backup transfer tag
maxiaoping Mar 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId 'com.seafile.seadroid2'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 123
versionName "2.2.48"
versionCode 125
versionName "2.2.50"
multiDexEnabled true
resValue "string", "authorities", applicationId + '.cameraupload.provider'
resValue "string", "account_type", "com.seafile.seadroid2.account.api2"
Expand Down Expand Up @@ -124,11 +124,17 @@ android {
implementation 'com.shuyu:gsyVideoPlayer-java:3.0.0'
implementation 'com.shuyu:gsyVideoPlayer-ex_so:3.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.github.getActivity:XXPermissions:16.2'
implementation 'io.reactivex.rxjava3:rxjava:3.1.5'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
implementation 'com.google.code.gson:gson:2.10'



implementation 'com.yydcdut:markdown-processor:0.1.3'
implementation 'ren.qinc.edit:lib:0.0.5'//editor undo redo
implementation 'com.github.tiagohm.MarkdownView:library:0.19.0'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'org.greenrobot:eventbus:3.3.1'
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}
Expand Down
13 changes: 10 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
<!--<uses-permission android:name="android.permission.WRITE_CONTACTS"/>-->

<!--android 9.0 FOREGROUND_SERVICE -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_SYNC_STATS"/>


<application
Expand Down Expand Up @@ -125,9 +128,9 @@
</intent-filter>
</activity>

<activity android:name="com.seafile.seadroid2.ui.activity.SeafilePathChooserActivity"
android:label="@string/app_name">
</activity>
<activity
android:name="com.seafile.seadroid2.ui.activity.SeafilePathChooserActivity"
android:label="@string/app_name"></activity>

<activity android:name="com.seafile.seadroid2.ui.activity.FileActivity"
android:label="@string/app_name">
Expand Down Expand Up @@ -159,6 +162,9 @@
<activity android:name="com.seafile.seadroid2.cameraupload.CameraUploadConfigActivity"
android:label="@string/app_name">
</activity>
<activity android:name=".folderbackup.FolderBackupConfigActivity"
android:label="@string/app_name">
</activity>
<!--<activity android:name="com.seafile.seadroid2.cameraupload.ContactsUploadConfigActivity"-->
<!--android:label="@string/app_name">-->
<!--</activity>-->
Expand Down Expand Up @@ -192,6 +198,7 @@
</intent-filter>
</provider>
<service android:name="com.seafile.seadroid2.transfer.TransferService" > </service>
<service android:name="com.seafile.seadroid2.folderbackup.FolderBackupService" > </service>
<service android:name="com.seafile.seadroid2.monitor.FileMonitorService" > </service>
<service android:name=".cameraupload.MediaObserverService" />

Expand Down
18 changes: 17 additions & 1 deletion app/src/main/java/com/seafile/seadroid2/SeadroidApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.seafile.seadroid2.data.StorageManager;
import com.seafile.seadroid2.gesturelock.AppLockManager;
import com.seafile.seadroid2.ui.CustomNotificationBuilder;
import com.seafile.seadroid2.util.CrashHandler;
import com.seafile.seadroid2.util.Utils;

import java.io.File;
Expand All @@ -28,6 +29,8 @@ public class SeadroidApplication extends Application {
private int totalNumber;
private int scanUploadStatus;
private static SeadroidApplication instance;
private int totalBackup;
private int waitingBackup;

public void onCreate() {
super.onCreate();
Expand All @@ -40,7 +43,8 @@ public void onCreate() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
initNotificationChannel();
}

CrashHandler crashHandler = CrashHandler.getInstance();
crashHandler.init(this);
Utils.logPhoneModelInfo();
}

Expand Down Expand Up @@ -125,4 +129,16 @@ public int getScanUploadStatus() {
return scanUploadStatus;
}

public int getTotalBackup() {
return totalBackup;
}

public int getWaitingBackup() {
return waitingBackup;
}

public void setFolderBackupNumber(int totalBackup, int waitingBackup) {
this.totalBackup = totalBackup;
this.waitingBackup = waitingBackup;
}
}
44 changes: 44 additions & 0 deletions app/src/main/java/com/seafile/seadroid2/SettingsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private SettingsManager() {
public static final String CAMERA_UPLOAD_ADVANCED_SCREEN_KEY = "screen_camera_upload_advanced_feature";
public static final String CAMERA_UPLOAD_ADVANCED_CATEGORY_KEY = "category_camera_upload_advanced_key";
public static final String CAMERA_UPLOAD_ALLOW_DATA_PLAN_SWITCH_KEY = "allow_data_plan_switch_key";

public static final String CAMERA_UPLOAD_ALLOW_VIDEOS_SWITCH_KEY = "allow_videos_upload_switch_key";
public static final String CAMERA_UPLOAD_BUCKETS_KEY = "camera_upload_buckets_key";
public static final String CAMERA_UPLOAD_CATEGORY_KEY = "category_camera_upload_key";
Expand Down Expand Up @@ -102,6 +103,18 @@ private SettingsManager() {
public static final String PIC_CHECK_START = "pic_check_start";
public static final String UPLOAD_COMPLETED_TIME = "upload_completed_time";

//FolderBackupStatus
public static final String FOLDER_BACKUP_SWITCH_KEY = "folder_backup_switch_key";
public static final String FOLDER_BACKUP_ALLOW_DATA_PLAN_SWITCH_KEY = "folder_backup_allow_data_plan_switch_key";
public static final String FOLDER_AUTOMATIC_BACKUP_SWITCH_KEY = "folder_automatic_backup_switch_key";
public static final String FOLDER_BACKUP_ACCOUNT_EMAIL = "folder_backup_account_email";
public static final String FOLDER_BACKUP_CATEGORY_KEY = "folder_backup_category_key";
public static final String FOLDER_BACKUP_MODE = "folder_backup_mode";
public static final String FOLDER_BACKUP_LIBRARY_KEY = "folder_backup_library_key";
public static final String SELECTED_BACKUP_FOLDERS_KEY = "selected_backup_folders_key";
public static final String FOLDER_BACKUP_STATE = "folder_backup_state";
public static final String FOLDER_BACKUP_PATHS = "folder_backup_paths";

public static long lock_timestamp = 0;
public static final long LOCK_EXPIRATION_MSECS = 5 * 60 * 1000;

Expand Down Expand Up @@ -233,6 +246,9 @@ public boolean checkCameraUploadNetworkAvailable() {
public boolean isDataPlanAllowed() {
return settingsSharedPref.getBoolean(CAMERA_UPLOAD_ALLOW_DATA_PLAN_SWITCH_KEY, false);
}
public boolean isFolderBackupDataPlanAllowed() {
return settingsSharedPref.getBoolean(FOLDER_BACKUP_ALLOW_DATA_PLAN_SWITCH_KEY, false);
}

public boolean isVideosUploadAllowed() {
return settingsSharedPref.getBoolean(CAMERA_UPLOAD_ALLOW_VIDEOS_SWITCH_KEY, false);
Expand All @@ -241,6 +257,16 @@ public boolean isVideosUploadAllowed() {
public void saveDataPlanAllowed(boolean isAllowed) {
settingsSharedPref.edit().putBoolean(CAMERA_UPLOAD_ALLOW_DATA_PLAN_SWITCH_KEY, isAllowed).commit();
}
public void saveFolderBackupDataPlanAllowed(boolean isAllowed) {
settingsSharedPref.edit().putBoolean(FOLDER_BACKUP_ALLOW_DATA_PLAN_SWITCH_KEY, isAllowed).commit();
}

public void saveFolderAutomaticBackup(boolean isAllowed) {
settingsSharedPref.edit().putBoolean(FOLDER_AUTOMATIC_BACKUP_SWITCH_KEY, isAllowed).commit();
}
public boolean isFolderAutomaticBackup() {
return settingsSharedPref.getBoolean(FOLDER_AUTOMATIC_BACKUP_SWITCH_KEY, false);
}

public void saveVideosAllowed(boolean isVideosUploadAllowed) {
settingsSharedPref.edit().putBoolean(CAMERA_UPLOAD_ALLOW_VIDEOS_SWITCH_KEY, isVideosUploadAllowed).commit();
Expand Down Expand Up @@ -310,4 +336,22 @@ public void savePrivacyPolicyConfirmed(int type) {
public int getPrivacyPolicyConfirmed() {
return sharedPref.getInt(PRIVACY_POLICY_CONFIRMED, 0);
}

public void saveBackupPaths(String path) {
editor.putString(FOLDER_BACKUP_PATHS, path);
editor.commit();
}

public String getBackupPaths() {
return sharedPref.getString(SettingsManager.FOLDER_BACKUP_PATHS, null);
}

public void saveBackupEmail(String path) {
editor.putString(FOLDER_BACKUP_ACCOUNT_EMAIL, path);
editor.commit();
}

public String getBackupEmail() {
return sharedPref.getString(SettingsManager.FOLDER_BACKUP_ACCOUNT_EMAIL, null);
}
}
Loading