From 9197275343afb6decfb8c0e9565771ea0244fe74 Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 29 Jul 2020 09:00:29 +0200 Subject: [PATCH 1/5] version++ --- CHANGES.md | 22 ++++++++++++++++++++++ vector/build.gradle | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index b374e41ae1..885249b34b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,25 @@ +Changes in Element 1.0.2 (2020-XX-XX) +=================================================== + +Features ✨: + - + +Improvements 🙌: + - + +Bugfix 🐛: + - + + +SDK API changes ⚠️: + - + +Build 🧱: + - + +Other changes: + - + Changes in Element 1.0.1 (2020-07-28) =================================================== diff --git a/vector/build.gradle b/vector/build.gradle index 2b033790bc..9dd91c2be1 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -17,7 +17,7 @@ androidExtensions { // Note: 2 digits max for each value ext.versionMajor = 1 ext.versionMinor = 0 -ext.versionPatch = 1 +ext.versionPatch = 2 static def getGitTimestamp() { def cmd = 'git show -s --format=%ct' From cbf43ea7b3c080f59522accbae74950c0ef371a3 Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 29 Jul 2020 09:26:11 +0200 Subject: [PATCH 2/5] Session store migration --- CHANGES.md | 2 +- .../database/RealmSessionStoreMigration.kt | 43 +++++++++++++++++++ .../SessionRealmConfigurationFactory.kt | 10 ++++- 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/RealmSessionStoreMigration.kt diff --git a/CHANGES.md b/CHANGES.md index 885249b34b..5aebe41024 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,7 +5,7 @@ Features ✨: - Improvements 🙌: - - + - Added Session Database migration to avoid unneeded initial syncs Bugfix 🐛: - diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/RealmSessionStoreMigration.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/RealmSessionStoreMigration.kt new file mode 100644 index 0000000000..5204eef878 --- /dev/null +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/RealmSessionStoreMigration.kt @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2020 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.matrix.android.internal.database + +import im.vector.matrix.android.internal.database.model.RoomSummaryEntityFields +import io.realm.DynamicRealm +import io.realm.RealmMigration +import timber.log.Timber +import javax.inject.Inject + +class RealmSessionStoreMigration @Inject constructor() : RealmMigration { + + override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) { + Timber.v("Migrating Realm Session from $oldVersion to $newVersion") + + if (oldVersion <= 0) migrateTo1(realm) + } + + private fun migrateTo1(realm: DynamicRealm) { + Timber.d("Step 0 -> 1") + // Add hasFailedSending in RoomSummary and a small warning icon on room list + + realm.schema.get("RoomSummaryEntity") + ?.addField(RoomSummaryEntityFields.HAS_FAILED_SENDING, Boolean::class.java) + ?.transform { obj -> + obj.setBoolean(RoomSummaryEntityFields.HAS_FAILED_SENDING, false) + } + } +} diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/SessionRealmConfigurationFactory.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/SessionRealmConfigurationFactory.kt index e3d9833e40..d014942169 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/SessionRealmConfigurationFactory.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/SessionRealmConfigurationFactory.kt @@ -42,8 +42,15 @@ internal class SessionRealmConfigurationFactory @Inject constructor( @SessionFilesDirectory val directory: File, @SessionId val sessionId: String, @UserMd5 val userMd5: String, + val migration: RealmSessionStoreMigration, context: Context) { + + companion object { + const val SESSION_STORE_SCHEMA_VERSION = 1L + } + + private val sharedPreferences = context.getSharedPreferences("im.vector.matrix.android.realm", Context.MODE_PRIVATE) fun create(): RealmConfiguration { @@ -67,7 +74,8 @@ internal class SessionRealmConfigurationFactory @Inject constructor( realmKeysUtils.configureEncryption(this, SessionModule.getKeyAlias(userMd5)) } .modules(SessionRealmModule()) - .deleteRealmIfMigrationNeeded() + .schemaVersion(SESSION_STORE_SCHEMA_VERSION) + .migration(migration) .build() // Try creating a realm instance and if it succeeds we can clear the flag From c04f22d3bfd4760d09d5ab53e5365aa4d673a189 Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 29 Jul 2020 09:51:20 +0200 Subject: [PATCH 3/5] quick fix plural --- vector/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 1eb4b312cb..1411b59b9a 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -994,7 +994,7 @@ Banned users - 1 banned user + %d banned user %d banned users From 5c32c7388acfeee1931e945505feedb33697aa0e Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 29 Jul 2020 09:51:50 +0200 Subject: [PATCH 4/5] cleaning --- .../internal/database/SessionRealmConfigurationFactory.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/SessionRealmConfigurationFactory.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/SessionRealmConfigurationFactory.kt index d014942169..f11f001e1c 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/SessionRealmConfigurationFactory.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/SessionRealmConfigurationFactory.kt @@ -45,12 +45,10 @@ internal class SessionRealmConfigurationFactory @Inject constructor( val migration: RealmSessionStoreMigration, context: Context) { - companion object { const val SESSION_STORE_SCHEMA_VERSION = 1L } - private val sharedPreferences = context.getSharedPreferences("im.vector.matrix.android.realm", Context.MODE_PRIVATE) fun create(): RealmConfiguration { From 06ef665f6633ae0cfe661b65fecaee40fcc550b5 Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 29 Jul 2020 10:33:55 +0200 Subject: [PATCH 5/5] prepare release 1.0.2 --- CHANGES.md | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 5aebe41024..34a5e5a6a4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,25 +1,9 @@ -Changes in Element 1.0.2 (2020-XX-XX) +Changes in Element 1.0.2 (2020-07-29) =================================================== -Features ✨: - - - Improvements 🙌: - Added Session Database migration to avoid unneeded initial syncs -Bugfix 🐛: - - - - -SDK API changes ⚠️: - - - -Build 🧱: - - - -Other changes: - - - Changes in Element 1.0.1 (2020-07-28) ===================================================