Merge pull request #2896 from vector-im/feature/bma/dependabot

Upgrade dependencies
This commit is contained in:
Benoit Marty 2021-02-22 12:22:43 +01:00 committed by GitHub
commit b38ff46af4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 51 additions and 36 deletions

View File

@ -17,7 +17,7 @@ SDK API changes ⚠️:
-
Build 🧱:
-
- Update a lot of dependencies, with the help of dependabot.
Test:
-

View File

@ -2,8 +2,8 @@
buildscript {
// Ref: https://kotlinlang.org/releases.html
ext.kotlin_version = '1.4.21'
ext.kotlin_coroutines_version = "1.4.1"
ext.kotlin_version = '1.4.30'
ext.kotlin_coroutines_version = "1.4.2"
repositories {
google()
jcenter()

View File

@ -145,7 +145,7 @@ dependencies {
// Database
implementation 'com.github.Zhuinden:realm-monarchy:0.7.1'
kapt 'dk.ilios:realmfieldnameshelper:1.1.1'
kapt 'dk.ilios:realmfieldnameshelper:2.0.0'
// Work
implementation "androidx.work:work-runtime-ktx:$work_version"

View File

@ -18,7 +18,6 @@ package org.matrix.android.sdk.internal.database.query
import org.matrix.android.sdk.internal.database.model.ChunkEntity
import org.matrix.android.sdk.internal.database.model.ChunkEntityFields
import org.matrix.android.sdk.internal.database.model.RoomEntityFields
import io.realm.Realm
import io.realm.RealmQuery
import io.realm.RealmResults
@ -27,7 +26,7 @@ import io.realm.kotlin.where
internal fun ChunkEntity.Companion.where(realm: Realm, roomId: String): RealmQuery<ChunkEntity> {
return realm.where<ChunkEntity>()
.equalTo("${ChunkEntityFields.ROOM}.${RoomEntityFields.ROOM_ID}", roomId)
.equalTo(ChunkEntityFields.ROOM.ROOM_ID, roomId)
}
internal fun ChunkEntity.Companion.find(realm: Realm, roomId: String, prevToken: String? = null, nextToken: String? = null): ChunkEntity? {

View File

@ -48,6 +48,6 @@ internal fun PushRuleEntity.Companion.where(realm: Realm,
scope: String,
ruleId: String): RealmQuery<PushRuleEntity> {
return realm.where<PushRuleEntity>()
.equalTo("${PushRuleEntityFields.PARENT}.${PushRulesEntityFields.SCOPE}", scope)
.equalTo(PushRuleEntityFields.PARENT.SCOPE, scope)
.equalTo(PushRuleEntityFields.RULE_ID, ruleId)
}

View File

@ -16,7 +16,6 @@
package org.matrix.android.sdk.internal.database.query
import org.matrix.android.sdk.internal.database.model.RoomSummaryEntityFields
import org.matrix.android.sdk.internal.database.model.UserDraftsEntity
import org.matrix.android.sdk.internal.database.model.UserDraftsEntityFields
import io.realm.Realm
@ -26,7 +25,7 @@ import io.realm.kotlin.where
internal fun UserDraftsEntity.Companion.where(realm: Realm, roomId: String? = null): RealmQuery<UserDraftsEntity> {
val query = realm.where<UserDraftsEntity>()
if (roomId != null) {
query.equalTo(UserDraftsEntityFields.ROOM_SUMMARY_ENTITY + "." + RoomSummaryEntityFields.ROOM_ID, roomId)
query.equalTo(UserDraftsEntityFields.ROOM_SUMMARY_ENTITY.ROOM_ID, roomId)
}
return query
}

View File

@ -43,7 +43,6 @@ import org.matrix.android.sdk.api.util.CancelableBag
import org.matrix.android.sdk.internal.database.RealmSessionProvider
import org.matrix.android.sdk.internal.database.mapper.TimelineEventMapper
import org.matrix.android.sdk.internal.database.model.ChunkEntity
import org.matrix.android.sdk.internal.database.model.ChunkEntityFields
import org.matrix.android.sdk.internal.database.model.RoomEntity
import org.matrix.android.sdk.internal.database.model.TimelineEventEntity
import org.matrix.android.sdk.internal.database.model.TimelineEventEntityFields
@ -688,11 +687,11 @@ internal class DefaultTimeline(
return if (initialEventId == null) {
TimelineEventEntity
.whereRoomId(realm, roomId = roomId)
.equalTo("${TimelineEventEntityFields.CHUNK}.${ChunkEntityFields.IS_LAST_FORWARD}", true)
.equalTo(TimelineEventEntityFields.CHUNK.IS_LAST_FORWARD, true)
} else {
TimelineEventEntity
.whereRoomId(realm, roomId = roomId)
.`in`("${TimelineEventEntityFields.CHUNK}.${ChunkEntityFields.TIMELINE_EVENTS.EVENT_ID}", arrayOf(initialEventId))
.`in`("${TimelineEventEntityFields.CHUNK.TIMELINE_EVENTS}.${TimelineEventEntityFields.EVENT_ID}", arrayOf(initialEventId))
}
}

View File

@ -24,6 +24,7 @@ import io.realm.RealmResults
import org.matrix.android.sdk.api.session.room.model.ReadReceipt
import org.matrix.android.sdk.api.session.room.timeline.TimelineSettings
import org.matrix.android.sdk.internal.database.mapper.ReadReceiptsSummaryMapper
import org.matrix.android.sdk.internal.database.model.EventEntityFields
import org.matrix.android.sdk.internal.database.model.ReadReceiptsSummaryEntity
import org.matrix.android.sdk.internal.database.model.ReadReceiptsSummaryEntityFields
import org.matrix.android.sdk.internal.database.model.TimelineEventEntity
@ -121,7 +122,7 @@ internal class TimelineHiddenReadReceipts constructor(private val readReceiptsSu
// We are looking for read receipts set on hidden events.
// We only accept those with a timelineEvent (so coming from pagination/sync).
this.hiddenReadReceipts = ReadReceiptsSummaryEntity.whereInRoom(realm, roomId)
.isNotEmpty(ReadReceiptsSummaryEntityFields.TIMELINE_EVENT)
.isNotEmpty(ReadReceiptsSummaryEntityFields.TIMELINE_EVENT.`$`)
.isNotEmpty(ReadReceiptsSummaryEntityFields.READ_RECEIPTS.`$`)
.filterReceiptsWithSettings()
.findAllAsync()
@ -157,12 +158,12 @@ internal class TimelineHiddenReadReceipts constructor(private val readReceiptsSu
// Result: D, F, H, I
settings.filters.allowedTypes.forEachIndexed { index, filter ->
if (filter.stateKey == null) {
notEqualTo("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT}.${TimelineEventEntityFields.ROOT.TYPE}", filter.eventType)
notEqualTo("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT.ROOT}.${EventEntityFields.TYPE}", filter.eventType)
} else {
beginGroup()
notEqualTo("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT}.${TimelineEventEntityFields.ROOT.TYPE}", filter.eventType)
notEqualTo("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT.ROOT}.${EventEntityFields.TYPE}", filter.eventType)
or()
notEqualTo("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT}.${TimelineEventEntityFields.ROOT.STATE_KEY}", filter.stateKey)
notEqualTo("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT.ROOT}.${EventEntityFields.STATE_KEY}", filter.stateKey)
endGroup()
}
if (index != settings.filters.allowedTypes.size - 1) {
@ -174,19 +175,19 @@ internal class TimelineHiddenReadReceipts constructor(private val readReceiptsSu
}
if (settings.filters.filterUseless) {
if (needOr) or()
equalTo("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT}.${TimelineEventEntityFields.ROOT.IS_USELESS}", true)
equalTo("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT.ROOT}.${EventEntityFields.IS_USELESS}", true)
needOr = true
}
if (settings.filters.filterEdits) {
if (needOr) or()
like("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT}.${TimelineEventEntityFields.ROOT.CONTENT}", TimelineEventFilter.Content.EDIT)
like("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT.ROOT}.${EventEntityFields.CONTENT}", TimelineEventFilter.Content.EDIT)
or()
like("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT}.${TimelineEventEntityFields.ROOT.CONTENT}", TimelineEventFilter.Content.RESPONSE)
like("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT.ROOT}.${EventEntityFields.CONTENT}", TimelineEventFilter.Content.RESPONSE)
needOr = true
}
if (settings.filters.filterRedacted) {
if (needOr) or()
like("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT}.${TimelineEventEntityFields.ROOT.UNSIGNED_DATA}", TimelineEventFilter.Unsigned.REDACTED)
like("${ReadReceiptsSummaryEntityFields.TIMELINE_EVENT.ROOT}.${EventEntityFields.UNSIGNED_DATA}", TimelineEventFilter.Unsigned.REDACTED)
}
endGroup()
return this

View File

@ -299,6 +299,7 @@ dependencies {
def work_version = '2.5.0'
def arch_version = '2.1.0'
def lifecycle_version = '2.2.0'
def rxbinding_version = '3.1.0'
// Tests
def kluent_version = '1.65'
@ -345,9 +346,9 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.1'
// RXBinding
implementation 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
implementation 'com.jakewharton.rxbinding3:rxbinding-appcompat:3.1.0'
implementation 'com.jakewharton.rxbinding3:rxbinding-material:3.1.0'
implementation "com.jakewharton.rxbinding3:rxbinding:$rxbinding_version"
implementation "com.jakewharton.rxbinding3:rxbinding-appcompat:$rxbinding_version"
implementation "com.jakewharton.rxbinding3:rxbinding-material:$rxbinding_version"
implementation("com.airbnb.android:epoxy:$epoxy_version")
implementation "com.airbnb.android:epoxy-glide-preloading:$epoxy_version"
@ -381,13 +382,13 @@ dependencies {
implementation 'com.github.vector-im:PFLockScreen-Android:1.0.0-beta12'
// Custom Tab
implementation 'androidx.browser:browser:1.2.0'
implementation 'androidx.browser:browser:1.3.0'
// Passphrase strength helper
implementation 'com.nulab-inc:zxcvbn:1.4.0'
//Alerter
implementation 'com.tapadoo.android:alerter:5.1.2'
implementation 'com.tapadoo.android:alerter:7.0.1'
implementation 'com.otaliastudios:autocomplete:1.1.0'

View File

@ -33,14 +33,15 @@ import android.provider.Settings
import android.webkit.MimeTypeMap
import android.widget.Toast
import androidx.activity.result.ActivityResultLauncher
import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.browser.customtabs.CustomTabsIntent
import androidx.browser.customtabs.CustomTabsSession
import androidx.core.content.ContextCompat
import androidx.core.content.FileProvider
import androidx.core.content.getSystemService
import im.vector.app.BuildConfig
import im.vector.app.R
import im.vector.app.features.notifications.NotificationUtils
import im.vector.app.features.themes.ThemeUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
@ -92,17 +93,24 @@ fun openUrlInExternalBrowser(context: Context, uri: Uri?) {
* If several compatible browsers are installed, the user will be proposed to choose one.
* Ref: https://developer.chrome.com/multidevice/android/customtabs
*/
fun openUrlInChromeCustomTab(context: Context, session: CustomTabsSession?, url: String) {
fun openUrlInChromeCustomTab(context: Context,
session: CustomTabsSession?,
url: String) {
try {
CustomTabsIntent.Builder()
.setToolbarColor(ContextCompat.getColor(context, R.color.riotx_background_light))
.apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setNavigationBarColor(ContextCompat.getColor(context, R.color.riotx_header_panel_background_light))
.setDefaultColorSchemeParams(
CustomTabColorSchemeParams.Builder()
.setToolbarColor(ThemeUtils.getColor(context, R.attr.riotx_background))
.setNavigationBarColor(ThemeUtils.getColor(context, R.attr.riotx_background))
.build()
)
.setColorScheme(
when {
ThemeUtils.isSystemTheme(context) -> CustomTabsIntent.COLOR_SCHEME_SYSTEM
ThemeUtils.isLightTheme(context) -> CustomTabsIntent.COLOR_SCHEME_LIGHT
else -> CustomTabsIntent.COLOR_SCHEME_DARK
}
}
.setNavigationBarColor(ContextCompat.getColor(context, R.color.riotx_background_light))
.setColorScheme(CustomTabsIntent.COLOR_SCHEME_LIGHT)
)
// Note: setting close button icon does not work
.setCloseButtonIcon(BitmapFactory.decodeResource(context.resources, R.drawable.ic_back_24dp))
.setStartAnimations(context, R.anim.enter_fade_in, R.anim.exit_fade_out)

View File

@ -99,7 +99,7 @@ class PopupAlertManager @Inject constructor() {
// we want to remove existing popup on previous activity and display it on new one
if (currentAlerter != null) {
weakCurrentActivity?.get()?.let {
Alerter.clearCurrent(it)
Alerter.clearCurrent(it, null)
if (currentAlerter?.isLight == false) {
setLightStatusBar()
}

View File

@ -59,6 +59,14 @@ object ThemeUtils {
setApplicationTheme(context, theme)
}
/**
* @return true if current theme is System
*/
fun isSystemTheme(context: Context): Boolean {
val theme = getApplicationTheme(context)
return theme == SYSTEM_THEME_VALUE
}
/**
* @return true if current theme is Light or current theme is System and system theme is light
*/