mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-09 17:57:41 +03:00
Merge branch 'release/0.9.1'
This commit is contained in:
commit
f9c0256afd
7 changed files with 18 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Changes in RiotX 0.9.1 (2019-12-05)
|
||||||
|
===================================================
|
||||||
|
|
||||||
|
Bugfix 🐛:
|
||||||
|
- Fix an issue with DB transaction (#740)
|
||||||
|
|
||||||
Changes in RiotX 0.9.0 (2019-12-05)
|
Changes in RiotX 0.9.0 (2019-12-05)
|
||||||
===================================================
|
===================================================
|
||||||
|
|
||||||
|
|
|
@ -643,9 +643,10 @@ internal class RealmCryptoStore(private val realmConfiguration: RealmConfigurati
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getOutgoingRoomKeyRequestByState(states: Set<OutgoingRoomKeyRequest.RequestState>): OutgoingRoomKeyRequest? {
|
override fun getOutgoingRoomKeyRequestByState(states: Set<OutgoingRoomKeyRequest.RequestState>): OutgoingRoomKeyRequest? {
|
||||||
|
val statesIndex = states.map { it.ordinal }.toTypedArray()
|
||||||
return doRealmQueryAndCopy(realmConfiguration) {
|
return doRealmQueryAndCopy(realmConfiguration) {
|
||||||
it.where<OutgoingRoomKeyRequestEntity>()
|
it.where<OutgoingRoomKeyRequestEntity>()
|
||||||
.`in`(OutgoingRoomKeyRequestEntityFields.STATE, states.map { it.ordinal }.toTypedArray())
|
.`in`(OutgoingRoomKeyRequestEntityFields.STATE, statesIndex)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
}
|
}
|
||||||
?.toOutgoingRoomKeyRequest()
|
?.toOutgoingRoomKeyRequest()
|
||||||
|
|
|
@ -41,6 +41,7 @@ internal open class OutgoingRoomKeyRequestEntity(
|
||||||
* Convert to OutgoingRoomKeyRequest
|
* Convert to OutgoingRoomKeyRequest
|
||||||
*/
|
*/
|
||||||
fun toOutgoingRoomKeyRequest(): OutgoingRoomKeyRequest {
|
fun toOutgoingRoomKeyRequest(): OutgoingRoomKeyRequest {
|
||||||
|
val cancellationTxnId = this.cancellationTxnId
|
||||||
return OutgoingRoomKeyRequest(
|
return OutgoingRoomKeyRequest(
|
||||||
RoomKeyRequestBody().apply {
|
RoomKeyRequestBody().apply {
|
||||||
algorithm = requestBodyAlgorithm
|
algorithm = requestBodyAlgorithm
|
||||||
|
|
|
@ -22,12 +22,13 @@ import kotlinx.coroutines.isActive
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
suspend fun awaitTransaction(config: RealmConfiguration, transaction: suspend (realm: Realm) -> Unit) = withContext(Dispatchers.Default) {
|
suspend fun <T> awaitTransaction(config: RealmConfiguration, transaction: suspend (realm: Realm) -> T) = withContext(Dispatchers.Default) {
|
||||||
Realm.getInstance(config).use { bgRealm ->
|
Realm.getInstance(config).use { bgRealm ->
|
||||||
bgRealm.beginTransaction()
|
bgRealm.beginTransaction()
|
||||||
|
val result: T
|
||||||
try {
|
try {
|
||||||
val start = System.currentTimeMillis()
|
val start = System.currentTimeMillis()
|
||||||
transaction(bgRealm)
|
result = transaction(bgRealm)
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
bgRealm.commitTransaction()
|
bgRealm.commitTransaction()
|
||||||
val end = System.currentTimeMillis()
|
val end = System.currentTimeMillis()
|
||||||
|
@ -39,5 +40,6 @@ suspend fun awaitTransaction(config: RealmConfiguration, transaction: suspend (r
|
||||||
bgRealm.cancelTransaction()
|
bgRealm.cancelTransaction()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ internal class DefaultFilterRepository @Inject constructor(private val monarchy:
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getFilter(): String {
|
override suspend fun getFilter(): String {
|
||||||
return Realm.getInstance(monarchy.realmConfiguration).use {
|
return monarchy.awaitTransaction {
|
||||||
val filter = FilterEntity.getOrCreate(it)
|
val filter = FilterEntity.getOrCreate(it)
|
||||||
if (filter.filterId.isBlank()) {
|
if (filter.filterId.isBlank()) {
|
||||||
// Use the Json format
|
// Use the Json format
|
||||||
|
@ -82,7 +82,7 @@ internal class DefaultFilterRepository @Inject constructor(private val monarchy:
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getRoomFilter(): String {
|
override suspend fun getRoomFilter(): String {
|
||||||
return Realm.getInstance(monarchy.realmConfiguration).use {
|
return monarchy.awaitTransaction {
|
||||||
FilterEntity.getOrCreate(it).roomEventFilterJson
|
FilterEntity.getOrCreate(it).roomEventFilterJson
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ import io.realm.Realm
|
||||||
import io.realm.RealmModel
|
import io.realm.RealmModel
|
||||||
import java.util.concurrent.atomic.AtomicReference
|
import java.util.concurrent.atomic.AtomicReference
|
||||||
|
|
||||||
internal suspend fun Monarchy.awaitTransaction(transaction: suspend (realm: Realm) -> Unit) {
|
internal suspend fun <T> Monarchy.awaitTransaction(transaction: suspend (realm: Realm) -> T): T {
|
||||||
awaitTransaction(realmConfiguration, transaction)
|
return awaitTransaction(realmConfiguration, transaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T : RealmModel> Monarchy.fetchCopied(query: (Realm) -> T?): T? {
|
fun <T : RealmModel> Monarchy.fetchCopied(query: (Realm) -> T?): T? {
|
||||||
|
|
|
@ -16,7 +16,7 @@ androidExtensions {
|
||||||
|
|
||||||
ext.versionMajor = 0
|
ext.versionMajor = 0
|
||||||
ext.versionMinor = 9
|
ext.versionMinor = 9
|
||||||
ext.versionPatch = 0
|
ext.versionPatch = 1
|
||||||
|
|
||||||
static def getGitTimestamp() {
|
static def getGitTimestamp() {
|
||||||
def cmd = 'git show -s --format=%ct'
|
def cmd = 'git show -s --format=%ct'
|
||||||
|
|
Loading…
Reference in a new issue