mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Add initial local archive export support.
This commit is contained in:
committed by
mtang-signal
parent
c39a1ebdb6
commit
8eb0b2f960
@@ -46,6 +46,24 @@ public class StorageUtil {
|
||||
return backups;
|
||||
}
|
||||
|
||||
public static File getOrCreateBackupV2Directory() throws NoExternalStorageException {
|
||||
File storage = Environment.getExternalStorageDirectory();
|
||||
|
||||
if (!storage.canWrite()) {
|
||||
throw new NoExternalStorageException();
|
||||
}
|
||||
|
||||
File backups = getBackupV2Directory();
|
||||
|
||||
if (!backups.exists()) {
|
||||
if (!backups.mkdirs()) {
|
||||
throw new NoExternalStorageException("Unable to create backup directory...");
|
||||
}
|
||||
}
|
||||
|
||||
return backups;
|
||||
}
|
||||
|
||||
public static File getBackupDirectory() throws NoExternalStorageException {
|
||||
File storage = Environment.getExternalStorageDirectory();
|
||||
File signal = new File(storage, "Signal");
|
||||
@@ -59,6 +77,18 @@ public class StorageUtil {
|
||||
return backups;
|
||||
}
|
||||
|
||||
public static File getBackupV2Directory() throws NoExternalStorageException {
|
||||
File storage = Environment.getExternalStorageDirectory();
|
||||
File backups = new File(storage, "Signal");
|
||||
|
||||
//noinspection ConstantConditions
|
||||
if (BuildConfig.APPLICATION_ID.startsWith(PRODUCTION_PACKAGE_ID + ".")) {
|
||||
backups = new File(storage, BuildConfig.APPLICATION_ID.substring(PRODUCTION_PACKAGE_ID.length() + 1));
|
||||
}
|
||||
|
||||
return backups;
|
||||
}
|
||||
|
||||
@RequiresApi(24)
|
||||
public static @NonNull String getDisplayPath(@NonNull Context context, @NonNull Uri uri) {
|
||||
String lastPathSegment = Objects.requireNonNull(uri.getLastPathSegment());
|
||||
|
||||
Reference in New Issue
Block a user