Upgrade the dependencies to the latest version

This commit is contained in:
Benoit Marty 2019-09-27 11:42:46 +02:00 committed by Benoit Marty
parent 4f7ec91255
commit 4ad86a13a0
15 changed files with 140 additions and 137 deletions

View File

@ -1,6 +1,6 @@
#Tue Mar 19 09:53:05 CET 2019
#Fri Sep 27 10:10:35 CEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

View File

@ -29,12 +29,14 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation project(":matrix-sdk-android")
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
// Paging

View File

@ -67,6 +67,10 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
static def gitRevision() {
@ -86,11 +90,10 @@ static def gitRevisionDate() {
dependencies {
def arrow_version = "0.8.0"
def support_version = '1.1.0-beta01'
def arrow_version = "0.8.2"
def moshi_version = '1.8.0'
def lifecycle_version = '2.0.0'
def coroutines_version = "1.0.1"
def lifecycle_version = '2.1.0'
def coroutines_version = "1.1.1"
def markwon_version = '3.0.0'
def daggerVersion = '2.23.1'
@ -98,8 +101,8 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "androidx.appcompat:appcompat:1.1.0-rc01"
implementation "androidx.recyclerview:recyclerview:1.1.0-beta01"
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.recyclerview:recyclerview:1.1.0-beta04"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
@ -120,7 +123,7 @@ dependencies {
kapt 'dk.ilios:realmfieldnameshelper:1.1.1'
// Work
implementation "androidx.work:work-runtime-ktx:2.1.0-rc01"
implementation "androidx.work:work-runtime-ktx:2.3.0-alpha01"
// FP
implementation "io.arrow-kt:arrow-core:$arrow_version"

View File

@ -208,6 +208,10 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
@ -229,10 +233,10 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
implementation 'androidx.appcompat:appcompat:1.1.0'
//Do not use beta2 at the moment, as it breaks things
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'androidx.core:core-ktx:1.1.0'
implementation "org.threeten:threetenbp:1.4.0:no-tzdb"
implementation "com.gabrielittner.threetenbp:lazythreetenbp:0.7.0"
@ -251,7 +255,7 @@ dependencies {
// rx
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.0'
// RXBinding
implementation 'com.jakewharton.rxbinding3:rxbinding:3.0.0'
@ -264,7 +268,7 @@ dependencies {
implementation 'com.airbnb.android:mvrx:1.0.1'
// Work
implementation "androidx.work:work-runtime-ktx:2.1.0-rc01"
implementation "androidx.work:work-runtime-ktx:2.3.0-alpha01"
// Paging
implementation "androidx.paging:paging-runtime-ktx:2.1.0"
@ -273,11 +277,11 @@ dependencies {
implementation "io.arrow-kt:arrow-core:$arrow_version"
// Pref
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.preference:preference:1.1.0'
// UI
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.google.android.material:material:1.1.0-alpha08'
implementation 'com.google.android.material:material:1.1.0-alpha10'
implementation 'me.gujun.android:span:1.7'
implementation "ru.noties.markwon:core:$markwon_version"
implementation "ru.noties.markwon:html:$markwon_version"
@ -324,7 +328,9 @@ dependencies {
kapt 'com.squareup.inject:assisted-inject-processor-dagger2:0.4.0'
// gplay flavor only
gplayImplementation('com.google.firebase:firebase-messaging:19.0.1') {
// Warning: due to the exclude, Android Studio does not propose to upgrade. Uncomment next line to be proposed to upgrade
// implementation 'com.google.firebase:firebase-messaging:20.0.0'
gplayImplementation('com.google.firebase:firebase-messaging:20.0.0') {
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-analytics'
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'

View File

@ -73,16 +73,12 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() {
*
* @param message the message
*/
override fun onMessageReceived(message: RemoteMessage?) {
override fun onMessageReceived(message: RemoteMessage) {
if (!vectorPreferences.areNotificationEnabledForDevice()) {
Timber.i("Notification are disabled for this device")
return
}
if (message == null || message.data == null) {
Timber.e("## onMessageReceived() : received a null message or message with no data")
return
}
if (BuildConfig.LOW_PRIVACY_LOG_ENABLE) {
Timber.i("## onMessageReceived() %s", message.data.toString())
Timber.i("## onMessageReceived() from FCM with priority %s", message.priority)
@ -103,15 +99,11 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() {
* when the InstanceID token is initially generated, so this is where
* you retrieve the token.
*/
override fun onNewToken(refreshedToken: String?) {
override fun onNewToken(refreshedToken: String) {
Timber.i("onNewToken: FCM Token has been updated")
FcmHelper.storeFcmToken(this, refreshedToken)
if (refreshedToken == null) {
Timber.w("onNewToken:received null token")
} else {
if (vectorPreferences.areNotificationEnabledForDevice() && activeSessionHolder.hasActiveSession()) {
pusherManager.registerPusherWithFcmKey(refreshedToken)
}
if (vectorPreferences.areNotificationEnabledForDevice() && activeSessionHolder.hasActiveSession()) {
pusherManager.registerPusherWithFcmKey(refreshedToken)
}
}
@ -226,8 +218,7 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() {
} else {
if (notifiableEvent is NotifiableMessageEvent) {
if (TextUtils.isEmpty(notifiableEvent.senderName)) {
notifiableEvent.senderName = data["sender_display_name"]
?: data["sender"] ?: ""
notifiableEvent.senderName = data["sender_display_name"] ?: data["sender"] ?: ""
}
if (TextUtils.isEmpty(notifiableEvent.roomName)) {
notifiableEvent.roomName = findRoomNameBestEffort(data, session) ?: ""
@ -272,11 +263,11 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() {
try {
return Event(eventId = data["event_id"],
senderId = data["sender"],
roomId = data["room_id"],
type = data.getValue("type"),
senderId = data["sender"],
roomId = data["room_id"],
type = data.getValue("type"),
// TODO content = data.getValue("content"),
originServerTs = System.currentTimeMillis())
originServerTs = System.currentTimeMillis())
} catch (e: Exception) {
Timber.e(e, "buildEvent fails ")
}

View File

@ -28,6 +28,7 @@ import im.vector.riotx.core.di.ScreenComponent
import im.vector.riotx.core.extensions.withArgs
import im.vector.riotx.core.preference.BingRule
import im.vector.riotx.core.preference.BingRulePreference
import im.vector.riotx.core.preference.VectorPreference
import im.vector.riotx.features.notifications.NotificationUtils
import javax.inject.Inject
@ -54,7 +55,7 @@ class VectorSettingsAdvancedNotificationPreferenceFragment : VectorSettingsBaseF
override fun bindPref() {
val callNotificationsSystemOptions = findPreference(VectorPreferences.SETTINGS_SYSTEM_CALL_NOTIFICATION_PREFERENCE_KEY)
val callNotificationsSystemOptions = findPreference<VectorPreference>(VectorPreferences.SETTINGS_SYSTEM_CALL_NOTIFICATION_PREFERENCE_KEY)!!
if (NotificationUtils.supportNotificationChannels()) {
callNotificationsSystemOptions.onPreferenceClickListener = Preference.OnPreferenceClickListener {
NotificationUtils.openSystemSettingsForCallCategory(this)
@ -64,7 +65,7 @@ class VectorSettingsAdvancedNotificationPreferenceFragment : VectorSettingsBaseF
callNotificationsSystemOptions.isVisible = false
}
val noisyNotificationsSystemOptions = findPreference(VectorPreferences.SETTINGS_SYSTEM_NOISY_NOTIFICATION_PREFERENCE_KEY)
val noisyNotificationsSystemOptions = findPreference<VectorPreference>(VectorPreferences.SETTINGS_SYSTEM_NOISY_NOTIFICATION_PREFERENCE_KEY)!!
if (NotificationUtils.supportNotificationChannels()) {
noisyNotificationsSystemOptions.onPreferenceClickListener = Preference.OnPreferenceClickListener {
NotificationUtils.openSystemSettingsForNoisyCategory(this)
@ -74,7 +75,7 @@ class VectorSettingsAdvancedNotificationPreferenceFragment : VectorSettingsBaseF
noisyNotificationsSystemOptions.isVisible = false
}
val silentNotificationsSystemOptions = findPreference(VectorPreferences.SETTINGS_SYSTEM_SILENT_NOTIFICATION_PREFERENCE_KEY)
val silentNotificationsSystemOptions = findPreference<VectorPreference>(VectorPreferences.SETTINGS_SYSTEM_SILENT_NOTIFICATION_PREFERENCE_KEY)!!
if (NotificationUtils.supportNotificationChannels()) {
silentNotificationsSystemOptions.onPreferenceClickListener = Preference.OnPreferenceClickListener {
NotificationUtils.openSystemSettingsForSilentCategory(this)
@ -86,7 +87,7 @@ class VectorSettingsAdvancedNotificationPreferenceFragment : VectorSettingsBaseF
// Ringtone
val ringtonePreference = findPreference(VectorPreferences.SETTINGS_NOTIFICATION_RINGTONE_SELECTION_PREFERENCE_KEY)
val ringtonePreference = findPreference<VectorPreference>(VectorPreferences.SETTINGS_NOTIFICATION_RINGTONE_SELECTION_PREFERENCE_KEY)!!
if (NotificationUtils.supportNotificationChannels()) {
ringtonePreference.isVisible = false
@ -106,45 +107,43 @@ class VectorSettingsAdvancedNotificationPreferenceFragment : VectorSettingsBaseF
}
for (preferenceKey in mPrefKeyToBingRuleId.keys) {
val preference = findPreference(preferenceKey)
if (null != preference) {
if (preference is BingRulePreference) {
//preference.isEnabled = null != rules && isConnected && pushManager.areDeviceNotificationsAllowed()
val rule: BingRule? = null // TODO session.dataHandler.pushRules()?.findDefaultRule(mPrefKeyToBingRuleId[preferenceKey])
val preference = findPreference<VectorPreference>(preferenceKey)
if (preference is BingRulePreference) {
//preference.isEnabled = null != rules && isConnected && pushManager.areDeviceNotificationsAllowed()
val rule: BingRule? = null // TODO session.dataHandler.pushRules()?.findDefaultRule(mPrefKeyToBingRuleId[preferenceKey])
if (rule == null) {
// The rule is not defined, hide the preference
preference.isVisible = false
} else {
preference.isVisible = true
preference.setBingRule(rule)
preference.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
val rule = preference.createRule(newValue as Int)
if (null != rule) {
/*
TODO
displayLoadingView()
session.dataHandler.bingRulesManager.updateRule(preference.rule,
rule,
object : BingRulesManager.onBingRuleUpdateListener {
private fun onDone() {
refreshDisplay()
hideLoadingView()
}
if (rule == null) {
// The rule is not defined, hide the preference
preference.isVisible = false
} else {
preference.isVisible = true
preference.setBingRule(rule)
preference.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
val rule = preference.createRule(newValue as Int)
if (null != rule) {
/*
TODO
displayLoadingView()
session.dataHandler.bingRulesManager.updateRule(preference.rule,
rule,
object : BingRulesManager.onBingRuleUpdateListener {
private fun onDone() {
refreshDisplay()
hideLoadingView()
}
override fun onBingRuleUpdateSuccess() {
onDone()
}
override fun onBingRuleUpdateSuccess() {
onDone()
}
override fun onBingRuleUpdateFailure(errorMessage: String) {
activity?.toast(errorMessage)
onDone()
}
})
*/
}
false
override fun onBingRuleUpdateFailure(errorMessage: String) {
activity?.toast(errorMessage)
onDone()
}
})
*/
}
false
}
}
}
@ -166,7 +165,7 @@ class VectorSettingsAdvancedNotificationPreferenceFragment : VectorSettingsBaseF
val notificationRingToneName = vectorPreferences.getNotificationRingToneName()
if (null != notificationRingToneName) {
vectorPreferences.setNotificationRingTone(vectorPreferences.getNotificationRingTone())
findPreference(VectorPreferences.SETTINGS_NOTIFICATION_RINGTONE_SELECTION_PREFERENCE_KEY).summary = notificationRingToneName
findPreference<VectorPreference>(VectorPreferences.SETTINGS_NOTIFICATION_RINGTONE_SELECTION_PREFERENCE_KEY)!!.summary = notificationRingToneName
}
}
}

View File

@ -30,7 +30,7 @@ class VectorSettingsFlairFragment : VectorSettingsBaseFragment() {
// Group Flairs
private val mGroupsFlairCategory by lazy {
findPreference(VectorPreferences.SETTINGS_GROUPS_FLAIR_KEY) as PreferenceCategory
findPreference<PreferenceCategory>(VectorPreferences.SETTINGS_GROUPS_FLAIR_KEY)!!
}
override fun bindPref() {

View File

@ -61,25 +61,25 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
private var mDisplayedPhoneNumber = ArrayList<String>()
private val mUserSettingsCategory by lazy {
findPreference(VectorPreferences.SETTINGS_USER_SETTINGS_PREFERENCE_KEY) as PreferenceCategory
findPreference<PreferenceCategory>(VectorPreferences.SETTINGS_USER_SETTINGS_PREFERENCE_KEY)!!
}
private val mUserAvatarPreference by lazy {
findPreference(VectorPreferences.SETTINGS_PROFILE_PICTURE_PREFERENCE_KEY) as UserAvatarPreference
findPreference<UserAvatarPreference>(VectorPreferences.SETTINGS_PROFILE_PICTURE_PREFERENCE_KEY)!!
}
private val mDisplayNamePreference by lazy {
findPreference(VectorPreferences.SETTINGS_DISPLAY_NAME_PREFERENCE_KEY) as EditTextPreference
findPreference<EditTextPreference>(VectorPreferences.SETTINGS_DISPLAY_NAME_PREFERENCE_KEY)!!
}
private val mPasswordPreference by lazy {
findPreference(VectorPreferences.SETTINGS_CHANGE_PASSWORD_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CHANGE_PASSWORD_PREFERENCE_KEY)!!
}
// Local contacts
private val mContactSettingsCategory by lazy {
findPreference(VectorPreferences.SETTINGS_CONTACT_PREFERENCE_KEYS) as PreferenceCategory
findPreference<PreferenceCategory>(VectorPreferences.SETTINGS_CONTACT_PREFERENCE_KEYS)!!
}
private val mContactPhonebookCountryPreference by lazy {
findPreference(VectorPreferences.SETTINGS_CONTACTS_PHONEBOOK_COUNTRY_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CONTACTS_PHONEBOOK_COUNTRY_PREFERENCE_KEY)!!
}
@ -111,7 +111,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
}
// Add Email
(findPreference(ADD_EMAIL_PREFERENCE_KEY) as EditTextPreference).let {
findPreference<EditTextPreference>(ADD_EMAIL_PREFERENCE_KEY)!!.let {
// It does not work on XML, do it here
it.icon = activity?.let {
ThemeUtils.tintDrawable(it,
@ -129,7 +129,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
}
// Add phone number
findPreference(ADD_PHONE_NUMBER_PREFERENCE_KEY).let {
findPreference<VectorPreference>(ADD_PHONE_NUMBER_PREFERENCE_KEY)!!.let {
// It does not work on XML, do it here
it.icon = activity?.let {
ThemeUtils.tintDrawable(it,
@ -147,15 +147,15 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
// Advanced settings
// user account
findPreference(VectorPreferences.SETTINGS_LOGGED_IN_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_LOGGED_IN_PREFERENCE_KEY)!!
.summary = session.myUserId
// home server
findPreference(VectorPreferences.SETTINGS_HOME_SERVER_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_HOME_SERVER_PREFERENCE_KEY)!!
.summary = session.sessionParams.homeServerConnectionConfig.homeServerUri.toString()
// identity server
findPreference(VectorPreferences.SETTINGS_IDENTITY_SERVER_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_IDENTITY_SERVER_PREFERENCE_KEY)!!
.summary = session.sessionParams.homeServerConnectionConfig.identityServerUri.toString()
@ -165,7 +165,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
setContactsPreferences()
// clear cache
findPreference(VectorPreferences.SETTINGS_CLEAR_CACHE_PREFERENCE_KEY).let {
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CLEAR_CACHE_PREFERENCE_KEY)!!.let {
/*
TODO
MXSession.getApplicationSizeCaches(activity, object : SimpleApiCallback<Long>() {
@ -185,7 +185,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
}
// clear medias cache
findPreference(VectorPreferences.SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY).let {
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY)!!.let {
val size = getSizeOfFiles(requireContext(),
File(requireContext().cacheDir, DiskCache.Factory.DEFAULT_DISK_CACHE_DIR))
@ -218,7 +218,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
}
// Sign out
findPreference("SETTINGS_SIGN_OUT_KEY")
findPreference<VectorPreference>("SETTINGS_SIGN_OUT_KEY")!!
.onPreferenceClickListener = Preference.OnPreferenceClickListener {
activity?.let {
SignOutUiWorker(requireActivity())
@ -232,7 +232,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
// Deactivate account section
// deactivate account
findPreference(VectorPreferences.SETTINGS_DEACTIVATE_ACCOUNT_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_DEACTIVATE_ACCOUNT_KEY)!!
.onPreferenceClickListener = Preference.OnPreferenceClickListener {
activity?.let {
notImplemented()
@ -478,7 +478,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
run {
var index = 0
while (true) {
val preference = mUserSettingsCategory.findPreference(EMAIL_PREFERENCE_KEY_BASE + index)
val preference = mUserSettingsCategory.findPreference<VectorPreference>(EMAIL_PREFERENCE_KEY_BASE + index)
if (null != preference) {
mUserSettingsCategory.removePreference(preference)
@ -492,8 +492,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
// add new emails list
mDisplayedEmails = newEmailsList
val addEmailBtn = mUserSettingsCategory.findPreference(ADD_EMAIL_PREFERENCE_KEY)
?: return
val addEmailBtn = mUserSettingsCategory.findPreference<VectorPreference>(ADD_EMAIL_PREFERENCE_KEY) ?: return
var order = addEmailBtn.order

View File

@ -24,6 +24,7 @@ import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import im.vector.matrix.android.api.Matrix
import im.vector.riotx.R
import im.vector.riotx.core.di.ScreenComponent
import im.vector.riotx.core.preference.VectorPreference
import im.vector.riotx.core.utils.copyToClipboard
import im.vector.riotx.core.utils.displayInWebView
import im.vector.riotx.features.version.VersionProvider
@ -42,7 +43,7 @@ class VectorSettingsHelpAboutFragment : VectorSettingsBaseFragment() {
override fun bindPref() {
// preference to start the App info screen, to facilitate App permissions access
findPreference(APP_INFO_LINK_PREFERENCE_KEY)
findPreference<VectorPreference>(APP_INFO_LINK_PREFERENCE_KEY)!!
.onPreferenceClickListener = Preference.OnPreferenceClickListener {
activity?.let {
@ -61,7 +62,7 @@ class VectorSettingsHelpAboutFragment : VectorSettingsBaseFragment() {
}
// application version
(findPreference(VectorPreferences.SETTINGS_VERSION_PREFERENCE_KEY)).let {
findPreference<VectorPreference>(VectorPreferences.SETTINGS_VERSION_PREFERENCE_KEY)!!.let {
it.summary = versionProvider.getVersion(longFormat = false, useBuildNumber = true)
it.setOnPreferenceClickListener { pref ->
@ -71,7 +72,7 @@ class VectorSettingsHelpAboutFragment : VectorSettingsBaseFragment() {
}
// SDK version
(findPreference(VectorPreferences.SETTINGS_SDK_VERSION_PREFERENCE_KEY)).let {
findPreference<VectorPreference>(VectorPreferences.SETTINGS_SDK_VERSION_PREFERENCE_KEY)!!.let {
it.summary = Matrix.getSdkVersion()
it.setOnPreferenceClickListener { pref ->
@ -81,38 +82,38 @@ class VectorSettingsHelpAboutFragment : VectorSettingsBaseFragment() {
}
// olm version
findPreference(VectorPreferences.SETTINGS_OLM_VERSION_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_OLM_VERSION_PREFERENCE_KEY)!!
.summary = session.getCryptoVersion(requireContext(), false)
// copyright
findPreference(VectorPreferences.SETTINGS_COPYRIGHT_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_COPYRIGHT_PREFERENCE_KEY)!!
.onPreferenceClickListener = Preference.OnPreferenceClickListener {
activity?.displayInWebView(VectorSettingsUrls.COPYRIGHT)
false
}
// terms & conditions
findPreference(VectorPreferences.SETTINGS_APP_TERM_CONDITIONS_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_APP_TERM_CONDITIONS_PREFERENCE_KEY)!!
.onPreferenceClickListener = Preference.OnPreferenceClickListener {
activity?.displayInWebView(VectorSettingsUrls.TAC)
false
}
// privacy policy
findPreference(VectorPreferences.SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY)!!
.onPreferenceClickListener = Preference.OnPreferenceClickListener {
activity?.displayInWebView(VectorSettingsUrls.PRIVACY_POLICY)
false
}
// third party notice
findPreference(VectorPreferences.SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY)!!
.onPreferenceClickListener = Preference.OnPreferenceClickListener {
activity?.displayInWebView(VectorSettingsUrls.THIRD_PARTY_LICENSES)
false
}
findPreference(VectorPreferences.SETTINGS_OTHER_THIRD_PARTY_NOTICES_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_OTHER_THIRD_PARTY_NOTICES_PREFERENCE_KEY)!!
.onPreferenceClickListener = Preference.OnPreferenceClickListener {
// See https://developers.google.com/android/guides/opensource
startActivity(Intent(requireActivity(), OssLicensesMenuActivity::class.java))

View File

@ -20,12 +20,9 @@ import androidx.appcompat.app.AlertDialog
import androidx.preference.Preference
import androidx.preference.PreferenceCategory
import im.vector.riotx.R
import im.vector.riotx.core.preference.VectorPreference
import java.util.ArrayList
import kotlin.Comparator
import kotlin.String
import kotlin.getValue
import kotlin.lazy
import kotlin.let
class VectorSettingsIgnoredUsersFragment : VectorSettingsBaseFragment() {
@ -34,10 +31,10 @@ class VectorSettingsIgnoredUsersFragment : VectorSettingsBaseFragment() {
// displayed the ignored users list
private val mIgnoredUserSettingsCategoryDivider by lazy {
findPreference(VectorPreferences.SETTINGS_IGNORE_USERS_DIVIDER_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_IGNORE_USERS_DIVIDER_PREFERENCE_KEY)!!
}
private val mIgnoredUserSettingsCategory by lazy {
findPreference(VectorPreferences.SETTINGS_IGNORED_USERS_PREFERENCE_KEY) as PreferenceCategory
findPreference<PreferenceCategory>(VectorPreferences.SETTINGS_IGNORED_USERS_PREFERENCE_KEY)!!
}
override fun bindPref() {

View File

@ -25,6 +25,7 @@ import im.vector.matrix.android.api.pushrules.RuleKind
import im.vector.riotx.R
import im.vector.riotx.core.di.ActiveSessionHolder
import im.vector.riotx.core.di.ScreenComponent
import im.vector.riotx.core.preference.VectorSwitchPreference
import im.vector.riotx.core.pushers.PushersManager
import im.vector.riotx.push.fcm.FcmHelper
import javax.inject.Inject
@ -40,7 +41,7 @@ class VectorSettingsNotificationPreferenceFragment : VectorSettingsBaseFragment(
@Inject lateinit var vectorPreferences: VectorPreferences
override fun bindPref() {
findPreference(VectorPreferences.SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY).let { pref ->
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY)!!.let { pref ->
val pushRuleService = session
val mRuleMaster = pushRuleService.getPushRules()
.find { it.ruleId == RuleIds.RULE_ID_DISABLE_ALL }

View File

@ -27,6 +27,8 @@ import androidx.preference.Preference
import androidx.preference.SwitchPreference
import im.vector.riotx.R
import im.vector.riotx.core.di.ScreenComponent
import im.vector.riotx.core.preference.VectorListPreference
import im.vector.riotx.core.preference.VectorPreference
import im.vector.riotx.features.configuration.VectorConfiguration
import im.vector.riotx.features.themes.ThemeUtils
import javax.inject.Inject
@ -37,10 +39,10 @@ class VectorSettingsPreferencesFragment : VectorSettingsBaseFragment() {
override val preferenceXmlRes = R.xml.vector_settings_preferences
private val selectedLanguagePreference by lazy {
findPreference(VectorPreferences.SETTINGS_INTERFACE_LANGUAGE_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_INTERFACE_LANGUAGE_PREFERENCE_KEY)!!
}
private val textSizePreference by lazy {
findPreference(VectorPreferences.SETTINGS_INTERFACE_TEXT_SIZE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_INTERFACE_TEXT_SIZE_KEY)!!
}
@Inject lateinit var vectorConfiguration: VectorConfiguration
@ -56,7 +58,7 @@ class VectorSettingsPreferencesFragment : VectorSettingsBaseFragment() {
setUserInterfacePreferences()
// Themes
findPreference(ThemeUtils.APPLICATION_THEME_KEY)
findPreference<VectorListPreference>(ThemeUtils.APPLICATION_THEME_KEY)!!
.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
if (newValue is String) {
vectorConfiguration.updateApplicationTheme(newValue)
@ -73,7 +75,7 @@ class VectorSettingsPreferencesFragment : VectorSettingsBaseFragment() {
}
// Url preview
(findPreference(VectorPreferences.SETTINGS_SHOW_URL_PREVIEW_KEY) as SwitchPreference).let {
findPreference<SwitchPreference>(VectorPreferences.SETTINGS_SHOW_URL_PREVIEW_KEY)!!.let {
/*
TODO
it.isChecked = session.isURLPreviewEnabled
@ -113,7 +115,7 @@ class VectorSettingsPreferencesFragment : VectorSettingsBaseFragment() {
}
// update keep medias period
findPreference(VectorPreferences.SETTINGS_MEDIA_SAVING_PERIOD_KEY).let {
findPreference<VectorPreference>(VectorPreferences.SETTINGS_MEDIA_SAVING_PERIOD_KEY)!!.let {
it.summary = vectorPreferences.getSelectedMediasSavingPeriodString()
it.onPreferenceClickListener = Preference.OnPreferenceClickListener {

View File

@ -50,6 +50,7 @@ import im.vector.riotx.core.intent.getFilenameFromUri
import im.vector.riotx.core.platform.SimpleTextWatcher
import im.vector.riotx.core.preference.ProgressBarPreference
import im.vector.riotx.core.preference.VectorPreference
import im.vector.riotx.core.preference.VectorPreferenceDivider
import im.vector.riotx.core.utils.*
import im.vector.riotx.features.crypto.keys.KeysExporter
import im.vector.riotx.features.crypto.keys.KeysImporter
@ -76,57 +77,57 @@ class VectorSettingsSecurityPrivacyFragment : VectorSettingsBaseFragment() {
// cryptography
private val mCryptographyCategory by lazy {
findPreference(VectorPreferences.SETTINGS_CRYPTOGRAPHY_PREFERENCE_KEY) as PreferenceCategory
findPreference<PreferenceCategory>(VectorPreferences.SETTINGS_CRYPTOGRAPHY_PREFERENCE_KEY)!!
}
private val mCryptographyCategoryDivider by lazy {
findPreference(VectorPreferences.SETTINGS_CRYPTOGRAPHY_DIVIDER_PREFERENCE_KEY)
findPreference<VectorPreferenceDivider>(VectorPreferences.SETTINGS_CRYPTOGRAPHY_DIVIDER_PREFERENCE_KEY)!!
}
// cryptography manage
private val mCryptographyManageCategory by lazy {
findPreference(VectorPreferences.SETTINGS_CRYPTOGRAPHY_MANAGE_PREFERENCE_KEY) as PreferenceCategory
findPreference<PreferenceCategory>(VectorPreferences.SETTINGS_CRYPTOGRAPHY_MANAGE_PREFERENCE_KEY)!!
}
private val mCryptographyManageCategoryDivider by lazy {
findPreference(VectorPreferences.SETTINGS_CRYPTOGRAPHY_MANAGE_DIVIDER_PREFERENCE_KEY)
findPreference<VectorPreferenceDivider>(VectorPreferences.SETTINGS_CRYPTOGRAPHY_MANAGE_DIVIDER_PREFERENCE_KEY)!!
}
// displayed pushers
private val mPushersSettingsDivider by lazy {
findPreference(VectorPreferences.SETTINGS_NOTIFICATIONS_TARGET_DIVIDER_PREFERENCE_KEY)
findPreference<VectorPreferenceDivider>(VectorPreferences.SETTINGS_NOTIFICATIONS_TARGET_DIVIDER_PREFERENCE_KEY)!!
}
private val mPushersSettingsCategory by lazy {
findPreference(VectorPreferences.SETTINGS_NOTIFICATIONS_TARGETS_PREFERENCE_KEY) as PreferenceCategory
findPreference<PreferenceCategory>(VectorPreferences.SETTINGS_NOTIFICATIONS_TARGETS_PREFERENCE_KEY)!!
}
private val mDevicesListSettingsCategory by lazy {
findPreference(VectorPreferences.SETTINGS_DEVICES_LIST_PREFERENCE_KEY) as PreferenceCategory
findPreference<PreferenceCategory>(VectorPreferences.SETTINGS_DEVICES_LIST_PREFERENCE_KEY)!!
}
private val mDevicesListSettingsCategoryDivider by lazy {
findPreference(VectorPreferences.SETTINGS_DEVICES_DIVIDER_PREFERENCE_KEY)
findPreference<VectorPreferenceDivider>(VectorPreferences.SETTINGS_DEVICES_DIVIDER_PREFERENCE_KEY)!!
}
private val cryptoInfoDeviceNamePreference by lazy {
findPreference(VectorPreferences.SETTINGS_ENCRYPTION_INFORMATION_DEVICE_NAME_PREFERENCE_KEY) as VectorPreference
findPreference<VectorPreference>(VectorPreferences.SETTINGS_ENCRYPTION_INFORMATION_DEVICE_NAME_PREFERENCE_KEY)!!
}
private val cryptoInfoDeviceIdPreference by lazy {
findPreference(VectorPreferences.SETTINGS_ENCRYPTION_INFORMATION_DEVICE_ID_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_ENCRYPTION_INFORMATION_DEVICE_ID_PREFERENCE_KEY)!!
}
private val manageBackupPref by lazy {
findPreference(VectorPreferences.SETTINGS_SECURE_MESSAGE_RECOVERY_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_SECURE_MESSAGE_RECOVERY_PREFERENCE_KEY)!!
}
private val exportPref by lazy {
findPreference(VectorPreferences.SETTINGS_ENCRYPTION_EXPORT_E2E_ROOM_KEYS_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_ENCRYPTION_EXPORT_E2E_ROOM_KEYS_PREFERENCE_KEY)!!
}
private val importPref by lazy {
findPreference(VectorPreferences.SETTINGS_ENCRYPTION_IMPORT_E2E_ROOM_KEYS_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_ENCRYPTION_IMPORT_E2E_ROOM_KEYS_PREFERENCE_KEY)!!
}
private val cryptoInfoTextPreference by lazy {
findPreference(VectorPreferences.SETTINGS_ENCRYPTION_INFORMATION_DEVICE_KEY_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_ENCRYPTION_INFORMATION_DEVICE_KEY_PREFERENCE_KEY)!!
}
// encrypt to unverified devices
private val sendToUnverifiedDevicesPref by lazy {
findPreference(VectorPreferences.SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY) as SwitchPreference
findPreference<SwitchPreference>(VectorPreferences.SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY)!!
}
@Inject lateinit var vectorPreferences: VectorPreferences
@ -148,7 +149,7 @@ class VectorSettingsSecurityPrivacyFragment : VectorSettingsBaseFragment() {
// Analytics
// Analytics tracking management
(findPreference(VectorPreferences.SETTINGS_USE_ANALYTICS_KEY) as SwitchPreference).let {
findPreference<SwitchPreference>(VectorPreferences.SETTINGS_USE_ANALYTICS_KEY)!!.let {
// On if the analytics tracking is activated
it.isChecked = vectorPreferences.useAnalytics()
@ -159,7 +160,7 @@ class VectorSettingsSecurityPrivacyFragment : VectorSettingsBaseFragment() {
}
// Rageshake Management
(findPreference(VectorPreferences.SETTINGS_USE_RAGE_SHAKE_KEY) as SwitchPreference).let {
findPreference<SwitchPreference>(VectorPreferences.SETTINGS_USE_RAGE_SHAKE_KEY)!!.let {
it.isChecked = vectorPreferences.useRageshake()
it.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->

View File

@ -23,6 +23,7 @@ import android.net.Uri
import androidx.preference.Preference
import androidx.preference.SwitchPreference
import im.vector.riotx.R
import im.vector.riotx.core.preference.VectorPreference
import im.vector.riotx.core.utils.getCallRingtoneName
import im.vector.riotx.core.utils.getCallRingtoneUri
import im.vector.riotx.core.utils.setCallRingtoneUri
@ -34,10 +35,10 @@ class VectorSettingsVoiceVideoFragment : VectorSettingsBaseFragment() {
override val preferenceXmlRes = R.xml.vector_settings_voice_video
private val mUseRiotCallRingtonePreference by lazy {
findPreference(VectorPreferences.SETTINGS_CALL_RINGTONE_USE_RIOT_PREFERENCE_KEY) as SwitchPreference
findPreference<SwitchPreference>(VectorPreferences.SETTINGS_CALL_RINGTONE_USE_RIOT_PREFERENCE_KEY)!!
}
private val mCallRingtonePreference by lazy {
findPreference(VectorPreferences.SETTINGS_CALL_RINGTONE_URI_PREFERENCE_KEY)
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CALL_RINGTONE_URI_PREFERENCE_KEY)!!
}
override fun bindPref() {

View File

@ -79,7 +79,7 @@
<im.vector.riotx.core.preference.VectorPreference
android:key="SETTINGS_IDENTITY_SERVER_PREFERENCE_KEY"
android:title="@string/settings_identity_server"
tools:summary="@string/default_identity_server_url" />
tools:summary="https://identity.server.url" />
<im.vector.riotx.core.preference.VectorPreference
android:key="SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY"