mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-05-05 20:39:25 -05:00
local backup/restore: archive restore fix
This commit is contained in:
+2
-2
@@ -54,8 +54,8 @@ public class BackupSettingsPresenter extends BasePresenter<Void> {
|
||||
createAndShowDialog();
|
||||
}
|
||||
|
||||
public void showLocalRestoreDialog() {
|
||||
BackupAndRestoreManager backupManager = new BackupAndRestoreManager(getContext());
|
||||
public void showLocalRestoreDialogApi30() {
|
||||
BackupAndRestoreManager backupManager = new BackupAndRestoreManager(getContext(), true);
|
||||
|
||||
backupManager.getBackupNames(names -> showLocalRestoreDialog(backupManager, names));
|
||||
}
|
||||
|
||||
+1
-1
@@ -139,7 +139,7 @@ public class BackupAndRestoreHelper implements OnResult {
|
||||
// Delete the temporary ZIP
|
||||
tempZip.delete();
|
||||
|
||||
BackupSettingsPresenter.instance(mContext).showLocalRestoreDialog();
|
||||
BackupSettingsPresenter.instance(mContext).showLocalRestoreDialogApi30();
|
||||
|
||||
//Toast.makeText(mContext, "Backup restored successfully", Toast.LENGTH_SHORT).show();
|
||||
|
||||
|
||||
+7
-1
@@ -26,6 +26,7 @@ public class BackupAndRestoreManager implements MotherActivity.OnPermissions {
|
||||
private final File mDataDir;
|
||||
private final List<File> mBackupDirs;
|
||||
private final BackupAndRestoreHelper mHelper;
|
||||
private final boolean mForceApi30;
|
||||
private final String[] mBackupPatterns = new String[] {
|
||||
"yt_service_prefs.xml",
|
||||
"com.liskovsoft.appupdatechecker2.preferences.xml",
|
||||
@@ -39,7 +40,12 @@ public class BackupAndRestoreManager implements MotherActivity.OnPermissions {
|
||||
}
|
||||
|
||||
public BackupAndRestoreManager(Context context) {
|
||||
this(context, false);
|
||||
}
|
||||
|
||||
public BackupAndRestoreManager(Context context, boolean forceApi30) {
|
||||
mContext = context;
|
||||
mForceApi30 = forceApi30;
|
||||
|
||||
mHelper = new BackupAndRestoreHelper(context);
|
||||
|
||||
@@ -334,7 +340,7 @@ public class BackupAndRestoreManager implements MotherActivity.OnPermissions {
|
||||
|
||||
// Android 11+: only backup through the file manager (no shared dir)
|
||||
private boolean hasAccessOnlyToAppFolders() {
|
||||
return getTargetSdkVersion() > 29;
|
||||
return getTargetSdkVersion() > 29 || mForceApi30;
|
||||
}
|
||||
|
||||
private int getTargetSdkVersion() {
|
||||
|
||||
Reference in New Issue
Block a user