mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Delete "external" persistent blobs on cleanup
Also switch external persistent blog directory to cache Fixes #6909 // FREEBIE
This commit is contained in:
parent
3ed82c1726
commit
3e9bfcb3fd
@ -73,6 +73,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
|||||||
public static final int NO_MORE_CANONICAL_DB_VERSION = 276;
|
public static final int NO_MORE_CANONICAL_DB_VERSION = 276;
|
||||||
public static final int PROFILES = 289;
|
public static final int PROFILES = 289;
|
||||||
public static final int SCREENSHOTS = 300;
|
public static final int SCREENSHOTS = 300;
|
||||||
|
public static final int PERSISTENT_BLOBS = 307;
|
||||||
|
|
||||||
private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{
|
private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{
|
||||||
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
|
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
|
||||||
@ -249,6 +250,16 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
|||||||
TextSecurePreferences.setScreenSecurityEnabled(getApplicationContext(), screenSecurity);
|
TextSecurePreferences.setScreenSecurityEnabled(getApplicationContext(), screenSecurity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params[0] < PERSISTENT_BLOBS) {
|
||||||
|
File externalDir = context.getExternalFilesDir(null);
|
||||||
|
|
||||||
|
if (externalDir != null && externalDir.isDirectory() && externalDir.exists()) {
|
||||||
|
for (File blob : externalDir.listFiles()) {
|
||||||
|
if (blob.exists() && blob.isFile()) blob.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +141,10 @@ public class PersistentBlobProvider {
|
|||||||
return getFile(ContentUris.parseId(uri)).delete();
|
return getFile(ContentUris.parseId(uri)).delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isExternalBlobUri(context, uri)) {
|
||||||
|
return new File(uri.getPath()).delete();
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +223,7 @@ public class PersistentBlobProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static @NonNull File getExternalDir(Context context) throws IOException {
|
private static @NonNull File getExternalDir(Context context) throws IOException {
|
||||||
final File externalDir = context.getExternalFilesDir(null);
|
final File externalDir = context.getExternalCacheDir();
|
||||||
if (externalDir == null) throw new IOException("no external files directory");
|
if (externalDir == null) throw new IOException("no external files directory");
|
||||||
return externalDir;
|
return externalDir;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user