mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-01 19:56:47 +01:00
Merge pull request #5664 from vector-im/feature/bma/dep_upgrade
Upgrade Jitsi and ktlint
This commit is contained in:
commit
9a2cc1a4c5
27
build.gradle
27
build.gradle
@ -21,7 +21,7 @@ buildscript {
|
|||||||
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
|
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
|
||||||
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.5'
|
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.5'
|
||||||
classpath "com.likethesalad.android:stem-plugin:2.0.0"
|
classpath "com.likethesalad.android:stem-plugin:2.0.0"
|
||||||
|
classpath 'org.owasp:dependency-check-gradle:7.0.0'
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
}
|
}
|
||||||
@ -32,6 +32,16 @@ plugins {
|
|||||||
id "org.jlleitschuh.gradle.ktlint" version "10.2.1"
|
id "org.jlleitschuh.gradle.ktlint" version "10.2.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/jeremylong/DependencyCheck
|
||||||
|
apply plugin: 'org.owasp.dependencycheck'
|
||||||
|
|
||||||
|
dependencyCheck {
|
||||||
|
// See https://jeremylong.github.io/DependencyCheck/general/suppression.html
|
||||||
|
suppressionFiles = [
|
||||||
|
"./tools/dependencycheck/suppressions.xml"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply plugin: "org.jlleitschuh.gradle.ktlint"
|
apply plugin: "org.jlleitschuh.gradle.ktlint"
|
||||||
|
|
||||||
@ -51,7 +61,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
// Jitsi repo
|
// Jitsi repo
|
||||||
maven {
|
maven {
|
||||||
url "https://github.com/vector-im/jitsi_libre_maven/raw/main/android-sdk-3.10.0"
|
url "https://github.com/vector-im/jitsi_libre_maven/raw/main/android-sdk-5.0.2"
|
||||||
// Note: to test Jitsi release you can use a local file like this:
|
// Note: to test Jitsi release you can use a local file like this:
|
||||||
// url "file:///Users/bmarty/workspaces/jitsi_libre_maven/android-sdk-3.10.0"
|
// url "file:///Users/bmarty/workspaces/jitsi_libre_maven/android-sdk-3.10.0"
|
||||||
content {
|
content {
|
||||||
@ -87,6 +97,8 @@ allprojects {
|
|||||||
|
|
||||||
// See https://github.com/JLLeitschuh/ktlint-gradle#configuration
|
// See https://github.com/JLLeitschuh/ktlint-gradle#configuration
|
||||||
ktlint {
|
ktlint {
|
||||||
|
// See https://github.com/pinterest/ktlint/releases/
|
||||||
|
version = "0.45.1"
|
||||||
android = true
|
android = true
|
||||||
ignoreFailures = false
|
ignoreFailures = false
|
||||||
enableExperimentalRules = true
|
enableExperimentalRules = true
|
||||||
@ -96,7 +108,16 @@ allprojects {
|
|||||||
"spacing-between-declarations-with-comments",
|
"spacing-between-declarations-with-comments",
|
||||||
"no-multi-spaces",
|
"no-multi-spaces",
|
||||||
"experimental:spacing-between-declarations-with-annotations",
|
"experimental:spacing-between-declarations-with-annotations",
|
||||||
"experimental:annotation"
|
"experimental:annotation",
|
||||||
|
// - Missing newline after "("
|
||||||
|
// - Missing newline before ")"
|
||||||
|
"wrapping",
|
||||||
|
// - Unnecessary trailing comma before ")"
|
||||||
|
"experimental:trailing-comma",
|
||||||
|
// - A block comment in between other elements on the same line is disallowed
|
||||||
|
"experimental:comment-wrapping",
|
||||||
|
// - A KDoc comment after any other element on the same line must be separated by a new line
|
||||||
|
"experimental:kdoc-wrapping",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
changelog.d/5654.feature
Normal file
1
changelog.d/5654.feature
Normal file
@ -0,0 +1 @@
|
|||||||
|
Update Jitsi lib from 3.10.0 to 5.0.2
|
1
changelog.d/5654.misc
Normal file
1
changelog.d/5654.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Setup the plugin org.owasp.dependencycheck
|
@ -7,6 +7,7 @@ ext.groups = [
|
|||||||
'com.github.chrisbanes',
|
'com.github.chrisbanes',
|
||||||
'com.github.hyuwah',
|
'com.github.hyuwah',
|
||||||
'com.github.jetradarmobile',
|
'com.github.jetradarmobile',
|
||||||
|
'com.github.MatrixFrog',
|
||||||
'com.github.tapadoo',
|
'com.github.tapadoo',
|
||||||
'com.github.vector-im',
|
'com.github.vector-im',
|
||||||
'com.github.yalantis',
|
'com.github.yalantis',
|
||||||
@ -39,6 +40,7 @@ ext.groups = [
|
|||||||
regex: [
|
regex: [
|
||||||
],
|
],
|
||||||
group: [
|
group: [
|
||||||
|
'ch.qos.logback',
|
||||||
'com.adevinta.android',
|
'com.adevinta.android',
|
||||||
'com.airbnb.android',
|
'com.airbnb.android',
|
||||||
'com.almworks.sqlite4java',
|
'com.almworks.sqlite4java',
|
||||||
@ -48,10 +50,12 @@ ext.groups = [
|
|||||||
'com.beust',
|
'com.beust',
|
||||||
'com.davemorrissey.labs',
|
'com.davemorrissey.labs',
|
||||||
'com.dropbox.core',
|
'com.dropbox.core',
|
||||||
|
'com.facebook.fbjni',
|
||||||
'com.facebook.fresco',
|
'com.facebook.fresco',
|
||||||
'com.facebook.infer.annotation',
|
'com.facebook.infer.annotation',
|
||||||
'com.facebook.soloader',
|
'com.facebook.soloader',
|
||||||
'com.facebook.stetho',
|
'com.facebook.stetho',
|
||||||
|
'com.facebook.yoga',
|
||||||
'com.fasterxml',
|
'com.fasterxml',
|
||||||
'com.fasterxml.jackson',
|
'com.fasterxml.jackson',
|
||||||
'com.fasterxml.jackson.core',
|
'com.fasterxml.jackson.core',
|
||||||
@ -113,6 +117,7 @@ ext.groups = [
|
|||||||
'info.picocli',
|
'info.picocli',
|
||||||
'io.arrow-kt',
|
'io.arrow-kt',
|
||||||
'io.github.detekt.sarif4k',
|
'io.github.detekt.sarif4k',
|
||||||
|
'io.github.microutils',
|
||||||
'io.github.reactivecircus.flowbinding',
|
'io.github.reactivecircus.flowbinding',
|
||||||
'io.grpc',
|
'io.grpc',
|
||||||
'io.jsonwebtoken',
|
'io.jsonwebtoken',
|
||||||
|
@ -18,6 +18,8 @@ The generated maven repository is then host in the project https://github.com/ve
|
|||||||
|
|
||||||
Update the script `./tools/jitsi/build_jisti_libs.sh` with the tag of the project `https://github.com/jitsi/jitsi-meet`.
|
Update the script `./tools/jitsi/build_jisti_libs.sh` with the tag of the project `https://github.com/jitsi/jitsi-meet`.
|
||||||
|
|
||||||
|
Latest tag can be found from this page: https://github.com/jitsi/jitsi-meet-release-notes/blob/master/CHANGELOG-MOBILE-SDKS.md
|
||||||
|
|
||||||
Currently we are building the version with the tag `android-sdk-3.10.0`.
|
Currently we are building the version with the tag `android-sdk-3.10.0`.
|
||||||
|
|
||||||
### Run the build script
|
### Run the build script
|
||||||
|
@ -138,7 +138,7 @@ class WithHeldTests : InstrumentedTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore("This test will be ignored until it is fixed")
|
@Ignore("This test will be ignored until it is fixed")
|
||||||
fun test_WithHeldNoOlm() {
|
fun test_WithHeldNoOlm() {
|
||||||
val testData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
|
val testData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
|
||||||
val aliceSession = testData.firstSession
|
val aliceSession = testData.firstSession
|
||||||
val bobSession = testData.secondSession!!
|
val bobSession = testData.secondSession!!
|
||||||
|
@ -137,8 +137,7 @@ internal abstract class CryptoModule {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Provides
|
@Provides
|
||||||
@CryptoDatabase
|
@CryptoDatabase
|
||||||
fun providesClearCacheTask(@CryptoDatabase
|
fun providesClearCacheTask(@CryptoDatabase realmConfiguration: RealmConfiguration): ClearCacheTask {
|
||||||
realmConfiguration: RealmConfiguration): ClearCacheTask {
|
|
||||||
return RealmClearCacheTask(realmConfiguration)
|
return RealmClearCacheTask(realmConfiguration)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ inline fun <T> MXUsersDevicesMap<T>.forEach(action: (String, String, T) -> Unit)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun <T> MXUsersDevicesMap<T>.toDebugString() =
|
internal fun <T> MXUsersDevicesMap<T>.toDebugString() =
|
||||||
map.entries.joinToString { "${it.key} [${it.value.keys.joinToString { it }}]" }
|
map.entries.joinToString { "${it.key} [${it.value.keys.joinToString { it }}]" }
|
||||||
|
|
||||||
internal fun <T> MXUsersDevicesMap<T>.toDebugCount() =
|
internal fun <T> MXUsersDevicesMap<T>.toDebugCount() =
|
||||||
|
@ -70,7 +70,7 @@ object HkdfSha256 {
|
|||||||
T(2) = HMAC-Hash(PRK, T(1) | info | 0x02)
|
T(2) = HMAC-Hash(PRK, T(1) | info | 0x02)
|
||||||
T(3) = HMAC-Hash(PRK, T(2) | info | 0x03)
|
T(3) = HMAC-Hash(PRK, T(2) | info | 0x03)
|
||||||
...
|
...
|
||||||
*/
|
*/
|
||||||
val n = ceil(outputLength.toDouble() / HASH_LEN.toDouble()).toInt()
|
val n = ceil(outputLength.toDouble() / HASH_LEN.toDouble()).toInt()
|
||||||
|
|
||||||
var stepHash = ByteArray(0) // T(0) empty string (zero length)
|
var stepHash = ByteArray(0) // T(0) empty string (zero length)
|
||||||
|
@ -364,14 +364,14 @@ internal class DefaultVerificationService @Inject constructor(
|
|||||||
dispatchRequestAdded(pendingVerificationRequest)
|
dispatchRequestAdded(pendingVerificationRequest)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* After the m.key.verification.ready event is sent, either party can send an m.key.verification.start event
|
* After the m.key.verification.ready event is sent, either party can send an m.key.verification.start event
|
||||||
* to begin the verification.
|
* to begin the verification.
|
||||||
* If both parties send an m.key.verification.start event, and they both specify the same verification method,
|
* If both parties send an m.key.verification.start event, and they both specify the same verification method,
|
||||||
* then the event sent by the user whose user ID is the smallest is used, and the other m.key.verification.start
|
* then the event sent by the user whose user ID is the smallest is used, and the other m.key.verification.start
|
||||||
* event is ignored.
|
* event is ignored.
|
||||||
* In the case of a single user verifying two of their devices, the device ID is compared instead.
|
* In the case of a single user verifying two of their devices, the device ID is compared instead.
|
||||||
* If both parties send an m.key.verification.start event, but they specify different verification methods,
|
* If both parties send an m.key.verification.start event, but they specify different verification methods,
|
||||||
* the verification should be cancelled with a code of m.unexpected_message.
|
* the verification should be cancelled with a code of m.unexpected_message.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,9 @@ import org.matrix.android.sdk.internal.di.SessionDatabase
|
|||||||
import org.matrix.android.sdk.internal.task.TaskExecutor
|
import org.matrix.android.sdk.internal.task.TaskExecutor
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class DefaultCacheService @Inject constructor(@SessionDatabase
|
internal class DefaultCacheService @Inject constructor(
|
||||||
private val clearCacheTask: ClearCacheTask,
|
@SessionDatabase private val clearCacheTask: ClearCacheTask,
|
||||||
private val taskExecutor: TaskExecutor
|
private val taskExecutor: TaskExecutor
|
||||||
) : CacheService {
|
) : CacheService {
|
||||||
|
|
||||||
override suspend fun clearCache() {
|
override suspend fun clearCache() {
|
||||||
|
@ -24,8 +24,9 @@ import org.matrix.android.sdk.internal.di.SessionDatabase
|
|||||||
import org.matrix.android.sdk.internal.session.sync.model.accountdata.DirectMessagesContent
|
import org.matrix.android.sdk.internal.session.sync.model.accountdata.DirectMessagesContent
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class DirectChatsHelper @Inject constructor(@SessionDatabase
|
internal class DirectChatsHelper @Inject constructor(
|
||||||
private val realmConfiguration: RealmConfiguration) {
|
@SessionDatabase private val realmConfiguration: RealmConfiguration
|
||||||
|
) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a map of userId <-> list of roomId
|
* @return a map of userId <-> list of roomId
|
||||||
|
@ -88,10 +88,10 @@ internal class DefaultWidgetPostAPIMediator @Inject constructor(private val mosh
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* *********************************************************************************************
|
* *********************************************************************************************
|
||||||
* Message sending methods
|
* Message sending methods
|
||||||
* *********************************************************************************************
|
* *********************************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a boolean response
|
* Send a boolean response
|
||||||
|
17
tools/dependencycheck/suppressions.xml
Normal file
17
tools/dependencycheck/suppressions.xml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
|
||||||
|
<suppress until="2023-01-01Z">
|
||||||
|
<notes><![CDATA[
|
||||||
|
file name: ktlint-reporter-checkstyle-0.45.1.jar
|
||||||
|
]]></notes>
|
||||||
|
<packageUrl regex="true">^pkg:maven/com\.pinterest\.ktlint/ktlint\-reporter\-checkstyle@.*$</packageUrl>
|
||||||
|
<cve>CVE-2019-10782</cve>
|
||||||
|
</suppress>
|
||||||
|
<suppress until="2023-01-01Z">
|
||||||
|
<notes><![CDATA[
|
||||||
|
file name: ktlint-reporter-checkstyle-0.45.1.jar
|
||||||
|
]]></notes>
|
||||||
|
<packageUrl regex="true">^pkg:maven/com\.pinterest\.ktlint/ktlint\-reporter\-checkstyle@.*$</packageUrl>
|
||||||
|
<cve>CVE-2019-9658</cve>
|
||||||
|
</suppress>
|
||||||
|
</suppressions>
|
@ -17,6 +17,9 @@ cd ..
|
|||||||
rm -rf jitsi-meet
|
rm -rf jitsi-meet
|
||||||
git clone https://github.com/jitsi/jitsi-meet
|
git clone https://github.com/jitsi/jitsi-meet
|
||||||
|
|
||||||
|
# Android SDK
|
||||||
|
export ANDROID_SDK_ROOT=~/Library/Android/sdk
|
||||||
|
|
||||||
# We want a libre build!
|
# We want a libre build!
|
||||||
export LIBRE_BUILD=true
|
export LIBRE_BUILD=true
|
||||||
|
|
||||||
@ -25,8 +28,9 @@ cd jitsi-meet
|
|||||||
# This is commit after version 2.2.2, which does not compile
|
# This is commit after version 2.2.2, which does not compile
|
||||||
# git checkout 5a934c071a5cbe64de275a25d0ed62d8193cdd03
|
# git checkout 5a934c071a5cbe64de275a25d0ed62d8193cdd03
|
||||||
|
|
||||||
# Version android-sdk-3.10.0, commit 99e56e229dfa3c490096e37c3e5b76d2a3f23e32
|
# Changelog: https://github.com/jitsi/jitsi-meet-release-notes/blob/master/CHANGELOG-MOBILE-SDKS.md
|
||||||
git checkout android-sdk-3.10.0
|
|
||||||
|
git checkout android-sdk-5.0.2
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "##################################################"
|
echo "##################################################"
|
||||||
|
@ -470,10 +470,10 @@ dependencies {
|
|||||||
// WebRTC
|
// WebRTC
|
||||||
// org.webrtc:google-webrtc is for development purposes only
|
// org.webrtc:google-webrtc is for development purposes only
|
||||||
// implementation 'org.webrtc:google-webrtc:1.0.+'
|
// implementation 'org.webrtc:google-webrtc:1.0.+'
|
||||||
implementation('com.facebook.react:react-native-webrtc:1.92.1-jitsi-9093212@aar')
|
implementation('com.facebook.react:react-native-webrtc:1.94.2-jitsi-10227332@aar')
|
||||||
|
|
||||||
// Jitsi
|
// Jitsi
|
||||||
implementation('org.jitsi.react:jitsi-meet-sdk:3.10.0') {
|
implementation('org.jitsi.react:jitsi-meet-sdk:5.0.2') {
|
||||||
exclude group: 'com.google.firebase'
|
exclude group: 'com.google.firebase'
|
||||||
exclude group: 'com.google.android.gms'
|
exclude group: 'com.google.android.gms'
|
||||||
exclude group: 'com.android.installreferrer'
|
exclude group: 'com.android.installreferrer'
|
||||||
|
@ -93,7 +93,7 @@ class TestLinkifyActivity : AppCompatActivity() {
|
|||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
subViews.testLinkifyCustomText.apply {
|
subViews.testLinkifyCustomText.apply {
|
||||||
@ -108,7 +108,7 @@ class TestLinkifyActivity : AppCompatActivity() {
|
|||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO Call VectorLinkify.addLinks(text)
|
// TODO Call VectorLinkify.addLinks(text)
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
<!--<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />-->
|
<!--<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />-->
|
||||||
|
|
||||||
<!-- Jitsi SDK is now API23+ -->
|
<!-- Jitsi SDK is now API23+ -->
|
||||||
<uses-sdk tools:overrideLibrary="org.jitsi.meet.sdk,com.oney.WebRTCModule,com.learnium.RNDeviceInfo,com.reactnativecommunity.asyncstorage,com.ocetnik.timer,com.calendarevents,com.reactnativecommunity.netinfo,com.kevinresol.react_native_default_preference,com.rnimmersive,com.corbt.keepawake,com.BV.LinearGradient,com.horcrux.svg,com.oblador.performance,com.reactnativecommunity.slider,com.brentvatne.react" />
|
<uses-sdk tools:overrideLibrary="org.jitsi.meet.sdk,com.oney.WebRTCModule,com.learnium.RNDeviceInfo,com.reactnativecommunity.asyncstorage,com.ocetnik.timer,com.calendarevents,com.reactnativecommunity.netinfo,com.kevinresol.react_native_default_preference,com.rnimmersive,com.corbt.keepawake,com.BV.LinearGradient,com.horcrux.svg,com.oblador.performance,com.reactnativecommunity.slider,com.brentvatne.react,com.reactnativecommunity.clipboard,com.swmansion.gesturehandler.react,org.linusu,org.reactnative.maskedview,com.reactnativepagerview,com.swmansion.reanimated,com.th3rdwave.safeareacontext,com.swmansion.rnscreens,org.devio.rn.splashscreen,com.reactnativecommunity.webview" />
|
||||||
|
|
||||||
<!-- Adding CAMERA permission prevents Chromebooks to see the application on the PlayStore -->
|
<!-- Adding CAMERA permission prevents Chromebooks to see the application on the PlayStore -->
|
||||||
<!-- Tell that the Camera is not mandatory to install the application -->
|
<!-- Tell that the Camera is not mandatory to install the application -->
|
||||||
|
@ -90,7 +90,7 @@ object BadgeProxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,6 +124,6 @@ object BadgeProxy {
|
|||||||
Timber.v("## updateBadgeCount(): badge update count=$unreadRoomsCount")
|
Timber.v("## updateBadgeCount(): badge update count=$unreadRoomsCount")
|
||||||
updateBadgeCount(aContext, unreadRoomsCount)
|
updateBadgeCount(aContext, unreadRoomsCount)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,11 @@ import org.matrix.android.sdk.api.session.permalinks.PermalinkParser
|
|||||||
import org.matrix.android.sdk.api.session.room.model.create.CreateRoomParams
|
import org.matrix.android.sdk.api.session.room.model.create.CreateRoomParams
|
||||||
import org.matrix.android.sdk.api.session.user.model.User
|
import org.matrix.android.sdk.api.session.user.model.User
|
||||||
|
|
||||||
class CreateDirectRoomViewModel @AssistedInject constructor(@Assisted
|
class CreateDirectRoomViewModel @AssistedInject constructor(
|
||||||
initialState: CreateDirectRoomViewState,
|
@Assisted initialState: CreateDirectRoomViewState,
|
||||||
private val rawService: RawService,
|
private val rawService: RawService,
|
||||||
val session: Session) :
|
val session: Session
|
||||||
|
) :
|
||||||
VectorViewModel<CreateDirectRoomViewState, CreateDirectRoomAction, CreateDirectRoomViewEvents>(initialState) {
|
VectorViewModel<CreateDirectRoomViewState, CreateDirectRoomAction, CreateDirectRoomViewEvents>(initialState) {
|
||||||
|
|
||||||
@AssistedFactory
|
@AssistedFactory
|
||||||
|
@ -52,7 +52,7 @@ class KeysBackupRestoreActivity : SimpleFragmentActivity() {
|
|||||||
super.onBackPressed()
|
super.onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject lateinit var activeSessionHolder: ActiveSessionHolder
|
@Inject lateinit var activeSessionHolder: ActiveSessionHolder
|
||||||
|
|
||||||
override fun initUiAndData() {
|
override fun initUiAndData() {
|
||||||
super.initUiAndData()
|
super.initUiAndData()
|
||||||
|
@ -1669,7 +1669,7 @@ class TimelineFragment @Inject constructor(
|
|||||||
is MessageComposerViewEvents.SlashCommandNotSupportedInThreads -> {
|
is MessageComposerViewEvents.SlashCommandNotSupportedInThreads -> {
|
||||||
displayCommandError(getString(R.string.command_not_supported_in_threads, sendMessageResult.command.command))
|
displayCommandError(getString(R.string.command_not_supported_in_threads, sendMessageResult.command.command))
|
||||||
}
|
}
|
||||||
} //
|
}
|
||||||
|
|
||||||
lockSendButton = false
|
lockSendButton = false
|
||||||
}
|
}
|
||||||
|
@ -69,16 +69,16 @@ import org.matrix.android.sdk.flow.unwrap
|
|||||||
/**
|
/**
|
||||||
* Information related to an event and used to display preview in contextual bottom sheet.
|
* Information related to an event and used to display preview in contextual bottom sheet.
|
||||||
*/
|
*/
|
||||||
class MessageActionsViewModel @AssistedInject constructor(@Assisted
|
class MessageActionsViewModel @AssistedInject constructor(
|
||||||
private val initialState: MessageActionState,
|
@Assisted private val initialState: MessageActionState,
|
||||||
private val eventHtmlRenderer: Lazy<EventHtmlRenderer>,
|
private val eventHtmlRenderer: Lazy<EventHtmlRenderer>,
|
||||||
private val htmlCompressor: VectorHtmlCompressor,
|
private val htmlCompressor: VectorHtmlCompressor,
|
||||||
private val session: Session,
|
private val session: Session,
|
||||||
private val noticeEventFormatter: NoticeEventFormatter,
|
private val noticeEventFormatter: NoticeEventFormatter,
|
||||||
private val errorFormatter: ErrorFormatter,
|
private val errorFormatter: ErrorFormatter,
|
||||||
private val stringProvider: StringProvider,
|
private val stringProvider: StringProvider,
|
||||||
private val pillsPostProcessorFactory: PillsPostProcessor.Factory,
|
private val pillsPostProcessorFactory: PillsPostProcessor.Factory,
|
||||||
private val vectorPreferences: VectorPreferences
|
private val vectorPreferences: VectorPreferences
|
||||||
) : VectorViewModel<MessageActionState, MessageActionsAction, EmptyViewEvents>(initialState) {
|
) : VectorViewModel<MessageActionState, MessageActionsAction, EmptyViewEvents>(initialState) {
|
||||||
|
|
||||||
private val informationData = initialState.informationData
|
private val informationData = initialState.informationData
|
||||||
|
@ -56,10 +56,10 @@ data class ReactionInfo(
|
|||||||
/**
|
/**
|
||||||
* Used to display the list of members that reacted to a given event
|
* Used to display the list of members that reacted to a given event
|
||||||
*/
|
*/
|
||||||
class ViewReactionsViewModel @AssistedInject constructor(@Assisted
|
class ViewReactionsViewModel @AssistedInject constructor(
|
||||||
initialState: DisplayReactionsViewState,
|
@Assisted initialState: DisplayReactionsViewState,
|
||||||
session: Session,
|
session: Session,
|
||||||
private val dateFormatter: VectorDateFormatter
|
private val dateFormatter: VectorDateFormatter
|
||||||
) : VectorViewModel<DisplayReactionsViewState, EmptyAction, EmptyViewEvents>(initialState) {
|
) : VectorViewModel<DisplayReactionsViewState, EmptyAction, EmptyViewEvents>(initialState) {
|
||||||
|
|
||||||
private val roomId = initialState.roomId
|
private val roomId = initialState.roomId
|
||||||
|
@ -28,16 +28,15 @@ import im.vector.app.core.resources.StringProvider
|
|||||||
import im.vector.app.features.userdirectory.PendingSelection
|
import im.vector.app.features.userdirectory.PendingSelection
|
||||||
import kotlinx.coroutines.flow.asFlow
|
import kotlinx.coroutines.flow.asFlow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.collect
|
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
|
|
||||||
class InviteUsersToRoomViewModel @AssistedInject constructor(@Assisted
|
class InviteUsersToRoomViewModel @AssistedInject constructor(
|
||||||
initialState: InviteUsersToRoomViewState,
|
@Assisted initialState: InviteUsersToRoomViewState,
|
||||||
session: Session,
|
session: Session,
|
||||||
val stringProvider: StringProvider) :
|
val stringProvider: StringProvider
|
||||||
VectorViewModel<InviteUsersToRoomViewState, InviteUsersToRoomAction, InviteUsersToRoomViewEvents>(initialState) {
|
) : VectorViewModel<InviteUsersToRoomViewState, InviteUsersToRoomAction, InviteUsersToRoomViewEvents>(initialState) {
|
||||||
|
|
||||||
private val room = session.getRoom(initialState.roomId)!!
|
private val room = session.getRoom(initialState.roomId)!!
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ class LoginViewModel @AssistedInject constructor(
|
|||||||
code = MatrixError.FORBIDDEN,
|
code = MatrixError.FORBIDDEN,
|
||||||
message = "Registration is disabled"
|
message = "Registration is disabled"
|
||||||
), 403))
|
), 403))
|
||||||
*/
|
*/
|
||||||
} catch (failure: Throwable) {
|
} catch (failure: Throwable) {
|
||||||
if (failure !is CancellationException) {
|
if (failure !is CancellationException) {
|
||||||
_viewEvents.post(LoginViewEvents.Failure(failure))
|
_viewEvents.post(LoginViewEvents.Failure(failure))
|
||||||
|
@ -771,7 +771,7 @@ class LoginViewModel2 @AssistedInject constructor(
|
|||||||
),
|
),
|
||||||
httpCode = 403
|
httpCode = 403
|
||||||
)
|
)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LoginViewEvents2.OpenSignUpChooseUsernameScreen
|
LoginViewEvents2.OpenSignUpChooseUsernameScreen
|
||||||
} catch (throwable: Throwable) {
|
} catch (throwable: Throwable) {
|
||||||
|
@ -202,7 +202,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
|||||||
VectorApp.getInstance().notificationDrawerManager.refreshNotificationDrawer(null)
|
VectorApp.getInstance().notificationDrawerManager.refreshNotificationDrawer(null)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getReplyMessage(intent: Intent?): String? {
|
private fun getReplyMessage(intent: Intent?): String? {
|
||||||
|
@ -110,8 +110,7 @@ class RoomPreviewNoPreviewFragment @Inject constructor(
|
|||||||
PeekingState.FOUND -> {
|
PeekingState.FOUND -> {
|
||||||
// show join buttons
|
// show join buttons
|
||||||
views.roomPreviewNoPreviewJoin.isVisible = true
|
views.roomPreviewNoPreviewJoin.isVisible = true
|
||||||
renderState(bestName, state.matrixItem(), state.roomTopic
|
renderState(bestName, state.matrixItem(), state.roomTopic)
|
||||||
/**, state.roomType*/)
|
|
||||||
if (state.fromEmailInvite != null && !state.isEmailBoundToAccount) {
|
if (state.fromEmailInvite != null && !state.isEmailBoundToAccount) {
|
||||||
views.roomPreviewNoPreviewLabel.text =
|
views.roomPreviewNoPreviewLabel.text =
|
||||||
span {
|
span {
|
||||||
@ -152,15 +151,13 @@ class RoomPreviewNoPreviewFragment @Inject constructor(
|
|||||||
views.roomPreviewNoPreviewJoin.isVisible = true
|
views.roomPreviewNoPreviewJoin.isVisible = true
|
||||||
views.roomPreviewNoPreviewLabel.isVisible = true
|
views.roomPreviewNoPreviewLabel.isVisible = true
|
||||||
views.roomPreviewNoPreviewLabel.setText(R.string.room_preview_no_preview_join)
|
views.roomPreviewNoPreviewLabel.setText(R.string.room_preview_no_preview_join)
|
||||||
renderState(bestName, state.matrixItem().takeIf { state.roomAlias != null }, state.roomTopic
|
renderState(bestName, state.matrixItem().takeIf { state.roomAlias != null }, state.roomTopic)
|
||||||
/**, state.roomType*/)
|
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
views.roomPreviewNoPreviewJoin.isVisible = false
|
views.roomPreviewNoPreviewJoin.isVisible = false
|
||||||
views.roomPreviewNoPreviewLabel.isVisible = true
|
views.roomPreviewNoPreviewLabel.isVisible = true
|
||||||
views.roomPreviewNoPreviewLabel.setText(R.string.room_preview_not_found)
|
views.roomPreviewNoPreviewLabel.setText(R.string.room_preview_not_found)
|
||||||
renderState(bestName, null, state.roomTopic
|
renderState(bestName, null, state.roomTopic)
|
||||||
/**, state.roomType*/)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,16 +165,13 @@ class RoomPreviewNoPreviewFragment @Inject constructor(
|
|||||||
// Render with initial state, no peeking
|
// Render with initial state, no peeking
|
||||||
views.roomPreviewPeekingProgress.isVisible = false
|
views.roomPreviewPeekingProgress.isVisible = false
|
||||||
views.roomPreviewNoPreviewJoin.isVisible = true
|
views.roomPreviewNoPreviewJoin.isVisible = true
|
||||||
renderState(bestName, state.matrixItem(), state.roomTopic
|
renderState(bestName, state.matrixItem(), state.roomTopic)
|
||||||
/**, state.roomType*/)
|
|
||||||
views.roomPreviewNoPreviewLabel.isVisible = false
|
views.roomPreviewNoPreviewLabel.isVisible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderState(roomName: String, matrixItem: MatrixItem?, topic: String?
|
private fun renderState(roomName: String, matrixItem: MatrixItem?, topic: String?) {
|
||||||
/**, roomType: String?*/
|
|
||||||
) {
|
|
||||||
// Toolbar
|
// Toolbar
|
||||||
if (matrixItem != null) {
|
if (matrixItem != null) {
|
||||||
views.roomPreviewNoPreviewToolbarAvatar.isVisible = true
|
views.roomPreviewNoPreviewToolbarAvatar.isVisible = true
|
||||||
|
@ -111,9 +111,6 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
|||||||
private const val SETTINGS_PIN_UNREAD_MESSAGES_PREFERENCE_KEY = "SETTINGS_PIN_UNREAD_MESSAGES_PREFERENCE_KEY"
|
private const val SETTINGS_PIN_UNREAD_MESSAGES_PREFERENCE_KEY = "SETTINGS_PIN_UNREAD_MESSAGES_PREFERENCE_KEY"
|
||||||
private const val SETTINGS_PIN_MISSED_NOTIFICATIONS_PREFERENCE_KEY = "SETTINGS_PIN_MISSED_NOTIFICATIONS_PREFERENCE_KEY"
|
private const val SETTINGS_PIN_MISSED_NOTIFICATIONS_PREFERENCE_KEY = "SETTINGS_PIN_MISSED_NOTIFICATIONS_PREFERENCE_KEY"
|
||||||
|
|
||||||
// flair
|
|
||||||
const val SETTINGS_GROUPS_FLAIR_KEY = "SETTINGS_GROUPS_FLAIR_KEY"
|
|
||||||
|
|
||||||
// notifications
|
// notifications
|
||||||
const val SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY = "SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY"
|
const val SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY = "SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY"
|
||||||
const val SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY = "SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
|
const val SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY = "SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
|
||||||
|
@ -1,170 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2019 New Vector Ltd
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package im.vector.app.features.settings
|
|
||||||
|
|
||||||
import androidx.preference.PreferenceCategory
|
|
||||||
import im.vector.app.R
|
|
||||||
import im.vector.app.core.preference.ProgressBarPreference
|
|
||||||
|
|
||||||
class VectorSettingsFlairFragment : VectorSettingsBaseFragment() {
|
|
||||||
|
|
||||||
override var titleRes = R.string.settings_flair
|
|
||||||
override val preferenceXmlRes = R.xml.vector_settings_flair
|
|
||||||
|
|
||||||
// current publicised group list
|
|
||||||
private var mPublicisedGroups: MutableSet<String>? = null
|
|
||||||
|
|
||||||
// Group Flairs
|
|
||||||
private val mGroupsFlairCategory by lazy {
|
|
||||||
findPreference<PreferenceCategory>(VectorPreferences.SETTINGS_GROUPS_FLAIR_KEY)!!
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun bindPref() {
|
|
||||||
// Flair
|
|
||||||
refreshGroupFlairsList()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================================================================
|
|
||||||
// Group flairs management
|
|
||||||
// ==============================================================================================================
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Force the refresh of the devices list.<br></br>
|
|
||||||
* The devices list is the list of the devices where the user as looged in.
|
|
||||||
* It can be any mobile device, as any browser.
|
|
||||||
*/
|
|
||||||
private fun refreshGroupFlairsList() {
|
|
||||||
// display a spinner while refreshing
|
|
||||||
if (0 == mGroupsFlairCategory.preferenceCount) {
|
|
||||||
activity?.let {
|
|
||||||
val preference = ProgressBarPreference(it)
|
|
||||||
mGroupsFlairCategory.addPreference(preference)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
TODO
|
|
||||||
session.groupsManager.getUserPublicisedGroups(session.myUserId, true, object : MatrixCallback<Set<String>> {
|
|
||||||
override fun onSuccess(publicisedGroups: Set<String>) {
|
|
||||||
// clear everything
|
|
||||||
mGroupsFlairCategory.removeAll()
|
|
||||||
|
|
||||||
if (publicisedGroups.isEmpty()) {
|
|
||||||
val vectorGroupPreference = Preference(activity)
|
|
||||||
vectorGroupPreference.title = resources.getString(R.string.settings_without_flair)
|
|
||||||
mGroupsFlairCategory.addPreference(vectorGroupPreference)
|
|
||||||
} else {
|
|
||||||
buildGroupsList(publicisedGroups)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onNetworkError(e: Exception) {
|
|
||||||
// NOP
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onMatrixError(e: MatrixError) {
|
|
||||||
// NOP
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onUnexpectedError(e: Exception) {
|
|
||||||
// NOP
|
|
||||||
}
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build the groups list.
|
|
||||||
*
|
|
||||||
* @param publicisedGroups the publicised groups list.
|
|
||||||
*/
|
|
||||||
private fun buildGroupsList(publicisedGroups: Set<String>) {
|
|
||||||
var isNewList = true
|
|
||||||
|
|
||||||
mPublicisedGroups?.let {
|
|
||||||
if (it.size == publicisedGroups.size) {
|
|
||||||
isNewList = !it.containsAll(publicisedGroups)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNewList) {
|
|
||||||
/*
|
|
||||||
TODO
|
|
||||||
val joinedGroups = ArrayList(session.groupsManager.joinedGroups)
|
|
||||||
Collections.sort(joinedGroups, Group.mGroupsComparator)
|
|
||||||
|
|
||||||
mPublicisedGroups = publicisedGroups.toMutableSet()
|
|
||||||
|
|
||||||
for ((prefIndex, group) in joinedGroups.withIndex()) {
|
|
||||||
val vectorGroupPreference = VectorGroupPreference(activity!!)
|
|
||||||
vectorGroupPreference.key = DEVICES_PREFERENCE_KEY_BASE + prefIndex
|
|
||||||
|
|
||||||
vectorGroupPreference.setGroup(group, session)
|
|
||||||
vectorGroupPreference.title = group.displayName
|
|
||||||
vectorGroupPreference.summary = group.groupId
|
|
||||||
|
|
||||||
vectorGroupPreference.isChecked = publicisedGroups.contains(group.groupId)
|
|
||||||
mGroupsFlairCategory.addPreference(vectorGroupPreference)
|
|
||||||
|
|
||||||
vectorGroupPreference.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
|
||||||
if (newValue is Boolean) {
|
|
||||||
/*
|
|
||||||
* if mPublicisedGroup is null somehow, then
|
|
||||||
* we cant check it contains groupId or not
|
|
||||||
* so set isFlaired to false
|
|
||||||
*/
|
|
||||||
val isFlaired = mPublicisedGroups?.contains(group.groupId) ?: false
|
|
||||||
|
|
||||||
if (newValue != isFlaired) {
|
|
||||||
displayLoadingView()
|
|
||||||
session.groupsManager.updateGroupPublicity(group.groupId, newValue, object : MatrixCallback<Unit> {
|
|
||||||
override fun onSuccess(info: Void?) {
|
|
||||||
hideLoadingView()
|
|
||||||
if (newValue) {
|
|
||||||
mPublicisedGroups?.add(group.groupId)
|
|
||||||
} else {
|
|
||||||
mPublicisedGroups?.remove(group.groupId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun onError() {
|
|
||||||
hideLoadingView()
|
|
||||||
// restore default value
|
|
||||||
vectorGroupPreference.isChecked = publicisedGroups.contains(group.groupId)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onNetworkError(e: Exception) {
|
|
||||||
onError()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onMatrixError(e: MatrixError) {
|
|
||||||
onError()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onUnexpectedError(e: Exception) {
|
|
||||||
onError()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -359,7 +359,7 @@ class VectorSettingsGeneralFragment @Inject constructor(
|
|||||||
startActivityForResult(intent, REQUEST_PHONEBOOK_COUNTRY)
|
startActivityForResult(intent, REQUEST_PHONEBOOK_COUNTRY)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==============================================================================================================
|
// ==============================================================================================================
|
||||||
|
@ -117,7 +117,7 @@ class VectorSettingsPreferencesFragment @Inject constructor(
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// update keep medias period
|
// update keep medias period
|
||||||
findPreference<VectorPreference>(VectorPreferences.SETTINGS_MEDIA_SAVING_PERIOD_KEY)!!.let {
|
findPreference<VectorPreference>(VectorPreferences.SETTINGS_MEDIA_SAVING_PERIOD_KEY)!!.let {
|
||||||
|
@ -1041,7 +1041,8 @@
|
|||||||
<string name="media_source_choose">Choose</string>
|
<string name="media_source_choose">Choose</string>
|
||||||
<string name="settings_play_shutter_sound">Play shutter sound</string>
|
<string name="settings_play_shutter_sound">Play shutter sound</string>
|
||||||
|
|
||||||
<string name="settings_flair">Flair</string>
|
<!-- TODO Remove -->
|
||||||
|
<string name="settings_flair" tools:ignore="MissingTranslation">Flair</string>
|
||||||
|
|
||||||
<!-- medias saving settings -->
|
<!-- medias saving settings -->
|
||||||
<string name="media_saving_period_3_days">3 days</string>
|
<string name="media_saving_period_3_days">3 days</string>
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<im.vector.app.core.preference.VectorPreferenceCategory
|
|
||||||
android:key="SETTINGS_GROUPS_FLAIR_KEY"
|
|
||||||
android:title="@string/settings_flair" />
|
|
||||||
|
|
||||||
</androidx.preference.PreferenceScreen>
|
|
Loading…
x
Reference in New Issue
Block a user