mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +03:00
Merge pull request #595 from vector-im/feature/lib_upgrade
Upgrade some dependencies
This commit is contained in:
commit
51554f7be0
30 changed files with 251 additions and 251 deletions
10
build.gradle
10
build.gradle
|
@ -3,7 +3,7 @@ import javax.tools.JavaCompiler
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.21'
|
||||
ext.kotlin_version = '1.3.50'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
@ -12,11 +12,11 @@ buildscript {
|
|||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.4.1'
|
||||
classpath 'com.google.gms:google-services:4.2.0'
|
||||
classpath "com.airbnb.okreplay:gradle-plugin:1.4.0"
|
||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
||||
classpath 'com.google.gms:google-services:4.3.2'
|
||||
classpath "com.airbnb.okreplay:gradle-plugin:1.5.0"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
|
||||
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1'
|
||||
classpath 'com.google.android.gms:oss-licenses-plugin:0.9.5'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -67,6 +67,10 @@ android {
|
|||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
static def gitRevision() {
|
||||
|
@ -86,29 +90,28 @@ 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 markwon_version = '3.0.0'
|
||||
def daggerVersion = '2.23.1'
|
||||
def lifecycle_version = '2.1.0'
|
||||
def coroutines_version = "1.3.2"
|
||||
def markwon_version = '3.1.0'
|
||||
def daggerVersion = '2.24'
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
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"
|
||||
|
||||
// Network
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
|
||||
implementation 'com.squareup.retrofit2:converter-moshi:2.4.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.14.1'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
|
||||
implementation 'com.squareup.retrofit2:converter-moshi:2.6.2'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.2.0'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.0'
|
||||
implementation 'com.novoda:merlin:1.2.0'
|
||||
implementation "com.squareup.moshi:moshi-adapters:$moshi_version"
|
||||
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_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"
|
||||
|
@ -132,24 +135,24 @@ dependencies {
|
|||
// DI
|
||||
implementation "com.google.dagger:dagger:$daggerVersion"
|
||||
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
|
||||
compileOnly 'com.squareup.inject:assisted-inject-annotations-dagger2:0.4.0'
|
||||
kapt 'com.squareup.inject:assisted-inject-processor-dagger2:0.4.0'
|
||||
compileOnly 'com.squareup.inject:assisted-inject-annotations-dagger2:0.5.0'
|
||||
kapt 'com.squareup.inject:assisted-inject-processor-dagger2:0.5.0'
|
||||
|
||||
// Logging
|
||||
implementation 'com.jakewharton.timber:timber:4.7.1'
|
||||
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
|
||||
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.1'
|
||||
|
||||
// Bus
|
||||
implementation 'org.greenrobot:eventbus:3.1.1'
|
||||
|
||||
debugImplementation 'com.airbnb.okreplay:okreplay:1.4.0'
|
||||
releaseImplementation 'com.airbnb.okreplay:noop:1.4.0'
|
||||
androidTestImplementation 'com.airbnb.okreplay:espresso:1.4.0'
|
||||
debugImplementation 'com.airbnb.okreplay:okreplay:1.5.0'
|
||||
releaseImplementation 'com.airbnb.okreplay:noop:1.5.0'
|
||||
androidTestImplementation 'com.airbnb.okreplay:espresso:1.5.0'
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'org.robolectric:robolectric:4.0.2'
|
||||
testImplementation 'org.robolectric:robolectric:4.3'
|
||||
//testImplementation 'org.robolectric:shadows-support-v4:3.0'
|
||||
testImplementation "io.mockk:mockk:1.8.13.kotlin13"
|
||||
testImplementation 'io.mockk:mockk:1.9.3.kotlin12'
|
||||
testImplementation 'org.amshove.kluent:kluent-android:1.44'
|
||||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
|
||||
|
||||
|
@ -159,7 +162,7 @@ dependencies {
|
|||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
androidTestImplementation 'org.amshove.kluent:kluent-android:1.44'
|
||||
androidTestImplementation "io.mockk:mockk-android:1.8.13.kotlin13"
|
||||
androidTestImplementation 'io.mockk:mockk-android:1.9.3.kotlin12'
|
||||
androidTestImplementation "androidx.arch.core:core-testing:$lifecycle_version"
|
||||
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
|
||||
|
||||
|
|
|
@ -52,12 +52,12 @@ internal class CurlLoggingInterceptor @Inject constructor(private val logger: Ht
|
|||
var compressed = false
|
||||
|
||||
var curlCmd = "curl"
|
||||
if (curlOptions != null) {
|
||||
curlCmd += " " + curlOptions!!
|
||||
curlOptions?.let {
|
||||
curlCmd += " $it"
|
||||
}
|
||||
curlCmd += " -X " + request.method()
|
||||
curlCmd += " -X " + request.method
|
||||
|
||||
val requestBody = request.body()
|
||||
val requestBody = request.body
|
||||
if (requestBody != null) {
|
||||
if (requestBody.contentLength() > 100_000) {
|
||||
Timber.w("Unable to log curl command data, size is too big (${requestBody.contentLength()})")
|
||||
|
@ -76,9 +76,9 @@ internal class CurlLoggingInterceptor @Inject constructor(private val logger: Ht
|
|||
}
|
||||
}
|
||||
|
||||
val headers = request.headers()
|
||||
val headers = request.headers
|
||||
var i = 0
|
||||
val count = headers.size()
|
||||
val count = headers.size
|
||||
while (i < count) {
|
||||
val name = headers.name(i)
|
||||
val value = headers.value(i)
|
||||
|
@ -89,7 +89,7 @@ internal class CurlLoggingInterceptor @Inject constructor(private val logger: Ht
|
|||
i++
|
||||
}
|
||||
|
||||
curlCmd += ((if (compressed) " --compressed " else " ") + "'" + request.url().toString()
|
||||
curlCmd += ((if (compressed) " --compressed " else " ") + "'" + request.url.toString()
|
||||
// Replace localhost for emulator by localhost for shell
|
||||
.replace("://10.0.2.2:8080/".toRegex(), "://127.0.0.1:8080/")
|
||||
+ "'")
|
||||
|
@ -97,7 +97,7 @@ internal class CurlLoggingInterceptor @Inject constructor(private val logger: Ht
|
|||
// Add Json formatting
|
||||
curlCmd += " | python -m json.tool"
|
||||
|
||||
logger.log("--- cURL (" + request.url() + ")")
|
||||
logger.log("--- cURL (" + request.url + ")")
|
||||
logger.log(curlCmd)
|
||||
|
||||
return chain.proceed(request)
|
||||
|
|
|
@ -43,7 +43,7 @@ internal class ProgressRequestBody(private val delegate: RequestBody,
|
|||
@Throws(IOException::class)
|
||||
override fun writeTo(sink: BufferedSink) {
|
||||
countingSink = CountingSink(sink)
|
||||
val bufferedSink = Okio.buffer(countingSink)
|
||||
val bufferedSink = countingSink.buffer()
|
||||
delegate.writeTo(bufferedSink)
|
||||
bufferedSink.flush()
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ internal fun <T> Response<T>.toFailure(): Failure {
|
|||
* Convert a okhttp3 Response to a Failure, and eventually parse errorBody to convert it to a MatrixError
|
||||
*/
|
||||
internal fun okhttp3.Response.toFailure(): Failure {
|
||||
return toFailure(body(), code())
|
||||
return toFailure(body, code)
|
||||
}
|
||||
|
||||
private fun toFailure(errorBody: ResponseBody?, httpCode: Int): Failure {
|
||||
|
|
|
@ -57,7 +57,7 @@ constructor(trustPinned: Array<TrustManager>, acceptedTlsVersions: List<TlsVersi
|
|||
context.init(null, trustPinned, SecureRandom())
|
||||
internalSSLSocketFactory = context.socketFactory
|
||||
enabledProtocols = Array(acceptedTlsVersions.size) {
|
||||
acceptedTlsVersions[it].javaName()
|
||||
acceptedTlsVersions[it].javaName
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@ internal class DefaultFileService @Inject constructor(private val context: Conte
|
|||
.build()
|
||||
|
||||
val response = okHttpClient.newCall(request).execute()
|
||||
val inputStream = response.body()?.byteStream()
|
||||
Timber.v("Response size ${response.body()?.contentLength()} - Stream available: ${inputStream?.available()}")
|
||||
val inputStream = response.body?.byteStream()
|
||||
Timber.v("Response size ${response.body?.contentLength()} - Stream available: ${inputStream?.available()}")
|
||||
if (!response.isSuccessful
|
||||
|| inputStream == null) {
|
||||
throw IOException()
|
||||
|
|
|
@ -23,6 +23,8 @@ import im.vector.matrix.android.internal.network.ProgressRequestBody
|
|||
import im.vector.matrix.android.internal.network.awaitResponse
|
||||
import im.vector.matrix.android.internal.network.toFailure
|
||||
import okhttp3.*
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import javax.inject.Inject
|
||||
|
@ -41,7 +43,7 @@ internal class FileUploader @Inject constructor(@Authenticated
|
|||
filename: String?,
|
||||
mimeType: String,
|
||||
progressListener: ProgressRequestBody.Listener? = null): ContentUploadResponse {
|
||||
val uploadBody = RequestBody.create(MediaType.parse(mimeType), file)
|
||||
val uploadBody = RequestBody.create(mimeType.toMediaTypeOrNull(), file)
|
||||
return upload(uploadBody, filename, progressListener)
|
||||
|
||||
}
|
||||
|
@ -50,13 +52,13 @@ internal class FileUploader @Inject constructor(@Authenticated
|
|||
filename: String?,
|
||||
mimeType: String,
|
||||
progressListener: ProgressRequestBody.Listener? = null): ContentUploadResponse {
|
||||
val uploadBody = RequestBody.create(MediaType.parse(mimeType), byteArray)
|
||||
val uploadBody = RequestBody.create(mimeType.toMediaTypeOrNull(), byteArray)
|
||||
return upload(uploadBody, filename, progressListener)
|
||||
}
|
||||
|
||||
|
||||
private suspend fun upload(uploadBody: RequestBody, filename: String?, progressListener: ProgressRequestBody.Listener?): ContentUploadResponse {
|
||||
val urlBuilder = HttpUrl.parse(uploadUrl)?.newBuilder() ?: throw RuntimeException()
|
||||
val urlBuilder = uploadUrl.toHttpUrlOrNull()?.newBuilder() ?: throw RuntimeException()
|
||||
|
||||
val httpUrl = urlBuilder
|
||||
.addQueryParameter("filename", filename)
|
||||
|
@ -73,7 +75,7 @@ internal class FileUploader @Inject constructor(@Authenticated
|
|||
if (!response.isSuccessful) {
|
||||
throw response.toFailure()
|
||||
} else {
|
||||
response.body()?.source()?.let {
|
||||
response.body?.source()?.let {
|
||||
responseAdapter.fromJson(it)
|
||||
}
|
||||
?: throw IOException()
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
package im.vector.matrix.android.internal.util
|
||||
|
||||
import androidx.annotation.WorkerThread
|
||||
import okio.Okio
|
||||
import okio.buffer
|
||||
import okio.sink
|
||||
import okio.source
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
|
||||
|
@ -26,8 +28,8 @@ import java.io.InputStream
|
|||
*/
|
||||
@WorkerThread
|
||||
fun writeToFile(inputStream: InputStream, outputFile: File) {
|
||||
Okio.buffer(Okio.source(inputStream)).use { input ->
|
||||
Okio.buffer(Okio.sink(outputFile)).use { output ->
|
||||
inputStream.source().buffer().use { input ->
|
||||
outputFile.sink().buffer().use { output ->
|
||||
output.writeAll(input)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,18 +208,22 @@ android {
|
|||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
def epoxy_version = "3.7.0"
|
||||
def epoxy_version = '3.8.0'
|
||||
def arrow_version = "0.8.2"
|
||||
def coroutines_version = "1.0.1"
|
||||
def markwon_version = '3.0.0'
|
||||
def coroutines_version = "1.3.2"
|
||||
def markwon_version = '3.1.0'
|
||||
def big_image_viewer_version = '1.5.6'
|
||||
def glide_version = '4.9.0'
|
||||
def glide_version = '4.10.0'
|
||||
def moshi_version = '1.8.0'
|
||||
def daggerVersion = '2.23.1'
|
||||
def daggerVersion = '2.24'
|
||||
|
||||
implementation project(":matrix-sdk-android")
|
||||
implementation project(":matrix-sdk-android-rx")
|
||||
|
@ -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.core:core-ktx:1.1.0'
|
||||
|
||||
implementation "org.threeten:threetenbp:1.4.0:no-tzdb"
|
||||
implementation "com.gabrielittner.threetenbp:lazythreetenbp:0.7.0"
|
||||
|
@ -247,12 +251,12 @@ dependencies {
|
|||
implementation 'com.jakewharton.timber:timber:4.7.1'
|
||||
|
||||
// Debug
|
||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||
implementation 'com.facebook.stetho:stetho:1.5.1'
|
||||
|
||||
// rx
|
||||
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
|
||||
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.0'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.1'
|
||||
// RXBinding
|
||||
implementation 'com.jakewharton.rxbinding3:rxbinding:3.0.0'
|
||||
implementation 'com.jakewharton.rxbinding3:rxbinding-appcompat:3.0.0'
|
||||
|
@ -261,10 +265,10 @@ dependencies {
|
|||
implementation("com.airbnb.android:epoxy:$epoxy_version")
|
||||
kapt "com.airbnb.android:epoxy-processor:$epoxy_version"
|
||||
implementation "com.airbnb.android:epoxy-paging:$epoxy_version"
|
||||
implementation 'com.airbnb.android:mvrx:1.0.1'
|
||||
implementation 'com.airbnb.android:mvrx:1.1.0'
|
||||
|
||||
// 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"
|
||||
|
@ -288,7 +292,7 @@ dependencies {
|
|||
implementation 'org.greenrobot:eventbus:3.1.1'
|
||||
|
||||
// Passphrase strength helper
|
||||
implementation 'com.nulab-inc:zxcvbn:1.2.5'
|
||||
implementation 'com.nulab-inc:zxcvbn:1.2.7'
|
||||
|
||||
//Alerter
|
||||
implementation 'com.tapadoo.android:alerter:4.0.3'
|
||||
|
@ -296,8 +300,8 @@ dependencies {
|
|||
implementation 'com.otaliastudios:autocomplete:1.1.0'
|
||||
|
||||
// Butterknife
|
||||
implementation 'com.jakewharton:butterknife:10.1.0'
|
||||
kapt 'com.jakewharton:butterknife-compiler:10.1.0'
|
||||
implementation 'com.jakewharton:butterknife:10.2.0'
|
||||
kapt 'com.jakewharton:butterknife-compiler:10.2.0'
|
||||
|
||||
// Shake detection
|
||||
implementation 'com.squareup:seismic:1.0.2'
|
||||
|
@ -312,7 +316,7 @@ dependencies {
|
|||
implementation 'com.danikula:videocache:2.7.1'
|
||||
|
||||
// Badge for compatibility
|
||||
implementation 'me.leolin:ShortcutBadger:1.1.2@aar'
|
||||
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
|
||||
|
||||
// File picker
|
||||
implementation 'com.github.jaiselrahman:FilePicker:1.2.2'
|
||||
|
@ -320,11 +324,13 @@ dependencies {
|
|||
// DI
|
||||
implementation "com.google.dagger:dagger:$daggerVersion"
|
||||
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
|
||||
compileOnly 'com.squareup.inject:assisted-inject-annotations-dagger2:0.4.0'
|
||||
kapt 'com.squareup.inject:assisted-inject-processor-dagger2:0.4.0'
|
||||
compileOnly 'com.squareup.inject:assisted-inject-annotations-dagger2:0.5.0'
|
||||
kapt 'com.squareup.inject:assisted-inject-processor-dagger2:0.5.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'
|
||||
|
|
|
@ -33,9 +33,8 @@ class TestBackgroundRestrictions @Inject constructor(private val context: AppCom
|
|||
// Checks if the device is on a metered network
|
||||
if (isActiveNetworkMetered) {
|
||||
// Checks user’s Data Saver settings.
|
||||
val restrictBackgroundStatus = ConnectivityManagerCompat.getRestrictBackgroundStatus(this)
|
||||
when (restrictBackgroundStatus) {
|
||||
ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED -> {
|
||||
when (ConnectivityManagerCompat.getRestrictBackgroundStatus(this)) {
|
||||
ConnectivityManagerCompat.RESTRICT_BACKGROUND_STATUS_ENABLED -> {
|
||||
// Background data usage is blocked for this app. Wherever possible,
|
||||
// the app should also use less data in the foreground.
|
||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_bg_restricted_failed,
|
||||
|
@ -43,7 +42,7 @@ class TestBackgroundRestrictions @Inject constructor(private val context: AppCom
|
|||
status = TestStatus.FAILED
|
||||
quickFix = null
|
||||
}
|
||||
ConnectivityManager.RESTRICT_BACKGROUND_STATUS_WHITELISTED -> {
|
||||
ConnectivityManagerCompat.RESTRICT_BACKGROUND_STATUS_WHITELISTED -> {
|
||||
// The app is whitelisted. Wherever possible,
|
||||
// the app should use less data in the foreground and background.
|
||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_bg_restricted_success,
|
||||
|
@ -51,7 +50,7 @@ class TestBackgroundRestrictions @Inject constructor(private val context: AppCom
|
|||
status = TestStatus.SUCCESS
|
||||
quickFix = null
|
||||
}
|
||||
ConnectivityManager.RESTRICT_BACKGROUND_STATUS_DISABLED -> {
|
||||
ConnectivityManagerCompat.RESTRICT_BACKGROUND_STATUS_DISABLED -> {
|
||||
// Data Saver is disabled. Since the device is connected to a
|
||||
// metered network, the app should use less data wherever possible.
|
||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_bg_restricted_success,
|
||||
|
|
|
@ -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 ")
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ import android.app.DownloadManager
|
|||
import android.content.Context
|
||||
import androidx.annotation.WorkerThread
|
||||
import arrow.core.Try
|
||||
import okio.Okio
|
||||
import okio.buffer
|
||||
import okio.sink
|
||||
import timber.log.Timber
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
|
||||
/**
|
||||
* Save a string to a file with Okio
|
||||
|
@ -31,9 +31,9 @@ import java.io.InputStream
|
|||
@WorkerThread
|
||||
fun writeToFile(str: String, file: File): Try<Unit> {
|
||||
return Try {
|
||||
val sink = Okio.sink(file)
|
||||
val sink = file.sink()
|
||||
|
||||
val bufferedSink = Okio.buffer(sink)
|
||||
val bufferedSink = sink.buffer()
|
||||
|
||||
bufferedSink.writeString(str, Charsets.UTF_8)
|
||||
|
||||
|
@ -48,9 +48,9 @@ fun writeToFile(str: String, file: File): Try<Unit> {
|
|||
@WorkerThread
|
||||
fun writeToFile(data: ByteArray, file: File): Try<Unit> {
|
||||
return Try {
|
||||
val sink = Okio.sink(file)
|
||||
val sink = file.sink()
|
||||
|
||||
val bufferedSink = Okio.buffer(sink)
|
||||
val bufferedSink = sink.buffer()
|
||||
|
||||
bufferedSink.write(data)
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import java.io.File
|
|||
import java.io.FileInputStream
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import com.bumptech.glide.load.engine.Resource as Resource1
|
||||
|
||||
|
||||
class VectorGlideModelLoaderFactory(private val activeSessionHolder: ActiveSessionHolder)
|
||||
|
@ -112,8 +111,8 @@ class VectorGlideDataFetcher(private val activeSessionHolder: ActiveSessionHolde
|
|||
.build()
|
||||
|
||||
val response = client.newCall(request).execute()
|
||||
val inputStream = response.body()?.byteStream()
|
||||
Timber.v("Response size ${response.body()?.contentLength()} - Stream available: ${inputStream?.available()}")
|
||||
val inputStream = response.body?.byteStream()
|
||||
Timber.v("Response size ${response.body?.contentLength()} - Stream available: ${inputStream?.available()}")
|
||||
if (!response.isSuccessful) {
|
||||
callback.onLoadFailed(IOException("Unexpected code $response"))
|
||||
return
|
||||
|
|
|
@ -20,7 +20,6 @@ import android.content.Context
|
|||
import android.os.Build
|
||||
import im.vector.matrix.android.api.session.Session
|
||||
import me.leolin.shortcutbadger.ShortcutBadger
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
* Manage application badge (displayed in the launcher)
|
||||
|
@ -45,12 +44,7 @@ object BadgeProxy {
|
|||
return
|
||||
}
|
||||
|
||||
try {
|
||||
ShortcutBadger.setBadge(context, badgeValue)
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## updateBadgeCount(): Exception Msg=" + e.message)
|
||||
}
|
||||
|
||||
ShortcutBadger.applyCount(context, badgeValue)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,6 +37,8 @@ import im.vector.riotx.features.settings.VectorLocale
|
|||
import im.vector.riotx.features.themes.ThemeUtils
|
||||
import im.vector.riotx.features.version.VersionProvider
|
||||
import okhttp3.*
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.RequestBody.Companion.asRequestBody
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import timber.log.Timber
|
||||
|
@ -53,7 +55,7 @@ import javax.inject.Singleton
|
|||
@Singleton
|
||||
class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSessionHolder,
|
||||
private val versionProvider: VersionProvider,
|
||||
private val vectorFileLogger : VectorFileLogger) {
|
||||
private val vectorFileLogger: VectorFileLogger) {
|
||||
var inMultiWindowMode = false
|
||||
|
||||
companion object {
|
||||
|
@ -248,7 +250,7 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
|||
|
||||
// add the gzipped files
|
||||
for (file in gzippedFiles) {
|
||||
builder.addFormDataPart("compressed-log", file.name, RequestBody.create(MediaType.parse("application/octet-stream"), file))
|
||||
builder.addFormDataPart("compressed-log", file.name, file.asRequestBody("application/octet-stream".toMediaTypeOrNull()))
|
||||
}
|
||||
|
||||
mBugReportFiles.addAll(gzippedFiles)
|
||||
|
@ -270,7 +272,7 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
|||
fos.close()
|
||||
|
||||
builder.addFormDataPart("file",
|
||||
logCatScreenshotFile.name, RequestBody.create(MediaType.parse("application/octet-stream"), logCatScreenshotFile))
|
||||
logCatScreenshotFile.name, logCatScreenshotFile.asRequestBody("application/octet-stream".toMediaTypeOrNull()))
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## sendBugReport() : fail to write screenshot$e")
|
||||
}
|
||||
|
@ -336,9 +338,9 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
|||
try {
|
||||
mBugReportCall = mOkHttpClient.newCall(request)
|
||||
response = mBugReportCall!!.execute()
|
||||
responseCode = response!!.code()
|
||||
responseCode = response.code
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "response " + e.message)
|
||||
Timber.e(e, "response")
|
||||
errorMessage = e.localizedMessage
|
||||
}
|
||||
|
||||
|
@ -346,44 +348,42 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
|||
if (responseCode != HttpURLConnection.HTTP_OK) {
|
||||
if (null != errorMessage) {
|
||||
serverError = "Failed with error $errorMessage"
|
||||
} else if (null == response || null == response.body()) {
|
||||
} else if (null == response || null == response.body) {
|
||||
serverError = "Failed with error $responseCode"
|
||||
} else {
|
||||
var inputStream: InputStream? = null
|
||||
|
||||
try {
|
||||
inputStream = response.body()!!.byteStream()
|
||||
inputStream = response.body!!.byteStream()
|
||||
|
||||
if (null != inputStream) {
|
||||
var ch = inputStream.read()
|
||||
val b = StringBuilder()
|
||||
while (ch != -1) {
|
||||
b.append(ch.toChar())
|
||||
ch = inputStream.read()
|
||||
}
|
||||
serverError = b.toString()
|
||||
inputStream.close()
|
||||
var ch = inputStream.read()
|
||||
val b = StringBuilder()
|
||||
while (ch != -1) {
|
||||
b.append(ch.toChar())
|
||||
ch = inputStream.read()
|
||||
}
|
||||
serverError = b.toString()
|
||||
inputStream.close()
|
||||
|
||||
// check if the error message
|
||||
try {
|
||||
val responseJSON = JSONObject(serverError)
|
||||
serverError = responseJSON.getString("error")
|
||||
} catch (e: JSONException) {
|
||||
Timber.e(e, "doInBackground ; Json conversion failed " + e.message)
|
||||
}
|
||||
// check if the error message
|
||||
try {
|
||||
val responseJSON = JSONObject(serverError)
|
||||
serverError = responseJSON.getString("error")
|
||||
} catch (e: JSONException) {
|
||||
Timber.e(e, "doInBackground ; Json conversion failed")
|
||||
}
|
||||
|
||||
// should never happen
|
||||
if (null == serverError) {
|
||||
serverError = "Failed with error $responseCode"
|
||||
}
|
||||
// should never happen
|
||||
if (null == serverError) {
|
||||
serverError = "Failed with error $responseCode"
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## sendBugReport() : failed to parse error " + e.message)
|
||||
Timber.e(e, "## sendBugReport() : failed to parse error")
|
||||
} finally {
|
||||
try {
|
||||
inputStream?.close()
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## sendBugReport() : failed to close the error stream " + e.message)
|
||||
Timber.e(e, "## sendBugReport() : failed to close the error stream")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -398,9 +398,9 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
|||
override fun onProgressUpdate(vararg progress: Int?) {
|
||||
if (null != listener) {
|
||||
try {
|
||||
listener.onProgress(progress?.get(0) ?: 0)
|
||||
listener.onProgress(progress[0] ?: 0)
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## onProgress() : failed " + e.message)
|
||||
Timber.e(e, "## onProgress() : failed")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
|||
listener.onUploadFailed(reason)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## onPostExecute() : failed " + e.message)
|
||||
Timber.e(e, "## onPostExecute() : failed")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -637,13 +637,13 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
|||
line = reader.readLine()
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
Timber.e(e, "getLog fails with " + e.localizedMessage)
|
||||
Timber.e(e, "getLog fails")
|
||||
} finally {
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close()
|
||||
} catch (e: IOException) {
|
||||
Timber.e(e, "getLog fails with " + e.localizedMessage)
|
||||
Timber.e(e, "getLog fails with")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -661,7 +661,7 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
|||
* @return the gzipped file
|
||||
*/
|
||||
private fun compressFile(fin: File): File? {
|
||||
Timber.v("## compressFile() : compress " + fin.name)
|
||||
Timber.v("## compressFile() : compress ${fin.name}")
|
||||
|
||||
val dstFile = File(fin.parent, fin.name + ".gz")
|
||||
|
||||
|
@ -688,19 +688,19 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
|||
gos.close()
|
||||
inputStream.close()
|
||||
|
||||
Timber.v("## compressFile() : " + fin.length() + " compressed to " + dstFile.length() + " bytes")
|
||||
Timber.v("## compressFile() : ${fin.length()} compressed to ${dstFile.length()} bytes")
|
||||
return dstFile
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## compressFile() failed " + e.message)
|
||||
Timber.e(e, "## compressFile() failed")
|
||||
} catch (oom: OutOfMemoryError) {
|
||||
Timber.e(oom, "## compressFile() failed " + oom.message)
|
||||
Timber.e(oom, "## compressFile() failed")
|
||||
} finally {
|
||||
try {
|
||||
fos?.close()
|
||||
gos?.close()
|
||||
inputStream?.close()
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## compressFile() failed to close inputStream " + e.message)
|
||||
Timber.e(e, "## compressFile() failed to close inputStream")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class BugReporterMultipartBody extends RequestBody {
|
|||
private BugReporterMultipartBody(ByteString boundary, List<Part> parts) {
|
||||
mBoundary = boundary;
|
||||
mContentType = MediaType.parse(FORM + "; boundary=" + boundary.utf8());
|
||||
mParts = Util.immutableList(parts);
|
||||
mParts = Util.toImmutableList(parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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,8 @@ 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 ->
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue