mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-24 18:36:21 +03:00
Merge pull request #5664 from vector-im/feature/bma/dep_upgrade
Upgrade Jitsi and ktlint
This commit is contained in:
commit
9a2cc1a4c5
35 changed files with 123 additions and 258 deletions
27
build.gradle
27
build.gradle
|
@ -21,7 +21,7 @@ buildscript {
|
|||
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
|
||||
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.5'
|
||||
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
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
|
@ -32,6 +32,16 @@ plugins {
|
|||
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 {
|
||||
apply plugin: "org.jlleitschuh.gradle.ktlint"
|
||||
|
||||
|
@ -51,7 +61,7 @@ allprojects {
|
|||
}
|
||||
// Jitsi repo
|
||||
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:
|
||||
// url "file:///Users/bmarty/workspaces/jitsi_libre_maven/android-sdk-3.10.0"
|
||||
content {
|
||||
|
@ -87,6 +97,8 @@ allprojects {
|
|||
|
||||
// See https://github.com/JLLeitschuh/ktlint-gradle#configuration
|
||||
ktlint {
|
||||
// See https://github.com/pinterest/ktlint/releases/
|
||||
version = "0.45.1"
|
||||
android = true
|
||||
ignoreFailures = false
|
||||
enableExperimentalRules = true
|
||||
|
@ -96,7 +108,16 @@ allprojects {
|
|||
"spacing-between-declarations-with-comments",
|
||||
"no-multi-spaces",
|
||||
"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.hyuwah',
|
||||
'com.github.jetradarmobile',
|
||||
'com.github.MatrixFrog',
|
||||
'com.github.tapadoo',
|
||||
'com.github.vector-im',
|
||||
'com.github.yalantis',
|
||||
|
@ -39,6 +40,7 @@ ext.groups = [
|
|||
regex: [
|
||||
],
|
||||
group: [
|
||||
'ch.qos.logback',
|
||||
'com.adevinta.android',
|
||||
'com.airbnb.android',
|
||||
'com.almworks.sqlite4java',
|
||||
|
@ -48,10 +50,12 @@ ext.groups = [
|
|||
'com.beust',
|
||||
'com.davemorrissey.labs',
|
||||
'com.dropbox.core',
|
||||
'com.facebook.fbjni',
|
||||
'com.facebook.fresco',
|
||||
'com.facebook.infer.annotation',
|
||||
'com.facebook.soloader',
|
||||
'com.facebook.stetho',
|
||||
'com.facebook.yoga',
|
||||
'com.fasterxml',
|
||||
'com.fasterxml.jackson',
|
||||
'com.fasterxml.jackson.core',
|
||||
|
@ -113,6 +117,7 @@ ext.groups = [
|
|||
'info.picocli',
|
||||
'io.arrow-kt',
|
||||
'io.github.detekt.sarif4k',
|
||||
'io.github.microutils',
|
||||
'io.github.reactivecircus.flowbinding',
|
||||
'io.grpc',
|
||||
'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`.
|
||||
|
||||
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`.
|
||||
|
||||
### Run the build script
|
||||
|
|
|
@ -138,7 +138,7 @@ class WithHeldTests : InstrumentedTest {
|
|||
|
||||
@Test
|
||||
@Ignore("This test will be ignored until it is fixed")
|
||||
fun test_WithHeldNoOlm() {
|
||||
fun test_WithHeldNoOlm() {
|
||||
val testData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
|
||||
val aliceSession = testData.firstSession
|
||||
val bobSession = testData.secondSession!!
|
||||
|
|
|
@ -137,8 +137,7 @@ internal abstract class CryptoModule {
|
|||
@JvmStatic
|
||||
@Provides
|
||||
@CryptoDatabase
|
||||
fun providesClearCacheTask(@CryptoDatabase
|
||||
realmConfiguration: RealmConfiguration): ClearCacheTask {
|
||||
fun providesClearCacheTask(@CryptoDatabase realmConfiguration: RealmConfiguration): ClearCacheTask {
|
||||
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 }}]" }
|
||||
|
||||
internal fun <T> MXUsersDevicesMap<T>.toDebugCount() =
|
||||
|
|
|
@ -70,7 +70,7 @@ object HkdfSha256 {
|
|||
T(2) = HMAC-Hash(PRK, T(1) | info | 0x02)
|
||||
T(3) = HMAC-Hash(PRK, T(2) | info | 0x03)
|
||||
...
|
||||
*/
|
||||
*/
|
||||
val n = ceil(outputLength.toDouble() / HASH_LEN.toDouble()).toInt()
|
||||
|
||||
var stepHash = ByteArray(0) // T(0) empty string (zero length)
|
||||
|
|
|
@ -364,14 +364,14 @@ internal class DefaultVerificationService @Inject constructor(
|
|||
dispatchRequestAdded(pendingVerificationRequest)
|
||||
|
||||
/*
|
||||
* After the m.key.verification.ready event is sent, either party can send an m.key.verification.start event
|
||||
* to begin the verification.
|
||||
* 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
|
||||
* event is ignored.
|
||||
* 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,
|
||||
* the verification should be cancelled with a code of m.unexpected_message.
|
||||
* After the m.key.verification.ready event is sent, either party can send an m.key.verification.start event
|
||||
* to begin the verification.
|
||||
* 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
|
||||
* event is ignored.
|
||||
* 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,
|
||||
* 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 javax.inject.Inject
|
||||
|
||||
internal class DefaultCacheService @Inject constructor(@SessionDatabase
|
||||
private val clearCacheTask: ClearCacheTask,
|
||||
private val taskExecutor: TaskExecutor
|
||||
internal class DefaultCacheService @Inject constructor(
|
||||
@SessionDatabase private val clearCacheTask: ClearCacheTask,
|
||||
private val taskExecutor: TaskExecutor
|
||||
) : CacheService {
|
||||
|
||||
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 javax.inject.Inject
|
||||
|
||||
internal class DirectChatsHelper @Inject constructor(@SessionDatabase
|
||||
private val realmConfiguration: RealmConfiguration) {
|
||||
internal class DirectChatsHelper @Inject constructor(
|
||||
@SessionDatabase private val realmConfiguration: RealmConfiguration
|
||||
) {
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
|
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
|
||||
git clone https://github.com/jitsi/jitsi-meet
|
||||
|
||||
# Android SDK
|
||||
export ANDROID_SDK_ROOT=~/Library/Android/sdk
|
||||
|
||||
# We want a libre build!
|
||||
export LIBRE_BUILD=true
|
||||
|
||||
|
@ -25,8 +28,9 @@ cd jitsi-meet
|
|||
# This is commit after version 2.2.2, which does not compile
|
||||
# git checkout 5a934c071a5cbe64de275a25d0ed62d8193cdd03
|
||||
|
||||
# Version android-sdk-3.10.0, commit 99e56e229dfa3c490096e37c3e5b76d2a3f23e32
|
||||
git checkout android-sdk-3.10.0
|
||||
# Changelog: https://github.com/jitsi/jitsi-meet-release-notes/blob/master/CHANGELOG-MOBILE-SDKS.md
|
||||
|
||||
git checkout android-sdk-5.0.2
|
||||
|
||||
echo
|
||||
echo "##################################################"
|
||||
|
|
|
@ -470,10 +470,10 @@ dependencies {
|
|||
// WebRTC
|
||||
// org.webrtc:google-webrtc is for development purposes only
|
||||
// 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
|
||||
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.android.gms'
|
||||
exclude group: 'com.android.installreferrer'
|
||||
|
|
|
@ -93,7 +93,7 @@ class TestLinkifyActivity : AppCompatActivity() {
|
|||
.show()
|
||||
}
|
||||
})
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
subViews.testLinkifyCustomText.apply {
|
||||
|
@ -108,7 +108,7 @@ class TestLinkifyActivity : AppCompatActivity() {
|
|||
.show()
|
||||
}
|
||||
})
|
||||
*/
|
||||
*/
|
||||
|
||||
// TODO Call VectorLinkify.addLinks(text)
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<!--<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />-->
|
||||
|
||||
<!-- 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 -->
|
||||
<!-- 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")
|
||||
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.user.model.User
|
||||
|
||||
class CreateDirectRoomViewModel @AssistedInject constructor(@Assisted
|
||||
initialState: CreateDirectRoomViewState,
|
||||
private val rawService: RawService,
|
||||
val session: Session) :
|
||||
class CreateDirectRoomViewModel @AssistedInject constructor(
|
||||
@Assisted initialState: CreateDirectRoomViewState,
|
||||
private val rawService: RawService,
|
||||
val session: Session
|
||||
) :
|
||||
VectorViewModel<CreateDirectRoomViewState, CreateDirectRoomAction, CreateDirectRoomViewEvents>(initialState) {
|
||||
|
||||
@AssistedFactory
|
||||
|
|
|
@ -52,7 +52,7 @@ class KeysBackupRestoreActivity : SimpleFragmentActivity() {
|
|||
super.onBackPressed()
|
||||
}
|
||||
|
||||
@Inject lateinit var activeSessionHolder: ActiveSessionHolder
|
||||
@Inject lateinit var activeSessionHolder: ActiveSessionHolder
|
||||
|
||||
override fun initUiAndData() {
|
||||
super.initUiAndData()
|
||||
|
|
|
@ -1669,7 +1669,7 @@ class TimelineFragment @Inject constructor(
|
|||
is MessageComposerViewEvents.SlashCommandNotSupportedInThreads -> {
|
||||
displayCommandError(getString(R.string.command_not_supported_in_threads, sendMessageResult.command.command))
|
||||
}
|
||||
} //
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
class MessageActionsViewModel @AssistedInject constructor(@Assisted
|
||||
private val initialState: MessageActionState,
|
||||
private val eventHtmlRenderer: Lazy<EventHtmlRenderer>,
|
||||
private val htmlCompressor: VectorHtmlCompressor,
|
||||
private val session: Session,
|
||||
private val noticeEventFormatter: NoticeEventFormatter,
|
||||
private val errorFormatter: ErrorFormatter,
|
||||
private val stringProvider: StringProvider,
|
||||
private val pillsPostProcessorFactory: PillsPostProcessor.Factory,
|
||||
private val vectorPreferences: VectorPreferences
|
||||
class MessageActionsViewModel @AssistedInject constructor(
|
||||
@Assisted private val initialState: MessageActionState,
|
||||
private val eventHtmlRenderer: Lazy<EventHtmlRenderer>,
|
||||
private val htmlCompressor: VectorHtmlCompressor,
|
||||
private val session: Session,
|
||||
private val noticeEventFormatter: NoticeEventFormatter,
|
||||
private val errorFormatter: ErrorFormatter,
|
||||
private val stringProvider: StringProvider,
|
||||
private val pillsPostProcessorFactory: PillsPostProcessor.Factory,
|
||||
private val vectorPreferences: VectorPreferences
|
||||
) : VectorViewModel<MessageActionState, MessageActionsAction, EmptyViewEvents>(initialState) {
|
||||
|
||||
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
|
||||
*/
|
||||
class ViewReactionsViewModel @AssistedInject constructor(@Assisted
|
||||
initialState: DisplayReactionsViewState,
|
||||
session: Session,
|
||||
private val dateFormatter: VectorDateFormatter
|
||||
class ViewReactionsViewModel @AssistedInject constructor(
|
||||
@Assisted initialState: DisplayReactionsViewState,
|
||||
session: Session,
|
||||
private val dateFormatter: VectorDateFormatter
|
||||
) : VectorViewModel<DisplayReactionsViewState, EmptyAction, EmptyViewEvents>(initialState) {
|
||||
|
||||
private val roomId = initialState.roomId
|
||||
|
|
|
@ -28,16 +28,15 @@ import im.vector.app.core.resources.StringProvider
|
|||
import im.vector.app.features.userdirectory.PendingSelection
|
||||
import kotlinx.coroutines.flow.asFlow
|
||||
import kotlinx.coroutines.flow.catch
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.launch
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
|
||||
class InviteUsersToRoomViewModel @AssistedInject constructor(@Assisted
|
||||
initialState: InviteUsersToRoomViewState,
|
||||
session: Session,
|
||||
val stringProvider: StringProvider) :
|
||||
VectorViewModel<InviteUsersToRoomViewState, InviteUsersToRoomAction, InviteUsersToRoomViewEvents>(initialState) {
|
||||
class InviteUsersToRoomViewModel @AssistedInject constructor(
|
||||
@Assisted initialState: InviteUsersToRoomViewState,
|
||||
session: Session,
|
||||
val stringProvider: StringProvider
|
||||
) : VectorViewModel<InviteUsersToRoomViewState, InviteUsersToRoomAction, InviteUsersToRoomViewEvents>(initialState) {
|
||||
|
||||
private val room = session.getRoom(initialState.roomId)!!
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ class LoginViewModel @AssistedInject constructor(
|
|||
code = MatrixError.FORBIDDEN,
|
||||
message = "Registration is disabled"
|
||||
), 403))
|
||||
*/
|
||||
*/
|
||||
} catch (failure: Throwable) {
|
||||
if (failure !is CancellationException) {
|
||||
_viewEvents.post(LoginViewEvents.Failure(failure))
|
||||
|
|
|
@ -771,7 +771,7 @@ class LoginViewModel2 @AssistedInject constructor(
|
|||
),
|
||||
httpCode = 403
|
||||
)
|
||||
*/
|
||||
*/
|
||||
|
||||
LoginViewEvents2.OpenSignUpChooseUsernameScreen
|
||||
} catch (throwable: Throwable) {
|
||||
|
|
|
@ -202,7 +202,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
|||
VectorApp.getInstance().notificationDrawerManager.refreshNotificationDrawer(null)
|
||||
}
|
||||
})
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
private fun getReplyMessage(intent: Intent?): String? {
|
||||
|
|
|
@ -110,8 +110,7 @@ class RoomPreviewNoPreviewFragment @Inject constructor(
|
|||
PeekingState.FOUND -> {
|
||||
// show join buttons
|
||||
views.roomPreviewNoPreviewJoin.isVisible = true
|
||||
renderState(bestName, state.matrixItem(), state.roomTopic
|
||||
/**, state.roomType*/)
|
||||
renderState(bestName, state.matrixItem(), state.roomTopic)
|
||||
if (state.fromEmailInvite != null && !state.isEmailBoundToAccount) {
|
||||
views.roomPreviewNoPreviewLabel.text =
|
||||
span {
|
||||
|
@ -152,15 +151,13 @@ class RoomPreviewNoPreviewFragment @Inject constructor(
|
|||
views.roomPreviewNoPreviewJoin.isVisible = true
|
||||
views.roomPreviewNoPreviewLabel.isVisible = true
|
||||
views.roomPreviewNoPreviewLabel.setText(R.string.room_preview_no_preview_join)
|
||||
renderState(bestName, state.matrixItem().takeIf { state.roomAlias != null }, state.roomTopic
|
||||
/**, state.roomType*/)
|
||||
renderState(bestName, state.matrixItem().takeIf { state.roomAlias != null }, state.roomTopic)
|
||||
}
|
||||
else -> {
|
||||
views.roomPreviewNoPreviewJoin.isVisible = false
|
||||
views.roomPreviewNoPreviewLabel.isVisible = true
|
||||
views.roomPreviewNoPreviewLabel.setText(R.string.room_preview_not_found)
|
||||
renderState(bestName, null, state.roomTopic
|
||||
/**, state.roomType*/)
|
||||
renderState(bestName, null, state.roomTopic)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,16 +165,13 @@ class RoomPreviewNoPreviewFragment @Inject constructor(
|
|||
// Render with initial state, no peeking
|
||||
views.roomPreviewPeekingProgress.isVisible = false
|
||||
views.roomPreviewNoPreviewJoin.isVisible = true
|
||||
renderState(bestName, state.matrixItem(), state.roomTopic
|
||||
/**, state.roomType*/)
|
||||
renderState(bestName, state.matrixItem(), state.roomTopic)
|
||||
views.roomPreviewNoPreviewLabel.isVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderState(roomName: String, matrixItem: MatrixItem?, topic: String?
|
||||
/**, roomType: String?*/
|
||||
) {
|
||||
private fun renderState(roomName: String, matrixItem: MatrixItem?, topic: String?) {
|
||||
// Toolbar
|
||||
if (matrixItem != null) {
|
||||
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_MISSED_NOTIFICATIONS_PREFERENCE_KEY = "SETTINGS_PIN_MISSED_NOTIFICATIONS_PREFERENCE_KEY"
|
||||
|
||||
// flair
|
||||
const val SETTINGS_GROUPS_FLAIR_KEY = "SETTINGS_GROUPS_FLAIR_KEY"
|
||||
|
||||
// notifications
|
||||
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"
|
||||
|
|
|
@ -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)
|
||||
true
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
// ==============================================================================================================
|
||||
|
|
|
@ -117,7 +117,7 @@ class VectorSettingsPreferencesFragment @Inject constructor(
|
|||
false
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
// update keep medias period
|
||||
findPreference<VectorPreference>(VectorPreferences.SETTINGS_MEDIA_SAVING_PERIOD_KEY)!!.let {
|
||||
|
|
|
@ -1041,7 +1041,8 @@
|
|||
<string name="media_source_choose">Choose</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 -->
|
||||
<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…
Reference in a new issue