mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-22 16:07:30 +00:00
Update import/export process for ICS+
This commit is contained in:
parent
8520cb558a
commit
e45bc61624
@ -185,8 +185,6 @@ public class ConversationListActivity extends SherlockFragmentActivity
|
|||||||
Intent clearKeyIntent = new Intent(KeyCachingService.CLEAR_KEY_ACTION, null,
|
Intent clearKeyIntent = new Intent(KeyCachingService.CLEAR_KEY_ACTION, null,
|
||||||
ConversationListActivity.this, KeyCachingService.class);
|
ConversationListActivity.this, KeyCachingService.class);
|
||||||
startService(clearKeyIntent);
|
startService(clearKeyIntent);
|
||||||
|
|
||||||
DatabaseFactory.getInstance(ConversationListActivity.this).close();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,14 +60,18 @@ public class ApplicationExporter {
|
|||||||
throw new NoExternalStorageException();
|
throw new NoExternalStorageException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void migrateFile(File from, File to) throws IOException {
|
private static void migrateFile(File from, File to) {
|
||||||
if (from.exists()) {
|
try {
|
||||||
FileChannel source = new FileInputStream(from).getChannel();
|
if (from.exists()) {
|
||||||
FileChannel destination = new FileOutputStream(to).getChannel();
|
FileChannel source = new FileInputStream(from).getChannel();
|
||||||
|
FileChannel destination = new FileOutputStream(to).getChannel();
|
||||||
|
|
||||||
destination.transferFrom(source, 0, source.size());
|
destination.transferFrom(source, 0, source.size());
|
||||||
source.close();
|
source.close();
|
||||||
destination.close();
|
destination.close();
|
||||||
|
}
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
Log.w("ApplicationExporter", ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,9 +108,7 @@ public class ApplicationExporter {
|
|||||||
|
|
||||||
File[] contents = directory.listFiles();
|
File[] contents = directory.listFiles();
|
||||||
|
|
||||||
for (int i=0;i<contents.length;i++) {
|
for (File exportedFile : contents) {
|
||||||
File exportedFile = contents[i];
|
|
||||||
|
|
||||||
if (exportedFile.isFile()) {
|
if (exportedFile.isFile()) {
|
||||||
File localFile = new File(importDirectory.getAbsolutePath() + File.separator + exportedFile.getName());
|
File localFile = new File(importDirectory.getAbsolutePath() + File.separator + exportedFile.getName());
|
||||||
migrateFile(exportedFile, localFile);
|
migrateFile(exportedFile, localFile);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user