@@ -153,7 +153,6 @@ public class ExportBackupService extends Worker {
int size = cursor != null ? cursor.getCount() : 0;
Log.d(Config.LOGTAG, "exporting " + size + " messages for account " + account.getUuid());
int i = 0;
- int p = 0;
Element archive = new Element("archive", "urn:xmpp:pie:0#mam");
writer.write(archive.startTag().toString());
while (cursor != null && cursor.moveToNext()) {
@@ -222,27 +221,20 @@ public class ExportBackupService extends Worker {
} catch (final Exception e) {
Log.e(Config.LOGTAG, "message export error: " + e);
}
- if (i + PAGE_SIZE > size) {
- i = size;
- } else {
- i += PAGE_SIZE;
- }
- final int percentage = i * 100 / size;
- if (p < percentage) {
- p = percentage;
- notificationManager.notify(NOTIFICATION_ID, progress.build(p));
- }
+ i++;
+ final int p = i * 100 / size;
+ notificationManager.notify(NOTIFICATION_ID, progress.build(p));
}
if (cursor != null) {
cursor.close();
}
+ messageExportCheogram(db, account, writer, progress);
writer.write(archive.endTag().toString());
}
private void messageExportCheogram(SQLiteDatabase db, Account account, PrintWriter writer, Progress progress) {
final var notificationManager = getApplicationContext().getSystemService(NotificationManager.class);
int i = 0;
- int p = 0;
Cursor cursor = db.rawQuery("select conversations.*,webxdc_updates.* from " + Conversation.TABLENAME + " join cheogram.webxdc_updates webxdc_updates on " + Conversation.TABLENAME + ".uuid=webxdc_updates." + Message.CONVERSATION + " where conversations.accountUuid=?", new String[]{account.getUuid()});
int size = cursor != null ? cursor.getCount() : 0;
Log.d(Config.LOGTAG, "exporting " + size + " WebXDC updates for account " + account.getUuid());
@@ -271,20 +263,14 @@ public class ExportBackupService extends Worker {
if (summary != null) x.addChild("document", "urn:xmpp:webxdc:0").setContent(summary);
final var payload = cursor.getString(cursor.getColumnIndex("payload"));
if (payload != null) x.addChild("json", "urn:xmpp:json:0").setContent(payload);
+ message.addChild(x);
forwarded.addChild(message);
result.addChild(forwarded);
writer.write(result.toString());
- if (i + PAGE_SIZE > size) {
- i = size;
- } else {
- i += PAGE_SIZE;
- }
- final int percentage = i * 100 / size;
- if (p < percentage) {
- p = percentage;
- notificationManager.notify(NOTIFICATION_ID, progress.build(p));
- }
+ i++;
+ final int p = i * 100 / size;
+ notificationManager.notify(NOTIFICATION_ID, progress.build(p));
}
if (cursor != null) {
cursor.close();