diff options
Diffstat (limited to '')
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | build.gradle | 4 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/ExportBackupService.java | 25 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 3 |
4 files changed, 25 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 20851444e..47f40149a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ### Changelog +#### Version 2.2.5 +* make backup compatible to Conversations (only works for Android >= 8) +* bug fix + #### Version 2.2.4 * added channel search via search.jabbercat.org * reworked onboarding screens diff --git a/build.gradle b/build.gradle index 1d71a9713..03ce0e06f 100644 --- a/build.gradle +++ b/build.gradle @@ -101,8 +101,8 @@ android { minSdkVersion 16 targetSdkVersion 28 - versionCode 262 - versionName "2.2.4" + versionCode 263 + versionName "2.2.5" archivesBaseName += "-$versionName" applicationId "de.pixart.messenger" diff --git a/src/main/java/de/pixart/messenger/services/ExportBackupService.java b/src/main/java/de/pixart/messenger/services/ExportBackupService.java index 62868e3e1..4489eca9f 100644 --- a/src/main/java/de/pixart/messenger/services/ExportBackupService.java +++ b/src/main/java/de/pixart/messenger/services/ExportBackupService.java @@ -11,6 +11,7 @@ import android.database.Cursor; import android.database.DatabaseUtils; import android.database.sqlite.SQLiteDatabase; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.IBinder; import android.os.PowerManager; @@ -55,6 +56,8 @@ import de.pixart.messenger.utils.Compatibility; import de.pixart.messenger.utils.WakeLockHelper; import rocks.xmpp.addr.Jid; +import static de.pixart.messenger.utils.Compatibility.runsTwentySix; + public class ExportBackupService extends Service { private PowerManager.WakeLock wakeLock; @@ -261,15 +264,19 @@ public class ExportBackupService extends Service { } private void messageExport(SQLiteDatabase db, String uuid, PrintWriter writer, Progress progress) { - // not select and create column Message.FILE_DELETED to be compareable with conversations - Cursor cursor = db.rawQuery("select messages." + String.join(", messages.", new String[] { - Message.UUID, Message.CONVERSATION, Message.TIME_SENT, Message.COUNTERPART, Message.TRUE_COUNTERPART, - Message.BODY, Message.ENCRYPTION, Message.STATUS, Message.TYPE, Message.RELATIVE_FILE_PATH, - Message.SERVER_MSG_ID, Message.FINGERPRINT, Message.CARBON, Message.EDITED, Message.READ, - Message.DELETED, Message.OOB, Message.ERROR_MESSAGE, Message.READ_BY_MARKERS, Message.MARKABLE, - Message.REMOTE_MSG_ID, Message.CONVERSATION + Cursor cursor; + if (runsTwentySix()) { + // not select and create column Message.FILE_DELETED to be compareable with conversations + cursor = db.rawQuery("select messages." + String.join(", messages.", new String[]{ + Message.UUID, Message.CONVERSATION, Message.TIME_SENT, Message.COUNTERPART, Message.TRUE_COUNTERPART, + Message.BODY, Message.ENCRYPTION, Message.STATUS, Message.TYPE, Message.RELATIVE_FILE_PATH, + Message.SERVER_MSG_ID, Message.FINGERPRINT, Message.CARBON, Message.EDITED, Message.READ, + Message.DELETED, Message.OOB, Message.ERROR_MESSAGE, Message.READ_BY_MARKERS, Message.MARKABLE, + Message.REMOTE_MSG_ID, Message.CONVERSATION }) + " from messages join conversations on conversations.uuid=messages.conversationUuid where conversations.accountUuid=?", new String[]{uuid}); - + } else { + cursor = db.rawQuery("select messages.* from messages join conversations on conversations.uuid=messages.conversationUuid where conversations.accountUuid=?", new String[]{uuid}); + } int size = cursor != null ? cursor.getCount() : 0; Log.d(Config.LOGTAG, "exporting " + size + " messages"); int i = 0; @@ -481,4 +488,4 @@ public class ExportBackupService extends Service { return builder.build(); } } -} +}
\ No newline at end of file diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 39a18c9a3..968365f57 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -771,6 +771,9 @@ public class XmppConnectionService extends Service { time.add(Calendar.DAY_OF_YEAR, -7); final File directory = new File(path); final File[] files = directory.listFiles(); + if (files == null) { + return; + } int count = 0; for (File file : files) { Date lastModified = new Date(file.lastModified()); |