mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 11:59:12 +03:00
Merge pull request #4190 from vector-im/feature/fga/mavericks_2
Feature/fga/mavericks 2
This commit is contained in:
commit
e3034e5d11
275 changed files with 2104 additions and 1643 deletions
1
changelog.d/3890.misc
Normal file
1
changelog.d/3890.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Migrate to MvRx2 (Mavericks)
|
|
@ -19,6 +19,7 @@ def moshi = "1.12.0"
|
||||||
def lifecycle = "2.2.0"
|
def lifecycle = "2.2.0"
|
||||||
def rxBinding = "3.1.0"
|
def rxBinding = "3.1.0"
|
||||||
def epoxy = "4.6.2"
|
def epoxy = "4.6.2"
|
||||||
|
def mavericks = "2.4.0"
|
||||||
def glide = "4.12.0"
|
def glide = "4.12.0"
|
||||||
def bigImageViewer = "1.8.1"
|
def bigImageViewer = "1.8.1"
|
||||||
def jjwt = "0.11.2"
|
def jjwt = "0.11.2"
|
||||||
|
@ -98,7 +99,9 @@ ext.libs = [
|
||||||
'epoxyGlide' : "com.airbnb.android:epoxy-glide-preloading:$epoxy",
|
'epoxyGlide' : "com.airbnb.android:epoxy-glide-preloading:$epoxy",
|
||||||
'epoxyProcessor' : "com.airbnb.android:epoxy-processor:$epoxy",
|
'epoxyProcessor' : "com.airbnb.android:epoxy-processor:$epoxy",
|
||||||
'epoxyPaging' : "com.airbnb.android:epoxy-paging:$epoxy",
|
'epoxyPaging' : "com.airbnb.android:epoxy-paging:$epoxy",
|
||||||
'mvrx' : "com.airbnb.android:mvrx:1.5.1"
|
'mavericks' : "com.airbnb.android:mavericks:$mavericks",
|
||||||
|
'mavericksRx' : "com.airbnb.android:mavericks-rxjava2:$mavericks",
|
||||||
|
'mavericksTesting' : "com.airbnb.android:mavericks-testing:$mavericks"
|
||||||
],
|
],
|
||||||
mockk : [
|
mockk : [
|
||||||
'mockk' : "io.mockk:mockk:$mockk",
|
'mockk' : "io.mockk:mockk:$mockk",
|
||||||
|
|
11
docs/mavericks_migration.md
Normal file
11
docs/mavericks_migration.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
Useful links:
|
||||||
|
- https://airbnb.io/mavericks/#/new-2x
|
||||||
|
|
||||||
|
Mavericks 2 is replacing MvRx, by removing usage of Rx by Flow, both internally and in the API.
|
||||||
|
See the link ^ to have more intel, but basically, the changes are:
|
||||||
|
|
||||||
|
session.rx() => session.flow()
|
||||||
|
room.rx() => room.flow()
|
||||||
|
subscribe { }.disposeOnClear() => onEach { }.launchIn(viewModelScope)
|
||||||
|
|
||||||
|
Only using manually onEach requires to add launchIn,any other methods provided by Mavericks on viewModel and activity/fragment are already taking care of lifecycle.
|
1
matrix-sdk-android-flow/.gitignore
vendored
Normal file
1
matrix-sdk-android-flow/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/build
|
48
matrix-sdk-android-flow/build.gradle
Normal file
48
matrix-sdk-android-flow/build.gradle
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'com.android.library'
|
||||||
|
id 'org.jetbrains.kotlin.android'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdk versions.compileSdk
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdk versions.minSdk
|
||||||
|
targetSdk versions.targetSdk
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility versions.sourceCompat
|
||||||
|
targetCompatibility versions.targetCompat
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "11"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation project(":matrix-sdk-android")
|
||||||
|
implementation libs.androidx.appCompat
|
||||||
|
|
||||||
|
implementation libs.jetbrains.kotlinStdlibJdk7
|
||||||
|
implementation libs.jetbrains.coroutinesCore
|
||||||
|
implementation libs.jetbrains.coroutinesAndroid
|
||||||
|
implementation libs.androidx.lifecycleLivedata
|
||||||
|
|
||||||
|
// Paging
|
||||||
|
implementation libs.androidx.pagingRuntimeKtx
|
||||||
|
|
||||||
|
// Logging
|
||||||
|
implementation libs.jakewharton.timber
|
||||||
|
}
|
0
matrix-sdk-android-flow/consumer-rules.pro
Normal file
0
matrix-sdk-android-flow/consumer-rules.pro
Normal file
21
matrix-sdk-android-flow/proguard-rules.pro
vendored
Normal file
21
matrix-sdk-android-flow/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
5
matrix-sdk-android-flow/src/main/AndroidManifest.xml
Normal file
5
matrix-sdk-android-flow/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="org.matrix.android.sdk.flow">
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 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 org.matrix.android.sdk.flow
|
||||||
|
|
||||||
|
import kotlinx.coroutines.CoroutineDispatcher
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.onStart
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
internal fun <T> Flow<T>.startWith(dispatcher: CoroutineDispatcher, supplier: suspend () -> T): Flow<T> {
|
||||||
|
return onStart {
|
||||||
|
val value = withContext(dispatcher) {
|
||||||
|
supplier()
|
||||||
|
}
|
||||||
|
emit(value)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,105 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
|
*
|
||||||
|
* 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 org.matrix.android.sdk.flow
|
||||||
|
|
||||||
|
import androidx.lifecycle.asFlow
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import org.matrix.android.sdk.api.query.QueryStringValue
|
||||||
|
import org.matrix.android.sdk.api.session.events.model.Event
|
||||||
|
import org.matrix.android.sdk.api.session.room.Room
|
||||||
|
import org.matrix.android.sdk.api.session.room.members.RoomMemberQueryParams
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.EventAnnotationsSummary
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.ReadReceipt
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||||
|
import org.matrix.android.sdk.api.session.room.notification.RoomNotificationState
|
||||||
|
import org.matrix.android.sdk.api.session.room.send.UserDraft
|
||||||
|
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
||||||
|
import org.matrix.android.sdk.api.util.Optional
|
||||||
|
import org.matrix.android.sdk.api.util.toOptional
|
||||||
|
|
||||||
|
class FlowRoom(private val room: Room) {
|
||||||
|
|
||||||
|
fun liveRoomSummary(): Flow<Optional<RoomSummary>> {
|
||||||
|
return room.getRoomSummaryLive().asFlow()
|
||||||
|
.startWith(room.coroutineDispatchers.io) {
|
||||||
|
room.roomSummary().toOptional()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveRoomMembers(queryParams: RoomMemberQueryParams): Flow<List<RoomMemberSummary>> {
|
||||||
|
return room.getRoomMembersLive(queryParams).asFlow()
|
||||||
|
.startWith(room.coroutineDispatchers.io) {
|
||||||
|
room.getRoomMembers(queryParams)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveAnnotationSummary(eventId: String): Flow<Optional<EventAnnotationsSummary>> {
|
||||||
|
return room.getEventAnnotationsSummaryLive(eventId).asFlow()
|
||||||
|
.startWith(room.coroutineDispatchers.io) {
|
||||||
|
room.getEventAnnotationsSummary(eventId).toOptional()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveTimelineEvent(eventId: String): Flow<Optional<TimelineEvent>> {
|
||||||
|
return room.getTimeLineEventLive(eventId).asFlow()
|
||||||
|
.startWith(room.coroutineDispatchers.io) {
|
||||||
|
room.getTimeLineEvent(eventId).toOptional()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveStateEvent(eventType: String, stateKey: QueryStringValue): Flow<Optional<Event>> {
|
||||||
|
return room.getStateEventLive(eventType, stateKey).asFlow()
|
||||||
|
.startWith(room.coroutineDispatchers.io) {
|
||||||
|
room.getStateEvent(eventType, stateKey).toOptional()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveStateEvents(eventTypes: Set<String>): Flow<List<Event>> {
|
||||||
|
return room.getStateEventsLive(eventTypes).asFlow()
|
||||||
|
.startWith(room.coroutineDispatchers.io) {
|
||||||
|
room.getStateEvents(eventTypes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveReadMarker(): Flow<Optional<String>> {
|
||||||
|
return room.getReadMarkerLive().asFlow()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveReadReceipt(): Flow<Optional<String>> {
|
||||||
|
return room.getMyReadReceiptLive().asFlow()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveEventReadReceipts(eventId: String): Flow<List<ReadReceipt>> {
|
||||||
|
return room.getEventReadReceiptsLive(eventId).asFlow()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveDraft(): Flow<Optional<UserDraft>> {
|
||||||
|
return room.getDraftLive().asFlow()
|
||||||
|
.startWith(room.coroutineDispatchers.io) {
|
||||||
|
room.getDraft().toOptional()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveNotificationState(): Flow<RoomNotificationState> {
|
||||||
|
return room.getLiveRoomNotificationState().asFlow()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Room.flow(): FlowRoom {
|
||||||
|
return FlowRoom(this)
|
||||||
|
}
|
|
@ -0,0 +1,180 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
|
*
|
||||||
|
* 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 org.matrix.android.sdk.flow
|
||||||
|
|
||||||
|
import androidx.lifecycle.asFlow
|
||||||
|
import androidx.paging.PagedList
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import org.matrix.android.sdk.api.query.QueryStringValue
|
||||||
|
import org.matrix.android.sdk.api.session.Session
|
||||||
|
import org.matrix.android.sdk.api.session.accountdata.UserAccountDataEvent
|
||||||
|
import org.matrix.android.sdk.api.session.crypto.crosssigning.MXCrossSigningInfo
|
||||||
|
import org.matrix.android.sdk.api.session.group.GroupSummaryQueryParams
|
||||||
|
import org.matrix.android.sdk.api.session.group.model.GroupSummary
|
||||||
|
import org.matrix.android.sdk.api.session.identity.ThreePid
|
||||||
|
import org.matrix.android.sdk.api.session.pushers.Pusher
|
||||||
|
import org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams
|
||||||
|
import org.matrix.android.sdk.api.session.room.accountdata.RoomAccountDataEvent
|
||||||
|
import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||||
|
import org.matrix.android.sdk.api.session.space.SpaceSummaryQueryParams
|
||||||
|
import org.matrix.android.sdk.api.session.sync.SyncState
|
||||||
|
import org.matrix.android.sdk.api.session.user.model.User
|
||||||
|
import org.matrix.android.sdk.api.session.widgets.model.Widget
|
||||||
|
import org.matrix.android.sdk.api.util.Optional
|
||||||
|
import org.matrix.android.sdk.api.util.toOptional
|
||||||
|
import org.matrix.android.sdk.internal.crypto.model.CryptoDeviceInfo
|
||||||
|
import org.matrix.android.sdk.internal.crypto.model.rest.DeviceInfo
|
||||||
|
import org.matrix.android.sdk.internal.crypto.store.PrivateKeysInfo
|
||||||
|
|
||||||
|
class FlowSession(private val session: Session) {
|
||||||
|
|
||||||
|
fun liveRoomSummaries(queryParams: RoomSummaryQueryParams): Flow<List<RoomSummary>> {
|
||||||
|
return session.getRoomSummariesLive(queryParams).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.getRoomSummaries(queryParams)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveGroupSummaries(queryParams: GroupSummaryQueryParams): Flow<List<GroupSummary>> {
|
||||||
|
return session.getGroupSummariesLive(queryParams).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.getGroupSummaries(queryParams)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveSpaceSummaries(queryParams: SpaceSummaryQueryParams): Flow<List<RoomSummary>> {
|
||||||
|
return session.spaceService().getSpaceSummariesLive(queryParams).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.spaceService().getSpaceSummaries(queryParams)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveBreadcrumbs(queryParams: RoomSummaryQueryParams): Flow<List<RoomSummary>> {
|
||||||
|
return session.getBreadcrumbsLive(queryParams).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.getBreadcrumbs(queryParams)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveMyDevicesInfo(): Flow<List<DeviceInfo>> {
|
||||||
|
return session.cryptoService().getLiveMyDevicesInfo().asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.cryptoService().getMyDevicesInfo()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveSyncState(): Flow<SyncState> {
|
||||||
|
return session.getSyncStateLive().asFlow()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun livePushers(): Flow<List<Pusher>> {
|
||||||
|
return session.getPushersLive().asFlow()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveUser(userId: String): Flow<Optional<User>> {
|
||||||
|
return session.getUserLive(userId).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.getUser(userId).toOptional()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveRoomMember(userId: String, roomId: String): Flow<Optional<RoomMemberSummary>> {
|
||||||
|
return session.getRoomMemberLive(userId, roomId).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.getRoomMember(userId, roomId).toOptional()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveUsers(): Flow<List<User>> {
|
||||||
|
return session.getUsersLive().asFlow()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveIgnoredUsers(): Flow<List<User>> {
|
||||||
|
return session.getIgnoredUsersLive().asFlow()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun livePagedUsers(filter: String? = null, excludedUserIds: Set<String>? = null): Flow<PagedList<User>> {
|
||||||
|
return session.getPagedUsersLive(filter, excludedUserIds).asFlow()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveThreePIds(refreshData: Boolean): Flow<List<ThreePid>> {
|
||||||
|
return session.getThreePidsLive(refreshData).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) { session.getThreePids() }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun livePendingThreePIds(): Flow<List<ThreePid>> {
|
||||||
|
return session.getPendingThreePidsLive().asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) { session.getPendingThreePids() }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveUserCryptoDevices(userId: String): Flow<List<CryptoDeviceInfo>> {
|
||||||
|
return session.cryptoService().getLiveCryptoDeviceInfo(userId).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.cryptoService().getCryptoDeviceInfo(userId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveCrossSigningInfo(userId: String): Flow<Optional<MXCrossSigningInfo>> {
|
||||||
|
return session.cryptoService().crossSigningService().getLiveCrossSigningKeys(userId).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.cryptoService().crossSigningService().getUserCrossSigningKeys(userId).toOptional()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveCrossSigningPrivateKeys(): Flow<Optional<PrivateKeysInfo>> {
|
||||||
|
return session.cryptoService().crossSigningService().getLiveCrossSigningPrivateKeys().asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.cryptoService().crossSigningService().getCrossSigningPrivateKeys().toOptional()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveUserAccountData(types: Set<String>): Flow<List<UserAccountDataEvent>> {
|
||||||
|
return session.accountDataService().getLiveUserAccountDataEvents(types).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.accountDataService().getUserAccountDataEvents(types)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveRoomAccountData(types: Set<String>): Flow<List<RoomAccountDataEvent>> {
|
||||||
|
return session.accountDataService().getLiveRoomAccountDataEvents(types).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.accountDataService().getRoomAccountDataEvents(types)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveRoomWidgets(
|
||||||
|
roomId: String,
|
||||||
|
widgetId: QueryStringValue,
|
||||||
|
widgetTypes: Set<String>? = null,
|
||||||
|
excludedTypes: Set<String>? = null
|
||||||
|
): Flow<List<Widget>> {
|
||||||
|
return session.widgetService().getRoomWidgetsLive(roomId, widgetId, widgetTypes, excludedTypes).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.widgetService().getRoomWidgets(roomId, widgetId, widgetTypes, excludedTypes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun liveRoomChangeMembershipState(): Flow<Map<String, ChangeMembershipState>> {
|
||||||
|
return session.getChangeMembershipsLive().asFlow()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Session.flow(): FlowSession {
|
||||||
|
return FlowSession(this)
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 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 org.matrix.android.sdk.flow
|
||||||
|
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.filter
|
||||||
|
import kotlinx.coroutines.flow.map
|
||||||
|
import org.matrix.android.sdk.api.util.Optional
|
||||||
|
|
||||||
|
fun <T : Any> Flow<Optional<T>>.unwrap(): Flow<T> {
|
||||||
|
return filter { it.hasValue() }.map { it.get() }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T : Any, U : Any> Flow<Optional<T>>.mapOptional(fn: (T) -> U?): Flow<Optional<U>> {
|
||||||
|
return map {
|
||||||
|
it.map(fn)
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,7 +18,7 @@ package org.matrix.android.sdk
|
||||||
|
|
||||||
import kotlinx.coroutines.Dispatchers.Main
|
import kotlinx.coroutines.Dispatchers.Main
|
||||||
import kotlinx.coroutines.asCoroutineDispatcher
|
import kotlinx.coroutines.asCoroutineDispatcher
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
internal val testCoroutineDispatchers = MatrixCoroutineDispatchers(Main, Main, Main, Main,
|
internal val testCoroutineDispatchers = MatrixCoroutineDispatchers(Main, Main, Main, Main,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -14,11 +14,11 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.util
|
package org.matrix.android.sdk.api
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineDispatcher
|
import kotlinx.coroutines.CoroutineDispatcher
|
||||||
|
|
||||||
internal data class MatrixCoroutineDispatchers(
|
data class MatrixCoroutineDispatchers(
|
||||||
val io: CoroutineDispatcher,
|
val io: CoroutineDispatcher,
|
||||||
val computation: CoroutineDispatcher,
|
val computation: CoroutineDispatcher,
|
||||||
val main: CoroutineDispatcher,
|
val main: CoroutineDispatcher,
|
|
@ -20,6 +20,7 @@ import androidx.annotation.MainThread
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import kotlinx.coroutines.flow.SharedFlow
|
import kotlinx.coroutines.flow.SharedFlow
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.auth.data.SessionParams
|
import org.matrix.android.sdk.api.auth.data.SessionParams
|
||||||
import org.matrix.android.sdk.api.failure.GlobalError
|
import org.matrix.android.sdk.api.failure.GlobalError
|
||||||
import org.matrix.android.sdk.api.federation.FederationService
|
import org.matrix.android.sdk.api.federation.FederationService
|
||||||
|
@ -82,6 +83,8 @@ interface Session :
|
||||||
SecureStorageService,
|
SecureStorageService,
|
||||||
AccountService {
|
AccountService {
|
||||||
|
|
||||||
|
val coroutineDispatchers: MatrixCoroutineDispatchers
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The params associated to the session
|
* The params associated to the session
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.matrix.android.sdk.api.session.room
|
package org.matrix.android.sdk.api.session.room
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.session.room.accountdata.RoomAccountDataService
|
import org.matrix.android.sdk.api.session.room.accountdata.RoomAccountDataService
|
||||||
import org.matrix.android.sdk.api.session.room.alias.AliasService
|
import org.matrix.android.sdk.api.session.room.alias.AliasService
|
||||||
import org.matrix.android.sdk.api.session.room.call.RoomCallService
|
import org.matrix.android.sdk.api.session.room.call.RoomCallService
|
||||||
|
@ -61,6 +62,8 @@ interface Room :
|
||||||
RoomAccountDataService,
|
RoomAccountDataService,
|
||||||
RoomVersionService {
|
RoomVersionService {
|
||||||
|
|
||||||
|
val coroutineDispatchers: MatrixCoroutineDispatchers
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The roomId of this room
|
* The roomId of this room
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,6 +29,7 @@ import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.matrix.android.sdk.api.MatrixCallback
|
import org.matrix.android.sdk.api.MatrixCallback
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.NoOpMatrixCallback
|
import org.matrix.android.sdk.api.NoOpMatrixCallback
|
||||||
import org.matrix.android.sdk.api.auth.UserInteractiveAuthInterceptor
|
import org.matrix.android.sdk.api.auth.UserInteractiveAuthInterceptor
|
||||||
import org.matrix.android.sdk.api.crypto.MXCryptoConfig
|
import org.matrix.android.sdk.api.crypto.MXCryptoConfig
|
||||||
|
@ -93,7 +94,6 @@ import org.matrix.android.sdk.internal.task.TaskThread
|
||||||
import org.matrix.android.sdk.internal.task.configureWith
|
import org.matrix.android.sdk.internal.task.configureWith
|
||||||
import org.matrix.android.sdk.internal.task.launchToCallback
|
import org.matrix.android.sdk.internal.task.launchToCallback
|
||||||
import org.matrix.android.sdk.internal.util.JsonCanonicalizer
|
import org.matrix.android.sdk.internal.util.JsonCanonicalizer
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.olm.OlmManager
|
import org.matrix.olm.OlmManager
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.matrix.android.sdk.internal.crypto
|
||||||
|
|
||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.MatrixPatterns
|
import org.matrix.android.sdk.api.MatrixPatterns
|
||||||
import org.matrix.android.sdk.api.auth.data.Credentials
|
import org.matrix.android.sdk.api.auth.data.Credentials
|
||||||
import org.matrix.android.sdk.internal.crypto.crosssigning.DeviceTrustLevel
|
import org.matrix.android.sdk.internal.crypto.crosssigning.DeviceTrustLevel
|
||||||
|
@ -29,7 +30,6 @@ import org.matrix.android.sdk.internal.crypto.tasks.DownloadKeysForUsersTask
|
||||||
import org.matrix.android.sdk.internal.session.SessionScope
|
import org.matrix.android.sdk.internal.session.SessionScope
|
||||||
import org.matrix.android.sdk.internal.session.sync.SyncTokenStore
|
import org.matrix.android.sdk.internal.session.sync.SyncTokenStore
|
||||||
import org.matrix.android.sdk.internal.task.TaskExecutor
|
import org.matrix.android.sdk.internal.task.TaskExecutor
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.android.sdk.internal.util.logLimit
|
import org.matrix.android.sdk.internal.util.logLimit
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -20,6 +20,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.matrix.android.sdk.api.MatrixCallback
|
import org.matrix.android.sdk.api.MatrixCallback
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
||||||
import org.matrix.android.sdk.api.session.events.model.Event
|
import org.matrix.android.sdk.api.session.events.model.Event
|
||||||
import org.matrix.android.sdk.api.session.events.model.EventType
|
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||||
|
@ -33,7 +34,6 @@ import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
||||||
import org.matrix.android.sdk.internal.crypto.tasks.SendToDeviceTask
|
import org.matrix.android.sdk.internal.crypto.tasks.SendToDeviceTask
|
||||||
import org.matrix.android.sdk.internal.extensions.foldToCallback
|
import org.matrix.android.sdk.internal.extensions.foldToCallback
|
||||||
import org.matrix.android.sdk.internal.session.SessionScope
|
import org.matrix.android.sdk.internal.session.SessionScope
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.jvm.Throws
|
import kotlin.jvm.Throws
|
||||||
|
|
|
@ -19,10 +19,10 @@ package org.matrix.android.sdk.internal.crypto
|
||||||
import android.util.LruCache
|
import android.util.LruCache
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.extensions.tryOrNull
|
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||||
import org.matrix.android.sdk.internal.crypto.model.OlmInboundGroupSessionWrapper2
|
import org.matrix.android.sdk.internal.crypto.model.OlmInboundGroupSessionWrapper2
|
||||||
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.Timer
|
import java.util.Timer
|
||||||
import java.util.TimerTask
|
import java.util.TimerTask
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.matrix.android.sdk.internal.crypto
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.auth.data.Credentials
|
import org.matrix.android.sdk.api.auth.data.Credentials
|
||||||
import org.matrix.android.sdk.api.crypto.MXCryptoConfig
|
import org.matrix.android.sdk.api.crypto.MXCryptoConfig
|
||||||
import org.matrix.android.sdk.api.session.crypto.crosssigning.KEYBACKUP_SECRET_SSSS_NAME
|
import org.matrix.android.sdk.api.session.crypto.crosssigning.KEYBACKUP_SECRET_SSSS_NAME
|
||||||
|
@ -38,7 +39,6 @@ import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
||||||
import org.matrix.android.sdk.internal.crypto.tasks.createUniqueTxnId
|
import org.matrix.android.sdk.internal.crypto.tasks.createUniqueTxnId
|
||||||
import org.matrix.android.sdk.internal.di.SessionId
|
import org.matrix.android.sdk.internal.di.SessionId
|
||||||
import org.matrix.android.sdk.internal.session.SessionScope
|
import org.matrix.android.sdk.internal.session.SessionScope
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.android.sdk.internal.worker.WorkerParamsFactory
|
import org.matrix.android.sdk.internal.worker.WorkerParamsFactory
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
|
|
@ -19,13 +19,13 @@ package org.matrix.android.sdk.internal.crypto
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.internal.crypto.model.rest.RoomKeyRequestBody
|
import org.matrix.android.sdk.internal.crypto.model.rest.RoomKeyRequestBody
|
||||||
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
||||||
import org.matrix.android.sdk.internal.crypto.tasks.createUniqueTxnId
|
import org.matrix.android.sdk.internal.crypto.tasks.createUniqueTxnId
|
||||||
import org.matrix.android.sdk.internal.crypto.util.RequestIdHelper
|
import org.matrix.android.sdk.internal.crypto.util.RequestIdHelper
|
||||||
import org.matrix.android.sdk.internal.di.SessionId
|
import org.matrix.android.sdk.internal.di.SessionId
|
||||||
import org.matrix.android.sdk.internal.session.SessionScope
|
import org.matrix.android.sdk.internal.session.SessionScope
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.android.sdk.internal.worker.WorkerParamsFactory
|
import org.matrix.android.sdk.internal.worker.WorkerParamsFactory
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.matrix.android.sdk.internal.crypto.algorithms.megolm
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
||||||
import org.matrix.android.sdk.api.session.events.model.Event
|
import org.matrix.android.sdk.api.session.events.model.Event
|
||||||
import org.matrix.android.sdk.api.session.events.model.EventType
|
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||||
|
@ -41,7 +42,6 @@ import org.matrix.android.sdk.internal.crypto.model.rest.ForwardedRoomKeyContent
|
||||||
import org.matrix.android.sdk.internal.crypto.model.rest.RoomKeyRequestBody
|
import org.matrix.android.sdk.internal.crypto.model.rest.RoomKeyRequestBody
|
||||||
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
||||||
import org.matrix.android.sdk.internal.crypto.tasks.SendToDeviceTask
|
import org.matrix.android.sdk.internal.crypto.tasks.SendToDeviceTask
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
internal class MXMegolmDecryption(private val userId: String,
|
internal class MXMegolmDecryption(private val userId: String,
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.matrix.android.sdk.internal.crypto.algorithms.megolm
|
package org.matrix.android.sdk.internal.crypto.algorithms.megolm
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.internal.crypto.DeviceListManager
|
import org.matrix.android.sdk.internal.crypto.DeviceListManager
|
||||||
import org.matrix.android.sdk.internal.crypto.MXOlmDevice
|
import org.matrix.android.sdk.internal.crypto.MXOlmDevice
|
||||||
import org.matrix.android.sdk.internal.crypto.OutgoingGossipingRequestManager
|
import org.matrix.android.sdk.internal.crypto.OutgoingGossipingRequestManager
|
||||||
|
@ -25,7 +26,6 @@ import org.matrix.android.sdk.internal.crypto.actions.MessageEncrypter
|
||||||
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
||||||
import org.matrix.android.sdk.internal.crypto.tasks.SendToDeviceTask
|
import org.matrix.android.sdk.internal.crypto.tasks.SendToDeviceTask
|
||||||
import org.matrix.android.sdk.internal.di.UserId
|
import org.matrix.android.sdk.internal.di.UserId
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class MXMegolmDecryptionFactory @Inject constructor(
|
internal class MXMegolmDecryptionFactory @Inject constructor(
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.matrix.android.sdk.internal.crypto.algorithms.megolm
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
||||||
import org.matrix.android.sdk.api.session.events.model.Content
|
import org.matrix.android.sdk.api.session.events.model.Content
|
||||||
import org.matrix.android.sdk.api.session.events.model.Event
|
import org.matrix.android.sdk.api.session.events.model.Event
|
||||||
|
@ -39,7 +40,6 @@ import org.matrix.android.sdk.internal.crypto.repository.WarnOnUnknownDeviceRepo
|
||||||
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
||||||
import org.matrix.android.sdk.internal.crypto.tasks.SendToDeviceTask
|
import org.matrix.android.sdk.internal.crypto.tasks.SendToDeviceTask
|
||||||
import org.matrix.android.sdk.internal.util.JsonCanonicalizer
|
import org.matrix.android.sdk.internal.util.JsonCanonicalizer
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.android.sdk.internal.util.convertToUTF8
|
import org.matrix.android.sdk.internal.util.convertToUTF8
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.matrix.android.sdk.internal.crypto.algorithms.megolm
|
package org.matrix.android.sdk.internal.crypto.algorithms.megolm
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.internal.crypto.DeviceListManager
|
import org.matrix.android.sdk.internal.crypto.DeviceListManager
|
||||||
import org.matrix.android.sdk.internal.crypto.MXOlmDevice
|
import org.matrix.android.sdk.internal.crypto.MXOlmDevice
|
||||||
import org.matrix.android.sdk.internal.crypto.actions.EnsureOlmSessionsForDevicesAction
|
import org.matrix.android.sdk.internal.crypto.actions.EnsureOlmSessionsForDevicesAction
|
||||||
|
@ -27,7 +28,6 @@ import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
||||||
import org.matrix.android.sdk.internal.crypto.tasks.SendToDeviceTask
|
import org.matrix.android.sdk.internal.crypto.tasks.SendToDeviceTask
|
||||||
import org.matrix.android.sdk.internal.di.DeviceId
|
import org.matrix.android.sdk.internal.di.DeviceId
|
||||||
import org.matrix.android.sdk.internal.di.UserId
|
import org.matrix.android.sdk.internal.di.UserId
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class MXMegolmEncryptionFactory @Inject constructor(
|
internal class MXMegolmEncryptionFactory @Inject constructor(
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.crypto.algorithms.olm
|
package org.matrix.android.sdk.internal.crypto.algorithms.olm
|
||||||
|
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.internal.crypto.DeviceListManager
|
import org.matrix.android.sdk.internal.crypto.DeviceListManager
|
||||||
import org.matrix.android.sdk.internal.crypto.MXOlmDevice
|
import org.matrix.android.sdk.internal.crypto.MXOlmDevice
|
||||||
import org.matrix.android.sdk.internal.crypto.actions.EnsureOlmSessionsForUsersAction
|
import org.matrix.android.sdk.internal.crypto.actions.EnsureOlmSessionsForUsersAction
|
||||||
import org.matrix.android.sdk.internal.crypto.actions.MessageEncrypter
|
import org.matrix.android.sdk.internal.crypto.actions.MessageEncrypter
|
||||||
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class MXOlmEncryptionFactory @Inject constructor(private val olmDevice: MXOlmDevice,
|
internal class MXOlmEncryptionFactory @Inject constructor(private val olmDevice: MXOlmDevice,
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
package org.matrix.android.sdk.internal.crypto.crosssigning
|
package org.matrix.android.sdk.internal.crypto.crosssigning
|
||||||
|
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.crypto.RoomEncryptionTrustLevel
|
import org.matrix.android.sdk.api.crypto.RoomEncryptionTrustLevel
|
||||||
import org.matrix.android.sdk.api.extensions.orFalse
|
import org.matrix.android.sdk.api.extensions.orFalse
|
||||||
import org.matrix.android.sdk.api.session.crypto.crosssigning.MXCrossSigningInfo
|
import org.matrix.android.sdk.api.session.crypto.crosssigning.MXCrossSigningInfo
|
||||||
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
||||||
import org.matrix.android.sdk.internal.di.UserId
|
import org.matrix.android.sdk.internal.di.UserId
|
||||||
import org.matrix.android.sdk.internal.task.Task
|
import org.matrix.android.sdk.internal.task.Task
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal interface ComputeTrustTask : Task<ComputeTrustTask.Params, RoomEncryptionTrustLevel> {
|
internal interface ComputeTrustTask : Task<ComputeTrustTask.Params, RoomEncryptionTrustLevel> {
|
||||||
|
|
|
@ -22,6 +22,7 @@ import androidx.work.ExistingWorkPolicy
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.matrix.android.sdk.api.MatrixCallback
|
import org.matrix.android.sdk.api.MatrixCallback
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.auth.UserInteractiveAuthInterceptor
|
import org.matrix.android.sdk.api.auth.UserInteractiveAuthInterceptor
|
||||||
import org.matrix.android.sdk.api.extensions.orFalse
|
import org.matrix.android.sdk.api.extensions.orFalse
|
||||||
import org.matrix.android.sdk.api.session.crypto.crosssigning.CrossSigningService
|
import org.matrix.android.sdk.api.session.crypto.crosssigning.CrossSigningService
|
||||||
|
@ -42,7 +43,6 @@ import org.matrix.android.sdk.internal.task.TaskExecutor
|
||||||
import org.matrix.android.sdk.internal.task.TaskThread
|
import org.matrix.android.sdk.internal.task.TaskThread
|
||||||
import org.matrix.android.sdk.internal.task.configureWith
|
import org.matrix.android.sdk.internal.task.configureWith
|
||||||
import org.matrix.android.sdk.internal.util.JsonCanonicalizer
|
import org.matrix.android.sdk.internal.util.JsonCanonicalizer
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.android.sdk.internal.util.logLimit
|
import org.matrix.android.sdk.internal.util.logLimit
|
||||||
import org.matrix.android.sdk.internal.worker.WorkerParamsFactory
|
import org.matrix.android.sdk.internal.worker.WorkerParamsFactory
|
||||||
import org.matrix.olm.OlmPkSigning
|
import org.matrix.olm.OlmPkSigning
|
||||||
|
|
|
@ -26,6 +26,7 @@ import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.matrix.android.sdk.api.MatrixCallback
|
import org.matrix.android.sdk.api.MatrixCallback
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.auth.data.Credentials
|
import org.matrix.android.sdk.api.auth.data.Credentials
|
||||||
import org.matrix.android.sdk.api.failure.Failure
|
import org.matrix.android.sdk.api.failure.Failure
|
||||||
import org.matrix.android.sdk.api.failure.MatrixError
|
import org.matrix.android.sdk.api.failure.MatrixError
|
||||||
|
@ -83,7 +84,6 @@ import org.matrix.android.sdk.internal.task.TaskExecutor
|
||||||
import org.matrix.android.sdk.internal.task.TaskThread
|
import org.matrix.android.sdk.internal.task.TaskThread
|
||||||
import org.matrix.android.sdk.internal.task.configureWith
|
import org.matrix.android.sdk.internal.task.configureWith
|
||||||
import org.matrix.android.sdk.internal.util.JsonCanonicalizer
|
import org.matrix.android.sdk.internal.util.JsonCanonicalizer
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.android.sdk.internal.util.awaitCallback
|
import org.matrix.android.sdk.internal.util.awaitCallback
|
||||||
import org.matrix.olm.OlmException
|
import org.matrix.olm.OlmException
|
||||||
import org.matrix.olm.OlmPkDecryption
|
import org.matrix.olm.OlmPkDecryption
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.matrix.android.sdk.internal.crypto.secrets
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.extensions.orFalse
|
import org.matrix.android.sdk.api.extensions.orFalse
|
||||||
import org.matrix.android.sdk.api.listeners.ProgressListener
|
import org.matrix.android.sdk.api.listeners.ProgressListener
|
||||||
import org.matrix.android.sdk.api.session.accountdata.SessionAccountDataService
|
import org.matrix.android.sdk.api.session.accountdata.SessionAccountDataService
|
||||||
|
@ -44,7 +45,6 @@ import org.matrix.android.sdk.internal.crypto.keysbackup.util.computeRecoveryKey
|
||||||
import org.matrix.android.sdk.internal.crypto.tools.HkdfSha256
|
import org.matrix.android.sdk.internal.crypto.tools.HkdfSha256
|
||||||
import org.matrix.android.sdk.internal.crypto.tools.withOlmDecryption
|
import org.matrix.android.sdk.internal.crypto.tools.withOlmDecryption
|
||||||
import org.matrix.android.sdk.internal.di.UserId
|
import org.matrix.android.sdk.internal.di.UserId
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.olm.OlmPkMessage
|
import org.matrix.olm.OlmPkMessage
|
||||||
import java.security.SecureRandom
|
import java.security.SecureRandom
|
||||||
import javax.crypto.Cipher
|
import javax.crypto.Cipher
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.os.Looper
|
||||||
import dagger.Lazy
|
import dagger.Lazy
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.session.crypto.crosssigning.CrossSigningService
|
import org.matrix.android.sdk.api.session.crypto.crosssigning.CrossSigningService
|
||||||
import org.matrix.android.sdk.api.session.crypto.crosssigning.KEYBACKUP_SECRET_SSSS_NAME
|
import org.matrix.android.sdk.api.session.crypto.crosssigning.KEYBACKUP_SECRET_SSSS_NAME
|
||||||
import org.matrix.android.sdk.api.session.crypto.crosssigning.MASTER_KEY_SSSS_NAME
|
import org.matrix.android.sdk.api.session.crypto.crosssigning.MASTER_KEY_SSSS_NAME
|
||||||
|
@ -83,7 +84,6 @@ import org.matrix.android.sdk.internal.di.DeviceId
|
||||||
import org.matrix.android.sdk.internal.di.UserId
|
import org.matrix.android.sdk.internal.di.UserId
|
||||||
import org.matrix.android.sdk.internal.session.SessionScope
|
import org.matrix.android.sdk.internal.session.SessionScope
|
||||||
import org.matrix.android.sdk.internal.task.TaskExecutor
|
import org.matrix.android.sdk.internal.task.TaskExecutor
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -24,6 +24,7 @@ import dagger.Component
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import org.matrix.android.sdk.api.Matrix
|
import org.matrix.android.sdk.api.Matrix
|
||||||
import org.matrix.android.sdk.api.MatrixConfiguration
|
import org.matrix.android.sdk.api.MatrixConfiguration
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.auth.AuthenticationService
|
import org.matrix.android.sdk.api.auth.AuthenticationService
|
||||||
import org.matrix.android.sdk.api.auth.HomeServerHistoryService
|
import org.matrix.android.sdk.api.auth.HomeServerHistoryService
|
||||||
import org.matrix.android.sdk.api.raw.RawService
|
import org.matrix.android.sdk.api.raw.RawService
|
||||||
|
@ -35,7 +36,6 @@ import org.matrix.android.sdk.internal.session.MockHttpInterceptor
|
||||||
import org.matrix.android.sdk.internal.session.TestInterceptor
|
import org.matrix.android.sdk.internal.session.TestInterceptor
|
||||||
import org.matrix.android.sdk.internal.task.TaskExecutor
|
import org.matrix.android.sdk.internal.task.TaskExecutor
|
||||||
import org.matrix.android.sdk.internal.util.BackgroundDetectionObserver
|
import org.matrix.android.sdk.internal.util.BackgroundDetectionObserver
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.android.sdk.internal.util.system.SystemModule
|
import org.matrix.android.sdk.internal.util.system.SystemModule
|
||||||
import org.matrix.olm.OlmManager
|
import org.matrix.olm.OlmManager
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
|
@ -23,7 +23,7 @@ import dagger.Provides
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.android.asCoroutineDispatcher
|
import kotlinx.coroutines.android.asCoroutineDispatcher
|
||||||
import kotlinx.coroutines.asCoroutineDispatcher
|
import kotlinx.coroutines.asCoroutineDispatcher
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.internal.util.createBackgroundHandler
|
import org.matrix.android.sdk.internal.util.createBackgroundHandler
|
||||||
import org.matrix.olm.OlmManager
|
import org.matrix.olm.OlmManager
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
|
@ -25,6 +25,7 @@ import kotlinx.coroutines.completeWith
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.failure.Failure
|
import org.matrix.android.sdk.api.failure.Failure
|
||||||
import org.matrix.android.sdk.api.session.content.ContentUrlResolver
|
import org.matrix.android.sdk.api.session.content.ContentUrlResolver
|
||||||
import org.matrix.android.sdk.api.session.file.FileService
|
import org.matrix.android.sdk.api.session.file.FileService
|
||||||
|
@ -33,7 +34,6 @@ import org.matrix.android.sdk.internal.crypto.attachments.MXEncryptedAttachments
|
||||||
import org.matrix.android.sdk.internal.di.SessionDownloadsDirectory
|
import org.matrix.android.sdk.internal.di.SessionDownloadsDirectory
|
||||||
import org.matrix.android.sdk.internal.di.UnauthenticatedWithCertificateWithProgress
|
import org.matrix.android.sdk.internal.di.UnauthenticatedWithCertificateWithProgress
|
||||||
import org.matrix.android.sdk.internal.session.download.DownloadProgressInterceptor.Companion.DOWNLOAD_PROGRESS_INTERCEPTOR_HEADER
|
import org.matrix.android.sdk.internal.session.download.DownloadProgressInterceptor.Companion.DOWNLOAD_PROGRESS_INTERCEPTOR_HEADER
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.android.sdk.internal.util.file.AtomicFileCreator
|
import org.matrix.android.sdk.internal.util.file.AtomicFileCreator
|
||||||
import org.matrix.android.sdk.internal.util.md5
|
import org.matrix.android.sdk.internal.util.md5
|
||||||
import org.matrix.android.sdk.internal.util.writeToFile
|
import org.matrix.android.sdk.internal.util.writeToFile
|
||||||
|
|
|
@ -22,6 +22,7 @@ import io.realm.RealmConfiguration
|
||||||
import kotlinx.coroutines.NonCancellable
|
import kotlinx.coroutines.NonCancellable
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.auth.data.SessionParams
|
import org.matrix.android.sdk.api.auth.data.SessionParams
|
||||||
import org.matrix.android.sdk.api.failure.GlobalError
|
import org.matrix.android.sdk.api.failure.GlobalError
|
||||||
import org.matrix.android.sdk.api.federation.FederationService
|
import org.matrix.android.sdk.api.federation.FederationService
|
||||||
|
@ -86,6 +87,7 @@ internal class DefaultSession @Inject constructor(
|
||||||
private val globalErrorHandler: GlobalErrorHandler,
|
private val globalErrorHandler: GlobalErrorHandler,
|
||||||
@SessionId
|
@SessionId
|
||||||
override val sessionId: String,
|
override val sessionId: String,
|
||||||
|
override val coroutineDispatchers: MatrixCoroutineDispatchers,
|
||||||
@SessionDatabase private val realmConfiguration: RealmConfiguration,
|
@SessionDatabase private val realmConfiguration: RealmConfiguration,
|
||||||
private val lifecycleObservers: Set<@JvmSuppressWildcards SessionLifecycleObserver>,
|
private val lifecycleObservers: Set<@JvmSuppressWildcards SessionLifecycleObserver>,
|
||||||
private val sessionListeners: SessionListeners,
|
private val sessionListeners: SessionListeners,
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.matrix.android.sdk.internal.session
|
||||||
|
|
||||||
import dagger.BindsInstance
|
import dagger.BindsInstance
|
||||||
import dagger.Component
|
import dagger.Component
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.auth.data.SessionParams
|
import org.matrix.android.sdk.api.auth.data.SessionParams
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
import org.matrix.android.sdk.internal.crypto.CancelGossipRequestWorker
|
import org.matrix.android.sdk.internal.crypto.CancelGossipRequestWorker
|
||||||
|
@ -62,7 +63,6 @@ import org.matrix.android.sdk.internal.session.user.UserModule
|
||||||
import org.matrix.android.sdk.internal.session.user.accountdata.AccountDataModule
|
import org.matrix.android.sdk.internal.session.user.accountdata.AccountDataModule
|
||||||
import org.matrix.android.sdk.internal.session.widgets.WidgetModule
|
import org.matrix.android.sdk.internal.session.widgets.WidgetModule
|
||||||
import org.matrix.android.sdk.internal.task.TaskExecutor
|
import org.matrix.android.sdk.internal.task.TaskExecutor
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.android.sdk.internal.util.system.SystemModule
|
import org.matrix.android.sdk.internal.util.system.SystemModule
|
||||||
|
|
||||||
@Component(dependencies = [MatrixComponent::class],
|
@Component(dependencies = [MatrixComponent::class],
|
||||||
|
|
|
@ -22,6 +22,7 @@ import androidx.lifecycle.LifecycleRegistry
|
||||||
import dagger.Lazy
|
import dagger.Lazy
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.auth.data.SessionParams
|
import org.matrix.android.sdk.api.auth.data.SessionParams
|
||||||
import org.matrix.android.sdk.api.extensions.orFalse
|
import org.matrix.android.sdk.api.extensions.orFalse
|
||||||
import org.matrix.android.sdk.api.extensions.tryOrNull
|
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||||
|
@ -51,7 +52,6 @@ import org.matrix.android.sdk.internal.session.profile.UnbindThreePidsTask
|
||||||
import org.matrix.android.sdk.internal.session.sync.model.accountdata.IdentityServerContent
|
import org.matrix.android.sdk.internal.session.sync.model.accountdata.IdentityServerContent
|
||||||
import org.matrix.android.sdk.internal.session.user.accountdata.UpdateUserAccountDataTask
|
import org.matrix.android.sdk.internal.session.user.accountdata.UpdateUserAccountDataTask
|
||||||
import org.matrix.android.sdk.internal.session.user.accountdata.UserAccountDataDataSource
|
import org.matrix.android.sdk.internal.session.user.accountdata.UserAccountDataDataSource
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.android.sdk.internal.util.ensureProtocol
|
import org.matrix.android.sdk.internal.util.ensureProtocol
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -22,6 +22,7 @@ import androidx.lifecycle.LiveData
|
||||||
import com.zhuinden.monarchy.Monarchy
|
import com.zhuinden.monarchy.Monarchy
|
||||||
import io.realm.kotlin.where
|
import io.realm.kotlin.where
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.auth.UserInteractiveAuthInterceptor
|
import org.matrix.android.sdk.api.auth.UserInteractiveAuthInterceptor
|
||||||
import org.matrix.android.sdk.api.session.identity.ThreePid
|
import org.matrix.android.sdk.api.session.identity.ThreePid
|
||||||
import org.matrix.android.sdk.api.session.profile.ProfileService
|
import org.matrix.android.sdk.api.session.profile.ProfileService
|
||||||
|
@ -35,7 +36,6 @@ import org.matrix.android.sdk.internal.session.content.FileUploader
|
||||||
import org.matrix.android.sdk.internal.session.user.UserStore
|
import org.matrix.android.sdk.internal.session.user.UserStore
|
||||||
import org.matrix.android.sdk.internal.task.TaskExecutor
|
import org.matrix.android.sdk.internal.task.TaskExecutor
|
||||||
import org.matrix.android.sdk.internal.task.configureWith
|
import org.matrix.android.sdk.internal.task.configureWith
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class DefaultProfileService @Inject constructor(private val taskExecutor: TaskExecutor,
|
internal class DefaultProfileService @Inject constructor(private val taskExecutor: TaskExecutor,
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.matrix.android.sdk.internal.session.room
|
package org.matrix.android.sdk.internal.session.room
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.session.crypto.CryptoService
|
import org.matrix.android.sdk.api.session.crypto.CryptoService
|
||||||
import org.matrix.android.sdk.api.session.events.model.EventType
|
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||||
import org.matrix.android.sdk.api.session.room.Room
|
import org.matrix.android.sdk.api.session.room.Room
|
||||||
|
@ -71,7 +72,8 @@ internal class DefaultRoom(override val roomId: String,
|
||||||
private val roomVersionService: RoomVersionService,
|
private val roomVersionService: RoomVersionService,
|
||||||
private val sendStateTask: SendStateTask,
|
private val sendStateTask: SendStateTask,
|
||||||
private val viaParameterFinder: ViaParameterFinder,
|
private val viaParameterFinder: ViaParameterFinder,
|
||||||
private val searchTask: SearchTask
|
private val searchTask: SearchTask,
|
||||||
|
override val coroutineDispatchers: MatrixCoroutineDispatchers
|
||||||
) :
|
) :
|
||||||
Room,
|
Room,
|
||||||
TimelineService by timelineService,
|
TimelineService by timelineService,
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.session.room
|
package org.matrix.android.sdk.internal.session.room
|
||||||
|
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.session.crypto.CryptoService
|
import org.matrix.android.sdk.api.session.crypto.CryptoService
|
||||||
import org.matrix.android.sdk.api.session.room.Room
|
import org.matrix.android.sdk.api.session.room.Room
|
||||||
import org.matrix.android.sdk.internal.session.SessionScope
|
import org.matrix.android.sdk.internal.session.SessionScope
|
||||||
|
@ -66,7 +67,8 @@ internal class DefaultRoomFactory @Inject constructor(private val cryptoService:
|
||||||
private val roomAccountDataServiceFactory: DefaultRoomAccountDataService.Factory,
|
private val roomAccountDataServiceFactory: DefaultRoomAccountDataService.Factory,
|
||||||
private val sendStateTask: SendStateTask,
|
private val sendStateTask: SendStateTask,
|
||||||
private val viaParameterFinder: ViaParameterFinder,
|
private val viaParameterFinder: ViaParameterFinder,
|
||||||
private val searchTask: SearchTask) :
|
private val searchTask: SearchTask,
|
||||||
|
private val coroutineDispatchers: MatrixCoroutineDispatchers) :
|
||||||
RoomFactory {
|
RoomFactory {
|
||||||
|
|
||||||
override fun create(roomId: String): Room {
|
override fun create(roomId: String): Room {
|
||||||
|
@ -92,7 +94,8 @@ internal class DefaultRoomFactory @Inject constructor(private val cryptoService:
|
||||||
roomVersionService = roomVersionServiceFactory.create(roomId),
|
roomVersionService = roomVersionServiceFactory.create(roomId),
|
||||||
sendStateTask = sendStateTask,
|
sendStateTask = sendStateTask,
|
||||||
searchTask = searchTask,
|
searchTask = searchTask,
|
||||||
viaParameterFinder = viaParameterFinder
|
viaParameterFinder = viaParameterFinder,
|
||||||
|
coroutineDispatchers = coroutineDispatchers
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,10 @@ import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedFactory
|
import dagger.assisted.AssistedFactory
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.session.room.send.DraftService
|
import org.matrix.android.sdk.api.session.room.send.DraftService
|
||||||
import org.matrix.android.sdk.api.session.room.send.UserDraft
|
import org.matrix.android.sdk.api.session.room.send.UserDraft
|
||||||
import org.matrix.android.sdk.api.util.Optional
|
import org.matrix.android.sdk.api.util.Optional
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
|
|
||||||
internal class DefaultDraftService @AssistedInject constructor(@Assisted private val roomId: String,
|
internal class DefaultDraftService @AssistedInject constructor(@Assisted private val roomId: String,
|
||||||
private val draftRepository: DraftRepository,
|
private val draftRepository: DraftRepository,
|
||||||
|
|
|
@ -25,6 +25,7 @@ import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.cancelChildren
|
import kotlinx.coroutines.cancelChildren
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.matrix.android.sdk.api.Matrix
|
import org.matrix.android.sdk.api.Matrix
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.failure.Failure
|
import org.matrix.android.sdk.api.failure.Failure
|
||||||
import org.matrix.android.sdk.api.failure.isTokenError
|
import org.matrix.android.sdk.api.failure.isTokenError
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
|
@ -34,7 +35,6 @@ import org.matrix.android.sdk.internal.session.sync.SyncPresence
|
||||||
import org.matrix.android.sdk.internal.session.sync.SyncTask
|
import org.matrix.android.sdk.internal.session.sync.SyncTask
|
||||||
import org.matrix.android.sdk.internal.task.TaskExecutor
|
import org.matrix.android.sdk.internal.task.TaskExecutor
|
||||||
import org.matrix.android.sdk.internal.util.BackgroundDetectionObserver
|
import org.matrix.android.sdk.internal.util.BackgroundDetectionObserver
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.net.SocketTimeoutException
|
import java.net.SocketTimeoutException
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
|
|
|
@ -21,10 +21,10 @@ import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.cancelChildren
|
import kotlinx.coroutines.cancelChildren
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.util.Cancelable
|
import org.matrix.android.sdk.api.util.Cancelable
|
||||||
import org.matrix.android.sdk.internal.di.MatrixScope
|
import org.matrix.android.sdk.internal.di.MatrixScope
|
||||||
import org.matrix.android.sdk.internal.extensions.foldToCallback
|
import org.matrix.android.sdk.internal.extensions.foldToCallback
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.android.sdk.internal.util.toCancelable
|
import org.matrix.android.sdk.internal.util.toCancelable
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -5,3 +5,4 @@ include ':diff-match-patch'
|
||||||
include ':attachment-viewer'
|
include ':attachment-viewer'
|
||||||
include ':multipicker'
|
include ':multipicker'
|
||||||
include ':library:ui-styles'
|
include ':library:ui-styles'
|
||||||
|
include ':matrix-sdk-android-flow'
|
||||||
|
|
|
@ -2,7 +2,7 @@ package ${escapeKotlinIdentifiers(packageName)}
|
||||||
|
|
||||||
import com.airbnb.mvrx.ActivityViewModelContext
|
import com.airbnb.mvrx.ActivityViewModelContext
|
||||||
import com.airbnb.mvrx.FragmentViewModelContext
|
import com.airbnb.mvrx.FragmentViewModelContext
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
|
@ -27,7 +27,7 @@ class ${viewModelClass} @AssistedInject constructor(@Assisted initialState: ${vi
|
||||||
fun create(initialState: ${viewStateClass}): ${viewModelClass}
|
fun create(initialState: ${viewStateClass}): ${viewModelClass}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<${viewModelClass}, ${viewStateClass}> {
|
companion object : MavericksViewModelFactory<${viewModelClass}, ${viewStateClass}> {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
override fun create(viewModelContext: ViewModelContext, state: ${viewStateClass}): ${viewModelClass}? {
|
override fun create(viewModelContext: ViewModelContext, state: ${viewStateClass}): ${viewModelClass}? {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package ${escapeKotlinIdentifiers(packageName)}
|
package ${escapeKotlinIdentifiers(packageName)}
|
||||||
|
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
|
|
||||||
data class ${viewStateClass}() : MvRxState
|
data class ${viewStateClass}() : MavericksState
|
|
@ -298,6 +298,16 @@ android {
|
||||||
|
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "11"
|
jvmTarget = "11"
|
||||||
|
freeCompilerArgs += [
|
||||||
|
"-Xopt-in=kotlin.RequiresOptIn",
|
||||||
|
// Fixes false positive "This is an internal Mavericks API. It is not intended for external use."
|
||||||
|
// of MvRx `by viewModel()` calls. Maybe due to the inlining of code... This is a temporary fix...
|
||||||
|
"-Xopt-in=com.airbnb.mvrx.InternalMavericksApi",
|
||||||
|
// Opt in for kotlinx.coroutines.FlowPreview too
|
||||||
|
"-Xopt-in=kotlinx.coroutines.FlowPreview",
|
||||||
|
// Opt in for kotlinx.coroutines.ExperimentalCoroutinesApi too
|
||||||
|
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
@ -323,6 +333,7 @@ dependencies {
|
||||||
|
|
||||||
implementation project(":matrix-sdk-android")
|
implementation project(":matrix-sdk-android")
|
||||||
implementation project(":matrix-sdk-android-rx")
|
implementation project(":matrix-sdk-android-rx")
|
||||||
|
implementation project(":matrix-sdk-android-flow")
|
||||||
implementation project(":diff-match-patch")
|
implementation project(":diff-match-patch")
|
||||||
implementation project(":multipicker")
|
implementation project(":multipicker")
|
||||||
implementation project(":attachment-viewer")
|
implementation project(":attachment-viewer")
|
||||||
|
@ -376,7 +387,10 @@ dependencies {
|
||||||
implementation libs.airbnb.epoxyGlide
|
implementation libs.airbnb.epoxyGlide
|
||||||
kapt libs.airbnb.epoxyProcessor
|
kapt libs.airbnb.epoxyProcessor
|
||||||
implementation libs.airbnb.epoxyPaging
|
implementation libs.airbnb.epoxyPaging
|
||||||
implementation libs.airbnb.mvrx
|
implementation libs.airbnb.mavericks
|
||||||
|
//TODO: remove when entirely migrated to Flow
|
||||||
|
implementation libs.airbnb.mavericksRx
|
||||||
|
|
||||||
|
|
||||||
// Work
|
// Work
|
||||||
implementation libs.androidx.work
|
implementation libs.androidx.work
|
||||||
|
@ -458,7 +472,9 @@ dependencies {
|
||||||
|
|
||||||
implementation "androidx.emoji:emoji-appcompat:1.1.0"
|
implementation "androidx.emoji:emoji-appcompat:1.1.0"
|
||||||
|
|
||||||
implementation 'com.github.BillCarsonFr:JsonViewer:0.6'
|
implementation ('com.github.BillCarsonFr:JsonViewer:0.6'){
|
||||||
|
exclude group: 'com.airbnb.android'
|
||||||
|
}
|
||||||
|
|
||||||
// WebRTC
|
// WebRTC
|
||||||
// org.webrtc:google-webrtc is for development purposes only
|
// org.webrtc:google-webrtc is for development purposes only
|
||||||
|
@ -498,6 +514,7 @@ dependencies {
|
||||||
testImplementation libs.mockk.mockk
|
testImplementation libs.mockk.mockk
|
||||||
// Plant Timber tree for test
|
// Plant Timber tree for test
|
||||||
testImplementation libs.tests.timberJunitRule
|
testImplementation libs.tests.timberJunitRule
|
||||||
|
testImplementation libs.airbnb.mavericksTesting
|
||||||
|
|
||||||
// Activate when you want to check for leaks, from time to time.
|
// Activate when you want to check for leaks, from time to time.
|
||||||
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.3'
|
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.3'
|
||||||
|
|
|
@ -34,6 +34,7 @@ import androidx.lifecycle.ProcessLifecycleOwner
|
||||||
import androidx.multidex.MultiDex
|
import androidx.multidex.MultiDex
|
||||||
import com.airbnb.epoxy.EpoxyAsyncUtil
|
import com.airbnb.epoxy.EpoxyAsyncUtil
|
||||||
import com.airbnb.epoxy.EpoxyController
|
import com.airbnb.epoxy.EpoxyController
|
||||||
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.facebook.stetho.Stetho
|
import com.facebook.stetho.Stetho
|
||||||
import com.gabrielittner.threetenbp.LazyThreeTen
|
import com.gabrielittner.threetenbp.LazyThreeTen
|
||||||
import com.vanniktech.emoji.EmojiManager
|
import com.vanniktech.emoji.EmojiManager
|
||||||
|
@ -137,7 +138,7 @@ class VectorApplication :
|
||||||
}
|
}
|
||||||
logInfo()
|
logInfo()
|
||||||
LazyThreeTen.init(this)
|
LazyThreeTen.init(this)
|
||||||
|
Mavericks.initialize(debugMode = false)
|
||||||
EpoxyController.defaultDiffingHandler = EpoxyAsyncUtil.getAsyncBackgroundHandler()
|
EpoxyController.defaultDiffingHandler = EpoxyAsyncUtil.getAsyncBackgroundHandler()
|
||||||
EpoxyController.defaultModelBuildingHandler = EpoxyAsyncUtil.getAsyncBackgroundHandler()
|
EpoxyController.defaultModelBuildingHandler = EpoxyAsyncUtil.getAsyncBackgroundHandler()
|
||||||
registerActivityLifecycleCallbacks(VectorActivityLifecycleCallbacks(popupAlertManager))
|
registerActivityLifecycleCallbacks(VectorActivityLifecycleCallbacks(popupAlertManager))
|
||||||
|
|
|
@ -18,8 +18,8 @@ package im.vector.app.core.extensions
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
|
|
||||||
fun Parcelable?.toMvRxBundle(): Bundle? {
|
fun Parcelable?.toMvRxBundle(): Bundle? {
|
||||||
return this?.let { Bundle().apply { putParcelable(MvRx.KEY_ARG, it) } }
|
return this?.let { Bundle().apply { putParcelable(Mavericks.KEY_ARG, it) } }
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import androidx.fragment.app.FragmentFactory
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.viewbinding.ViewBinding
|
import androidx.viewbinding.ViewBinding
|
||||||
|
import com.airbnb.mvrx.MavericksView
|
||||||
import com.bumptech.glide.util.Util
|
import com.bumptech.glide.util.Util
|
||||||
import com.google.android.material.appbar.MaterialToolbar
|
import com.google.android.material.appbar.MaterialToolbar
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
@ -88,7 +89,7 @@ import timber.log.Timber
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import kotlin.system.measureTimeMillis
|
import kotlin.system.measureTimeMillis
|
||||||
|
|
||||||
abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), HasScreenInjector {
|
abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), HasScreenInjector, MavericksView {
|
||||||
/* ==========================================================================================
|
/* ==========================================================================================
|
||||||
* View
|
* View
|
||||||
* ========================================================================================== */
|
* ========================================================================================== */
|
||||||
|
@ -576,6 +577,8 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), HasSc
|
||||||
|
|
||||||
open fun initUiAndData() = Unit
|
open fun initUiAndData() = Unit
|
||||||
|
|
||||||
|
override fun invalidate() = Unit
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
open fun getTitleRes() = -1
|
open fun getTitleRes() = -1
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,8 @@ import android.widget.FrameLayout
|
||||||
import androidx.annotation.CallSuper
|
import androidx.annotation.CallSuper
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.viewbinding.ViewBinding
|
import androidx.viewbinding.ViewBinding
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.airbnb.mvrx.MvRxView
|
import com.airbnb.mvrx.MavericksView
|
||||||
import com.airbnb.mvrx.MvRxViewId
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||||
|
@ -44,12 +43,10 @@ import timber.log.Timber
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add MvRx capabilities to bottomsheetdialog (like BaseMvRxFragment)
|
* Add Mavericks capabilities, handle DI and bindings.
|
||||||
*/
|
*/
|
||||||
abstract class VectorBaseBottomSheetDialogFragment<VB : ViewBinding> : BottomSheetDialogFragment(), MvRxView {
|
abstract class VectorBaseBottomSheetDialogFragment<VB : ViewBinding> : BottomSheetDialogFragment(), MavericksView {
|
||||||
|
|
||||||
private val mvrxViewIdProperty = MvRxViewId()
|
|
||||||
final override val mvrxViewId: String by mvrxViewIdProperty
|
|
||||||
private lateinit var screenComponent: ScreenComponent
|
private lateinit var screenComponent: ScreenComponent
|
||||||
|
|
||||||
/* ==========================================================================================
|
/* ==========================================================================================
|
||||||
|
@ -133,11 +130,6 @@ abstract class VectorBaseBottomSheetDialogFragment<VB : ViewBinding> : BottomShe
|
||||||
|
|
||||||
protected open fun injectWith(injector: ScreenComponent) = Unit
|
protected open fun injectWith(injector: ScreenComponent) = Unit
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
mvrxViewIdProperty.restoreFrom(savedInstanceState)
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
Timber.i("onResume BottomSheet ${javaClass.simpleName}")
|
Timber.i("onResume BottomSheet ${javaClass.simpleName}")
|
||||||
|
@ -154,11 +146,6 @@ abstract class VectorBaseBottomSheetDialogFragment<VB : ViewBinding> : BottomShe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
|
||||||
super.onSaveInstanceState(outState)
|
|
||||||
mvrxViewIdProperty.saveTo(outState)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
// This ensures that invalidate() is called for static screens that don't
|
// This ensures that invalidate() is called for static screens that don't
|
||||||
|
@ -179,7 +166,7 @@ abstract class VectorBaseBottomSheetDialogFragment<VB : ViewBinding> : BottomShe
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun setArguments(args: Parcelable? = null) {
|
protected fun setArguments(args: Parcelable? = null) {
|
||||||
arguments = args?.let { Bundle().apply { putParcelable(MvRx.KEY_ARG, it) } }
|
arguments = args?.let { Bundle().apply { putParcelable(Mavericks.KEY_ARG, it) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ==========================================================================================
|
/* ==========================================================================================
|
||||||
|
|
|
@ -27,9 +27,10 @@ import android.view.ViewGroup
|
||||||
import androidx.annotation.CallSuper
|
import androidx.annotation.CallSuper
|
||||||
import androidx.annotation.MainThread
|
import androidx.annotation.MainThread
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.viewbinding.ViewBinding
|
import androidx.viewbinding.ViewBinding
|
||||||
import com.airbnb.mvrx.BaseMvRxFragment
|
import com.airbnb.mvrx.MavericksView
|
||||||
import com.bumptech.glide.util.Util.assertMainThread
|
import com.bumptech.glide.util.Util.assertMainThread
|
||||||
import com.google.android.material.appbar.MaterialToolbar
|
import com.google.android.material.appbar.MaterialToolbar
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
@ -49,7 +50,7 @@ import io.reactivex.disposables.Disposable
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
abstract class VectorBaseFragment<VB : ViewBinding> : BaseMvRxFragment(), HasScreenInjector {
|
abstract class VectorBaseFragment<VB : ViewBinding> : Fragment(), MavericksView, HasScreenInjector {
|
||||||
|
|
||||||
protected val vectorBaseActivity: VectorBaseActivity<*> by lazy {
|
protected val vectorBaseActivity: VectorBaseActivity<*> by lazy {
|
||||||
activity as VectorBaseActivity<*>
|
activity as VectorBaseActivity<*>
|
||||||
|
|
|
@ -20,17 +20,17 @@ import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.BaseMvRxViewModel
|
import com.airbnb.mvrx.BaseMvRxViewModel
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import im.vector.app.core.utils.DataSource
|
import im.vector.app.core.utils.DataSource
|
||||||
import im.vector.app.core.utils.PublishDataSource
|
import im.vector.app.core.utils.PublishDataSource
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
import io.reactivex.Single
|
import io.reactivex.Single
|
||||||
|
|
||||||
abstract class VectorViewModel<S : MvRxState, VA : VectorViewModelAction, VE : VectorViewEvents>(initialState: S) :
|
abstract class VectorViewModel<S : MavericksState, VA : VectorViewModelAction, VE : VectorViewEvents>(initialState: S) :
|
||||||
BaseMvRxViewModel<S>(initialState, false) {
|
BaseMvRxViewModel<S>(initialState) {
|
||||||
|
|
||||||
interface Factory<S : MvRxState> {
|
interface Factory<S : MavericksState> {
|
||||||
fun create(state: S): BaseMvRxViewModel<S>
|
fun create(state: S): BaseMvRxViewModel<S>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import android.view.KeyEvent
|
||||||
import androidx.core.app.NotificationManagerCompat
|
import androidx.core.app.NotificationManagerCompat
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.media.session.MediaButtonReceiver
|
import androidx.media.session.MediaButtonReceiver
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
import im.vector.app.core.extensions.vectorComponent
|
import im.vector.app.core.extensions.vectorComponent
|
||||||
import im.vector.app.features.call.CallArgs
|
import im.vector.app.features.call.CallArgs
|
||||||
import im.vector.app.features.call.VectorCallActivity
|
import im.vector.app.features.call.VectorCallActivity
|
||||||
|
@ -166,7 +166,7 @@ class CallService : VectorService() {
|
||||||
val incomingCallAlert = IncomingCallAlert(callId,
|
val incomingCallAlert = IncomingCallAlert(callId,
|
||||||
shouldBeDisplayedIn = { activity ->
|
shouldBeDisplayedIn = { activity ->
|
||||||
if (activity is VectorCallActivity) {
|
if (activity is VectorCallActivity) {
|
||||||
activity.intent.getParcelableExtra<CallArgs>(MvRx.KEY_ARG)?.callId != call.callId
|
activity.intent.getParcelableExtra<CallArgs>(Mavericks.KEY_ARG)?.callId != call.callId
|
||||||
} else true
|
} else true
|
||||||
}
|
}
|
||||||
).apply {
|
).apply {
|
||||||
|
|
|
@ -16,6 +16,6 @@
|
||||||
|
|
||||||
package im.vector.app.core.ui.bottomsheet
|
package im.vector.app.core.ui.bottomsheet
|
||||||
|
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
|
|
||||||
abstract class BottomSheetGenericState : MvRxState
|
abstract class BottomSheetGenericState : MavericksState
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
|
|
||||||
package im.vector.app.core.ui.bottomsheet
|
package im.vector.app.core.ui.bottomsheet
|
||||||
|
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import im.vector.app.core.platform.EmptyAction
|
import im.vector.app.core.platform.EmptyAction
|
||||||
import im.vector.app.core.platform.EmptyViewEvents
|
import im.vector.app.core.platform.EmptyViewEvents
|
||||||
import im.vector.app.core.platform.VectorViewModel
|
import im.vector.app.core.platform.VectorViewModel
|
||||||
|
|
||||||
abstract class BottomSheetGenericViewModel<State : MvRxState>(initialState: State) :
|
abstract class BottomSheetGenericViewModel<State : MavericksState>(initialState: State) :
|
||||||
VectorViewModel<State, EmptyAction, EmptyViewEvents>(initialState) {
|
VectorViewModel<State, EmptyAction, EmptyViewEvents>(initialState) {
|
||||||
|
|
||||||
override fun handle(action: EmptyAction) {
|
override fun handle(action: EmptyAction) {
|
||||||
|
|
|
@ -17,14 +17,14 @@
|
||||||
|
|
||||||
package im.vector.app.features.attachments.preview
|
package im.vector.app.features.attachments.preview
|
||||||
|
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import org.matrix.android.sdk.api.session.content.ContentAttachmentData
|
import org.matrix.android.sdk.api.session.content.ContentAttachmentData
|
||||||
|
|
||||||
data class AttachmentsPreviewViewState(
|
data class AttachmentsPreviewViewState(
|
||||||
val attachments: List<ContentAttachmentData>,
|
val attachments: List<ContentAttachmentData>,
|
||||||
val currentAttachmentIndex: Int = 0,
|
val currentAttachmentIndex: Int = 0,
|
||||||
val sendImagesWithOriginalSize: Boolean = false
|
val sendImagesWithOriginalSize: Boolean = false
|
||||||
) : MvRxState {
|
) : MavericksState {
|
||||||
|
|
||||||
constructor(args: AttachmentsPreviewArgs) : this(attachments = args.attachments)
|
constructor(args: AttachmentsPreviewArgs) : this(attachments = args.attachments)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import androidx.browser.customtabs.CustomTabsCallback
|
||||||
import androidx.browser.customtabs.CustomTabsClient
|
import androidx.browser.customtabs.CustomTabsClient
|
||||||
import androidx.browser.customtabs.CustomTabsServiceConnection
|
import androidx.browser.customtabs.CustomTabsServiceConnection
|
||||||
import androidx.browser.customtabs.CustomTabsSession
|
import androidx.browser.customtabs.CustomTabsSession
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.airbnb.mvrx.viewModel
|
import com.airbnb.mvrx.viewModel
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
|
@ -78,7 +78,7 @@ class ReAuthActivity : SimpleFragmentActivity(), ReAuthViewModel.Factory {
|
||||||
val title = intent.extras?.getString(EXTRA_REASON_TITLE) ?: getString(R.string.re_authentication_activity_title)
|
val title = intent.extras?.getString(EXTRA_REASON_TITLE) ?: getString(R.string.re_authentication_activity_title)
|
||||||
supportActionBar?.setTitle(title) ?: run { setTitle(title) }
|
supportActionBar?.setTitle(title) ?: run { setTitle(title) }
|
||||||
|
|
||||||
// val authArgs = intent.getParcelableExtra<Args>(MvRx.KEY_ARG)
|
// val authArgs = intent.getParcelableExtra<Args>(Mavericks.KEY_ARG)
|
||||||
|
|
||||||
// For the sso flow we can for now only rely on the fallback flow, that handles all
|
// For the sso flow we can for now only rely on the fallback flow, that handles all
|
||||||
// the UI, due to the sandbox nature of CCT (chrome custom tab) we cannot get much information
|
// the UI, due to the sandbox nature of CCT (chrome custom tab) we cannot get much information
|
||||||
|
@ -221,7 +221,7 @@ class ReAuthActivity : SimpleFragmentActivity(), ReAuthViewModel.Factory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Intent(context, ReAuthActivity::class.java).apply {
|
return Intent(context, ReAuthActivity::class.java).apply {
|
||||||
putExtra(MvRx.KEY_ARG, Args(authType, reasonTitle, fromError.session, lastErrorCode, resultKeyStoreAlias))
|
putExtra(Mavericks.KEY_ARG, Args(authType, reasonTitle, fromError.session, lastErrorCode, resultKeyStoreAlias))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
package im.vector.app.features.auth
|
package im.vector.app.features.auth
|
||||||
|
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
|
|
||||||
data class ReAuthState(
|
data class ReAuthState(
|
||||||
val title: String? = null,
|
val title: String? = null,
|
||||||
|
@ -25,7 +25,7 @@ data class ReAuthState(
|
||||||
val ssoFallbackPageWasShown: Boolean = false,
|
val ssoFallbackPageWasShown: Boolean = false,
|
||||||
val lastErrorCode: String? = null,
|
val lastErrorCode: String? = null,
|
||||||
val resultKeyStoreAlias: String = ""
|
val resultKeyStoreAlias: String = ""
|
||||||
) : MvRxState {
|
) : MavericksState {
|
||||||
constructor(args: ReAuthActivity.Args) : this(
|
constructor(args: ReAuthActivity.Args) : this(
|
||||||
args.title,
|
args.title,
|
||||||
args.session,
|
args.session,
|
||||||
|
|
|
@ -18,7 +18,7 @@ package im.vector.app.features.auth
|
||||||
|
|
||||||
import com.airbnb.mvrx.ActivityViewModelContext
|
import com.airbnb.mvrx.ActivityViewModelContext
|
||||||
import com.airbnb.mvrx.FragmentViewModelContext
|
import com.airbnb.mvrx.FragmentViewModelContext
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedFactory
|
import dagger.assisted.AssistedFactory
|
||||||
|
@ -39,7 +39,7 @@ class ReAuthViewModel @AssistedInject constructor(
|
||||||
fun create(initialState: ReAuthState): ReAuthViewModel
|
fun create(initialState: ReAuthState): ReAuthViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<ReAuthViewModel, ReAuthState> {
|
companion object : MavericksViewModelFactory<ReAuthViewModel, ReAuthState> {
|
||||||
|
|
||||||
override fun create(viewModelContext: ViewModelContext, state: ReAuthState): ReAuthViewModel? {
|
override fun create(viewModelContext: ViewModelContext, state: ReAuthState): ReAuthViewModel? {
|
||||||
val factory = when (viewModelContext) {
|
val factory = when (viewModelContext) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ import androidx.core.content.getSystemService
|
||||||
import androidx.core.view.isInvisible
|
import androidx.core.view.isInvisible
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.airbnb.mvrx.viewModel
|
import com.airbnb.mvrx.viewModel
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
import com.google.android.material.card.MaterialCardView
|
import com.google.android.material.card.MaterialCardView
|
||||||
|
@ -139,7 +139,7 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
||||||
renderState(it)
|
renderState(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
callViewModel.asyncSubscribe(this, VectorCallViewState::callState) {
|
callViewModel.onAsync(VectorCallViewState::callState) {
|
||||||
if (it is CallState.Ended) {
|
if (it is CallState.Ended) {
|
||||||
handleCallEnded(it)
|
handleCallEnded(it)
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
||||||
}
|
}
|
||||||
.disposeOnDestroy()
|
.disposeOnDestroy()
|
||||||
|
|
||||||
callViewModel.selectSubscribe(this, VectorCallViewState::callId, VectorCallViewState::isVideoCall) { _, isVideoCall ->
|
callViewModel.onEach(VectorCallViewState::callId, VectorCallViewState::isVideoCall) { _, isVideoCall ->
|
||||||
if (isVideoCall) {
|
if (isVideoCall) {
|
||||||
if (checkPermissions(PERMISSIONS_FOR_VIDEO_IP_CALL, this, permissionCameraLauncher, R.string.permissions_rationale_msg_camera_and_audio)) {
|
if (checkPermissions(PERMISSIONS_FOR_VIDEO_IP_CALL, this, permissionCameraLauncher, R.string.permissions_rationale_msg_camera_and_audio)) {
|
||||||
setupRenderersIfNeeded()
|
setupRenderersIfNeeded()
|
||||||
|
@ -168,8 +168,8 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent?) {
|
override fun onNewIntent(intent: Intent?) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
intent?.takeIf { it.hasExtra(MvRx.KEY_ARG) }
|
intent?.takeIf { it.hasExtra(Mavericks.KEY_ARG) }
|
||||||
?.let { intent.getParcelableExtra<CallArgs>(MvRx.KEY_ARG) }
|
?.let { intent.getParcelableExtra<CallArgs>(Mavericks.KEY_ARG) }
|
||||||
?.let {
|
?.let {
|
||||||
callViewModel.handle(VectorCallViewActions.SwitchCall(it))
|
callViewModel.handle(VectorCallViewActions.SwitchCall(it))
|
||||||
}
|
}
|
||||||
|
@ -631,10 +631,11 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
||||||
const val INCOMING_ACCEPT = "INCOMING_ACCEPT"
|
const val INCOMING_ACCEPT = "INCOMING_ACCEPT"
|
||||||
|
|
||||||
fun newIntent(context: Context, call: WebRtcCall, mode: String?): Intent {
|
fun newIntent(context: Context, call: WebRtcCall, mode: String?): Intent {
|
||||||
|
val callArgs = CallArgs(call.nativeRoomId, call.callId, call.mxCall.opponentUserId, !call.mxCall.isOutgoing, call.mxCall.isVideoCall)
|
||||||
return Intent(context, VectorCallActivity::class.java).apply {
|
return Intent(context, VectorCallActivity::class.java).apply {
|
||||||
// what could be the best flags?
|
// what could be the best flags?
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
putExtra(MvRx.KEY_ARG, CallArgs(call.nativeRoomId, call.callId, call.mxCall.opponentUserId, !call.mxCall.isOutgoing, call.mxCall.isVideoCall))
|
putExtra(Mavericks.KEY_ARG, callArgs)
|
||||||
putExtra(EXTRA_MODE, mode)
|
putExtra(EXTRA_MODE, mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -646,10 +647,11 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
||||||
isIncomingCall: Boolean,
|
isIncomingCall: Boolean,
|
||||||
isVideoCall: Boolean,
|
isVideoCall: Boolean,
|
||||||
mode: String?): Intent {
|
mode: String?): Intent {
|
||||||
|
val callArgs = CallArgs(signalingRoomId, callId, otherUserId, isIncomingCall, isVideoCall)
|
||||||
return Intent(context, VectorCallActivity::class.java).apply {
|
return Intent(context, VectorCallActivity::class.java).apply {
|
||||||
// what could be the best flags?
|
// what could be the best flags?
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
putExtra(MvRx.KEY_ARG, CallArgs(signalingRoomId, callId, otherUserId, isIncomingCall, isVideoCall))
|
putExtra(Mavericks.KEY_ARG, callArgs)
|
||||||
putExtra(EXTRA_MODE, mode)
|
putExtra(EXTRA_MODE, mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package im.vector.app.features.call
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
|
@ -345,7 +345,7 @@ class VectorCallViewModel @AssistedInject constructor(
|
||||||
fun create(initialState: VectorCallViewState): VectorCallViewModel
|
fun create(initialState: VectorCallViewState): VectorCallViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<VectorCallViewModel, VectorCallViewState> {
|
companion object : MavericksViewModelFactory<VectorCallViewModel, VectorCallViewState> {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
override fun create(viewModelContext: ViewModelContext, state: VectorCallViewState): VectorCallViewModel {
|
override fun create(viewModelContext: ViewModelContext, state: VectorCallViewState): VectorCallViewModel {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package im.vector.app.features.call
|
package im.vector.app.features.call
|
||||||
|
|
||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import im.vector.app.features.call.audio.CallAudioManager
|
import im.vector.app.features.call.audio.CallAudioManager
|
||||||
import org.matrix.android.sdk.api.session.call.CallState
|
import org.matrix.android.sdk.api.session.call.CallState
|
||||||
|
@ -43,7 +43,7 @@ data class VectorCallViewState(
|
||||||
val formattedDuration: String = "",
|
val formattedDuration: String = "",
|
||||||
val canOpponentBeTransferred: Boolean = false,
|
val canOpponentBeTransferred: Boolean = false,
|
||||||
val transferee: TransfereeState = TransfereeState.NoTransferee
|
val transferee: TransfereeState = TransfereeState.NoTransferee
|
||||||
) : MvRxState {
|
) : MavericksState {
|
||||||
|
|
||||||
sealed class TransfereeState {
|
sealed class TransfereeState {
|
||||||
object NoTransferee : TransfereeState()
|
object NoTransferee : TransfereeState()
|
||||||
|
|
|
@ -16,9 +16,10 @@
|
||||||
|
|
||||||
package im.vector.app.features.call.conference
|
package im.vector.app.features.call.conference
|
||||||
|
|
||||||
|
import androidx.lifecycle.asFlow
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
|
@ -27,14 +28,16 @@ import dagger.assisted.AssistedFactory
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
import im.vector.app.core.extensions.exhaustive
|
import im.vector.app.core.extensions.exhaustive
|
||||||
import im.vector.app.core.platform.VectorViewModel
|
import im.vector.app.core.platform.VectorViewModel
|
||||||
import io.reactivex.disposables.Disposable
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
|
import kotlinx.coroutines.flow.launchIn
|
||||||
|
import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.matrix.android.sdk.api.query.QueryStringValue
|
import org.matrix.android.sdk.api.query.QueryStringValue
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
import org.matrix.android.sdk.api.session.widgets.model.Widget
|
import org.matrix.android.sdk.api.session.widgets.model.Widget
|
||||||
import org.matrix.android.sdk.api.session.widgets.model.WidgetType
|
import org.matrix.android.sdk.api.session.widgets.model.WidgetType
|
||||||
import org.matrix.android.sdk.rx.asObservable
|
|
||||||
|
|
||||||
class JitsiCallViewModel @AssistedInject constructor(
|
class JitsiCallViewModel @AssistedInject constructor(
|
||||||
@Assisted initialState: JitsiCallViewState,
|
@Assisted initialState: JitsiCallViewState,
|
||||||
|
@ -47,7 +50,7 @@ class JitsiCallViewModel @AssistedInject constructor(
|
||||||
fun create(initialState: JitsiCallViewState): JitsiCallViewModel
|
fun create(initialState: JitsiCallViewState): JitsiCallViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
private var currentWidgetObserver: Disposable? = null
|
private var currentWidgetObserver: Job? = null
|
||||||
private val widgetService = session.widgetService()
|
private val widgetService = session.widgetService()
|
||||||
|
|
||||||
private var confIsJoined = false
|
private var confIsJoined = false
|
||||||
|
@ -59,11 +62,11 @@ class JitsiCallViewModel @AssistedInject constructor(
|
||||||
|
|
||||||
private fun observeWidget(roomId: String, widgetId: String) {
|
private fun observeWidget(roomId: String, widgetId: String) {
|
||||||
confIsJoined = false
|
confIsJoined = false
|
||||||
currentWidgetObserver?.dispose()
|
currentWidgetObserver?.cancel()
|
||||||
currentWidgetObserver = widgetService.getRoomWidgetsLive(roomId, QueryStringValue.Equals(widgetId), WidgetType.Jitsi.values())
|
currentWidgetObserver = widgetService.getRoomWidgetsLive(roomId, QueryStringValue.Equals(widgetId), WidgetType.Jitsi.values())
|
||||||
.asObservable()
|
.asFlow()
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.subscribe {
|
.onEach {
|
||||||
val jitsiWidget = it.firstOrNull()
|
val jitsiWidget = it.firstOrNull()
|
||||||
if (jitsiWidget != null) {
|
if (jitsiWidget != null) {
|
||||||
setState {
|
setState {
|
||||||
|
@ -81,7 +84,7 @@ class JitsiCallViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.disposeOnClear()
|
.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun joinConference(jitsiWidget: Widget) = withState { state ->
|
private fun joinConference(jitsiWidget: Widget) = withState { state ->
|
||||||
|
@ -140,7 +143,7 @@ class JitsiCallViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<JitsiCallViewModel, JitsiCallViewState> {
|
companion object : MavericksViewModelFactory<JitsiCallViewModel, JitsiCallViewState> {
|
||||||
|
|
||||||
const val ENABLE_VIDEO_OPTION = "ENABLE_VIDEO_OPTION"
|
const val ENABLE_VIDEO_OPTION = "ENABLE_VIDEO_OPTION"
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package im.vector.app.features.call.conference
|
package im.vector.app.features.call.conference
|
||||||
|
|
||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import org.matrix.android.sdk.api.session.widgets.model.Widget
|
import org.matrix.android.sdk.api.session.widgets.model.Widget
|
||||||
|
|
||||||
|
@ -26,4 +26,4 @@ data class JitsiCallViewState(
|
||||||
val widgetId: String = "",
|
val widgetId: String = "",
|
||||||
val enableVideo: Boolean = false,
|
val enableVideo: Boolean = false,
|
||||||
val widget: Async<Widget> = Uninitialized
|
val widget: Async<Widget> = Uninitialized
|
||||||
) : MvRxState
|
) : MavericksState
|
||||||
|
|
|
@ -28,7 +28,7 @@ import android.widget.Toast
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.viewModel
|
import com.airbnb.mvrx.viewModel
|
||||||
import com.facebook.react.modules.core.PermissionListener
|
import com.facebook.react.modules.core.PermissionListener
|
||||||
|
@ -205,8 +205,8 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
|
||||||
JitsiMeetActivityDelegate.onNewIntent(intent)
|
JitsiMeetActivityDelegate.onNewIntent(intent)
|
||||||
|
|
||||||
// Is it a switch to another conf?
|
// Is it a switch to another conf?
|
||||||
intent?.takeIf { it.hasExtra(MvRx.KEY_ARG) }
|
intent?.takeIf { it.hasExtra(Mavericks.KEY_ARG) }
|
||||||
?.let { intent.getParcelableExtra<Args>(MvRx.KEY_ARG) }
|
?.let { intent.getParcelableExtra<Args>(Mavericks.KEY_ARG) }
|
||||||
?.let {
|
?.let {
|
||||||
jitsiViewModel.handle(JitsiCallViewActions.SwitchTo(it, true))
|
jitsiViewModel.handle(JitsiCallViewActions.SwitchTo(it, true))
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
|
||||||
companion object {
|
companion object {
|
||||||
fun newIntent(context: Context, roomId: String, widgetId: String, enableVideo: Boolean): Intent {
|
fun newIntent(context: Context, roomId: String, widgetId: String, enableVideo: Boolean): Intent {
|
||||||
return Intent(context, VectorJitsiActivity::class.java).apply {
|
return Intent(context, VectorJitsiActivity::class.java).apply {
|
||||||
putExtra(MvRx.KEY_ARG, Args(roomId, widgetId, enableVideo))
|
putExtra(Mavericks.KEY_ARG, Args(roomId, widgetId, enableVideo))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.airbnb.mvrx.viewModel
|
import com.airbnb.mvrx.viewModel
|
||||||
import com.google.android.material.tabs.TabLayoutMediator
|
import com.google.android.material.tabs.TabLayoutMediator
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
|
@ -121,7 +121,7 @@ class CallTransferActivity : VectorBaseActivity<ActivityCallTransferBinding>(),
|
||||||
|
|
||||||
fun newIntent(context: Context, callId: String): Intent {
|
fun newIntent(context: Context, callId: String): Intent {
|
||||||
return Intent(context, CallTransferActivity::class.java).also {
|
return Intent(context, CallTransferActivity::class.java).also {
|
||||||
it.putExtra(MvRx.KEY_ARG, CallTransferArgs(callId))
|
it.putExtra(Mavericks.KEY_ARG, CallTransferArgs(callId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ package im.vector.app.features.call.transfer
|
||||||
|
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.airbnb.mvrx.ActivityViewModelContext
|
import com.airbnb.mvrx.ActivityViewModelContext
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedFactory
|
import dagger.assisted.AssistedFactory
|
||||||
|
@ -45,7 +45,7 @@ class CallTransferViewModel @AssistedInject constructor(@Assisted initialState:
|
||||||
fun create(initialState: CallTransferViewState): CallTransferViewModel
|
fun create(initialState: CallTransferViewState): CallTransferViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<CallTransferViewModel, CallTransferViewState> {
|
companion object : MavericksViewModelFactory<CallTransferViewModel, CallTransferViewState> {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
override fun create(viewModelContext: ViewModelContext, state: CallTransferViewState): CallTransferViewModel? {
|
override fun create(viewModelContext: ViewModelContext, state: CallTransferViewState): CallTransferViewModel? {
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
package im.vector.app.features.call.transfer
|
package im.vector.app.features.call.transfer
|
||||||
|
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
|
|
||||||
data class CallTransferViewState(
|
data class CallTransferViewState(
|
||||||
val callId: String
|
val callId: String
|
||||||
) : MvRxState {
|
) : MavericksState {
|
||||||
|
|
||||||
constructor(args: CallTransferArgs) : this(callId = args.callId)
|
constructor(args: CallTransferArgs) : this(callId = args.callId)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import androidx.lifecycle.viewModelScope
|
||||||
import com.airbnb.mvrx.ActivityViewModelContext
|
import com.airbnb.mvrx.ActivityViewModelContext
|
||||||
import com.airbnb.mvrx.FragmentViewModelContext
|
import com.airbnb.mvrx.FragmentViewModelContext
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
|
@ -49,7 +49,7 @@ class ContactsBookViewModel @AssistedInject constructor(@Assisted
|
||||||
fun create(initialState: ContactsBookViewState): ContactsBookViewModel
|
fun create(initialState: ContactsBookViewState): ContactsBookViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<ContactsBookViewModel, ContactsBookViewState> {
|
companion object : MavericksViewModelFactory<ContactsBookViewModel, ContactsBookViewState> {
|
||||||
|
|
||||||
override fun create(viewModelContext: ViewModelContext, state: ContactsBookViewState): ContactsBookViewModel? {
|
override fun create(viewModelContext: ViewModelContext, state: ContactsBookViewState): ContactsBookViewModel? {
|
||||||
val factory = when (viewModelContext) {
|
val factory = when (viewModelContext) {
|
||||||
|
@ -66,7 +66,7 @@ class ContactsBookViewModel @AssistedInject constructor(@Assisted
|
||||||
init {
|
init {
|
||||||
loadContacts()
|
loadContacts()
|
||||||
|
|
||||||
selectSubscribe(ContactsBookViewState::searchTerm, ContactsBookViewState::onlyBoundContacts) { _, _ ->
|
onEach(ContactsBookViewState::searchTerm, ContactsBookViewState::onlyBoundContacts) { _, _ ->
|
||||||
updateFilteredMappedContacts()
|
updateFilteredMappedContacts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ package im.vector.app.features.contactsbook
|
||||||
|
|
||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import im.vector.app.core.contacts.MappedContact
|
import im.vector.app.core.contacts.MappedContact
|
||||||
|
|
||||||
data class ContactsBookViewState(
|
data class ContactsBookViewState(
|
||||||
|
@ -36,4 +36,4 @@ data class ContactsBookViewState(
|
||||||
val identityServerUrl: String? = null,
|
val identityServerUrl: String? = null,
|
||||||
// User consent to perform lookup (send emails to the identity server)
|
// User consent to perform lookup (send emails to the identity server)
|
||||||
val userConsent: Boolean = false
|
val userConsent: Boolean = false
|
||||||
) : MvRxState
|
) : MavericksState
|
||||||
|
|
|
@ -102,7 +102,7 @@ class CreateDirectRoomActivity : SimpleFragmentActivity(), UserListViewModel.Fac
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
viewModel.selectSubscribe(this, CreateDirectRoomViewState::createAndInviteState) {
|
viewModel.onEach(CreateDirectRoomViewState::createAndInviteState) {
|
||||||
renderCreateAndInviteState(it)
|
renderCreateAndInviteState(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import androidx.lifecycle.viewModelScope
|
||||||
import com.airbnb.mvrx.ActivityViewModelContext
|
import com.airbnb.mvrx.ActivityViewModelContext
|
||||||
import com.airbnb.mvrx.FragmentViewModelContext
|
import com.airbnb.mvrx.FragmentViewModelContext
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
|
@ -49,7 +49,7 @@ class CreateDirectRoomViewModel @AssistedInject constructor(@Assisted
|
||||||
fun create(initialState: CreateDirectRoomViewState): CreateDirectRoomViewModel
|
fun create(initialState: CreateDirectRoomViewState): CreateDirectRoomViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<CreateDirectRoomViewModel, CreateDirectRoomViewState> {
|
companion object : MavericksViewModelFactory<CreateDirectRoomViewModel, CreateDirectRoomViewState> {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
override fun create(viewModelContext: ViewModelContext, state: CreateDirectRoomViewState): CreateDirectRoomViewModel? {
|
override fun create(viewModelContext: ViewModelContext, state: CreateDirectRoomViewState): CreateDirectRoomViewModel? {
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
package im.vector.app.features.createdirect
|
package im.vector.app.features.createdirect
|
||||||
|
|
||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
|
|
||||||
data class CreateDirectRoomViewState(
|
data class CreateDirectRoomViewState(
|
||||||
val createAndInviteState: Async<String> = Uninitialized
|
val createAndInviteState: Async<String> = Uninitialized
|
||||||
) : MvRxState
|
) : MavericksState
|
||||||
|
|
|
@ -55,7 +55,7 @@ class KeysBackupManageActivity : SimpleFragmentActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Observe the deletion of keys backup
|
// Observe the deletion of keys backup
|
||||||
viewModel.selectSubscribe(this, KeysBackupSettingViewState::deleteBackupRequest) { asyncDelete ->
|
viewModel.onEach(KeysBackupSettingViewState::deleteBackupRequest) { asyncDelete ->
|
||||||
when (asyncDelete) {
|
when (asyncDelete) {
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
updateWaitingView(null)
|
updateWaitingView(null)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package im.vector.app.features.crypto.keysbackup.settings
|
package im.vector.app.features.crypto.keysbackup.settings
|
||||||
|
|
||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import org.matrix.android.sdk.api.session.crypto.keysbackup.KeysBackupState
|
import org.matrix.android.sdk.api.session.crypto.keysbackup.KeysBackupState
|
||||||
import org.matrix.android.sdk.internal.crypto.keysbackup.model.KeysBackupVersionTrust
|
import org.matrix.android.sdk.internal.crypto.keysbackup.model.KeysBackupVersionTrust
|
||||||
|
@ -27,4 +27,4 @@ data class KeysBackupSettingViewState(val keysBackupVersionTrust: Async<KeysBack
|
||||||
val keysBackupState: KeysBackupState? = null,
|
val keysBackupState: KeysBackupState? = null,
|
||||||
val keysBackupVersion: KeysVersionResult? = null,
|
val keysBackupVersion: KeysVersionResult? = null,
|
||||||
val deleteBackupRequest: Async<Unit> = Uninitialized) :
|
val deleteBackupRequest: Async<Unit> = Uninitialized) :
|
||||||
MvRxState
|
MavericksState
|
||||||
|
|
|
@ -18,7 +18,7 @@ package im.vector.app.features.crypto.keysbackup.settings
|
||||||
import com.airbnb.mvrx.ActivityViewModelContext
|
import com.airbnb.mvrx.ActivityViewModelContext
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
|
@ -45,7 +45,7 @@ class KeysBackupSettingsViewModel @AssistedInject constructor(@Assisted initialS
|
||||||
fun create(initialState: KeysBackupSettingViewState): KeysBackupSettingsViewModel
|
fun create(initialState: KeysBackupSettingViewState): KeysBackupSettingsViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<KeysBackupSettingsViewModel, KeysBackupSettingViewState> {
|
companion object : MavericksViewModelFactory<KeysBackupSettingsViewModel, KeysBackupSettingViewState> {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
override fun create(viewModelContext: ViewModelContext, state: KeysBackupSettingViewState): KeysBackupSettingsViewModel? {
|
override fun create(viewModelContext: ViewModelContext, state: KeysBackupSettingViewState): KeysBackupSettingsViewModel? {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import android.view.View
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.fragment.app.FragmentOnAttachListener
|
import androidx.fragment.app.FragmentOnAttachListener
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.airbnb.mvrx.viewModel
|
import com.airbnb.mvrx.viewModel
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
|
@ -159,7 +159,7 @@ class SharedSecureStorageActivity :
|
||||||
resultKeyStoreAlias: String = DEFAULT_RESULT_KEYSTORE_ALIAS): Intent {
|
resultKeyStoreAlias: String = DEFAULT_RESULT_KEYSTORE_ALIAS): Intent {
|
||||||
require(requestedSecrets.isNotEmpty())
|
require(requestedSecrets.isNotEmpty())
|
||||||
return Intent(context, SharedSecureStorageActivity::class.java).also {
|
return Intent(context, SharedSecureStorageActivity::class.java).also {
|
||||||
it.putExtra(MvRx.KEY_ARG, Args(
|
it.putExtra(Mavericks.KEY_ARG, Args(
|
||||||
keyId,
|
keyId,
|
||||||
requestedSecrets,
|
requestedSecrets,
|
||||||
resultKeyStoreAlias
|
resultKeyStoreAlias
|
||||||
|
|
|
@ -16,13 +16,12 @@
|
||||||
|
|
||||||
package im.vector.app.features.crypto.quads
|
package im.vector.app.features.crypto.quads
|
||||||
|
|
||||||
import androidx.lifecycle.viewModelScope
|
|
||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
|
@ -35,6 +34,7 @@ import im.vector.app.core.platform.VectorViewModel
|
||||||
import im.vector.app.core.platform.WaitingViewData
|
import im.vector.app.core.platform.WaitingViewData
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.matrix.android.sdk.api.listeners.ProgressListener
|
import org.matrix.android.sdk.api.listeners.ProgressListener
|
||||||
|
@ -42,8 +42,8 @@ import org.matrix.android.sdk.api.session.Session
|
||||||
import org.matrix.android.sdk.api.session.securestorage.IntegrityResult
|
import org.matrix.android.sdk.api.session.securestorage.IntegrityResult
|
||||||
import org.matrix.android.sdk.api.session.securestorage.KeyInfoResult
|
import org.matrix.android.sdk.api.session.securestorage.KeyInfoResult
|
||||||
import org.matrix.android.sdk.api.session.securestorage.RawBytesKeySpec
|
import org.matrix.android.sdk.api.session.securestorage.RawBytesKeySpec
|
||||||
|
import org.matrix.android.sdk.flow.flow
|
||||||
import org.matrix.android.sdk.internal.crypto.crosssigning.toBase64NoPadding
|
import org.matrix.android.sdk.internal.crypto.crosssigning.toBase64NoPadding
|
||||||
import org.matrix.android.sdk.rx.rx
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ data class SharedSecureStorageViewState(
|
||||||
val activeDeviceCount: Int = 0,
|
val activeDeviceCount: Int = 0,
|
||||||
val showResetAllAction: Boolean = false,
|
val showResetAllAction: Boolean = false,
|
||||||
val userId: String = ""
|
val userId: String = ""
|
||||||
) : MvRxState {
|
) : MavericksState {
|
||||||
enum class Step {
|
enum class Step {
|
||||||
EnterPassphrase,
|
EnterPassphrase,
|
||||||
EnterKey,
|
EnterKey,
|
||||||
|
@ -114,7 +114,7 @@ class SharedSecureStorageViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
session.rx()
|
session.flow()
|
||||||
.liveUserCryptoDevices(session.myUserId)
|
.liveUserCryptoDevices(session.myUserId)
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.execute {
|
.execute {
|
||||||
|
@ -320,12 +320,12 @@ class SharedSecureStorageViewModel @AssistedInject constructor(
|
||||||
_viewEvents.post(SharedSecureStorageViewEvent.Dismiss)
|
_viewEvents.post(SharedSecureStorageViewEvent.Dismiss)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<SharedSecureStorageViewModel, SharedSecureStorageViewState> {
|
companion object : MavericksViewModelFactory<SharedSecureStorageViewModel, SharedSecureStorageViewState> {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
override fun create(viewModelContext: ViewModelContext, state: SharedSecureStorageViewState): SharedSecureStorageViewModel? {
|
override fun create(viewModelContext: ViewModelContext, state: SharedSecureStorageViewState): SharedSecureStorageViewModel? {
|
||||||
val activity: SharedSecureStorageActivity = viewModelContext.activity()
|
val activity: SharedSecureStorageActivity = viewModelContext.activity()
|
||||||
val args: SharedSecureStorageActivity.Args = activity.intent.getParcelableExtra(MvRx.KEY_ARG) ?: error("Missing args")
|
val args: SharedSecureStorageActivity.Args = activity.intent.getParcelableExtra(Mavericks.KEY_ARG) ?: error("Missing args")
|
||||||
return activity.viewModelFactory.create(state, args)
|
return activity.viewModelFactory.create(state, args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import androidx.lifecycle.viewModelScope
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.FragmentViewModelContext
|
import com.airbnb.mvrx.FragmentViewModelContext
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
|
@ -552,7 +552,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
||||||
// Companion, view model assisted creation
|
// Companion, view model assisted creation
|
||||||
// ======================================
|
// ======================================
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<BootstrapSharedViewModel, BootstrapViewState> {
|
companion object : MavericksViewModelFactory<BootstrapSharedViewModel, BootstrapViewState> {
|
||||||
|
|
||||||
override fun create(viewModelContext: ViewModelContext, state: BootstrapViewState): BootstrapSharedViewModel? {
|
override fun create(viewModelContext: ViewModelContext, state: BootstrapViewState): BootstrapSharedViewModel? {
|
||||||
val fragment: BootstrapBottomSheet = (viewModelContext as FragmentViewModelContext).fragment()
|
val fragment: BootstrapBottomSheet = (viewModelContext as FragmentViewModelContext).fragment()
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package im.vector.app.features.crypto.recover
|
package im.vector.app.features.crypto.recover
|
||||||
|
|
||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.nulabinc.zxcvbn.Strength
|
import com.nulabinc.zxcvbn.Strength
|
||||||
import im.vector.app.core.platform.WaitingViewData
|
import im.vector.app.core.platform.WaitingViewData
|
||||||
|
@ -34,4 +34,4 @@ data class BootstrapViewState(
|
||||||
val recoveryKeyCreationInfo: SsssKeyCreationInfo? = null,
|
val recoveryKeyCreationInfo: SsssKeyCreationInfo? = null,
|
||||||
val initializationWaitingViewData: WaitingViewData? = null,
|
val initializationWaitingViewData: WaitingViewData? = null,
|
||||||
val recoverySaveFileProcess: Async<Unit> = Uninitialized
|
val recoverySaveFileProcess: Async<Unit> = Uninitialized
|
||||||
) : MvRxState
|
) : MavericksState
|
||||||
|
|
|
@ -24,7 +24,7 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.airbnb.mvrx.fragmentViewModel
|
import com.airbnb.mvrx.fragmentViewModel
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
@ -185,7 +185,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
||||||
|
|
||||||
if (state.quadSHasBeenReset) {
|
if (state.quadSHasBeenReset) {
|
||||||
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationConclusionFragment.Args(
|
putParcelable(Mavericks.KEY_ARG, VerificationConclusionFragment.Args(
|
||||||
isSuccessFull = true,
|
isSuccessFull = true,
|
||||||
isMe = true,
|
isMe = true,
|
||||||
cancelReason = null
|
cancelReason = null
|
||||||
|
@ -212,7 +212,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
||||||
}
|
}
|
||||||
if (state.selfVerificationMode && state.verifiedFromPrivateKeys) {
|
if (state.selfVerificationMode && state.verifiedFromPrivateKeys) {
|
||||||
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationConclusionFragment.Args(true, null, state.isMe))
|
putParcelable(Mavericks.KEY_ARG, VerificationConclusionFragment.Args(true, null, state.isMe))
|
||||||
})
|
})
|
||||||
return@withState
|
return@withState
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
||||||
is VerificationTxState.MacSent,
|
is VerificationTxState.MacSent,
|
||||||
is VerificationTxState.Verifying -> {
|
is VerificationTxState.Verifying -> {
|
||||||
showFragment(VerificationEmojiCodeFragment::class, Bundle().apply {
|
showFragment(VerificationEmojiCodeFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationArgs(
|
putParcelable(Mavericks.KEY_ARG, VerificationArgs(
|
||||||
state.otherUserMxItem?.id ?: "",
|
state.otherUserMxItem?.id ?: "",
|
||||||
// If it was outgoing it.transaction id would be null, but the pending request
|
// If it was outgoing it.transaction id would be null, but the pending request
|
||||||
// would be updated (from localId to txId)
|
// would be updated (from localId to txId)
|
||||||
|
@ -245,12 +245,12 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
||||||
}
|
}
|
||||||
is VerificationTxState.Verified -> {
|
is VerificationTxState.Verified -> {
|
||||||
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationConclusionFragment.Args(true, null, state.isMe))
|
putParcelable(Mavericks.KEY_ARG, VerificationConclusionFragment.Args(true, null, state.isMe))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
is VerificationTxState.Cancelled -> {
|
is VerificationTxState.Cancelled -> {
|
||||||
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationConclusionFragment.Args(false, state.sasTransactionState.cancelCode.value, state.isMe))
|
putParcelable(Mavericks.KEY_ARG, VerificationConclusionFragment.Args(false, state.sasTransactionState.cancelCode.value, state.isMe))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
||||||
is VerificationTxState.Started,
|
is VerificationTxState.Started,
|
||||||
is VerificationTxState.WaitingOtherReciprocateConfirm -> {
|
is VerificationTxState.WaitingOtherReciprocateConfirm -> {
|
||||||
showFragment(VerificationQRWaitingFragment::class, Bundle().apply {
|
showFragment(VerificationQRWaitingFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationQRWaitingFragment.Args(
|
putParcelable(Mavericks.KEY_ARG, VerificationQRWaitingFragment.Args(
|
||||||
isMe = state.isMe,
|
isMe = state.isMe,
|
||||||
otherUserName = state.otherUserMxItem?.getBestName() ?: ""
|
otherUserName = state.otherUserMxItem?.getBestName() ?: ""
|
||||||
))
|
))
|
||||||
|
@ -275,13 +275,13 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
||||||
}
|
}
|
||||||
is VerificationTxState.Verified -> {
|
is VerificationTxState.Verified -> {
|
||||||
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationConclusionFragment.Args(true, null, state.isMe))
|
putParcelable(Mavericks.KEY_ARG, VerificationConclusionFragment.Args(true, null, state.isMe))
|
||||||
})
|
})
|
||||||
return@withState
|
return@withState
|
||||||
}
|
}
|
||||||
is VerificationTxState.Cancelled -> {
|
is VerificationTxState.Cancelled -> {
|
||||||
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationConclusionFragment.Args(false, state.qrTransactionState.cancelCode.value, state.isMe))
|
putParcelable(Mavericks.KEY_ARG, VerificationConclusionFragment.Args(false, state.qrTransactionState.cancelCode.value, state.isMe))
|
||||||
})
|
})
|
||||||
return@withState
|
return@withState
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
||||||
// The request has been declined, we should dismiss
|
// The request has been declined, we should dismiss
|
||||||
views.otherUserNameText.text = getString(R.string.verification_cancelled)
|
views.otherUserNameText.text = getString(R.string.verification_cancelled)
|
||||||
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationConclusionFragment.Args(
|
putParcelable(Mavericks.KEY_ARG, VerificationConclusionFragment.Args(
|
||||||
false,
|
false,
|
||||||
state.pendingRequest.invoke()?.cancelConclusion?.value ?: CancelCode.User.value,
|
state.pendingRequest.invoke()?.cancelConclusion?.value ?: CancelCode.User.value,
|
||||||
state.isMe))
|
state.isMe))
|
||||||
|
@ -310,13 +310,13 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
||||||
Timber.v("## SAS show bottom sheet for outgoing and ready request")
|
Timber.v("## SAS show bottom sheet for outgoing and ready request")
|
||||||
// Show choose method fragment with waiting
|
// Show choose method fragment with waiting
|
||||||
showFragment(VerificationChooseMethodFragment::class, Bundle().apply {
|
showFragment(VerificationChooseMethodFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationArgs(state.otherUserMxItem?.id
|
putParcelable(Mavericks.KEY_ARG, VerificationArgs(state.otherUserMxItem?.id
|
||||||
?: "", state.pendingRequest.invoke()?.transactionId))
|
?: "", state.pendingRequest.invoke()?.transactionId))
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// Stay on the start fragment
|
// Stay on the start fragment
|
||||||
showFragment(VerificationRequestFragment::class, Bundle().apply {
|
showFragment(VerificationRequestFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationArgs(
|
putParcelable(Mavericks.KEY_ARG, VerificationArgs(
|
||||||
state.otherUserMxItem?.id ?: "",
|
state.otherUserMxItem?.id ?: "",
|
||||||
state.pendingRequest.invoke()?.transactionId,
|
state.pendingRequest.invoke()?.transactionId,
|
||||||
state.roomId))
|
state.roomId))
|
||||||
|
@ -326,7 +326,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
||||||
Timber.v("## SAS show bottom sheet for Incoming request")
|
Timber.v("## SAS show bottom sheet for Incoming request")
|
||||||
// For incoming we can switch to choose method because ready is being sent or already sent
|
// For incoming we can switch to choose method because ready is being sent or already sent
|
||||||
showFragment(VerificationChooseMethodFragment::class, Bundle().apply {
|
showFragment(VerificationChooseMethodFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationArgs(state.otherUserMxItem?.id
|
putParcelable(Mavericks.KEY_ARG, VerificationArgs(state.otherUserMxItem?.id
|
||||||
?: "", state.pendingRequest.invoke()?.transactionId))
|
?: "", state.pendingRequest.invoke()?.transactionId))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
||||||
fun withArgs(roomId: String?, otherUserId: String, transactionId: String? = null): VerificationBottomSheet {
|
fun withArgs(roomId: String?, otherUserId: String, transactionId: String? = null): VerificationBottomSheet {
|
||||||
return VerificationBottomSheet().apply {
|
return VerificationBottomSheet().apply {
|
||||||
arguments = Bundle().apply {
|
arguments = Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationArgs(
|
putParcelable(Mavericks.KEY_ARG, VerificationArgs(
|
||||||
otherUserId = otherUserId,
|
otherUserId = otherUserId,
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
verificationId = transactionId,
|
verificationId = transactionId,
|
||||||
|
@ -362,7 +362,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
||||||
fun forSelfVerification(session: Session): VerificationBottomSheet {
|
fun forSelfVerification(session: Session): VerificationBottomSheet {
|
||||||
return VerificationBottomSheet().apply {
|
return VerificationBottomSheet().apply {
|
||||||
arguments = Bundle().apply {
|
arguments = Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationArgs(
|
putParcelable(Mavericks.KEY_ARG, VerificationArgs(
|
||||||
otherUserId = session.myUserId,
|
otherUserId = session.myUserId,
|
||||||
selfVerificationMode = true
|
selfVerificationMode = true
|
||||||
))
|
))
|
||||||
|
@ -373,7 +373,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
||||||
fun forSelfVerification(session: Session, outgoingRequest: String): VerificationBottomSheet {
|
fun forSelfVerification(session: Session, outgoingRequest: String): VerificationBottomSheet {
|
||||||
return VerificationBottomSheet().apply {
|
return VerificationBottomSheet().apply {
|
||||||
arguments = Bundle().apply {
|
arguments = Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationArgs(
|
putParcelable(Mavericks.KEY_ARG, VerificationArgs(
|
||||||
otherUserId = session.myUserId,
|
otherUserId = session.myUserId,
|
||||||
selfVerificationMode = true,
|
selfVerificationMode = true,
|
||||||
verificationId = outgoingRequest
|
verificationId = outgoingRequest
|
||||||
|
|
|
@ -20,8 +20,8 @@ import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.FragmentViewModelContext
|
import com.airbnb.mvrx.FragmentViewModelContext
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
|
@ -79,7 +79,7 @@ data class VerificationBottomSheetViewState(
|
||||||
val quadSContainsSecrets: Boolean = true,
|
val quadSContainsSecrets: Boolean = true,
|
||||||
val quadSHasBeenReset: Boolean = false,
|
val quadSHasBeenReset: Boolean = false,
|
||||||
val hasAnyOtherSession: Boolean = false
|
val hasAnyOtherSession: Boolean = false
|
||||||
) : MvRxState
|
) : MavericksState
|
||||||
|
|
||||||
class VerificationBottomSheetViewModel @AssistedInject constructor(
|
class VerificationBottomSheetViewModel @AssistedInject constructor(
|
||||||
@Assisted initialState: VerificationBottomSheetViewState,
|
@Assisted initialState: VerificationBottomSheetViewState,
|
||||||
|
@ -223,7 +223,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
||||||
_viewEvents.post(VerificationBottomSheetViewEvents.GoToSettings)
|
_viewEvents.post(VerificationBottomSheetViewEvents.GoToSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<VerificationBottomSheetViewModel, VerificationBottomSheetViewState> {
|
companion object : MavericksViewModelFactory<VerificationBottomSheetViewModel, VerificationBottomSheetViewState> {
|
||||||
|
|
||||||
override fun create(viewModelContext: ViewModelContext, state: VerificationBottomSheetViewState): VerificationBottomSheetViewModel? {
|
override fun create(viewModelContext: ViewModelContext, state: VerificationBottomSheetViewState): VerificationBottomSheetViewModel? {
|
||||||
val fragment: VerificationBottomSheet = (viewModelContext as FragmentViewModelContext).fragment()
|
val fragment: VerificationBottomSheet = (viewModelContext as FragmentViewModelContext).fragment()
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
package im.vector.app.features.crypto.verification.choose
|
package im.vector.app.features.crypto.verification.choose
|
||||||
|
|
||||||
import com.airbnb.mvrx.FragmentViewModelContext
|
import com.airbnb.mvrx.FragmentViewModelContext
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedFactory
|
import dagger.assisted.AssistedFactory
|
||||||
|
@ -43,7 +43,7 @@ data class VerificationChooseMethodViewState(
|
||||||
val sasModeAvailable: Boolean = false,
|
val sasModeAvailable: Boolean = false,
|
||||||
val isMe: Boolean = false,
|
val isMe: Boolean = false,
|
||||||
val canCrossSign: Boolean = false
|
val canCrossSign: Boolean = false
|
||||||
) : MvRxState
|
) : MavericksState
|
||||||
|
|
||||||
class VerificationChooseMethodViewModel @AssistedInject constructor(
|
class VerificationChooseMethodViewModel @AssistedInject constructor(
|
||||||
@Assisted initialState: VerificationChooseMethodViewState,
|
@Assisted initialState: VerificationChooseMethodViewState,
|
||||||
|
@ -94,7 +94,7 @@ class VerificationChooseMethodViewModel @AssistedInject constructor(
|
||||||
super.onCleared()
|
super.onCleared()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<VerificationChooseMethodViewModel, VerificationChooseMethodViewState> {
|
companion object : MavericksViewModelFactory<VerificationChooseMethodViewModel, VerificationChooseMethodViewState> {
|
||||||
override fun create(viewModelContext: ViewModelContext, state: VerificationChooseMethodViewState): VerificationChooseMethodViewModel? {
|
override fun create(viewModelContext: ViewModelContext, state: VerificationChooseMethodViewState): VerificationChooseMethodViewModel? {
|
||||||
val fragment: VerificationChooseMethodFragment = (viewModelContext as FragmentViewModelContext).fragment()
|
val fragment: VerificationChooseMethodFragment = (viewModelContext as FragmentViewModelContext).fragment()
|
||||||
return fragment.verificationChooseMethodViewModelFactory.create(state)
|
return fragment.verificationChooseMethodViewModelFactory.create(state)
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package im.vector.app.features.crypto.verification.conclusion
|
package im.vector.app.features.crypto.verification.conclusion
|
||||||
|
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
import im.vector.app.core.platform.EmptyAction
|
import im.vector.app.core.platform.EmptyAction
|
||||||
import im.vector.app.core.platform.EmptyViewEvents
|
import im.vector.app.core.platform.EmptyViewEvents
|
||||||
|
@ -27,7 +27,7 @@ import org.matrix.android.sdk.api.session.crypto.verification.safeValueOf
|
||||||
data class VerificationConclusionViewState(
|
data class VerificationConclusionViewState(
|
||||||
val conclusionState: ConclusionState = ConclusionState.CANCELLED,
|
val conclusionState: ConclusionState = ConclusionState.CANCELLED,
|
||||||
val isSelfVerification: Boolean = false
|
val isSelfVerification: Boolean = false
|
||||||
) : MvRxState
|
) : MavericksState
|
||||||
|
|
||||||
enum class ConclusionState {
|
enum class ConclusionState {
|
||||||
SUCCESS,
|
SUCCESS,
|
||||||
|
@ -38,7 +38,7 @@ enum class ConclusionState {
|
||||||
class VerificationConclusionViewModel(initialState: VerificationConclusionViewState) :
|
class VerificationConclusionViewModel(initialState: VerificationConclusionViewState) :
|
||||||
VectorViewModel<VerificationConclusionViewState, EmptyAction, EmptyViewEvents>(initialState) {
|
VectorViewModel<VerificationConclusionViewState, EmptyAction, EmptyViewEvents>(initialState) {
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<VerificationConclusionViewModel, VerificationConclusionViewState> {
|
companion object : MavericksViewModelFactory<VerificationConclusionViewModel, VerificationConclusionViewState> {
|
||||||
|
|
||||||
override fun initialState(viewModelContext: ViewModelContext): VerificationConclusionViewState? {
|
override fun initialState(viewModelContext: ViewModelContext): VerificationConclusionViewState? {
|
||||||
val args = viewModelContext.args<VerificationConclusionFragment.Args>()
|
val args = viewModelContext.args<VerificationConclusionFragment.Args>()
|
||||||
|
|
|
@ -19,8 +19,8 @@ import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.FragmentViewModelContext
|
import com.airbnb.mvrx.FragmentViewModelContext
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
|
@ -48,7 +48,7 @@ data class VerificationEmojiCodeViewState(
|
||||||
val emojiDescription: Async<List<EmojiRepresentation>> = Uninitialized,
|
val emojiDescription: Async<List<EmojiRepresentation>> = Uninitialized,
|
||||||
val decimalDescription: Async<String> = Uninitialized,
|
val decimalDescription: Async<String> = Uninitialized,
|
||||||
val isWaitingFromOther: Boolean = false
|
val isWaitingFromOther: Boolean = false
|
||||||
) : MvRxState
|
) : MavericksState
|
||||||
|
|
||||||
class VerificationEmojiCodeViewModel @AssistedInject constructor(
|
class VerificationEmojiCodeViewModel @AssistedInject constructor(
|
||||||
@Assisted initialState: VerificationEmojiCodeViewState,
|
@Assisted initialState: VerificationEmojiCodeViewState,
|
||||||
|
@ -155,7 +155,7 @@ class VerificationEmojiCodeViewModel @AssistedInject constructor(
|
||||||
fun create(initialState: VerificationEmojiCodeViewState): VerificationEmojiCodeViewModel
|
fun create(initialState: VerificationEmojiCodeViewState): VerificationEmojiCodeViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<VerificationEmojiCodeViewModel, VerificationEmojiCodeViewState> {
|
companion object : MavericksViewModelFactory<VerificationEmojiCodeViewModel, VerificationEmojiCodeViewState> {
|
||||||
|
|
||||||
override fun create(viewModelContext: ViewModelContext, state: VerificationEmojiCodeViewState): VerificationEmojiCodeViewModel? {
|
override fun create(viewModelContext: ViewModelContext, state: VerificationEmojiCodeViewState): VerificationEmojiCodeViewModel? {
|
||||||
val factory = (viewModelContext as FragmentViewModelContext).fragment<VerificationEmojiCodeFragment>().viewModelFactory
|
val factory = (viewModelContext as FragmentViewModelContext).fragment<VerificationEmojiCodeFragment>().viewModelFactory
|
||||||
|
|
|
@ -21,7 +21,7 @@ import android.os.Parcelable
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
import im.vector.app.core.extensions.cleanup
|
import im.vector.app.core.extensions.cleanup
|
||||||
import im.vector.app.core.extensions.configureWith
|
import im.vector.app.core.extensions.configureWith
|
||||||
import im.vector.app.core.platform.VectorBaseFragment
|
import im.vector.app.core.platform.VectorBaseFragment
|
||||||
|
@ -46,7 +46,7 @@ class VerificationQRWaitingFragment @Inject constructor(
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
setupRecyclerView()
|
setupRecyclerView()
|
||||||
(arguments?.getParcelable(MvRx.KEY_ARG) as? Args)?.let {
|
(arguments?.getParcelable(Mavericks.KEY_ARG) as? Args)?.let {
|
||||||
controller.update(it)
|
controller.update(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.viewModel
|
import com.airbnb.mvrx.viewModel
|
||||||
|
@ -208,7 +208,7 @@ class RoomDevToolActivity : SimpleFragmentActivity(), RoomDevToolViewModel.Facto
|
||||||
|
|
||||||
fun intent(context: Context, roomId: String): Intent {
|
fun intent(context: Context, roomId: String): Intent {
|
||||||
return Intent(context, RoomDevToolActivity::class.java).apply {
|
return Intent(context, RoomDevToolActivity::class.java).apply {
|
||||||
putExtra(MvRx.KEY_ARG, Args(roomId))
|
putExtra(Mavericks.KEY_ARG, Args(roomId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import com.airbnb.mvrx.ActivityViewModelContext
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.FragmentViewModelContext
|
import com.airbnb.mvrx.FragmentViewModelContext
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
import com.squareup.moshi.Types
|
import com.squareup.moshi.Types
|
||||||
|
@ -40,8 +40,8 @@ import org.matrix.android.sdk.api.session.events.model.EventType
|
||||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||||
import org.matrix.android.sdk.api.session.room.model.message.MessageContent
|
import org.matrix.android.sdk.api.session.room.model.message.MessageContent
|
||||||
import org.matrix.android.sdk.api.util.JsonDict
|
import org.matrix.android.sdk.api.util.JsonDict
|
||||||
|
import org.matrix.android.sdk.flow.flow
|
||||||
import org.matrix.android.sdk.internal.di.MoshiProvider
|
import org.matrix.android.sdk.internal.di.MoshiProvider
|
||||||
import org.matrix.android.sdk.rx.rx
|
|
||||||
|
|
||||||
class RoomDevToolViewModel @AssistedInject constructor(
|
class RoomDevToolViewModel @AssistedInject constructor(
|
||||||
@Assisted val initialState: RoomDevToolViewState,
|
@Assisted val initialState: RoomDevToolViewState,
|
||||||
|
@ -55,7 +55,7 @@ class RoomDevToolViewModel @AssistedInject constructor(
|
||||||
fun create(initialState: RoomDevToolViewState): RoomDevToolViewModel
|
fun create(initialState: RoomDevToolViewState): RoomDevToolViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<RoomDevToolViewModel, RoomDevToolViewState> {
|
companion object : MavericksViewModelFactory<RoomDevToolViewModel, RoomDevToolViewState> {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
override fun create(viewModelContext: ViewModelContext, state: RoomDevToolViewState): RoomDevToolViewModel {
|
override fun create(viewModelContext: ViewModelContext, state: RoomDevToolViewState): RoomDevToolViewModel {
|
||||||
|
@ -69,7 +69,7 @@ class RoomDevToolViewModel @AssistedInject constructor(
|
||||||
|
|
||||||
init {
|
init {
|
||||||
session.getRoom(initialState.roomId)
|
session.getRoom(initialState.roomId)
|
||||||
?.rx()
|
?.flow()
|
||||||
?.liveStateEvents(emptySet())
|
?.liveStateEvents(emptySet())
|
||||||
?.execute { async ->
|
?.execute { async ->
|
||||||
copy(stateEvents = async)
|
copy(stateEvents = async)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package im.vector.app.features.devtools
|
package im.vector.app.features.devtools
|
||||||
|
|
||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import org.matrix.android.sdk.api.session.events.model.Event
|
import org.matrix.android.sdk.api.session.events.model.Event
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ data class RoomDevToolViewState(
|
||||||
val editedContent: String? = null,
|
val editedContent: String? = null,
|
||||||
val modalLoading: Async<Unit> = Uninitialized,
|
val modalLoading: Async<Unit> = Uninitialized,
|
||||||
val sendEventDraft: SendEventDraft? = null
|
val sendEventDraft: SendEventDraft? = null
|
||||||
) : MvRxState {
|
) : MavericksState {
|
||||||
|
|
||||||
constructor(args: RoomDevToolActivity.Args) : this(roomId = args.roomId, displayMode = Mode.Root)
|
constructor(args: RoomDevToolActivity.Args) : this(roomId = args.roomId, displayMode = Mode.Root)
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package im.vector.app.features.discovery
|
package im.vector.app.features.discovery
|
||||||
|
|
||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
|
|
||||||
data class DiscoverySettingsState(
|
data class DiscoverySettingsState(
|
||||||
|
@ -28,7 +28,7 @@ data class DiscoverySettingsState(
|
||||||
val termsNotSigned: Boolean = false,
|
val termsNotSigned: Boolean = false,
|
||||||
val userConsent: Boolean = false,
|
val userConsent: Boolean = false,
|
||||||
val isIdentityPolicyUrlsExpanded: Boolean = false
|
val isIdentityPolicyUrlsExpanded: Boolean = false
|
||||||
) : MvRxState
|
) : MavericksState
|
||||||
|
|
||||||
data class IdentityServerWithTerms(
|
data class IdentityServerWithTerms(
|
||||||
val serverUrl: String,
|
val serverUrl: String,
|
||||||
|
|
|
@ -15,12 +15,11 @@
|
||||||
*/
|
*/
|
||||||
package im.vector.app.features.discovery
|
package im.vector.app.features.discovery
|
||||||
|
|
||||||
import androidx.lifecycle.viewModelScope
|
|
||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.FragmentViewModelContext
|
import com.airbnb.mvrx.FragmentViewModelContext
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
|
@ -32,6 +31,8 @@ import im.vector.app.core.extensions.exhaustive
|
||||||
import im.vector.app.core.platform.VectorViewModel
|
import im.vector.app.core.platform.VectorViewModel
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
import im.vector.app.core.utils.ensureProtocol
|
import im.vector.app.core.utils.ensureProtocol
|
||||||
|
import kotlinx.coroutines.flow.launchIn
|
||||||
|
import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
import org.matrix.android.sdk.api.session.identity.IdentityServiceError
|
import org.matrix.android.sdk.api.session.identity.IdentityServiceError
|
||||||
|
@ -39,7 +40,7 @@ import org.matrix.android.sdk.api.session.identity.IdentityServiceListener
|
||||||
import org.matrix.android.sdk.api.session.identity.SharedState
|
import org.matrix.android.sdk.api.session.identity.SharedState
|
||||||
import org.matrix.android.sdk.api.session.identity.ThreePid
|
import org.matrix.android.sdk.api.session.identity.ThreePid
|
||||||
import org.matrix.android.sdk.api.session.terms.TermsService
|
import org.matrix.android.sdk.api.session.terms.TermsService
|
||||||
import org.matrix.android.sdk.rx.rx
|
import org.matrix.android.sdk.flow.flow
|
||||||
|
|
||||||
class DiscoverySettingsViewModel @AssistedInject constructor(
|
class DiscoverySettingsViewModel @AssistedInject constructor(
|
||||||
@Assisted initialState: DiscoverySettingsState,
|
@Assisted initialState: DiscoverySettingsState,
|
||||||
|
@ -52,7 +53,7 @@ class DiscoverySettingsViewModel @AssistedInject constructor(
|
||||||
fun create(initialState: DiscoverySettingsState): DiscoverySettingsViewModel
|
fun create(initialState: DiscoverySettingsState): DiscoverySettingsViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<DiscoverySettingsViewModel, DiscoverySettingsState> {
|
companion object : MavericksViewModelFactory<DiscoverySettingsViewModel, DiscoverySettingsState> {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
override fun create(viewModelContext: ViewModelContext, state: DiscoverySettingsState): DiscoverySettingsViewModel? {
|
override fun create(viewModelContext: ViewModelContext, state: DiscoverySettingsState): DiscoverySettingsViewModel? {
|
||||||
|
@ -96,12 +97,12 @@ class DiscoverySettingsViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeThreePids() {
|
private fun observeThreePids() {
|
||||||
session.rx()
|
session.flow()
|
||||||
.liveThreePIds(true)
|
.liveThreePIds(true)
|
||||||
.subscribe {
|
.onEach {
|
||||||
retrieveBinding(it)
|
retrieveBinding(it)
|
||||||
}
|
}
|
||||||
.disposeOnClear()
|
.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCleared() {
|
override fun onCleared() {
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
|
|
||||||
package im.vector.app.features.discovery.change
|
package im.vector.app.features.discovery.change
|
||||||
|
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
|
|
||||||
data class SetIdentityServerState(
|
data class SetIdentityServerState(
|
||||||
val homeServerUrl: String = "",
|
val homeServerUrl: String = "",
|
||||||
// Will contain the default identity server url if any
|
// Will contain the default identity server url if any
|
||||||
val defaultIdentityServerUrl: String? = null
|
val defaultIdentityServerUrl: String? = null
|
||||||
) : MvRxState
|
) : MavericksState
|
||||||
|
|
|
@ -17,7 +17,7 @@ package im.vector.app.features.discovery.change
|
||||||
|
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.airbnb.mvrx.FragmentViewModelContext
|
import com.airbnb.mvrx.FragmentViewModelContext
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedFactory
|
import dagger.assisted.AssistedFactory
|
||||||
|
@ -46,7 +46,7 @@ class SetIdentityServerViewModel @AssistedInject constructor(
|
||||||
fun create(initialState: SetIdentityServerState): SetIdentityServerViewModel
|
fun create(initialState: SetIdentityServerState): SetIdentityServerViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<SetIdentityServerViewModel, SetIdentityServerState> {
|
companion object : MavericksViewModelFactory<SetIdentityServerViewModel, SetIdentityServerState> {
|
||||||
|
|
||||||
override fun initialState(viewModelContext: ViewModelContext): SetIdentityServerState? {
|
override fun initialState(viewModelContext: ViewModelContext): SetIdentityServerState? {
|
||||||
val session = (viewModelContext.activity as HasScreenInjector).injector().activeSessionHolder().getActiveSession()
|
val session = (viewModelContext.activity as HasScreenInjector).injector().activeSessionHolder().getActiveSession()
|
||||||
|
|
|
@ -29,7 +29,8 @@ import androidx.core.view.isVisible
|
||||||
import androidx.drawerlayout.widget.DrawerLayout
|
import androidx.drawerlayout.widget.DrawerLayout
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import com.airbnb.mvrx.MvRx
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.airbnb.mvrx.viewModel
|
import com.airbnb.mvrx.viewModel
|
||||||
import com.google.android.material.appbar.MaterialToolbar
|
import com.google.android.material.appbar.MaterialToolbar
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
@ -73,7 +74,7 @@ import im.vector.app.features.themes.ThemeUtils
|
||||||
import im.vector.app.features.workers.signout.ServerBackupStatusViewModel
|
import im.vector.app.features.workers.signout.ServerBackupStatusViewModel
|
||||||
import im.vector.app.features.workers.signout.ServerBackupStatusViewState
|
import im.vector.app.features.workers.signout.ServerBackupStatusViewState
|
||||||
import im.vector.app.push.fcm.FcmHelper
|
import im.vector.app.push.fcm.FcmHelper
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||||
import org.matrix.android.sdk.api.session.permalinks.PermalinkService
|
import org.matrix.android.sdk.api.session.permalinks.PermalinkService
|
||||||
|
@ -248,7 +249,7 @@ class HomeActivity :
|
||||||
}
|
}
|
||||||
.disposeOnDestroy()
|
.disposeOnDestroy()
|
||||||
|
|
||||||
val args = intent.getParcelableExtra<HomeActivityArgs>(MvRx.KEY_ARG)
|
val args = intent.getParcelableExtra<HomeActivityArgs>(Mavericks.KEY_ARG)
|
||||||
|
|
||||||
if (args?.clearNotification == true) {
|
if (args?.clearNotification == true) {
|
||||||
notificationDrawerManager.clearAllEvents()
|
notificationDrawerManager.clearAllEvents()
|
||||||
|
@ -308,26 +309,24 @@ class HomeActivity :
|
||||||
}
|
}
|
||||||
else -> deepLink
|
else -> deepLink
|
||||||
}
|
}
|
||||||
permalinkHandler.launch(
|
|
||||||
context = this,
|
lifecycleScope.launch {
|
||||||
deepLink = resolvedLink,
|
val isHandled = permalinkHandler.launch(
|
||||||
navigationInterceptor = this,
|
context = this@HomeActivity,
|
||||||
buildTask = true
|
deepLink = resolvedLink,
|
||||||
)
|
navigationInterceptor = this@HomeActivity,
|
||||||
// .delay(500, TimeUnit.MILLISECONDS)
|
buildTask = true
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
)
|
||||||
.subscribe { isHandled ->
|
if (!isHandled) {
|
||||||
if (!isHandled) {
|
val isMatrixToLink = deepLink.startsWith(PermalinkService.MATRIX_TO_URL_BASE) ||
|
||||||
val isMatrixToLink = deepLink.startsWith(PermalinkService.MATRIX_TO_URL_BASE) ||
|
deepLink.startsWith(MATRIX_TO_CUSTOM_SCHEME_URL_BASE)
|
||||||
deepLink.startsWith(MATRIX_TO_CUSTOM_SCHEME_URL_BASE)
|
MaterialAlertDialogBuilder(this@HomeActivity)
|
||||||
MaterialAlertDialogBuilder(this)
|
.setTitle(R.string.dialog_title_error)
|
||||||
.setTitle(R.string.dialog_title_error)
|
.setMessage(if (isMatrixToLink) R.string.permalink_malformed else R.string.universal_link_malformed)
|
||||||
.setMessage(if (isMatrixToLink) R.string.permalink_malformed else R.string.universal_link_malformed)
|
.setPositiveButton(R.string.ok, null)
|
||||||
.setPositiveButton(R.string.ok, null)
|
.show()
|
||||||
.show()
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.disposeOnDestroy()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +452,7 @@ class HomeActivity :
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent?) {
|
override fun onNewIntent(intent: Intent?) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
val parcelableExtra = intent?.getParcelableExtra<HomeActivityArgs>(MvRx.KEY_ARG)
|
val parcelableExtra = intent?.getParcelableExtra<HomeActivityArgs>(Mavericks.KEY_ARG)
|
||||||
if (parcelableExtra?.clearNotification == true) {
|
if (parcelableExtra?.clearNotification == true) {
|
||||||
notificationDrawerManager.clearAllEvents()
|
notificationDrawerManager.clearAllEvents()
|
||||||
}
|
}
|
||||||
|
@ -586,7 +585,7 @@ class HomeActivity :
|
||||||
|
|
||||||
return Intent(context, HomeActivity::class.java)
|
return Intent(context, HomeActivity::class.java)
|
||||||
.apply {
|
.apply {
|
||||||
putExtra(MvRx.KEY_ARG, args)
|
putExtra(Mavericks.KEY_ARG, args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,10 @@
|
||||||
|
|
||||||
package im.vector.app.features.home
|
package im.vector.app.features.home
|
||||||
|
|
||||||
|
import androidx.lifecycle.asFlow
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.Mavericks
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedFactory
|
import dagger.assisted.AssistedFactory
|
||||||
|
@ -31,6 +32,8 @@ import im.vector.app.features.session.coroutineScope
|
||||||
import im.vector.app.features.settings.VectorPreferences
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.flow.launchIn
|
||||||
|
import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.matrix.android.sdk.api.auth.UIABaseAuth
|
import org.matrix.android.sdk.api.auth.UIABaseAuth
|
||||||
import org.matrix.android.sdk.api.auth.UserInteractiveAuthInterceptor
|
import org.matrix.android.sdk.api.auth.UserInteractiveAuthInterceptor
|
||||||
|
@ -44,11 +47,10 @@ import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||||
import org.matrix.android.sdk.api.session.room.model.Membership
|
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||||
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
||||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||||
|
import org.matrix.android.sdk.flow.flow
|
||||||
import org.matrix.android.sdk.internal.crypto.model.CryptoDeviceInfo
|
import org.matrix.android.sdk.internal.crypto.model.CryptoDeviceInfo
|
||||||
import org.matrix.android.sdk.internal.crypto.model.MXUsersDevicesMap
|
import org.matrix.android.sdk.internal.crypto.model.MXUsersDevicesMap
|
||||||
import org.matrix.android.sdk.internal.util.awaitCallback
|
import org.matrix.android.sdk.internal.util.awaitCallback
|
||||||
import org.matrix.android.sdk.rx.asObservable
|
|
||||||
import org.matrix.android.sdk.rx.rx
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import kotlin.coroutines.Continuation
|
import kotlin.coroutines.Continuation
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
|
@ -67,12 +69,12 @@ class HomeActivityViewModel @AssistedInject constructor(
|
||||||
fun create(initialState: HomeActivityViewState, args: HomeActivityArgs): HomeActivityViewModel
|
fun create(initialState: HomeActivityViewState, args: HomeActivityArgs): HomeActivityViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<HomeActivityViewModel, HomeActivityViewState> {
|
companion object : MavericksViewModelFactory<HomeActivityViewModel, HomeActivityViewState> {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
override fun create(viewModelContext: ViewModelContext, state: HomeActivityViewState): HomeActivityViewModel? {
|
override fun create(viewModelContext: ViewModelContext, state: HomeActivityViewState): HomeActivityViewModel? {
|
||||||
val activity: HomeActivity = viewModelContext.activity()
|
val activity: HomeActivity = viewModelContext.activity()
|
||||||
val args: HomeActivityArgs? = activity.intent.getParcelableExtra(MvRx.KEY_ARG)
|
val args: HomeActivityArgs? = activity.intent.getParcelableExtra(Mavericks.KEY_ARG)
|
||||||
return activity.viewModelFactory.create(state, args ?: HomeActivityArgs(clearNotification = false, accountCreation = false))
|
return activity.viewModelFactory.create(state, args ?: HomeActivityArgs(clearNotification = false, accountCreation = false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,9 +102,9 @@ class HomeActivityViewModel @AssistedInject constructor(
|
||||||
.crossSigningService().allPrivateKeysKnown()
|
.crossSigningService().allPrivateKeysKnown()
|
||||||
|
|
||||||
safeActiveSession
|
safeActiveSession
|
||||||
.rx()
|
.flow()
|
||||||
.liveCrossSigningInfo(safeActiveSession.myUserId)
|
.liveCrossSigningInfo(safeActiveSession.myUserId)
|
||||||
.subscribe {
|
.onEach {
|
||||||
val isVerified = it.getOrNull()?.isTrusted() ?: false
|
val isVerified = it.getOrNull()?.isTrusted() ?: false
|
||||||
if (!isVerified && onceTrusted) {
|
if (!isVerified && onceTrusted) {
|
||||||
// cross signing keys have been reset
|
// cross signing keys have been reset
|
||||||
|
@ -116,15 +118,15 @@ class HomeActivityViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
onceTrusted = isVerified
|
onceTrusted = isVerified
|
||||||
}
|
}
|
||||||
.disposeOnClear()
|
.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeInitialSync() {
|
private fun observeInitialSync() {
|
||||||
val session = activeSessionHolder.getSafeActiveSession() ?: return
|
val session = activeSessionHolder.getSafeActiveSession() ?: return
|
||||||
|
|
||||||
session.getSyncStatusLive()
|
session.getSyncStatusLive()
|
||||||
.asObservable()
|
.asFlow()
|
||||||
.subscribe { status ->
|
.onEach { status ->
|
||||||
when (status) {
|
when (status) {
|
||||||
is SyncStatusService.Status.Progressing -> {
|
is SyncStatusService.Status.Progressing -> {
|
||||||
// Schedule a check of the bootstrap when the init sync will be finished
|
// Schedule a check of the bootstrap when the init sync will be finished
|
||||||
|
@ -145,7 +147,7 @@ class HomeActivityViewModel @AssistedInject constructor(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.disposeOnClear()
|
.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
package im.vector.app.features.home
|
package im.vector.app.features.home
|
||||||
|
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MavericksState
|
||||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||||
|
|
||||||
data class HomeActivityViewState(
|
data class HomeActivityViewState(
|
||||||
val syncStatusServiceStatus: SyncStatusService.Status = SyncStatusService.Status.Idle
|
val syncStatusServiceStatus: SyncStatusService.Status = SyncStatusService.Status.Idle
|
||||||
) : MvRxState
|
) : MavericksState
|
||||||
|
|
|
@ -134,7 +134,7 @@ class HomeDetailFragment @Inject constructor(
|
||||||
views.bottomNavigationView.selectedItemId = it.currentTab.toMenuId()
|
views.bottomNavigationView.selectedItemId = it.currentTab.toMenuId()
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.selectSubscribe(this, HomeDetailViewState::roomGroupingMethod) { roomGroupingMethod ->
|
viewModel.onEach(HomeDetailViewState::roomGroupingMethod) { roomGroupingMethod ->
|
||||||
when (roomGroupingMethod) {
|
when (roomGroupingMethod) {
|
||||||
is RoomGroupingMethod.ByLegacyGroup -> {
|
is RoomGroupingMethod.ByLegacyGroup -> {
|
||||||
onGroupChange(roomGroupingMethod.groupSummary)
|
onGroupChange(roomGroupingMethod.groupSummary)
|
||||||
|
@ -145,11 +145,11 @@ class HomeDetailFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.selectSubscribe(this, HomeDetailViewState::currentTab) { currentTab ->
|
viewModel.onEach(HomeDetailViewState::currentTab) { currentTab ->
|
||||||
updateUIForTab(currentTab)
|
updateUIForTab(currentTab)
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.selectSubscribe(this, HomeDetailViewState::showDialPadTab) { showDialPadTab ->
|
viewModel.onEach(HomeDetailViewState::showDialPadTab) { showDialPadTab ->
|
||||||
updateTabVisibilitySafely(R.id.bottom_action_dial_pad, showDialPadTab)
|
updateTabVisibilitySafely(R.id.bottom_action_dial_pad, showDialPadTab)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ class HomeDetailFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unknownDeviceDetectorSharedViewModel.subscribe { state ->
|
unknownDeviceDetectorSharedViewModel.onEach { state ->
|
||||||
state.unknownSessions.invoke()?.let { unknownDevices ->
|
state.unknownSessions.invoke()?.let { unknownDevices ->
|
||||||
// Timber.v("## Detector Triggerred in fragment - ${unknownDevices.firstOrNull()}")
|
// Timber.v("## Detector Triggerred in fragment - ${unknownDevices.firstOrNull()}")
|
||||||
if (unknownDevices.firstOrNull()?.currentSessionTrust == true) {
|
if (unknownDevices.firstOrNull()?.currentSessionTrust == true) {
|
||||||
|
@ -179,7 +179,7 @@ class HomeDetailFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unreadMessagesSharedViewModel.subscribe { state ->
|
unreadMessagesSharedViewModel.onEach { state ->
|
||||||
views.drawerUnreadCounterBadgeView.render(
|
views.drawerUnreadCounterBadgeView.render(
|
||||||
UnreadCounterBadgeView.State(
|
UnreadCounterBadgeView.State(
|
||||||
count = state.otherSpacesUnread.totalCount,
|
count = state.otherSpacesUnread.totalCount,
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
package im.vector.app.features.home
|
package im.vector.app.features.home
|
||||||
|
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.asFlow
|
||||||
import com.airbnb.mvrx.FragmentViewModelContext
|
import com.airbnb.mvrx.FragmentViewModelContext
|
||||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import com.airbnb.mvrx.ViewModelContext
|
import com.airbnb.mvrx.ViewModelContext
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedFactory
|
import dagger.assisted.AssistedFactory
|
||||||
|
@ -38,6 +38,7 @@ import im.vector.app.features.ui.UiStateRepository
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.collect
|
import kotlinx.coroutines.flow.collect
|
||||||
|
import kotlinx.coroutines.flow.filterIsInstance
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.matrix.android.sdk.api.query.ActiveSpaceFilter
|
import org.matrix.android.sdk.api.query.ActiveSpaceFilter
|
||||||
import org.matrix.android.sdk.api.query.RoomCategoryFilter
|
import org.matrix.android.sdk.api.query.RoomCategoryFilter
|
||||||
|
@ -47,8 +48,8 @@ import org.matrix.android.sdk.api.session.room.RoomSortOrder
|
||||||
import org.matrix.android.sdk.api.session.room.model.Membership
|
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||||
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
||||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||||
|
import org.matrix.android.sdk.flow.flow
|
||||||
import org.matrix.android.sdk.rx.asObservable
|
import org.matrix.android.sdk.rx.asObservable
|
||||||
import org.matrix.android.sdk.rx.rx
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
|
||||||
fun create(initialState: HomeDetailViewState): HomeDetailViewModel
|
fun create(initialState: HomeDetailViewState): HomeDetailViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : MvRxViewModelFactory<HomeDetailViewModel, HomeDetailViewState> {
|
companion object : MavericksViewModelFactory<HomeDetailViewModel, HomeDetailViewState> {
|
||||||
|
|
||||||
override fun initialState(viewModelContext: ViewModelContext): HomeDetailViewState? {
|
override fun initialState(viewModelContext: ViewModelContext): HomeDetailViewState? {
|
||||||
val uiStateRepository = (viewModelContext.activity as HasScreenInjector).injector().uiStateRepository()
|
val uiStateRepository = (viewModelContext.activity as HasScreenInjector).injector().uiStateRepository()
|
||||||
|
@ -95,7 +96,7 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
|
||||||
updateShowDialPadTab()
|
updateShowDialPadTab()
|
||||||
observeDataStore()
|
observeDataStore()
|
||||||
callManager.addProtocolsCheckerListener(this)
|
callManager.addProtocolsCheckerListener(this)
|
||||||
session.rx().liveUser(session.myUserId).execute {
|
session.flow().liveUser(session.myUserId).execute {
|
||||||
copy(
|
copy(
|
||||||
myMatrixItem = it.invoke()?.getOrNull()?.toMatrixItem()
|
myMatrixItem = it.invoke()?.getOrNull()?.toMatrixItem()
|
||||||
)
|
)
|
||||||
|
@ -182,25 +183,18 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeSyncState() {
|
private fun observeSyncState() {
|
||||||
session.rx()
|
session.flow()
|
||||||
.liveSyncState()
|
.liveSyncState()
|
||||||
.subscribe { syncState ->
|
.setOnEach { syncState ->
|
||||||
setState {
|
copy(syncState = syncState)
|
||||||
copy(syncState = syncState)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.disposeOnClear()
|
|
||||||
|
|
||||||
session.getSyncStatusLive()
|
session.getSyncStatusLive()
|
||||||
.asObservable()
|
.asFlow()
|
||||||
.subscribe {
|
.filterIsInstance<SyncStatusService.Status.IncrementalSyncStatus>()
|
||||||
if (it is SyncStatusService.Status.IncrementalSyncStatus) {
|
.setOnEach {
|
||||||
setState {
|
copy(incrementalSyncStatus = it)
|
||||||
copy(incrementalSyncStatus = it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.disposeOnClear()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeRoomGroupingMethod() {
|
private fun observeRoomGroupingMethod() {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue