diff --git a/src/main/java/eu/siacs/conversations/services/ExportBackupService.java b/src/main/java/eu/siacs/conversations/services/ExportBackupService.java index e8f4fc5971104c415abd4ff8110561c1f8752e71..0c152c2dbfe1610152f17a74dae28fdf08822c7c 100644 --- a/src/main/java/eu/siacs/conversations/services/ExportBackupService.java +++ b/src/main/java/eu/siacs/conversations/services/ExportBackupService.java @@ -227,7 +227,7 @@ public class ExportBackupService extends Service { boolean success; List files; try { - files = export(); + files = export(intent.getBooleanExtra("cheogram_db", true)); success = true; } catch (final Exception e) { Log.d(Config.LOGTAG, "unable to create backup", e); @@ -296,7 +296,7 @@ public class ExportBackupService extends Service { } } - private List export() throws Exception { + private List export(boolean withCheogramDb) throws Exception { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getBaseContext(), "backup"); mBuilder.setContentTitle(getString(R.string.notification_create_backup_title)) .setSmallIcon(R.drawable.ic_archive_white_24dp) @@ -345,7 +345,7 @@ public class ExportBackupService extends Service { accountExport(db, uuid, writer); simpleExport(db, Conversation.TABLENAME, Conversation.ACCOUNT, uuid, writer); messageExport(db, uuid, writer, progress); - messageExportCheogram(db, uuid, writer, progress); + if (withCheogramDb) messageExportCheogram(db, uuid, writer, progress); for (String table : Arrays.asList(SQLiteAxolotlStore.PREKEY_TABLENAME, SQLiteAxolotlStore.SIGNED_PREKEY_TABLENAME, SQLiteAxolotlStore.SESSION_TABLENAME, SQLiteAxolotlStore.IDENTITIES_TABLENAME)) { simpleExport(db, table, SQLiteAxolotlStore.ACCOUNT, uuid, writer); } diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java index f04cfa60c0ebdfed3930709a69b6f2662186b29f..67bda3d67920cec2e6093bce042e0dab3742b090 100644 --- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java @@ -523,7 +523,21 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference } private void createBackup() { - ContextCompat.startForegroundService(this, new Intent(this, ExportBackupService.class)); + new AlertDialog.Builder(this) + .setTitle("Create Backup") + .setMessage("Export extra Cheogram-only data (backup will not import into other apps then)?") + .setPositiveButton(R.string.yes, (dialog, whichButton) -> { + createBackup(true); + }) + .setNegativeButton(R.string.no, (dialog, whichButton) -> { + createBackup(false); + }).show(); + } + + private void createBackup(boolean withCheogramDb) { + Intent intent = new Intent(this, ExportBackupService.class); + intent.putExtra("cheogram_db", withCheogramDb); + ContextCompat.startForegroundService(this, intent); final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.backup_started_message); builder.setPositiveButton(R.string.ok, null);