mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-18 04:08:44 +03:00
Disables when arrow alignment post merge with develop
This commit is contained in:
parent
5cc7deea4e
commit
7d8590d85f
29 changed files with 446 additions and 434 deletions
|
@ -51,12 +51,12 @@ internal class DefaultRegistrationWizard(
|
|||
|
||||
override fun getCurrentThreePid(): String? {
|
||||
return when (val threePid = pendingSessionData.currentThreePidData?.threePid) {
|
||||
is RegisterThreePid.Email -> threePid.email
|
||||
is RegisterThreePid.Email -> threePid.email
|
||||
is RegisterThreePid.Msisdn -> {
|
||||
// Take formatted msisdn if provided by the server
|
||||
pendingSessionData.currentThreePidData?.addThreePidRegistrationResponse?.formattedMsisdn?.takeIf { it.isNotBlank() } ?: threePid.msisdn
|
||||
}
|
||||
null -> null
|
||||
null -> null
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -322,7 +322,7 @@ internal class DefaultKeysBackupService @Inject constructor(
|
|||
// val hashServer = keysBackupData?.backupLastServerHash
|
||||
|
||||
return when {
|
||||
totalNumberOfKeysLocally < totalNumberOfKeysServer -> {
|
||||
totalNumberOfKeysLocally < totalNumberOfKeysServer -> {
|
||||
// Server contains more keys than this device
|
||||
true
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ internal class DefaultKeysBackupService @Inject constructor(
|
|||
// TODO We have not found any algorithm to determine if a restore is recommended here. Return false for the moment
|
||||
false
|
||||
}
|
||||
else -> false
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -929,7 +929,7 @@ internal class DefaultKeysBackupService @Inject constructor(
|
|||
*/
|
||||
fun maybeBackupKeys() {
|
||||
when {
|
||||
isStuck() -> {
|
||||
isStuck() -> {
|
||||
// If not already done, or in error case, check for a valid backup version on the homeserver.
|
||||
// If there is one, maybeBackupKeys will be called again.
|
||||
checkAndStartKeysBackup()
|
||||
|
@ -947,7 +947,7 @@ internal class DefaultKeysBackupService @Inject constructor(
|
|||
uiHandler.post { backupKeys() }
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
Timber.v("maybeBackupKeys: Skip it because state: ${getState()}")
|
||||
}
|
||||
}
|
||||
|
@ -992,7 +992,7 @@ internal class DefaultKeysBackupService @Inject constructor(
|
|||
override fun onSuccess(data: KeysBackupLastVersionResult) {
|
||||
val localBackupVersion = keysBackupVersion?.version
|
||||
when (data) {
|
||||
KeysBackupLastVersionResult.NoKeysBackup -> {
|
||||
KeysBackupLastVersionResult.NoKeysBackup -> {
|
||||
if (localBackupVersion == null) {
|
||||
// No backup on the server, and backup is not active
|
||||
callback.onSuccess(true)
|
||||
|
@ -1378,7 +1378,7 @@ internal class DefaultKeysBackupService @Inject constructor(
|
|||
// Do not stay in KeysBackupState.WrongBackUpVersion but check what is available on the homeserver
|
||||
checkAndStartKeysBackup()
|
||||
}
|
||||
else ->
|
||||
else ->
|
||||
// Come back to the ready state so that we will retry on the next received key
|
||||
keysBackupStateManager.state = KeysBackupState.ReadyToBackUp
|
||||
}
|
||||
|
|
|
@ -33,8 +33,10 @@ internal fun LiveLocationShareAggregatedSummaryEntity.Companion.where(
|
|||
.equalTo(LiveLocationShareAggregatedSummaryEntityFields.EVENT_ID, eventId)
|
||||
}
|
||||
|
||||
internal fun LiveLocationShareAggregatedSummaryEntity.Companion.whereRoomId(realm: Realm,
|
||||
roomId: String): RealmQuery<LiveLocationShareAggregatedSummaryEntity> {
|
||||
internal fun LiveLocationShareAggregatedSummaryEntity.Companion.whereRoomId(
|
||||
realm: Realm,
|
||||
roomId: String
|
||||
): RealmQuery<LiveLocationShareAggregatedSummaryEntity> {
|
||||
return realm.where<LiveLocationShareAggregatedSummaryEntity>()
|
||||
.equalTo(LiveLocationShareAggregatedSummaryEntityFields.ROOM_ID, roomId)
|
||||
}
|
||||
|
|
|
@ -305,19 +305,19 @@ internal class RoomSummaryDataSource @Inject constructor(
|
|||
query.equalTo(RoomSummaryEntityFields.ROOM_TYPE, it)
|
||||
}
|
||||
when (queryParams.roomCategoryFilter) {
|
||||
RoomCategoryFilter.ONLY_DM -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, true)
|
||||
RoomCategoryFilter.ONLY_ROOMS -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, false)
|
||||
RoomCategoryFilter.ONLY_DM -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, true)
|
||||
RoomCategoryFilter.ONLY_ROOMS -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, false)
|
||||
RoomCategoryFilter.ONLY_WITH_NOTIFICATIONS -> query.greaterThan(RoomSummaryEntityFields.NOTIFICATION_COUNT, 0)
|
||||
null -> Unit
|
||||
null -> Unit
|
||||
}
|
||||
|
||||
// Timber.w("VAL: activeSpaceId : ${queryParams.activeSpaceId}")
|
||||
when (queryParams.spaceFilter) {
|
||||
SpaceFilter.OrphanRooms -> {
|
||||
SpaceFilter.OrphanRooms -> {
|
||||
// orphan rooms
|
||||
query.isNull(RoomSummaryEntityFields.FLATTEN_PARENT_IDS)
|
||||
}
|
||||
is SpaceFilter.ActiveSpace -> {
|
||||
is SpaceFilter.ActiveSpace -> {
|
||||
// It's annoying but for now realm java does not support querying in primitive list :/
|
||||
// https://github.com/realm/realm-java/issues/5361
|
||||
query.contains(RoomSummaryEntityFields.FLATTEN_PARENT_IDS, queryParams.spaceFilter.spaceId)
|
||||
|
@ -325,7 +325,7 @@ internal class RoomSummaryDataSource @Inject constructor(
|
|||
is SpaceFilter.ExcludeSpace -> {
|
||||
query.not().contains(RoomSummaryEntityFields.FLATTEN_PARENT_IDS, queryParams.spaceFilter.spaceId)
|
||||
}
|
||||
null -> Unit // nop
|
||||
null -> Unit // nop
|
||||
}
|
||||
|
||||
queryParams.activeGroupId?.let { activeGroupId ->
|
||||
|
|
|
@ -494,8 +494,10 @@ internal class TimelineChunk(
|
|||
val firstInsertion = results[range.startIndex]!!
|
||||
val lastBeforeInsertion = builtEvents[range.startIndex - 1]
|
||||
if (firstInsertion.displayIndex + 1 != lastBeforeInsertion.displayIndex) {
|
||||
Timber.i("handleDatabaseChangeSet: skip insertion at ${range.startIndex}/${builtEvents.size}, " +
|
||||
"displayIndex mismatch at ${range.startIndex}: ${firstInsertion.displayIndex} -> ${lastBeforeInsertion.displayIndex}")
|
||||
Timber.i(
|
||||
"handleDatabaseChangeSet: skip insertion at ${range.startIndex}/${builtEvents.size}, " +
|
||||
"displayIndex mismatch at ${range.startIndex}: ${firstInsertion.displayIndex} -> ${lastBeforeInsertion.displayIndex}"
|
||||
)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
@ -504,9 +506,11 @@ internal class TimelineChunk(
|
|||
val lastInsertion = results[range.startIndex + range.length - 1]!!
|
||||
val firstAfterInsertion = builtEvents[range.startIndex]
|
||||
if (firstAfterInsertion.displayIndex + 1 != lastInsertion.displayIndex) {
|
||||
Timber.i("handleDatabaseChangeSet: skip insertion at ${range.startIndex}/${builtEvents.size}, " +
|
||||
"displayIndex mismatch at ${range.startIndex + range.length}: " +
|
||||
"${firstAfterInsertion.displayIndex} -> ${lastInsertion.displayIndex}")
|
||||
Timber.i(
|
||||
"handleDatabaseChangeSet: skip insertion at ${range.startIndex}/${builtEvents.size}, " +
|
||||
"displayIndex mismatch at ${range.startIndex + range.length}: " +
|
||||
"${firstAfterInsertion.displayIndex} -> ${lastInsertion.displayIndex}"
|
||||
)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,27 +49,27 @@ internal class MatrixWorkerFactory @Inject constructor(private val sessionManage
|
|||
): ListenableWorker? {
|
||||
Timber.d("MatrixWorkerFactory.createWorker for $workerClassName")
|
||||
return when (workerClassName) {
|
||||
CheckFactoryWorker::class.java.name ->
|
||||
CheckFactoryWorker::class.java.name ->
|
||||
CheckFactoryWorker(appContext, workerParameters, true)
|
||||
AddPusherWorker::class.java.name ->
|
||||
AddPusherWorker::class.java.name ->
|
||||
AddPusherWorker(appContext, workerParameters, sessionManager)
|
||||
GetGroupDataWorker::class.java.name ->
|
||||
GetGroupDataWorker::class.java.name ->
|
||||
GetGroupDataWorker(appContext, workerParameters, sessionManager)
|
||||
MultipleEventSendingDispatcherWorker::class.java.name ->
|
||||
MultipleEventSendingDispatcherWorker(appContext, workerParameters, sessionManager)
|
||||
RedactEventWorker::class.java.name ->
|
||||
RedactEventWorker::class.java.name ->
|
||||
RedactEventWorker(appContext, workerParameters, sessionManager)
|
||||
SendEventWorker::class.java.name ->
|
||||
SendEventWorker::class.java.name ->
|
||||
SendEventWorker(appContext, workerParameters, sessionManager)
|
||||
SyncWorker::class.java.name ->
|
||||
SyncWorker::class.java.name ->
|
||||
SyncWorker(appContext, workerParameters, sessionManager)
|
||||
UpdateTrustWorker::class.java.name ->
|
||||
UpdateTrustWorker::class.java.name ->
|
||||
UpdateTrustWorker(appContext, workerParameters, sessionManager)
|
||||
UploadContentWorker::class.java.name ->
|
||||
UploadContentWorker::class.java.name ->
|
||||
UploadContentWorker(appContext, workerParameters, sessionManager)
|
||||
DeactivateLiveLocationShareWorker::class.java.name ->
|
||||
DeactivateLiveLocationShareWorker(appContext, workerParameters, sessionManager)
|
||||
else -> {
|
||||
else -> {
|
||||
Timber.w("No worker defined on MatrixWorkerFactory for $workerClassName will delegate to default.")
|
||||
// Return null to delegate to the default WorkerFactory.
|
||||
null
|
||||
|
|
|
@ -99,16 +99,16 @@ fun Context.inferNoConnectivity(buildMeta: BuildMeta): Boolean {
|
|||
val networkCapabilities = connectivityManager.getNetworkCapabilities(connectivityManager.activeNetwork)
|
||||
when {
|
||||
networkCapabilities?.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) == true -> false
|
||||
networkCapabilities?.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) == true -> false
|
||||
networkCapabilities?.hasTransport(NetworkCapabilities.TRANSPORT_VPN) == true -> false
|
||||
else -> true
|
||||
networkCapabilities?.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) == true -> false
|
||||
networkCapabilities?.hasTransport(NetworkCapabilities.TRANSPORT_VPN) == true -> false
|
||||
else -> true
|
||||
}
|
||||
} else {
|
||||
when (connectivityManager.activeNetworkInfo?.type) {
|
||||
ConnectivityManager.TYPE_WIFI -> false
|
||||
ConnectivityManager.TYPE_WIFI -> false
|
||||
ConnectivityManager.TYPE_MOBILE -> false
|
||||
ConnectivityManager.TYPE_VPN -> false
|
||||
else -> true
|
||||
ConnectivityManager.TYPE_VPN -> false
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,19 +74,19 @@ class ReadReceiptsView @JvmOverloads constructor(
|
|||
views.receiptMore.visibility = View.GONE
|
||||
}
|
||||
contentDescription = when (readReceipts.size) {
|
||||
1 ->
|
||||
1 ->
|
||||
if (displayNames.size == 1) {
|
||||
context.getString(R.string.one_user_read, displayNames[0])
|
||||
} else {
|
||||
context.resources.getQuantityString(R.plurals.fallback_users_read, readReceipts.size)
|
||||
}
|
||||
2 ->
|
||||
2 ->
|
||||
if (displayNames.size == 2) {
|
||||
context.getString(R.string.two_users_read, displayNames[0], displayNames[1])
|
||||
} else {
|
||||
context.resources.getQuantityString(R.plurals.fallback_users_read, readReceipts.size)
|
||||
}
|
||||
3 ->
|
||||
3 ->
|
||||
if (displayNames.size == 3) {
|
||||
context.getString(R.string.three_users_read, displayNames[0], displayNames[1], displayNames[2])
|
||||
} else {
|
||||
|
@ -96,12 +96,12 @@ class ReadReceiptsView @JvmOverloads constructor(
|
|||
if (displayNames.size >= 2) {
|
||||
val qty = readReceipts.size - 2
|
||||
context.resources.getQuantityString(
|
||||
R.plurals.two_and_some_others_read,
|
||||
R.plurals.two_and_some_others_read,
|
||||
qty,
|
||||
displayNames[0],
|
||||
displayNames[1],
|
||||
qty
|
||||
)
|
||||
)
|
||||
} else {
|
||||
context.resources.getQuantityString(R.plurals.fallback_users_read, readReceipts.size)
|
||||
}
|
||||
|
|
|
@ -61,10 +61,10 @@ object TextUtils {
|
|||
} else {
|
||||
// First convert the size
|
||||
when {
|
||||
sizeBytes < 1024 -> sizeBytes
|
||||
sizeBytes < 1024 * 1024 -> sizeBytes * 1000 / 1024
|
||||
sizeBytes < 1024 -> sizeBytes
|
||||
sizeBytes < 1024 * 1024 -> sizeBytes * 1000 / 1024
|
||||
sizeBytes < 1024 * 1024 * 1024 -> sizeBytes * 1000 / 1024 * 1000 / 1024
|
||||
else -> sizeBytes * 1000 / 1024 * 1000 / 1024 * 1000 / 1024
|
||||
else -> sizeBytes * 1000 / 1024 * 1000 / 1024 * 1000 / 1024
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ object TextUtils {
|
|||
val seconds = getSeconds(duration)
|
||||
val builder = StringBuilder()
|
||||
when {
|
||||
hours > 0 -> {
|
||||
hours > 0 -> {
|
||||
appendHours(getString, builder, hours)
|
||||
if (minutes > 0) {
|
||||
builder.append(" ")
|
||||
|
@ -126,7 +126,7 @@ object TextUtils {
|
|||
appendSeconds(getString, builder, seconds)
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
appendSeconds(getString, builder, seconds)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,13 +108,13 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
when (initialState.setupMode) {
|
||||
SetupMode.PASSPHRASE_RESET,
|
||||
SetupMode.PASSPHRASE_AND_NEEDED_SECRETS_RESET,
|
||||
SetupMode.HARD_RESET -> {
|
||||
SetupMode.HARD_RESET -> {
|
||||
setState {
|
||||
copy(
|
||||
step = BootstrapStep.FirstForm(
|
||||
keyBackUpExist = false,
|
||||
reset = session.sharedSecretStorageService().isRecoverySetup(),
|
||||
methods = this.secureBackupMethod
|
||||
keyBackUpExist = false,
|
||||
reset = session.sharedSecretStorageService().isRecoverySetup(),
|
||||
methods = this.secureBackupMethod
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
copy(step = BootstrapStep.AccountReAuth())
|
||||
}
|
||||
}
|
||||
SetupMode.NORMAL -> {
|
||||
SetupMode.NORMAL -> {
|
||||
// need to check if user have an existing keybackup
|
||||
setState {
|
||||
copy(step = BootstrapStep.CheckingMigration)
|
||||
|
@ -177,14 +177,14 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
|
||||
override fun handle(action: BootstrapActions) = withState { state ->
|
||||
when (action) {
|
||||
is BootstrapActions.GoBack -> queryBack()
|
||||
BootstrapActions.StartKeyBackupMigration -> {
|
||||
is BootstrapActions.GoBack -> queryBack()
|
||||
BootstrapActions.StartKeyBackupMigration -> {
|
||||
handleStartMigratingKeyBackup()
|
||||
}
|
||||
is BootstrapActions.Start -> {
|
||||
is BootstrapActions.Start -> {
|
||||
handleStart(action)
|
||||
}
|
||||
is BootstrapActions.UpdateCandidatePassphrase -> {
|
||||
is BootstrapActions.UpdateCandidatePassphrase -> {
|
||||
val strength = zxcvbn.measure(action.pass)
|
||||
setState {
|
||||
copy(
|
||||
|
@ -193,7 +193,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
)
|
||||
}
|
||||
}
|
||||
is BootstrapActions.GoToConfirmPassphrase -> {
|
||||
is BootstrapActions.GoToConfirmPassphrase -> {
|
||||
setState {
|
||||
copy(
|
||||
passphrase = action.passphrase,
|
||||
|
@ -208,7 +208,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
)
|
||||
}
|
||||
}
|
||||
is BootstrapActions.DoInitialize -> {
|
||||
is BootstrapActions.DoInitialize -> {
|
||||
if (state.passphrase == state.passphraseRepeat) {
|
||||
startInitializeFlow(state)
|
||||
} else {
|
||||
|
@ -219,42 +219,42 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
is BootstrapActions.DoInitializeGeneratedKey -> {
|
||||
is BootstrapActions.DoInitializeGeneratedKey -> {
|
||||
startInitializeFlow(state)
|
||||
}
|
||||
BootstrapActions.RecoveryKeySaved -> {
|
||||
BootstrapActions.RecoveryKeySaved -> {
|
||||
_viewEvents.post(BootstrapViewEvents.RecoveryKeySaved)
|
||||
setState {
|
||||
copy(step = BootstrapStep.SaveRecoveryKey(true))
|
||||
}
|
||||
}
|
||||
BootstrapActions.Completed -> {
|
||||
BootstrapActions.Completed -> {
|
||||
_viewEvents.post(BootstrapViewEvents.Dismiss(true))
|
||||
}
|
||||
BootstrapActions.GoToCompleted -> {
|
||||
BootstrapActions.GoToCompleted -> {
|
||||
setState {
|
||||
copy(step = BootstrapStep.DoneSuccess)
|
||||
}
|
||||
}
|
||||
BootstrapActions.SaveReqQueryStarted -> {
|
||||
BootstrapActions.SaveReqQueryStarted -> {
|
||||
setState {
|
||||
copy(recoverySaveFileProcess = Loading())
|
||||
}
|
||||
}
|
||||
is BootstrapActions.SaveKeyToUri -> {
|
||||
is BootstrapActions.SaveKeyToUri -> {
|
||||
saveRecoveryKeyToUri(action.os)
|
||||
}
|
||||
BootstrapActions.SaveReqFailed -> {
|
||||
BootstrapActions.SaveReqFailed -> {
|
||||
setState {
|
||||
copy(recoverySaveFileProcess = Uninitialized)
|
||||
}
|
||||
}
|
||||
BootstrapActions.GoToEnterAccountPassword -> {
|
||||
BootstrapActions.GoToEnterAccountPassword -> {
|
||||
setState {
|
||||
copy(step = BootstrapStep.AccountReAuth())
|
||||
}
|
||||
}
|
||||
BootstrapActions.HandleForgotBackupPassphrase -> {
|
||||
BootstrapActions.HandleForgotBackupPassphrase -> {
|
||||
if (state.step is BootstrapStep.GetBackupSecretPassForMigration) {
|
||||
setState {
|
||||
copy(step = BootstrapStep.GetBackupSecretPassForMigration(true))
|
||||
|
@ -264,16 +264,16 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
// is BootstrapActions.ReAuth -> {
|
||||
// startInitializeFlow(action.pass)
|
||||
// }
|
||||
is BootstrapActions.DoMigrateWithPassphrase -> {
|
||||
is BootstrapActions.DoMigrateWithPassphrase -> {
|
||||
startMigrationFlow(state.step, action.passphrase, null)
|
||||
}
|
||||
is BootstrapActions.DoMigrateWithRecoveryKey -> {
|
||||
is BootstrapActions.DoMigrateWithRecoveryKey -> {
|
||||
startMigrationFlow(state.step, null, action.recoveryKey)
|
||||
}
|
||||
BootstrapActions.SsoAuthDone -> {
|
||||
BootstrapActions.SsoAuthDone -> {
|
||||
uiaContinuation?.resume(DefaultBaseAuth(session = pendingAuth?.session ?: ""))
|
||||
}
|
||||
is BootstrapActions.PasswordAuthDone -> {
|
||||
is BootstrapActions.PasswordAuthDone -> {
|
||||
val decryptedPass = session.secureStorageService()
|
||||
.loadSecureSecret<String>(action.password.fromBase64().inputStream(), ReAuthActivity.DEFAULT_RESULT_KEYSTORE_ALIAS)
|
||||
uiaContinuation?.resume(
|
||||
|
@ -284,7 +284,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
)
|
||||
)
|
||||
}
|
||||
BootstrapActions.ReAuthCancelled -> {
|
||||
BootstrapActions.ReAuthCancelled -> {
|
||||
setState {
|
||||
copy(step = BootstrapStep.AccountReAuth(stringProvider.getString(R.string.authentication_error)))
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
}
|
||||
_viewEvents.post(BootstrapViewEvents.RequestReAuth(flowResponse, errCode))
|
||||
}
|
||||
LoginFlowTypes.SSO -> {
|
||||
LoginFlowTypes.SSO -> {
|
||||
pendingAuth = DefaultBaseAuth(flowResponse.session)
|
||||
uiaContinuation = promise
|
||||
setState {
|
||||
|
@ -424,7 +424,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
}
|
||||
_viewEvents.post(BootstrapViewEvents.RequestReAuth(flowResponse, errCode))
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
promise.resumeWithException(UnsupportedOperationException())
|
||||
}
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
is BootstrapResult.SuccessCrossSigningOnly -> {
|
||||
_viewEvents.post(BootstrapViewEvents.Dismiss(true))
|
||||
}
|
||||
is BootstrapResult.Success -> {
|
||||
is BootstrapResult.Success -> {
|
||||
val isSecureBackupRequired = state.isSecureBackupRequired
|
||||
val secureBackupMethod = state.secureBackupMethod
|
||||
|
||||
|
@ -466,7 +466,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
is BootstrapResult.InvalidPasswordError -> {
|
||||
is BootstrapResult.InvalidPasswordError -> {
|
||||
// it's a bad password / auth
|
||||
setState {
|
||||
copy(
|
||||
|
@ -474,7 +474,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
)
|
||||
}
|
||||
}
|
||||
is BootstrapResult.Failure -> {
|
||||
is BootstrapResult.Failure -> {
|
||||
if (bootstrapResult is BootstrapResult.GenericError &&
|
||||
bootstrapResult.failure is Failure.OtherServerError &&
|
||||
bootstrapResult.failure.httpCode == 401) {
|
||||
|
@ -523,7 +523,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
is BootstrapStep.SetupPassphrase -> {
|
||||
is BootstrapStep.SetupPassphrase -> {
|
||||
setState {
|
||||
copy(
|
||||
step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist, methods = this.secureBackupMethod),
|
||||
|
@ -533,14 +533,14 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
)
|
||||
}
|
||||
}
|
||||
is BootstrapStep.ConfirmPassphrase -> {
|
||||
is BootstrapStep.ConfirmPassphrase -> {
|
||||
setState {
|
||||
copy(
|
||||
step = BootstrapStep.SetupPassphrase
|
||||
)
|
||||
}
|
||||
}
|
||||
is BootstrapStep.AccountReAuth -> {
|
||||
is BootstrapStep.AccountReAuth -> {
|
||||
if (state.canLeave) {
|
||||
_viewEvents.post(BootstrapViewEvents.SkipBootstrap(state.passphrase != null))
|
||||
} else {
|
||||
|
@ -555,29 +555,29 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
BootstrapStep.Initializing -> {
|
||||
BootstrapStep.Initializing -> {
|
||||
// do we let you cancel from here?
|
||||
if (state.canLeave) {
|
||||
_viewEvents.post(BootstrapViewEvents.SkipBootstrap(state.passphrase != null))
|
||||
}
|
||||
}
|
||||
is BootstrapStep.SaveRecoveryKey,
|
||||
BootstrapStep.DoneSuccess -> {
|
||||
BootstrapStep.DoneSuccess -> {
|
||||
// nop
|
||||
}
|
||||
BootstrapStep.CheckingMigration -> Unit
|
||||
is BootstrapStep.FirstForm -> {
|
||||
BootstrapStep.CheckingMigration -> Unit
|
||||
is BootstrapStep.FirstForm -> {
|
||||
if (state.canLeave) {
|
||||
_viewEvents.post(
|
||||
when (state.setupMode) {
|
||||
SetupMode.CROSS_SIGNING_ONLY,
|
||||
SetupMode.NORMAL -> BootstrapViewEvents.SkipBootstrap()
|
||||
else -> BootstrapViewEvents.Dismiss(success = false)
|
||||
else -> BootstrapViewEvents.Dismiss(success = false)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
is BootstrapStep.GetBackupSecretForMigration -> {
|
||||
is BootstrapStep.GetBackupSecretForMigration -> {
|
||||
setState {
|
||||
copy(
|
||||
step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist, methods = this.secureBackupMethod),
|
||||
|
@ -595,10 +595,10 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||
private fun BackupToQuadSMigrationTask.Result.Failure.toHumanReadable(): String {
|
||||
return when (this) {
|
||||
is BackupToQuadSMigrationTask.Result.InvalidRecoverySecret -> stringProvider.getString(R.string.keys_backup_passphrase_error_decrypt)
|
||||
is BackupToQuadSMigrationTask.Result.ErrorFailure -> errorFormatter.toHumanReadable(throwable)
|
||||
is BackupToQuadSMigrationTask.Result.ErrorFailure -> errorFormatter.toHumanReadable(throwable)
|
||||
// is BackupToQuadSMigrationTask.Result.NoKeyBackupVersion,
|
||||
// is BackupToQuadSMigrationTask.Result.IllegalParams,
|
||||
else -> stringProvider.getString(R.string.unexpected_error)
|
||||
else -> stringProvider.getString(R.string.unexpected_error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
?: session.roomService().getExistingDirectRoomWithUser(otherUserId)
|
||||
|
||||
when (action) {
|
||||
is VerificationAction.RequestVerificationByDM -> {
|
||||
is VerificationAction.RequestVerificationByDM -> {
|
||||
if (roomId == null) {
|
||||
val localId = LocalEcho.createLocalEchoId()
|
||||
setState {
|
||||
|
@ -303,7 +303,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
}
|
||||
Unit
|
||||
}
|
||||
is VerificationAction.StartSASVerification -> {
|
||||
is VerificationAction.StartSASVerification -> {
|
||||
val request = session.cryptoService().verificationService().getExistingVerificationRequest(otherUserId, action.pendingRequestTransactionId)
|
||||
?: return@withState
|
||||
val otherDevice = if (request.isIncoming) request.requestInfo?.fromDevice else request.readyInfo?.fromDevice
|
||||
|
@ -325,7 +325,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
}
|
||||
Unit
|
||||
}
|
||||
is VerificationAction.RemoteQrCodeScanned -> {
|
||||
is VerificationAction.RemoteQrCodeScanned -> {
|
||||
val existingTransaction = session.cryptoService().verificationService()
|
||||
.getExistingTransaction(action.otherUserId, action.transactionId) as? QrCodeVerificationTransaction
|
||||
existingTransaction
|
||||
|
@ -339,7 +339,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
existingTransaction
|
||||
?.otherUserScannedMyQrCode()
|
||||
}
|
||||
is VerificationAction.OtherUserDidNotScanned -> {
|
||||
is VerificationAction.OtherUserDidNotScanned -> {
|
||||
val transactionId = state.transactionId ?: return@withState
|
||||
|
||||
val existingTransaction = session.cryptoService().verificationService()
|
||||
|
@ -347,18 +347,18 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
existingTransaction
|
||||
?.otherUserDidNotScannedMyQrCode()
|
||||
}
|
||||
is VerificationAction.SASMatchAction -> {
|
||||
is VerificationAction.SASMatchAction -> {
|
||||
(session.cryptoService().verificationService()
|
||||
.getExistingTransaction(action.otherUserId, action.sasTransactionId)
|
||||
as? SasVerificationTransaction)?.userHasVerifiedShortCode()
|
||||
}
|
||||
is VerificationAction.SASDoNotMatchAction -> {
|
||||
is VerificationAction.SASDoNotMatchAction -> {
|
||||
(session.cryptoService().verificationService()
|
||||
.getExistingTransaction(action.otherUserId, action.sasTransactionId)
|
||||
as? SasVerificationTransaction)
|
||||
?.shortCodeDoesNotMatch()
|
||||
}
|
||||
is VerificationAction.GotItConclusion -> {
|
||||
is VerificationAction.GotItConclusion -> {
|
||||
if (state.isVerificationRequired && !action.verified) {
|
||||
// we should go back to first screen
|
||||
setState {
|
||||
|
@ -372,17 +372,17 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
_viewEvents.post(VerificationBottomSheetViewEvents.Dismiss)
|
||||
}
|
||||
}
|
||||
is VerificationAction.SkipVerification -> {
|
||||
is VerificationAction.SkipVerification -> {
|
||||
_viewEvents.post(VerificationBottomSheetViewEvents.Dismiss)
|
||||
}
|
||||
is VerificationAction.VerifyFromPassphrase -> {
|
||||
is VerificationAction.VerifyFromPassphrase -> {
|
||||
setState { copy(verifyingFrom4S = true) }
|
||||
_viewEvents.post(VerificationBottomSheetViewEvents.AccessSecretStore)
|
||||
}
|
||||
is VerificationAction.GotResultFromSsss -> {
|
||||
is VerificationAction.GotResultFromSsss -> {
|
||||
handleSecretBackFromSSSS(action)
|
||||
}
|
||||
VerificationAction.SecuredStorageHasBeenReset -> {
|
||||
VerificationAction.SecuredStorageHasBeenReset -> {
|
||||
if (session.cryptoService().crossSigningService().allPrivateKeysKnown()) {
|
||||
setState {
|
||||
copy(quadSHasBeenReset = true, verifyingFrom4S = false)
|
||||
|
@ -390,7 +390,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
}
|
||||
Unit
|
||||
}
|
||||
VerificationAction.CancelledFromSsss -> {
|
||||
VerificationAction.CancelledFromSsss -> {
|
||||
setState {
|
||||
copy(verifyingFrom4S = false)
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
}
|
||||
|
||||
when (tx) {
|
||||
is SasVerificationTransaction -> {
|
||||
is SasVerificationTransaction -> {
|
||||
if (tx.transactionId == (state.pendingRequest.invoke()?.transactionId ?: state.transactionId)) {
|
||||
// A SAS tx has been started following this request
|
||||
setState {
|
||||
|
|
|
@ -198,15 +198,15 @@ class HomeActivity :
|
|||
.stream()
|
||||
.onEach { sharedAction ->
|
||||
when (sharedAction) {
|
||||
is HomeActivitySharedAction.OpenDrawer -> views.drawerLayout.openDrawer(GravityCompat.START)
|
||||
is HomeActivitySharedAction.CloseDrawer -> views.drawerLayout.closeDrawer(GravityCompat.START)
|
||||
is HomeActivitySharedAction.OpenGroup -> openGroup(sharedAction.shouldClearFragment)
|
||||
is HomeActivitySharedAction.OpenSpacePreview -> startActivity(SpacePreviewActivity.newIntent(this, sharedAction.spaceId))
|
||||
is HomeActivitySharedAction.AddSpace -> createSpaceResultLauncher.launch(SpaceCreationActivity.newIntent(this))
|
||||
is HomeActivitySharedAction.OpenDrawer -> views.drawerLayout.openDrawer(GravityCompat.START)
|
||||
is HomeActivitySharedAction.CloseDrawer -> views.drawerLayout.closeDrawer(GravityCompat.START)
|
||||
is HomeActivitySharedAction.OpenGroup -> openGroup(sharedAction.shouldClearFragment)
|
||||
is HomeActivitySharedAction.OpenSpacePreview -> startActivity(SpacePreviewActivity.newIntent(this, sharedAction.spaceId))
|
||||
is HomeActivitySharedAction.AddSpace -> createSpaceResultLauncher.launch(SpaceCreationActivity.newIntent(this))
|
||||
is HomeActivitySharedAction.ShowSpaceSettings -> showSpaceSettings(sharedAction.spaceId)
|
||||
is HomeActivitySharedAction.OpenSpaceInvite -> openSpaceInvite(sharedAction.spaceId)
|
||||
HomeActivitySharedAction.SendSpaceFeedBack -> bugReporter.openBugReportScreen(this, ReportType.SPACE_BETA_FEEDBACK)
|
||||
HomeActivitySharedAction.CloseGroup -> closeGroup()
|
||||
is HomeActivitySharedAction.OpenSpaceInvite -> openSpaceInvite(sharedAction.spaceId)
|
||||
HomeActivitySharedAction.SendSpaceFeedBack -> bugReporter.openBugReportScreen(this, ReportType.SPACE_BETA_FEEDBACK)
|
||||
HomeActivitySharedAction.CloseGroup -> closeGroup()
|
||||
}
|
||||
}
|
||||
.launchIn(lifecycleScope)
|
||||
|
@ -225,20 +225,20 @@ class HomeActivity :
|
|||
homeActivityViewModel.observeViewEvents {
|
||||
when (it) {
|
||||
is HomeActivityViewEvents.AskPasswordToInitCrossSigning -> handleAskPasswordToInitCrossSigning(it)
|
||||
is HomeActivityViewEvents.OnNewSession -> handleOnNewSession(it)
|
||||
HomeActivityViewEvents.PromptToEnableSessionPush -> handlePromptToEnablePush()
|
||||
HomeActivityViewEvents.StartRecoverySetupFlow -> handleStartRecoverySetup()
|
||||
is HomeActivityViewEvents.ForceVerification -> {
|
||||
is HomeActivityViewEvents.OnNewSession -> handleOnNewSession(it)
|
||||
HomeActivityViewEvents.PromptToEnableSessionPush -> handlePromptToEnablePush()
|
||||
HomeActivityViewEvents.StartRecoverySetupFlow -> handleStartRecoverySetup()
|
||||
is HomeActivityViewEvents.ForceVerification -> {
|
||||
if (it.sendRequest) {
|
||||
navigator.requestSelfSessionVerification(this)
|
||||
} else {
|
||||
navigator.waitSessionVerification(this)
|
||||
}
|
||||
}
|
||||
is HomeActivityViewEvents.OnCrossSignedInvalidated -> handleCrossSigningInvalidated(it)
|
||||
HomeActivityViewEvents.ShowAnalyticsOptIn -> handleShowAnalyticsOptIn()
|
||||
HomeActivityViewEvents.NotifyUserForThreadsMigration -> handleNotifyUserForThreadsMigration()
|
||||
is HomeActivityViewEvents.MigrateThreads -> migrateThreadsIfNeeded(it.checkSession)
|
||||
is HomeActivityViewEvents.OnCrossSignedInvalidated -> handleCrossSigningInvalidated(it)
|
||||
HomeActivityViewEvents.ShowAnalyticsOptIn -> handleShowAnalyticsOptIn()
|
||||
HomeActivityViewEvents.NotifyUserForThreadsMigration -> handleNotifyUserForThreadsMigration()
|
||||
is HomeActivityViewEvents.MigrateThreads -> migrateThreadsIfNeeded(it.checkSession)
|
||||
}
|
||||
}
|
||||
homeActivityViewModel.onEach { renderState(it) }
|
||||
|
@ -336,12 +336,12 @@ class HomeActivity :
|
|||
when {
|
||||
deepLink.startsWith(USER_LINK_PREFIX) -> deepLink.substring(USER_LINK_PREFIX.length)
|
||||
deepLink.startsWith(ROOM_LINK_PREFIX) -> deepLink.substring(ROOM_LINK_PREFIX.length)
|
||||
else -> null
|
||||
else -> null
|
||||
}?.let { permalinkId ->
|
||||
activeSessionHolder.getSafeActiveSession()?.permalinkService()?.createPermalink(permalinkId)
|
||||
}
|
||||
}
|
||||
else -> deepLink
|
||||
else -> deepLink
|
||||
}
|
||||
|
||||
lifecycleScope.launch {
|
||||
|
@ -391,7 +391,7 @@ class HomeActivity :
|
|||
}
|
||||
views.waitingView.root.isVisible = true
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
// Idle or Incremental sync status
|
||||
views.waitingView.root.isVisible = false
|
||||
}
|
||||
|
@ -543,15 +543,15 @@ class HomeActivity :
|
|||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.menu_home_suggestion -> {
|
||||
R.id.menu_home_suggestion -> {
|
||||
bugReporter.openBugReportScreen(this, ReportType.SUGGESTION)
|
||||
return true
|
||||
}
|
||||
R.id.menu_home_report_bug -> {
|
||||
R.id.menu_home_report_bug -> {
|
||||
bugReporter.openBugReportScreen(this, ReportType.BUG_REPORT)
|
||||
return true
|
||||
}
|
||||
R.id.menu_home_init_sync_legacy -> {
|
||||
R.id.menu_home_init_sync_legacy -> {
|
||||
// Configure the SDK
|
||||
initialSyncStrategy = InitialSyncStrategy.Legacy
|
||||
// And clear cache
|
||||
|
@ -565,11 +565,11 @@ class HomeActivity :
|
|||
MainActivity.restartApp(this, MainActivityArgs(clearCache = true))
|
||||
return true
|
||||
}
|
||||
R.id.menu_home_filter -> {
|
||||
R.id.menu_home_filter -> {
|
||||
navigator.openRoomsFiltering(this)
|
||||
return true
|
||||
}
|
||||
R.id.menu_home_setting -> {
|
||||
R.id.menu_home_setting -> {
|
||||
navigator.openSettings(this)
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ class HomeActivityViewModel @AssistedInject constructor(
|
|||
vectorPreferences.userNotifiedAboutThreads()
|
||||
}
|
||||
// Migrate users with enabled lab settings
|
||||
vectorPreferences.shouldNotifyUserAboutThreads() && vectorPreferences.shouldMigrateThreads() -> {
|
||||
vectorPreferences.shouldNotifyUserAboutThreads() && vectorPreferences.shouldMigrateThreads() -> {
|
||||
Timber.i("----> Migrate threads with enabled labs")
|
||||
// If user had io.element.thread enabled then enable the new thread support,
|
||||
// clear cache to sync messages appropriately
|
||||
|
@ -177,7 +177,7 @@ class HomeActivityViewModel @AssistedInject constructor(
|
|||
_viewEvents.post(HomeActivityViewEvents.MigrateThreads(checkSession = false))
|
||||
}
|
||||
// Enable all users
|
||||
vectorPreferences.shouldMigrateThreads() && vectorPreferences.areThreadMessagesEnabled() -> {
|
||||
vectorPreferences.shouldMigrateThreads() && vectorPreferences.areThreadMessagesEnabled() -> {
|
||||
Timber.i("----> Try to migrate threads")
|
||||
_viewEvents.post(HomeActivityViewEvents.MigrateThreads(checkSession = true))
|
||||
}
|
||||
|
@ -191,10 +191,10 @@ class HomeActivityViewModel @AssistedInject constructor(
|
|||
.asFlow()
|
||||
.onEach { status ->
|
||||
when (status) {
|
||||
is SyncStatusService.Status.Idle -> {
|
||||
is SyncStatusService.Status.Idle -> {
|
||||
maybeVerifyOrBootstrapCrossSigning()
|
||||
}
|
||||
else -> Unit
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
setState {
|
||||
|
@ -395,7 +395,7 @@ class HomeActivityViewModel @AssistedInject constructor(
|
|||
HomeActivityViewActions.PushPromptHasBeenReviewed -> {
|
||||
vectorPreferences.setDidAskUserToEnableSessionPush()
|
||||
}
|
||||
HomeActivityViewActions.ViewStarted -> {
|
||||
HomeActivityViewActions.ViewStarted -> {
|
||||
initialize()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ class HomeDetailFragment @Inject constructor(
|
|||
viewModel.onEach(HomeDetailViewState::roomGroupingMethod) { roomGroupingMethod ->
|
||||
when (roomGroupingMethod) {
|
||||
is RoomGroupingMethod.ByLegacyGroup -> onGroupChange(roomGroupingMethod.groupSummary)
|
||||
is RoomGroupingMethod.BySpace -> onSpaceChange(roomGroupingMethod.spaceSummary)
|
||||
is RoomGroupingMethod.BySpace -> onSpaceChange(roomGroupingMethod.spaceSummary)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,9 +147,9 @@ class HomeDetailFragment @Inject constructor(
|
|||
|
||||
viewModel.observeViewEvents { viewEvent ->
|
||||
when (viewEvent) {
|
||||
HomeDetailViewEvents.CallStarted -> handleCallStarted()
|
||||
HomeDetailViewEvents.CallStarted -> handleCallStarted()
|
||||
is HomeDetailViewEvents.FailToCall -> showFailure(viewEvent.failure)
|
||||
HomeDetailViewEvents.Loading -> showLoadingDialog()
|
||||
HomeDetailViewEvents.Loading -> showLoadingDialog()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,8 +229,8 @@ class HomeDetailFragment @Inject constructor(
|
|||
private fun refreshSpaceState() {
|
||||
when (val roomGroupingMethod = appStateHandler.getCurrentRoomGroupingMethod()) {
|
||||
is RoomGroupingMethod.ByLegacyGroup -> onGroupChange(roomGroupingMethod.groupSummary)
|
||||
is RoomGroupingMethod.BySpace -> onSpaceChange(roomGroupingMethod.spaceSummary)
|
||||
else -> Unit
|
||||
is RoomGroupingMethod.BySpace -> onSpaceChange(roomGroupingMethod.spaceSummary)
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,10 +313,10 @@ class HomeDetailFragment @Inject constructor(
|
|||
serverBackupStatusViewModel
|
||||
.onEach {
|
||||
when (val banState = it.bannerState.invoke()) {
|
||||
is BannerState.Setup -> views.homeKeysBackupBanner.render(KeysBackupBanner.State.Setup(banState.numberOfKeys), false)
|
||||
is BannerState.Setup -> views.homeKeysBackupBanner.render(KeysBackupBanner.State.Setup(banState.numberOfKeys), false)
|
||||
BannerState.BackingUp -> views.homeKeysBackupBanner.render(KeysBackupBanner.State.BackingUp, false)
|
||||
null,
|
||||
BannerState.Hidden -> views.homeKeysBackupBanner.render(KeysBackupBanner.State.Hidden, false)
|
||||
BannerState.Hidden -> views.homeKeysBackupBanner.render(KeysBackupBanner.State.Hidden, false)
|
||||
}
|
||||
}
|
||||
views.homeKeysBackupBanner.delegate = this
|
||||
|
@ -340,7 +340,7 @@ class HomeDetailFragment @Inject constructor(
|
|||
is RoomGroupingMethod.ByLegacyGroup -> {
|
||||
// do nothing
|
||||
}
|
||||
is RoomGroupingMethod.BySpace -> {
|
||||
is RoomGroupingMethod.BySpace -> {
|
||||
it.roomGroupingMethod.spaceSummary?.let { spaceSummary ->
|
||||
sharedActionViewModel.post(HomeActivitySharedAction.ShowSpaceSettings(spaceSummary.roomId))
|
||||
}
|
||||
|
@ -354,10 +354,10 @@ class HomeDetailFragment @Inject constructor(
|
|||
views.bottomNavigationView.menu.findItem(R.id.bottom_action_notification).isVisible = vectorPreferences.labAddNotificationTab()
|
||||
views.bottomNavigationView.setOnItemSelectedListener {
|
||||
val tab = when (it.itemId) {
|
||||
R.id.bottom_action_people -> HomeTab.RoomList(RoomListDisplayMode.PEOPLE)
|
||||
R.id.bottom_action_rooms -> HomeTab.RoomList(RoomListDisplayMode.ROOMS)
|
||||
R.id.bottom_action_people -> HomeTab.RoomList(RoomListDisplayMode.PEOPLE)
|
||||
R.id.bottom_action_rooms -> HomeTab.RoomList(RoomListDisplayMode.ROOMS)
|
||||
R.id.bottom_action_notification -> HomeTab.RoomList(RoomListDisplayMode.NOTIFICATIONS)
|
||||
else -> HomeTab.DialPad
|
||||
else -> HomeTab.DialPad
|
||||
}
|
||||
viewModel.handle(HomeDetailAction.SwitchTab(tab))
|
||||
true
|
||||
|
@ -388,7 +388,7 @@ class HomeDetailFragment @Inject constructor(
|
|||
val params = RoomListParams(tab.displayMode)
|
||||
add(R.id.roomListContainer, RoomListFragment::class.java, params.toMvRxBundle(), fragmentTag)
|
||||
}
|
||||
is HomeTab.DialPad -> {
|
||||
is HomeTab.DialPad -> {
|
||||
add(R.id.roomListContainer, createDialPadFragment(), fragmentTag)
|
||||
}
|
||||
}
|
||||
|
@ -465,11 +465,11 @@ class HomeDetailFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun HomeTab.toMenuId() = when (this) {
|
||||
is HomeTab.DialPad -> R.id.bottom_action_dial_pad
|
||||
is HomeTab.DialPad -> R.id.bottom_action_dial_pad
|
||||
is HomeTab.RoomList -> when (displayMode) {
|
||||
RoomListDisplayMode.PEOPLE -> R.id.bottom_action_people
|
||||
RoomListDisplayMode.ROOMS -> R.id.bottom_action_rooms
|
||||
else -> R.id.bottom_action_notification
|
||||
RoomListDisplayMode.ROOMS -> R.id.bottom_action_rooms
|
||||
else -> R.id.bottom_action_notification
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -421,10 +421,10 @@ class TimelineFragment @Inject constructor(
|
|||
}
|
||||
when (mode) {
|
||||
is SendMode.Regular -> renderRegularMode(mode.text)
|
||||
is SendMode.Edit -> renderSpecialMode(mode.timelineEvent, R.drawable.ic_edit, R.string.edit, mode.text)
|
||||
is SendMode.Quote -> renderSpecialMode(mode.timelineEvent, R.drawable.ic_quote, R.string.action_quote, mode.text)
|
||||
is SendMode.Reply -> renderSpecialMode(mode.timelineEvent, R.drawable.ic_reply, R.string.reply, mode.text)
|
||||
is SendMode.Voice -> renderVoiceMessageMode(mode.text)
|
||||
is SendMode.Edit -> renderSpecialMode(mode.timelineEvent, R.drawable.ic_edit, R.string.edit, mode.text)
|
||||
is SendMode.Quote -> renderSpecialMode(mode.timelineEvent, R.drawable.ic_quote, R.string.action_quote, mode.text)
|
||||
is SendMode.Reply -> renderSpecialMode(mode.timelineEvent, R.drawable.ic_reply, R.string.reply, mode.text)
|
||||
is SendMode.Voice -> renderVoiceMessageMode(mode.text)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -443,13 +443,13 @@ class TimelineFragment @Inject constructor(
|
|||
|
||||
messageComposerViewModel.observeViewEvents {
|
||||
when (it) {
|
||||
is MessageComposerViewEvents.JoinRoomCommandSuccess -> handleJoinedToAnotherRoom(it)
|
||||
is MessageComposerViewEvents.JoinRoomCommandSuccess -> handleJoinedToAnotherRoom(it)
|
||||
is MessageComposerViewEvents.SlashCommandConfirmationRequest -> handleSlashCommandConfirmationRequest(it)
|
||||
is MessageComposerViewEvents.SendMessageResult -> renderSendMessageResult(it)
|
||||
is MessageComposerViewEvents.ShowMessage -> showSnackWithMessage(it.message)
|
||||
is MessageComposerViewEvents.ShowRoomUpgradeDialog -> handleShowRoomUpgradeDialog(it)
|
||||
is MessageComposerViewEvents.AnimateSendButtonVisibility -> handleSendButtonVisibilityChanged(it)
|
||||
is MessageComposerViewEvents.OpenRoomMemberProfile -> openRoomMemberProfile(it.userId)
|
||||
is MessageComposerViewEvents.SendMessageResult -> renderSendMessageResult(it)
|
||||
is MessageComposerViewEvents.ShowMessage -> showSnackWithMessage(it.message)
|
||||
is MessageComposerViewEvents.ShowRoomUpgradeDialog -> handleShowRoomUpgradeDialog(it)
|
||||
is MessageComposerViewEvents.AnimateSendButtonVisibility -> handleSendButtonVisibilityChanged(it)
|
||||
is MessageComposerViewEvents.OpenRoomMemberProfile -> openRoomMemberProfile(it.userId)
|
||||
is MessageComposerViewEvents.VoicePlaybackOrRecordingFailure -> {
|
||||
if (it.throwable is VoiceFailure.UnableToRecord) {
|
||||
onCannotRecord()
|
||||
|
@ -461,39 +461,39 @@ class TimelineFragment @Inject constructor(
|
|||
|
||||
timelineViewModel.observeViewEvents {
|
||||
when (it) {
|
||||
is RoomDetailViewEvents.Failure -> displayErrorMessage(it)
|
||||
is RoomDetailViewEvents.OnNewTimelineEvents -> scrollOnNewMessageCallback.addNewTimelineEventIds(it.eventIds)
|
||||
is RoomDetailViewEvents.ActionSuccess -> displayRoomDetailActionSuccess(it)
|
||||
is RoomDetailViewEvents.ActionFailure -> displayRoomDetailActionFailure(it)
|
||||
is RoomDetailViewEvents.ShowMessage -> showSnackWithMessage(it.message)
|
||||
is RoomDetailViewEvents.NavigateToEvent -> navigateToEvent(it)
|
||||
is RoomDetailViewEvents.DownloadFileState -> handleDownloadFileState(it)
|
||||
is RoomDetailViewEvents.ShowE2EErrorMessage -> displayE2eError(it.withHeldCode)
|
||||
RoomDetailViewEvents.DisplayPromptForIntegrationManager -> displayPromptForIntegrationManager()
|
||||
is RoomDetailViewEvents.OpenStickerPicker -> openStickerPicker(it)
|
||||
is RoomDetailViewEvents.Failure -> displayErrorMessage(it)
|
||||
is RoomDetailViewEvents.OnNewTimelineEvents -> scrollOnNewMessageCallback.addNewTimelineEventIds(it.eventIds)
|
||||
is RoomDetailViewEvents.ActionSuccess -> displayRoomDetailActionSuccess(it)
|
||||
is RoomDetailViewEvents.ActionFailure -> displayRoomDetailActionFailure(it)
|
||||
is RoomDetailViewEvents.ShowMessage -> showSnackWithMessage(it.message)
|
||||
is RoomDetailViewEvents.NavigateToEvent -> navigateToEvent(it)
|
||||
is RoomDetailViewEvents.DownloadFileState -> handleDownloadFileState(it)
|
||||
is RoomDetailViewEvents.ShowE2EErrorMessage -> displayE2eError(it.withHeldCode)
|
||||
RoomDetailViewEvents.DisplayPromptForIntegrationManager -> displayPromptForIntegrationManager()
|
||||
is RoomDetailViewEvents.OpenStickerPicker -> openStickerPicker(it)
|
||||
is RoomDetailViewEvents.DisplayEnableIntegrationsWarning -> displayDisabledIntegrationDialog()
|
||||
is RoomDetailViewEvents.OpenIntegrationManager -> openIntegrationManager()
|
||||
is RoomDetailViewEvents.OpenFile -> startOpenFileIntent(it)
|
||||
RoomDetailViewEvents.OpenActiveWidgetBottomSheet -> onViewWidgetsClicked()
|
||||
is RoomDetailViewEvents.ShowInfoOkDialog -> showDialogWithMessage(it.message)
|
||||
is RoomDetailViewEvents.JoinJitsiConference -> joinJitsiRoom(it.widget, it.withVideo)
|
||||
RoomDetailViewEvents.LeaveJitsiConference -> leaveJitsiConference()
|
||||
RoomDetailViewEvents.ShowWaitingView -> vectorBaseActivity.showWaitingView()
|
||||
RoomDetailViewEvents.HideWaitingView -> vectorBaseActivity.hideWaitingView()
|
||||
is RoomDetailViewEvents.RequestNativeWidgetPermission -> requestNativeWidgetPermission(it)
|
||||
is RoomDetailViewEvents.OpenRoom -> handleOpenRoom(it)
|
||||
RoomDetailViewEvents.OpenInvitePeople -> navigator.openInviteUsersToRoom(requireContext(), timelineArgs.roomId)
|
||||
RoomDetailViewEvents.OpenSetRoomAvatarDialog -> galleryOrCameraDialogHelper.show()
|
||||
RoomDetailViewEvents.OpenRoomSettings -> handleOpenRoomSettings(RoomProfileActivity.EXTRA_DIRECT_ACCESS_ROOM_SETTINGS)
|
||||
RoomDetailViewEvents.OpenRoomProfile -> handleOpenRoomSettings()
|
||||
is RoomDetailViewEvents.ShowRoomAvatarFullScreen -> it.matrixItem?.let { item ->
|
||||
is RoomDetailViewEvents.OpenIntegrationManager -> openIntegrationManager()
|
||||
is RoomDetailViewEvents.OpenFile -> startOpenFileIntent(it)
|
||||
RoomDetailViewEvents.OpenActiveWidgetBottomSheet -> onViewWidgetsClicked()
|
||||
is RoomDetailViewEvents.ShowInfoOkDialog -> showDialogWithMessage(it.message)
|
||||
is RoomDetailViewEvents.JoinJitsiConference -> joinJitsiRoom(it.widget, it.withVideo)
|
||||
RoomDetailViewEvents.LeaveJitsiConference -> leaveJitsiConference()
|
||||
RoomDetailViewEvents.ShowWaitingView -> vectorBaseActivity.showWaitingView()
|
||||
RoomDetailViewEvents.HideWaitingView -> vectorBaseActivity.hideWaitingView()
|
||||
is RoomDetailViewEvents.RequestNativeWidgetPermission -> requestNativeWidgetPermission(it)
|
||||
is RoomDetailViewEvents.OpenRoom -> handleOpenRoom(it)
|
||||
RoomDetailViewEvents.OpenInvitePeople -> navigator.openInviteUsersToRoom(requireContext(), timelineArgs.roomId)
|
||||
RoomDetailViewEvents.OpenSetRoomAvatarDialog -> galleryOrCameraDialogHelper.show()
|
||||
RoomDetailViewEvents.OpenRoomSettings -> handleOpenRoomSettings(RoomProfileActivity.EXTRA_DIRECT_ACCESS_ROOM_SETTINGS)
|
||||
RoomDetailViewEvents.OpenRoomProfile -> handleOpenRoomSettings()
|
||||
is RoomDetailViewEvents.ShowRoomAvatarFullScreen -> it.matrixItem?.let { item ->
|
||||
navigator.openBigImageViewer(requireActivity(), it.view, item)
|
||||
}
|
||||
is RoomDetailViewEvents.StartChatEffect -> handleChatEffect(it.type)
|
||||
RoomDetailViewEvents.StopChatEffects -> handleStopChatEffects()
|
||||
is RoomDetailViewEvents.DisplayAndAcceptCall -> acceptIncomingCall(it)
|
||||
RoomDetailViewEvents.RoomReplacementStarted -> handleRoomReplacement()
|
||||
is RoomDetailViewEvents.ChangeLocationIndicator -> handleChangeLocationIndicator(it)
|
||||
is RoomDetailViewEvents.StartChatEffect -> handleChatEffect(it.type)
|
||||
RoomDetailViewEvents.StopChatEffects -> handleStopChatEffects()
|
||||
is RoomDetailViewEvents.DisplayAndAcceptCall -> acceptIncomingCall(it)
|
||||
RoomDetailViewEvents.RoomReplacementStarted -> handleRoomReplacement()
|
||||
is RoomDetailViewEvents.ChangeLocationIndicator -> handleChangeLocationIndicator(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -506,7 +506,7 @@ class TimelineFragment @Inject constructor(
|
|||
private fun handleSlashCommandConfirmationRequest(action: MessageComposerViewEvents.SlashCommandConfirmationRequest) {
|
||||
when (action.parsedCommand) {
|
||||
is ParsedCommand.UnignoreUser -> promptUnignoreUser(action.parsedCommand)
|
||||
else -> TODO("Add case for ${action.parsedCommand.javaClass.simpleName}")
|
||||
else -> TODO("Add case for ${action.parsedCommand.javaClass.simpleName}")
|
||||
}
|
||||
lockSendButton = false
|
||||
}
|
||||
|
@ -937,14 +937,14 @@ class TimelineFragment @Inject constructor(
|
|||
|
||||
private fun handleShareData() {
|
||||
when (val sharedData = timelineArgs.sharedData) {
|
||||
is SharedData.Text -> {
|
||||
is SharedData.Text -> {
|
||||
messageComposerViewModel.handle(MessageComposerAction.EnterRegularMode(sharedData.text, fromSharing = true))
|
||||
}
|
||||
is SharedData.Attachments -> {
|
||||
// open share edition
|
||||
onContentAttachmentsReady(sharedData.attachmentData)
|
||||
}
|
||||
null -> Timber.v("No share data to process")
|
||||
null -> Timber.v("No share data to process")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1087,8 +1087,8 @@ class TimelineFragment @Inject constructor(
|
|||
// Set the visual state of the call buttons (voice/video) to enabled/disabled according to user permissions
|
||||
val hasCallInRoom = callManager.getCallsByRoomId(state.roomId).isNotEmpty() || state.jitsiState.hasJoined
|
||||
val callButtonsEnabled = !hasCallInRoom && when (state.asyncRoomSummary.invoke()?.joinedMembersCount) {
|
||||
1 -> false
|
||||
2 -> state.isAllowedToStartWebRTCCall
|
||||
1 -> false
|
||||
2 -> state.isAllowedToStartWebRTCCall
|
||||
else -> state.isAllowedToManageWidgets
|
||||
}
|
||||
setOf(R.id.voice_call, R.id.video_call).forEach {
|
||||
|
@ -1122,39 +1122,39 @@ class TimelineFragment @Inject constructor(
|
|||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.invite -> {
|
||||
R.id.invite -> {
|
||||
navigator.openInviteUsersToRoom(requireActivity(), timelineArgs.roomId)
|
||||
true
|
||||
}
|
||||
R.id.timeline_setting -> {
|
||||
R.id.timeline_setting -> {
|
||||
navigator.openRoomProfile(requireActivity(), timelineArgs.roomId)
|
||||
true
|
||||
}
|
||||
R.id.open_matrix_apps -> {
|
||||
R.id.open_matrix_apps -> {
|
||||
timelineViewModel.handle(RoomDetailAction.ManageIntegrations)
|
||||
true
|
||||
}
|
||||
R.id.voice_call -> {
|
||||
R.id.voice_call -> {
|
||||
callActionsHandler.onVoiceCallClicked()
|
||||
true
|
||||
}
|
||||
R.id.video_call -> {
|
||||
R.id.video_call -> {
|
||||
callActionsHandler.onVideoCallClicked()
|
||||
true
|
||||
}
|
||||
R.id.menu_timeline_thread_list -> {
|
||||
R.id.menu_timeline_thread_list -> {
|
||||
navigateToThreadList()
|
||||
true
|
||||
}
|
||||
R.id.search -> {
|
||||
R.id.search -> {
|
||||
handleSearchAction()
|
||||
true
|
||||
}
|
||||
R.id.dev_tools -> {
|
||||
R.id.dev_tools -> {
|
||||
navigator.openDevTools(requireContext(), timelineArgs.roomId)
|
||||
true
|
||||
}
|
||||
R.id.menu_thread_timeline_copy_link -> {
|
||||
R.id.menu_thread_timeline_copy_link -> {
|
||||
getRootThreadEventId()?.let {
|
||||
val permalink = session.permalinkService().createPermalink(timelineArgs.roomId, it)
|
||||
copyToClipboard(requireContext(), permalink, false)
|
||||
|
@ -1166,14 +1166,14 @@ class TimelineFragment @Inject constructor(
|
|||
handleViewInRoomAction()
|
||||
true
|
||||
}
|
||||
R.id.menu_thread_timeline_share -> {
|
||||
R.id.menu_thread_timeline_share -> {
|
||||
getRootThreadEventId()?.let {
|
||||
val permalink = session.permalinkService().createPermalink(timelineArgs.roomId, it)
|
||||
shareText(requireContext(), permalink)
|
||||
}
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1257,8 +1257,8 @@ class TimelineFragment @Inject constructor(
|
|||
val messageContent: MessageContent? = event.getLastMessageContent()
|
||||
val nonFormattedBody = when (messageContent) {
|
||||
is MessageAudioContent -> getAudioContentBodyText(messageContent)
|
||||
is MessagePollContent -> messageContent.getBestPollCreationInfo()?.question?.getBestQuestion()
|
||||
else -> messageContent?.body.orEmpty()
|
||||
is MessagePollContent -> messageContent.getBestPollCreationInfo()?.question?.getBestQuestion()
|
||||
else -> messageContent?.body.orEmpty()
|
||||
}
|
||||
var formattedBody: CharSequence? = null
|
||||
if (messageContent is MessageTextContent && messageContent.format == MessageFormat.FORMAT_MATRIX_HTML) {
|
||||
|
@ -1320,9 +1320,9 @@ class TimelineFragment @Inject constructor(
|
|||
when (roomDetailPendingAction) {
|
||||
is RoomDetailPendingAction.JumpToReadReceipt ->
|
||||
timelineViewModel.handle(RoomDetailAction.JumpToReadReceipt(roomDetailPendingAction.userId))
|
||||
is RoomDetailPendingAction.MentionUser ->
|
||||
is RoomDetailPendingAction.MentionUser ->
|
||||
insertUserDisplayNameInTextEditor(roomDetailPendingAction.userId)
|
||||
is RoomDetailPendingAction.OpenRoom ->
|
||||
is RoomDetailPendingAction.OpenRoom ->
|
||||
handleOpenRoom(RoomDetailViewEvents.OpenRoom(roomDetailPendingAction.roomId, roomDetailPendingAction.closeCurrentRoom))
|
||||
}
|
||||
}
|
||||
|
@ -1464,7 +1464,7 @@ class TimelineFragment @Inject constructor(
|
|||
is MessageTextItem -> {
|
||||
return (model as AbsMessageItem).attributes.informationData.sendState == SendState.SYNCED
|
||||
}
|
||||
else -> false
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1490,9 +1490,9 @@ class TimelineFragment @Inject constructor(
|
|||
val state = timelineViewModel.awaitState()
|
||||
val showJumpToUnreadBanner = when (state.unreadState) {
|
||||
UnreadState.Unknown,
|
||||
UnreadState.HasNoUnread -> false
|
||||
UnreadState.HasNoUnread -> false
|
||||
is UnreadState.ReadMarkerNotLoaded -> true
|
||||
is UnreadState.HasUnread -> {
|
||||
is UnreadState.HasUnread -> {
|
||||
if (state.canShowJumpToReadMarker) {
|
||||
val lastVisibleItem = layoutManager.findLastCompletelyVisibleItemPosition()
|
||||
val positionOfReadMarker = withContext(Dispatchers.Default) {
|
||||
|
@ -1647,10 +1647,10 @@ class TimelineFragment @Inject constructor(
|
|||
views.composerLayout.setRoomEncrypted(summary.isEncrypted)
|
||||
// views.composerLayout.alwaysShowSendButton = false
|
||||
when (messageComposerState.canSendMessage) {
|
||||
CanSendStatus.Allowed -> {
|
||||
CanSendStatus.Allowed -> {
|
||||
NotificationAreaView.State.Hidden
|
||||
}
|
||||
CanSendStatus.NoPermission -> {
|
||||
CanSendStatus.NoPermission -> {
|
||||
NotificationAreaView.State.NoPermissionToPost
|
||||
}
|
||||
is CanSendStatus.UnSupportedE2eAlgorithm -> {
|
||||
|
@ -1724,23 +1724,23 @@ class TimelineFragment @Inject constructor(
|
|||
|
||||
private fun renderSendMessageResult(sendMessageResult: MessageComposerViewEvents.SendMessageResult) {
|
||||
when (sendMessageResult) {
|
||||
is MessageComposerViewEvents.SlashCommandLoading -> {
|
||||
is MessageComposerViewEvents.SlashCommandLoading -> {
|
||||
showLoading(null)
|
||||
}
|
||||
is MessageComposerViewEvents.SlashCommandError -> {
|
||||
is MessageComposerViewEvents.SlashCommandError -> {
|
||||
displayCommandError(getString(R.string.command_problem_with_parameters, sendMessageResult.command.command))
|
||||
}
|
||||
is MessageComposerViewEvents.SlashCommandUnknown -> {
|
||||
is MessageComposerViewEvents.SlashCommandUnknown -> {
|
||||
displayCommandError(getString(R.string.unrecognized_command, sendMessageResult.command))
|
||||
}
|
||||
is MessageComposerViewEvents.SlashCommandResultOk -> {
|
||||
is MessageComposerViewEvents.SlashCommandResultOk -> {
|
||||
handleSlashCommandResultOk(sendMessageResult.parsedCommand)
|
||||
}
|
||||
is MessageComposerViewEvents.SlashCommandResultError -> {
|
||||
is MessageComposerViewEvents.SlashCommandResultError -> {
|
||||
dismissLoadingDialog()
|
||||
displayCommandError(errorFormatter.toHumanReadable(sendMessageResult.throwable))
|
||||
}
|
||||
is MessageComposerViewEvents.SlashCommandNotImplemented -> {
|
||||
is MessageComposerViewEvents.SlashCommandNotImplemented -> {
|
||||
displayCommandError(getString(R.string.not_implemented))
|
||||
}
|
||||
is MessageComposerViewEvents.SlashCommandNotSupportedInThreads -> {
|
||||
|
@ -1758,7 +1758,7 @@ class TimelineFragment @Inject constructor(
|
|||
is ParsedCommand.SetMarkdown -> {
|
||||
showSnackWithMessage(getString(if (parsedCommand.enable) R.string.markdown_has_been_enabled else R.string.markdown_has_been_disabled))
|
||||
}
|
||||
else -> Unit
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1773,10 +1773,10 @@ class TimelineFragment @Inject constructor(
|
|||
private fun displayE2eError(withHeldCode: WithHeldCode?) {
|
||||
val msgId = when (withHeldCode) {
|
||||
WithHeldCode.BLACKLISTED -> R.string.crypto_error_withheld_blacklisted
|
||||
WithHeldCode.UNVERIFIED -> R.string.crypto_error_withheld_unverified
|
||||
WithHeldCode.UNVERIFIED -> R.string.crypto_error_withheld_unverified
|
||||
WithHeldCode.UNAUTHORISED,
|
||||
WithHeldCode.UNAVAILABLE -> R.string.crypto_error_withheld_generic
|
||||
else -> R.string.notice_crypto_unable_to_decrypt_friendly_desc
|
||||
else -> R.string.notice_crypto_unable_to_decrypt_friendly_desc
|
||||
}
|
||||
MaterialAlertDialogBuilder(requireActivity())
|
||||
.setMessage(msgId)
|
||||
|
@ -1824,9 +1824,9 @@ class TimelineFragment @Inject constructor(
|
|||
|
||||
private fun displayRoomDetailActionSuccess(result: RoomDetailViewEvents.ActionSuccess) {
|
||||
when (val data = result.action) {
|
||||
is RoomDetailAction.ReportContent -> {
|
||||
is RoomDetailAction.ReportContent -> {
|
||||
when {
|
||||
data.spam -> {
|
||||
data.spam -> {
|
||||
MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive)
|
||||
.setTitle(R.string.content_reported_as_spam_title)
|
||||
.setMessage(R.string.content_reported_as_spam_content)
|
||||
|
@ -1846,7 +1846,7 @@ class TimelineFragment @Inject constructor(
|
|||
}
|
||||
.show()
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive)
|
||||
.setTitle(R.string.content_reported_title)
|
||||
.setMessage(R.string.content_reported_content)
|
||||
|
@ -1858,7 +1858,7 @@ class TimelineFragment @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
is RoomDetailAction.RequestVerification -> {
|
||||
is RoomDetailAction.RequestVerification -> {
|
||||
Timber.v("## SAS RequestVerification action")
|
||||
VerificationBottomSheet.withArgs(
|
||||
timelineArgs.roomId,
|
||||
|
@ -1873,7 +1873,7 @@ class TimelineFragment @Inject constructor(
|
|||
data.transactionId
|
||||
).show(parentFragmentManager, "REQ")
|
||||
}
|
||||
is RoomDetailAction.ResumeVerification -> {
|
||||
is RoomDetailAction.ResumeVerification -> {
|
||||
val otherUserId = data.otherUserId ?: return
|
||||
VerificationBottomSheet.withArgs(
|
||||
roomId = timelineArgs.roomId,
|
||||
|
@ -1881,7 +1881,7 @@ class TimelineFragment @Inject constructor(
|
|||
transactionId = data.transactionId,
|
||||
).show(parentFragmentManager, "REQ")
|
||||
}
|
||||
else -> Unit
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1928,7 +1928,7 @@ class TimelineFragment @Inject constructor(
|
|||
})
|
||||
if (!isManaged) {
|
||||
when {
|
||||
url.containsRtLOverride() -> {
|
||||
url.containsRtLOverride() -> {
|
||||
displayUrlConfirmationDialog(
|
||||
seenUrl = title.ensureEndsLeftToRight(),
|
||||
actualUrl = url.filterDirectionOverrides(),
|
||||
|
@ -1938,7 +1938,7 @@ class TimelineFragment @Inject constructor(
|
|||
title.isValidUrl() && url.isValidUrl() && URL(title).host != URL(url).host -> {
|
||||
displayUrlConfirmationDialog(title, url)
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
openUrlInExternalBrowser(requireContext(), url)
|
||||
}
|
||||
}
|
||||
|
@ -2033,20 +2033,20 @@ class TimelineFragment @Inject constructor(
|
|||
is MessageVerificationRequestContent -> {
|
||||
timelineViewModel.handle(RoomDetailAction.ResumeVerification(informationData.eventId, null))
|
||||
}
|
||||
is MessageWithAttachmentContent -> {
|
||||
is MessageWithAttachmentContent -> {
|
||||
val action = RoomDetailAction.DownloadOrOpen(informationData.eventId, informationData.senderId, messageContent)
|
||||
timelineViewModel.handle(action)
|
||||
}
|
||||
is EncryptedEventContent -> {
|
||||
is EncryptedEventContent -> {
|
||||
timelineViewModel.handle(RoomDetailAction.TapOnFailedToDecrypt(informationData.eventId))
|
||||
}
|
||||
is MessageLocationContent -> {
|
||||
is MessageLocationContent -> {
|
||||
handleShowLocationPreview(messageContent, informationData.senderId)
|
||||
}
|
||||
is MessageBeaconInfoContent -> {
|
||||
is MessageBeaconInfoContent -> {
|
||||
navigateToLocationLiveMap()
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
val handled = onThreadSummaryClicked(informationData.eventId, isRootThreadEvent)
|
||||
if (!handled) {
|
||||
Timber.d("No click action defined for this message content")
|
||||
|
@ -2183,8 +2183,8 @@ class TimelineFragment @Inject constructor(
|
|||
|
||||
private fun onShareActionClicked(action: EventSharedAction.Share) {
|
||||
when (action.messageContent) {
|
||||
is MessageTextContent -> shareText(requireContext(), action.messageContent.body)
|
||||
is MessageLocationContent -> {
|
||||
is MessageTextContent -> shareText(requireContext(), action.messageContent.body)
|
||||
is MessageLocationContent -> {
|
||||
action.messageContent.toLocationData()?.let {
|
||||
openLocation(requireActivity(), it.latitude, it.longitude)
|
||||
}
|
||||
|
@ -2244,52 +2244,52 @@ class TimelineFragment @Inject constructor(
|
|||
|
||||
private fun handleActions(action: EventSharedAction) {
|
||||
when (action) {
|
||||
is EventSharedAction.OpenUserProfile -> {
|
||||
is EventSharedAction.OpenUserProfile -> {
|
||||
openRoomMemberProfile(action.userId)
|
||||
}
|
||||
is EventSharedAction.AddReaction -> {
|
||||
is EventSharedAction.AddReaction -> {
|
||||
openEmojiReactionPicker(action.eventId)
|
||||
}
|
||||
is EventSharedAction.ViewReactions -> {
|
||||
is EventSharedAction.ViewReactions -> {
|
||||
ViewReactionsBottomSheet.newInstance(timelineArgs.roomId, action.messageInformationData)
|
||||
.show(requireActivity().supportFragmentManager, "DISPLAY_REACTIONS")
|
||||
}
|
||||
is EventSharedAction.Copy -> {
|
||||
is EventSharedAction.Copy -> {
|
||||
// I need info about the current selected message :/
|
||||
copyToClipboard(requireContext(), action.content, false)
|
||||
showSnackWithMessage(getString(R.string.copied_to_clipboard))
|
||||
}
|
||||
is EventSharedAction.Redact -> {
|
||||
is EventSharedAction.Redact -> {
|
||||
promptConfirmationToRedactEvent(action)
|
||||
}
|
||||
is EventSharedAction.Share -> {
|
||||
is EventSharedAction.Share -> {
|
||||
onShareActionClicked(action)
|
||||
}
|
||||
is EventSharedAction.Save -> {
|
||||
is EventSharedAction.Save -> {
|
||||
onSaveActionClicked(action)
|
||||
}
|
||||
is EventSharedAction.ViewEditHistory -> {
|
||||
is EventSharedAction.ViewEditHistory -> {
|
||||
onEditedDecorationClicked(action.messageInformationData)
|
||||
}
|
||||
is EventSharedAction.ViewSource -> {
|
||||
is EventSharedAction.ViewSource -> {
|
||||
JSonViewerDialog.newInstance(
|
||||
action.content,
|
||||
-1,
|
||||
createJSonViewerStyleProvider(colorProvider)
|
||||
).show(childFragmentManager, "JSON_VIEWER")
|
||||
}
|
||||
is EventSharedAction.ViewDecryptedSource -> {
|
||||
is EventSharedAction.ViewDecryptedSource -> {
|
||||
JSonViewerDialog.newInstance(
|
||||
action.content,
|
||||
-1,
|
||||
createJSonViewerStyleProvider(colorProvider)
|
||||
).show(childFragmentManager, "JSON_VIEWER")
|
||||
}
|
||||
is EventSharedAction.QuickReact -> {
|
||||
is EventSharedAction.QuickReact -> {
|
||||
// eventId,ClickedOn,Add
|
||||
timelineViewModel.handle(RoomDetailAction.UpdateQuickReactAction(action.eventId, action.clickedOn, action.add))
|
||||
}
|
||||
is EventSharedAction.Edit -> {
|
||||
is EventSharedAction.Edit -> {
|
||||
if (action.eventType in EventType.POLL_START) {
|
||||
navigator.openCreatePoll(requireContext(), timelineArgs.roomId, action.eventId, PollMode.EDIT)
|
||||
} else if (withState(messageComposerViewModel) { it.isVoiceMessageIdle }) {
|
||||
|
@ -2298,45 +2298,45 @@ class TimelineFragment @Inject constructor(
|
|||
requireActivity().toast(R.string.error_voice_message_cannot_reply_or_edit)
|
||||
}
|
||||
}
|
||||
is EventSharedAction.Quote -> {
|
||||
is EventSharedAction.Quote -> {
|
||||
messageComposerViewModel.handle(MessageComposerAction.EnterQuoteMode(action.eventId, views.composerLayout.text.toString()))
|
||||
}
|
||||
is EventSharedAction.Reply -> {
|
||||
is EventSharedAction.Reply -> {
|
||||
if (withState(messageComposerViewModel) { it.isVoiceMessageIdle }) {
|
||||
messageComposerViewModel.handle(MessageComposerAction.EnterReplyMode(action.eventId, views.composerLayout.text.toString()))
|
||||
} else {
|
||||
requireActivity().toast(R.string.error_voice_message_cannot_reply_or_edit)
|
||||
}
|
||||
}
|
||||
is EventSharedAction.ReplyInThread -> {
|
||||
is EventSharedAction.ReplyInThread -> {
|
||||
if (withState(messageComposerViewModel) { it.isVoiceMessageIdle }) {
|
||||
onReplyInThreadClicked(action)
|
||||
} else {
|
||||
requireActivity().toast(R.string.error_voice_message_cannot_reply_or_edit)
|
||||
}
|
||||
}
|
||||
is EventSharedAction.ViewInRoom -> {
|
||||
is EventSharedAction.ViewInRoom -> {
|
||||
if (withState(messageComposerViewModel) { it.isVoiceMessageIdle }) {
|
||||
handleViewInRoomAction()
|
||||
} else {
|
||||
requireActivity().toast(R.string.error_voice_message_cannot_reply_or_edit)
|
||||
}
|
||||
}
|
||||
is EventSharedAction.CopyPermalink -> {
|
||||
is EventSharedAction.CopyPermalink -> {
|
||||
val permalink = session.permalinkService().createPermalink(timelineArgs.roomId, action.eventId)
|
||||
copyToClipboard(requireContext(), permalink, false)
|
||||
showSnackWithMessage(getString(R.string.copied_to_clipboard))
|
||||
}
|
||||
is EventSharedAction.Resend -> {
|
||||
is EventSharedAction.Resend -> {
|
||||
timelineViewModel.handle(RoomDetailAction.ResendMessage(action.eventId))
|
||||
}
|
||||
is EventSharedAction.Remove -> {
|
||||
is EventSharedAction.Remove -> {
|
||||
timelineViewModel.handle(RoomDetailAction.RemoveFailedEcho(action.eventId))
|
||||
}
|
||||
is EventSharedAction.Cancel -> {
|
||||
is EventSharedAction.Cancel -> {
|
||||
handleCancelSend(action)
|
||||
}
|
||||
is EventSharedAction.ReportContentSpam -> {
|
||||
is EventSharedAction.ReportContentSpam -> {
|
||||
timelineViewModel.handle(
|
||||
RoomDetailAction.ReportContent(
|
||||
action.eventId, action.senderId, "This message is spam", spam = true
|
||||
|
@ -2350,31 +2350,31 @@ class TimelineFragment @Inject constructor(
|
|||
)
|
||||
)
|
||||
}
|
||||
is EventSharedAction.ReportContentCustom -> {
|
||||
is EventSharedAction.ReportContentCustom -> {
|
||||
promptReasonToReportContent(action)
|
||||
}
|
||||
is EventSharedAction.IgnoreUser -> {
|
||||
is EventSharedAction.IgnoreUser -> {
|
||||
action.senderId?.let { askConfirmationToIgnoreUser(it) }
|
||||
}
|
||||
is EventSharedAction.OnUrlClicked -> {
|
||||
is EventSharedAction.OnUrlClicked -> {
|
||||
onUrlClicked(action.url, action.title)
|
||||
}
|
||||
is EventSharedAction.OnUrlLongClicked -> {
|
||||
is EventSharedAction.OnUrlLongClicked -> {
|
||||
onUrlLongClicked(action.url)
|
||||
}
|
||||
is EventSharedAction.ReRequestKey -> {
|
||||
is EventSharedAction.ReRequestKey -> {
|
||||
timelineViewModel.handle(RoomDetailAction.ReRequestKeys(action.eventId))
|
||||
}
|
||||
is EventSharedAction.UseKeyBackup -> {
|
||||
is EventSharedAction.UseKeyBackup -> {
|
||||
context?.let {
|
||||
startActivity(KeysBackupRestoreActivity.intent(it))
|
||||
}
|
||||
}
|
||||
is EventSharedAction.EndPoll -> {
|
||||
is EventSharedAction.EndPoll -> {
|
||||
askConfirmationToEndPoll(action.eventId)
|
||||
}
|
||||
is EventSharedAction.ReportContent -> Unit /* Not clickable */
|
||||
EventSharedAction.Separator -> Unit /* Not clickable */
|
||||
is EventSharedAction.ReportContent -> Unit /* Not clickable */
|
||||
EventSharedAction.Separator -> Unit /* Not clickable */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2584,17 +2584,17 @@ class TimelineFragment @Inject constructor(
|
|||
|
||||
private fun launchAttachmentProcess(type: AttachmentTypeSelectorView.Type) {
|
||||
when (type) {
|
||||
AttachmentTypeSelectorView.Type.CAMERA -> attachmentsHelper.openCamera(
|
||||
AttachmentTypeSelectorView.Type.CAMERA -> attachmentsHelper.openCamera(
|
||||
activity = requireActivity(),
|
||||
vectorPreferences = vectorPreferences,
|
||||
cameraActivityResultLauncher = attachmentCameraActivityResultLauncher,
|
||||
cameraVideoActivityResultLauncher = attachmentCameraVideoActivityResultLauncher
|
||||
)
|
||||
AttachmentTypeSelectorView.Type.FILE -> attachmentsHelper.selectFile(attachmentFileActivityResultLauncher)
|
||||
AttachmentTypeSelectorView.Type.GALLERY -> attachmentsHelper.selectGallery(attachmentMediaActivityResultLauncher)
|
||||
AttachmentTypeSelectorView.Type.CONTACT -> attachmentsHelper.selectContact(attachmentContactActivityResultLauncher)
|
||||
AttachmentTypeSelectorView.Type.STICKER -> timelineViewModel.handle(RoomDetailAction.SelectStickerAttachment)
|
||||
AttachmentTypeSelectorView.Type.POLL -> navigator.openCreatePoll(requireContext(), timelineArgs.roomId, null, PollMode.CREATE)
|
||||
AttachmentTypeSelectorView.Type.FILE -> attachmentsHelper.selectFile(attachmentFileActivityResultLauncher)
|
||||
AttachmentTypeSelectorView.Type.GALLERY -> attachmentsHelper.selectGallery(attachmentMediaActivityResultLauncher)
|
||||
AttachmentTypeSelectorView.Type.CONTACT -> attachmentsHelper.selectContact(attachmentContactActivityResultLauncher)
|
||||
AttachmentTypeSelectorView.Type.STICKER -> timelineViewModel.handle(RoomDetailAction.SelectStickerAttachment)
|
||||
AttachmentTypeSelectorView.Type.POLL -> navigator.openCreatePoll(requireContext(), timelineArgs.roomId, null, PollMode.CREATE)
|
||||
AttachmentTypeSelectorView.Type.LOCATION -> {
|
||||
navigator
|
||||
.openLocationSharing(
|
||||
|
|
|
@ -56,10 +56,10 @@ class LiveLocationShareMessageItemFactory @Inject constructor(
|
|||
): VectorEpoxyModel<*>? {
|
||||
val liveLocationShareSummaryData = getLiveLocationShareSummaryData(event)
|
||||
val item = when (val currentState = getViewState(liveLocationShareSummaryData)) {
|
||||
LiveLocationShareViewState.Inactive -> buildInactiveItem(highlight, attributes)
|
||||
LiveLocationShareViewState.Loading -> buildLoadingItem(highlight, attributes)
|
||||
LiveLocationShareViewState.Inactive -> buildInactiveItem(highlight, attributes)
|
||||
LiveLocationShareViewState.Loading -> buildLoadingItem(highlight, attributes)
|
||||
is LiveLocationShareViewState.Running -> buildRunningItem(highlight, attributes, currentState)
|
||||
LiveLocationShareViewState.Unkwown -> null
|
||||
LiveLocationShareViewState.Unkwown -> null
|
||||
}
|
||||
item?.layout(attributes.informationData.messageLayout.layoutRes)
|
||||
|
||||
|
@ -127,10 +127,10 @@ class LiveLocationShareMessageItemFactory @Inject constructor(
|
|||
|
||||
private fun getViewState(liveLocationShareSummaryData: LiveLocationShareSummaryData?): LiveLocationShareViewState {
|
||||
return when {
|
||||
liveLocationShareSummaryData?.isActive == null -> LiveLocationShareViewState.Unkwown
|
||||
liveLocationShareSummaryData.isActive.not() -> LiveLocationShareViewState.Inactive
|
||||
liveLocationShareSummaryData?.isActive == null -> LiveLocationShareViewState.Unkwown
|
||||
liveLocationShareSummaryData.isActive.not() -> LiveLocationShareViewState.Inactive
|
||||
liveLocationShareSummaryData.isActive && liveLocationShareSummaryData.lastGeoUri.isNullOrEmpty() -> LiveLocationShareViewState.Loading
|
||||
else ->
|
||||
else ->
|
||||
LiveLocationShareViewState.Running(
|
||||
liveLocationShareSummaryData.lastGeoUri.orEmpty(),
|
||||
getEndOfLiveDateTime(liveLocationShareSummaryData)
|
||||
|
|
|
@ -110,8 +110,8 @@ class RoomListFragment @Inject constructor(
|
|||
super.onCreate(savedInstanceState)
|
||||
analyticsScreenName = when (roomListParams.displayMode) {
|
||||
RoomListDisplayMode.PEOPLE -> MobileScreen.ScreenName.People
|
||||
RoomListDisplayMode.ROOMS -> MobileScreen.ScreenName.Rooms
|
||||
else -> null
|
||||
RoomListDisplayMode.ROOMS -> MobileScreen.ScreenName.Rooms
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,10 +124,10 @@ class RoomListFragment @Inject constructor(
|
|||
sharedActionViewModel = activityViewModelProvider.get(RoomListQuickActionsSharedActionViewModel::class.java)
|
||||
roomListViewModel.observeViewEvents {
|
||||
when (it) {
|
||||
is RoomListViewEvents.Loading -> showLoading(it.message)
|
||||
is RoomListViewEvents.Failure -> showFailure(it.throwable)
|
||||
is RoomListViewEvents.SelectRoom -> handleSelectRoom(it, it.isInviteAlreadyAccepted)
|
||||
is RoomListViewEvents.Done -> Unit
|
||||
is RoomListViewEvents.Loading -> showLoading(it.message)
|
||||
is RoomListViewEvents.Failure -> showFailure(it.throwable)
|
||||
is RoomListViewEvents.SelectRoom -> handleSelectRoom(it, it.isInviteAlreadyAccepted)
|
||||
is RoomListViewEvents.Done -> Unit
|
||||
is RoomListViewEvents.NavigateToMxToBottomSheet -> handleShowMxToLink(it.link)
|
||||
}
|
||||
}
|
||||
|
@ -209,9 +209,9 @@ class RoomListFragment @Inject constructor(
|
|||
private fun setupCreateRoomButton() {
|
||||
when (roomListParams.displayMode) {
|
||||
RoomListDisplayMode.NOTIFICATIONS -> views.createChatFabMenu.isVisible = true
|
||||
RoomListDisplayMode.PEOPLE -> views.createChatRoomButton.isVisible = true
|
||||
RoomListDisplayMode.ROOMS -> views.createGroupRoomButton.isVisible = true
|
||||
RoomListDisplayMode.FILTERED -> Unit // No button in this mode
|
||||
RoomListDisplayMode.PEOPLE -> views.createChatRoomButton.isVisible = true
|
||||
RoomListDisplayMode.ROOMS -> views.createGroupRoomButton.isVisible = true
|
||||
RoomListDisplayMode.FILTERED -> Unit // No button in this mode
|
||||
}
|
||||
|
||||
views.createChatRoomButton.debouncedClicks {
|
||||
|
@ -228,16 +228,16 @@ class RoomListFragment @Inject constructor(
|
|||
views.createChatFabMenu.removeCallbacks(showFabRunnable)
|
||||
|
||||
when (newState) {
|
||||
RecyclerView.SCROLL_STATE_IDLE -> {
|
||||
RecyclerView.SCROLL_STATE_IDLE -> {
|
||||
views.createChatFabMenu.postDelayed(showFabRunnable, 250)
|
||||
}
|
||||
RecyclerView.SCROLL_STATE_DRAGGING,
|
||||
RecyclerView.SCROLL_STATE_SETTLING -> {
|
||||
when (roomListParams.displayMode) {
|
||||
RoomListDisplayMode.NOTIFICATIONS -> views.createChatFabMenu.hide()
|
||||
RoomListDisplayMode.PEOPLE -> views.createChatRoomButton.hide()
|
||||
RoomListDisplayMode.ROOMS -> views.createGroupRoomButton.hide()
|
||||
RoomListDisplayMode.FILTERED -> Unit
|
||||
RoomListDisplayMode.PEOPLE -> views.createChatRoomButton.hide()
|
||||
RoomListDisplayMode.ROOMS -> views.createGroupRoomButton.hide()
|
||||
RoomListDisplayMode.FILTERED -> Unit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ class RoomListFragment @Inject constructor(
|
|||
}
|
||||
val contentAdapter =
|
||||
when {
|
||||
section.livePages != null -> {
|
||||
section.livePages != null -> {
|
||||
pagedControllerFactory.createRoomSummaryPagedController(roomListParams.displayMode)
|
||||
.also { controller ->
|
||||
section.livePages.observe(viewLifecycleOwner) { pl ->
|
||||
|
@ -343,7 +343,7 @@ class RoomListFragment @Inject constructor(
|
|||
controller.listener = this
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
pagedControllerFactory.createRoomSummaryListController(roomListParams.displayMode)
|
||||
.also { controller ->
|
||||
section.liveList?.observe(viewLifecycleOwner) { list ->
|
||||
|
@ -400,9 +400,9 @@ class RoomListFragment @Inject constructor(
|
|||
if (isAdded) {
|
||||
when (roomListParams.displayMode) {
|
||||
RoomListDisplayMode.NOTIFICATIONS -> views.createChatFabMenu.show()
|
||||
RoomListDisplayMode.PEOPLE -> views.createChatRoomButton.show()
|
||||
RoomListDisplayMode.ROOMS -> views.createGroupRoomButton.show()
|
||||
RoomListDisplayMode.FILTERED -> Unit
|
||||
RoomListDisplayMode.PEOPLE -> views.createChatRoomButton.show()
|
||||
RoomListDisplayMode.ROOMS -> views.createGroupRoomButton.show()
|
||||
RoomListDisplayMode.FILTERED -> Unit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -422,28 +422,28 @@ class RoomListFragment @Inject constructor(
|
|||
|
||||
private fun handleQuickActions(quickAction: RoomListQuickActionsSharedAction) {
|
||||
when (quickAction) {
|
||||
is RoomListQuickActionsSharedAction.NotificationsAllNoisy -> {
|
||||
is RoomListQuickActionsSharedAction.NotificationsAllNoisy -> {
|
||||
roomListViewModel.handle(RoomListAction.ChangeRoomNotificationState(quickAction.roomId, RoomNotificationState.ALL_MESSAGES_NOISY))
|
||||
}
|
||||
is RoomListQuickActionsSharedAction.NotificationsAll -> {
|
||||
is RoomListQuickActionsSharedAction.NotificationsAll -> {
|
||||
roomListViewModel.handle(RoomListAction.ChangeRoomNotificationState(quickAction.roomId, RoomNotificationState.ALL_MESSAGES))
|
||||
}
|
||||
is RoomListQuickActionsSharedAction.NotificationsMentionsOnly -> {
|
||||
roomListViewModel.handle(RoomListAction.ChangeRoomNotificationState(quickAction.roomId, RoomNotificationState.MENTIONS_ONLY))
|
||||
}
|
||||
is RoomListQuickActionsSharedAction.NotificationsMute -> {
|
||||
is RoomListQuickActionsSharedAction.NotificationsMute -> {
|
||||
roomListViewModel.handle(RoomListAction.ChangeRoomNotificationState(quickAction.roomId, RoomNotificationState.MUTE))
|
||||
}
|
||||
is RoomListQuickActionsSharedAction.Settings -> {
|
||||
is RoomListQuickActionsSharedAction.Settings -> {
|
||||
navigator.openRoomProfile(requireActivity(), quickAction.roomId)
|
||||
}
|
||||
is RoomListQuickActionsSharedAction.Favorite -> {
|
||||
is RoomListQuickActionsSharedAction.Favorite -> {
|
||||
roomListViewModel.handle(RoomListAction.ToggleTag(quickAction.roomId, RoomTag.ROOM_TAG_FAVOURITE))
|
||||
}
|
||||
is RoomListQuickActionsSharedAction.LowPriority -> {
|
||||
is RoomListQuickActionsSharedAction.LowPriority -> {
|
||||
roomListViewModel.handle(RoomListAction.ToggleTag(quickAction.roomId, RoomTag.ROOM_TAG_LOW_PRIORITY))
|
||||
}
|
||||
is RoomListQuickActionsSharedAction.Leave -> {
|
||||
is RoomListQuickActionsSharedAction.Leave -> {
|
||||
promptLeaveRoom(quickAction.roomId)
|
||||
}
|
||||
}
|
||||
|
@ -484,21 +484,21 @@ class RoomListFragment @Inject constructor(
|
|||
message = getString(R.string.room_list_catchup_empty_body)
|
||||
)
|
||||
}
|
||||
RoomListDisplayMode.PEOPLE ->
|
||||
RoomListDisplayMode.PEOPLE ->
|
||||
StateView.State.Empty(
|
||||
title = getString(R.string.room_list_people_empty_title),
|
||||
image = ContextCompat.getDrawable(requireContext(), R.drawable.empty_state_dm),
|
||||
isBigImage = true,
|
||||
message = getString(R.string.room_list_people_empty_body)
|
||||
)
|
||||
RoomListDisplayMode.ROOMS ->
|
||||
RoomListDisplayMode.ROOMS ->
|
||||
StateView.State.Empty(
|
||||
title = getString(R.string.room_list_rooms_empty_title),
|
||||
image = ContextCompat.getDrawable(requireContext(), R.drawable.empty_state_room),
|
||||
isBigImage = true,
|
||||
message = getString(R.string.room_list_rooms_empty_body)
|
||||
)
|
||||
RoomListDisplayMode.FILTERED ->
|
||||
RoomListDisplayMode.FILTERED ->
|
||||
// Always display the content in this mode, because if the footer
|
||||
StateView.State.Content
|
||||
}
|
||||
|
|
|
@ -78,15 +78,15 @@ class RoomListSectionBuilderSpace(
|
|||
val sections = mutableListOf<RoomsSection>()
|
||||
val activeSpaceAwareQueries = mutableListOf<RoomListViewModel.ActiveSpaceQueryUpdater>()
|
||||
when (mode) {
|
||||
RoomListDisplayMode.PEOPLE -> {
|
||||
RoomListDisplayMode.PEOPLE -> {
|
||||
// 4 sections Invites / Fav / Dms / Low Priority
|
||||
buildDmSections(sections, activeSpaceAwareQueries)
|
||||
}
|
||||
RoomListDisplayMode.ROOMS -> {
|
||||
RoomListDisplayMode.ROOMS -> {
|
||||
// 6 sections invites / Fav / Rooms / Low Priority / Server notice / Suggested rooms
|
||||
buildRoomsSections(sections, activeSpaceAwareQueries)
|
||||
}
|
||||
RoomListDisplayMode.FILTERED -> {
|
||||
RoomListDisplayMode.FILTERED -> {
|
||||
// Used when searching for rooms
|
||||
buildFilteredSection(sections)
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ class RoomListSectionBuilderSpace(
|
|||
}
|
||||
})
|
||||
}
|
||||
RoomListViewModel.SpaceFilterStrategy.ALL_IF_SPACE_NULL -> {
|
||||
RoomListViewModel.SpaceFilterStrategy.ALL_IF_SPACE_NULL -> {
|
||||
activeSpaceUpdaters.add(object : RoomListViewModel.ActiveSpaceQueryUpdater {
|
||||
override fun updateForSpaceId(roomId: String?) {
|
||||
if (roomId != null) {
|
||||
|
@ -401,7 +401,7 @@ class RoomListSectionBuilderSpace(
|
|||
}
|
||||
})
|
||||
}
|
||||
RoomListViewModel.SpaceFilterStrategy.NONE -> {
|
||||
RoomListViewModel.SpaceFilterStrategy.NONE -> {
|
||||
// we ignore current space for this one
|
||||
}
|
||||
}
|
||||
|
@ -448,12 +448,12 @@ class RoomListSectionBuilderSpace(
|
|||
spaceFilter = currentSpace?.toActiveSpaceOrOrphanRooms()
|
||||
)
|
||||
}
|
||||
RoomListViewModel.SpaceFilterStrategy.ALL_IF_SPACE_NULL -> {
|
||||
RoomListViewModel.SpaceFilterStrategy.ALL_IF_SPACE_NULL -> {
|
||||
copy(
|
||||
spaceFilter = currentSpace?.let { SpaceFilter.ActiveSpace(it) }
|
||||
)
|
||||
}
|
||||
RoomListViewModel.SpaceFilterStrategy.NONE -> this
|
||||
RoomListViewModel.SpaceFilterStrategy.NONE -> this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ abstract class RoomSummaryItem : VectorEpoxyModel<RoomSummaryItem.Holder>() {
|
|||
RoomListDisplayMode.ROOMS,
|
||||
RoomListDisplayMode.PEOPLE,
|
||||
RoomListDisplayMode.NOTIFICATIONS -> renderForDefaultDisplayMode(holder)
|
||||
RoomListDisplayMode.FILTERED -> renderForFilteredDisplayMode(holder)
|
||||
RoomListDisplayMode.FILTERED -> renderForFilteredDisplayMode(holder)
|
||||
}
|
||||
|
||||
private fun renderForDefaultDisplayMode(holder: Holder) {
|
||||
|
|
|
@ -58,7 +58,7 @@ class RoomSummaryItemFactory @Inject constructor(
|
|||
val changeMembershipState = roomChangeMembershipStates[roomSummary.roomId] ?: ChangeMembershipState.Unknown
|
||||
createInvitationItem(roomSummary, changeMembershipState, listener)
|
||||
}
|
||||
else -> createRoomItem(
|
||||
else -> createRoomItem(
|
||||
roomSummary, selectedRoomIds, displayMode, listener?.let { it::onRoomClicked }, listener?.let { it::onRoomLongClicked }
|
||||
)
|
||||
}
|
||||
|
|
|
@ -49,9 +49,9 @@ class LocationLiveMapViewModel @AssistedInject constructor(
|
|||
|
||||
override fun handle(action: LocationLiveMapAction) {
|
||||
when (action) {
|
||||
is LocationLiveMapAction.AddMapSymbol -> handleAddMapSymbol(action)
|
||||
is LocationLiveMapAction.AddMapSymbol -> handleAddMapSymbol(action)
|
||||
is LocationLiveMapAction.RemoveMapSymbol -> handleRemoveMapSymbol(action)
|
||||
LocationLiveMapAction.StopSharing -> handleStopSharing()
|
||||
LocationLiveMapAction.StopSharing -> handleStopSharing()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class UserLiveLocationViewStateMapper @Inject constructor(
|
|||
userId.isNullOrEmpty() || locationData == null -> continuation.resume(null) {
|
||||
// do nothing on cancellation
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
locationPinProvider.create(userId) { pinDrawable ->
|
||||
val session = activeSessionHolder.getActiveSession()
|
||||
session.getUser(userId)?.toMatrixItem()?.let { matrixItem ->
|
||||
|
|
|
@ -137,30 +137,30 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
|
||||
override fun handle(action: OnboardingAction) {
|
||||
when (action) {
|
||||
is OnboardingAction.SplashAction -> handleSplashAction(action)
|
||||
is OnboardingAction.UpdateUseCase -> handleUpdateUseCase(action)
|
||||
OnboardingAction.ResetUseCase -> resetUseCase()
|
||||
is OnboardingAction.UpdateServerType -> handleUpdateServerType(action)
|
||||
is OnboardingAction.UpdateSignMode -> handleUpdateSignMode(action)
|
||||
is OnboardingAction.InitWith -> handleInitWith(action)
|
||||
is OnboardingAction.HomeServerChange -> withAction(action) { handleHomeserverChange(action) }
|
||||
is AuthenticateAction -> withAction(action) { handleAuthenticateAction(action) }
|
||||
is OnboardingAction.LoginWithToken -> handleLoginWithToken(action)
|
||||
is OnboardingAction.WebLoginSuccess -> handleWebLoginSuccess(action)
|
||||
is OnboardingAction.ResetPassword -> handleResetPassword(action)
|
||||
is OnboardingAction.SplashAction -> handleSplashAction(action)
|
||||
is OnboardingAction.UpdateUseCase -> handleUpdateUseCase(action)
|
||||
OnboardingAction.ResetUseCase -> resetUseCase()
|
||||
is OnboardingAction.UpdateServerType -> handleUpdateServerType(action)
|
||||
is OnboardingAction.UpdateSignMode -> handleUpdateSignMode(action)
|
||||
is OnboardingAction.InitWith -> handleInitWith(action)
|
||||
is OnboardingAction.HomeServerChange -> withAction(action) { handleHomeserverChange(action) }
|
||||
is AuthenticateAction -> withAction(action) { handleAuthenticateAction(action) }
|
||||
is OnboardingAction.LoginWithToken -> handleLoginWithToken(action)
|
||||
is OnboardingAction.WebLoginSuccess -> handleWebLoginSuccess(action)
|
||||
is OnboardingAction.ResetPassword -> handleResetPassword(action)
|
||||
is OnboardingAction.ResetPasswordMailConfirmed -> handleResetPasswordMailConfirmed()
|
||||
is OnboardingAction.PostRegisterAction -> handleRegisterAction(action.registerAction, ::emitFlowResultViewEvent)
|
||||
is OnboardingAction.ResetAction -> handleResetAction(action)
|
||||
is OnboardingAction.UserAcceptCertificate -> handleUserAcceptCertificate(action)
|
||||
OnboardingAction.ClearHomeServerHistory -> handleClearHomeServerHistory()
|
||||
is OnboardingAction.UpdateDisplayName -> updateDisplayName(action.displayName)
|
||||
OnboardingAction.UpdateDisplayNameSkipped -> handleDisplayNameStepComplete()
|
||||
OnboardingAction.UpdateProfilePictureSkipped -> completePersonalization()
|
||||
OnboardingAction.PersonalizeProfile -> handlePersonalizeProfile()
|
||||
is OnboardingAction.ProfilePictureSelected -> handleProfilePictureSelected(action)
|
||||
OnboardingAction.SaveSelectedProfilePicture -> updateProfilePicture()
|
||||
is OnboardingAction.PostViewEvent -> _viewEvents.post(action.viewEvent)
|
||||
OnboardingAction.StopEmailValidationCheck -> cancelWaitForEmailValidation()
|
||||
is OnboardingAction.PostRegisterAction -> handleRegisterAction(action.registerAction, ::emitFlowResultViewEvent)
|
||||
is OnboardingAction.ResetAction -> handleResetAction(action)
|
||||
is OnboardingAction.UserAcceptCertificate -> handleUserAcceptCertificate(action)
|
||||
OnboardingAction.ClearHomeServerHistory -> handleClearHomeServerHistory()
|
||||
is OnboardingAction.UpdateDisplayName -> updateDisplayName(action.displayName)
|
||||
OnboardingAction.UpdateDisplayNameSkipped -> handleDisplayNameStepComplete()
|
||||
OnboardingAction.UpdateProfilePictureSkipped -> completePersonalization()
|
||||
OnboardingAction.PersonalizeProfile -> handlePersonalizeProfile()
|
||||
is OnboardingAction.ProfilePictureSelected -> handleProfilePictureSelected(action)
|
||||
OnboardingAction.SaveSelectedProfilePicture -> updateProfilePicture()
|
||||
is OnboardingAction.PostViewEvent -> _viewEvents.post(action.viewEvent)
|
||||
OnboardingAction.StopEmailValidationCheck -> cancelWaitForEmailValidation()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,8 +171,8 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
|
||||
private fun handleAuthenticateAction(action: AuthenticateAction) {
|
||||
when (action) {
|
||||
is AuthenticateAction.Register -> handleRegisterWith(action)
|
||||
is AuthenticateAction.Login -> handleLogin(action)
|
||||
is AuthenticateAction.Register -> handleRegisterWith(action)
|
||||
is AuthenticateAction.Login -> handleLogin(action)
|
||||
is AuthenticateAction.LoginDirect -> handleDirectLogin(action, homeServerConnectionConfig = null)
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
|
||||
private fun continueToPageAfterSplash(onboardingFlow: OnboardingFlow) {
|
||||
when (onboardingFlow) {
|
||||
OnboardingFlow.SignUp -> {
|
||||
OnboardingFlow.SignUp -> {
|
||||
_viewEvents.post(
|
||||
if (vectorFeatures.isOnboardingUseCaseEnabled()) {
|
||||
OnboardingViewEvents.OpenUseCaseSelection
|
||||
|
@ -193,11 +193,11 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
}
|
||||
)
|
||||
}
|
||||
OnboardingFlow.SignIn -> when {
|
||||
OnboardingFlow.SignIn -> when {
|
||||
vectorFeatures.isOnboardingCombinedLoginEnabled() -> {
|
||||
handle(OnboardingAction.HomeServerChange.SelectHomeServer(deeplinkOrDefaultHomeserverUrl()))
|
||||
}
|
||||
else -> openServerSelectionOrDeeplinkToOther()
|
||||
else -> openServerSelectionOrDeeplinkToOther()
|
||||
}
|
||||
|
||||
OnboardingFlow.SignInSignUp -> openServerSelectionOrDeeplinkToOther()
|
||||
|
@ -220,7 +220,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
?.let { it.copy(allowedFingerprints = it.allowedFingerprints + action.fingerprint) }
|
||||
?.let { startAuthenticationFlow(finalLastAction, it, serverTypeOverride = null) }
|
||||
}
|
||||
is AuthenticateAction.LoginDirect ->
|
||||
is AuthenticateAction.LoginDirect ->
|
||||
handleDirectLogin(
|
||||
finalLastAction,
|
||||
HomeServerConnectionConfig.Builder()
|
||||
|
@ -229,7 +229,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
.withAllowedFingerPrints(listOf(action.fingerprint))
|
||||
.build()
|
||||
)
|
||||
else -> Unit
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
// Allow email verification polling to coexist with other jobs
|
||||
when (action) {
|
||||
is RegisterAction.CheckIfEmailHasBeenValidated -> emailVerificationPollingJob = job
|
||||
else -> currentJob = job
|
||||
else -> currentJob = job
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,11 +288,11 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
action.ignoresResult() -> {
|
||||
// do nothing
|
||||
}
|
||||
else -> when (it) {
|
||||
is RegistrationResult.Complete -> onSessionCreated(it.session, isAccountCreated = true)
|
||||
is RegistrationResult.NextStep -> onFlowResponse(it.flowResult, onNextRegistrationStepAction)
|
||||
else -> when (it) {
|
||||
is RegistrationResult.Complete -> onSessionCreated(it.session, isAccountCreated = true)
|
||||
is RegistrationResult.NextStep -> onFlowResponse(it.flowResult, onNextRegistrationStepAction)
|
||||
is RegistrationResult.SendEmailSuccess -> _viewEvents.post(OnboardingViewEvents.OnSendEmailSuccess(it.email))
|
||||
is RegistrationResult.Error -> _viewEvents.post(OnboardingViewEvents.Failure(it.cause))
|
||||
is RegistrationResult.Error -> _viewEvents.post(OnboardingViewEvents.Failure(it.cause))
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -310,7 +310,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
state.hasSelectedMatrixOrg() && vectorFeatures.isOnboardingCombinedRegisterEnabled() -> flowResult.copy(
|
||||
missingStages = flowResult.missingStages.sortedWith(MatrixOrgRegistrationStagesComparator())
|
||||
)
|
||||
else -> flowResult
|
||||
else -> flowResult
|
||||
}
|
||||
_viewEvents.post(OnboardingViewEvents.RegistrationFlowResult(orderedResult, isRegistrationStarted))
|
||||
}
|
||||
|
@ -336,10 +336,10 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
emailVerificationPollingJob = null
|
||||
|
||||
when (action) {
|
||||
OnboardingAction.ResetHomeServerType -> {
|
||||
OnboardingAction.ResetHomeServerType -> {
|
||||
setState { copy(serverType = ServerType.Unknown) }
|
||||
}
|
||||
OnboardingAction.ResetHomeServerUrl -> {
|
||||
OnboardingAction.ResetHomeServerUrl -> {
|
||||
viewModelScope.launch {
|
||||
authenticationService.reset()
|
||||
setState {
|
||||
|
@ -350,7 +350,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
OnboardingAction.ResetSignMode -> {
|
||||
OnboardingAction.ResetSignMode -> {
|
||||
setState {
|
||||
copy(
|
||||
isLoading = false,
|
||||
|
@ -364,7 +364,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
setState { copy(isLoading = false) }
|
||||
}
|
||||
}
|
||||
OnboardingAction.ResetResetPassword -> {
|
||||
OnboardingAction.ResetResetPassword -> {
|
||||
setState {
|
||||
copy(
|
||||
isLoading = false,
|
||||
|
@ -372,17 +372,17 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
)
|
||||
}
|
||||
}
|
||||
OnboardingAction.ResetDeeplinkConfig -> loginConfig = null
|
||||
OnboardingAction.ResetDeeplinkConfig -> loginConfig = null
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleUpdateSignMode(action: OnboardingAction.UpdateSignMode) {
|
||||
updateSignMode(action.signMode)
|
||||
when (action.signMode) {
|
||||
SignMode.SignUp -> handleRegisterAction(RegisterAction.StartRegistration, ::emitFlowResultViewEvent)
|
||||
SignMode.SignIn -> startAuthenticationFlow()
|
||||
SignMode.SignUp -> handleRegisterAction(RegisterAction.StartRegistration, ::emitFlowResultViewEvent)
|
||||
SignMode.SignIn -> startAuthenticationFlow()
|
||||
SignMode.SignInWithMatrixId -> _viewEvents.post(OnboardingViewEvents.OnSignModeSelected(SignMode.SignInWithMatrixId))
|
||||
SignMode.Unknown -> Unit
|
||||
SignMode.Unknown -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -393,7 +393,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
private fun handleUpdateUseCase(action: OnboardingAction.UpdateUseCase) {
|
||||
setState { copy(useCase = action.useCase) }
|
||||
when (vectorFeatures.isOnboardingCombinedRegisterEnabled()) {
|
||||
true -> handle(OnboardingAction.HomeServerChange.SelectHomeServer(deeplinkOrDefaultHomeserverUrl()))
|
||||
true -> handle(OnboardingAction.HomeServerChange.SelectHomeServer(deeplinkOrDefaultHomeserverUrl()))
|
||||
false -> _viewEvents.post(OnboardingViewEvents.OpenServerSelection)
|
||||
}
|
||||
}
|
||||
|
@ -412,12 +412,12 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
}
|
||||
|
||||
when (action.serverType) {
|
||||
ServerType.Unknown -> Unit /* Should not happen */
|
||||
ServerType.Unknown -> Unit /* Should not happen */
|
||||
ServerType.MatrixOrg ->
|
||||
// Request login flow here
|
||||
handle(OnboardingAction.HomeServerChange.SelectHomeServer(matrixOrgUrl))
|
||||
ServerType.EMS,
|
||||
ServerType.Other -> _viewEvents.post(OnboardingViewEvents.OnServerSelectionDone(action.serverType))
|
||||
ServerType.Other -> _viewEvents.post(OnboardingViewEvents.OnServerSelectionDone(action.serverType))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -565,7 +565,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
session.configureAndStart(applicationContext)
|
||||
|
||||
when (isAccountCreated) {
|
||||
true -> {
|
||||
true -> {
|
||||
val personalizationState = createPersonalizationState(session, state)
|
||||
setState {
|
||||
copy(isLoading = false, personalizationState = personalizationState)
|
||||
|
@ -589,7 +589,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
supportsChangingProfilePicture = capabilityOverrides?.canChangeAvatar ?: homeServerCapabilities.canChangeAvatar
|
||||
)
|
||||
}
|
||||
else -> state.personalizationState
|
||||
else -> state.personalizationState
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -643,12 +643,12 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
error.isHomeserverUnavailable() && applicationContext.inferNoConnectivity(buildMeta) -> _viewEvents.post(
|
||||
OnboardingViewEvents.Failure(error)
|
||||
)
|
||||
deeplinkUrlIsUnavailable(error, trigger) -> _viewEvents.post(
|
||||
deeplinkUrlIsUnavailable(error, trigger) -> _viewEvents.post(
|
||||
OnboardingViewEvents.DeeplinkAuthenticationFailure(
|
||||
retryAction = (trigger as OnboardingAction.HomeServerChange.SelectHomeServer).resetToDefaultUrl()
|
||||
)
|
||||
)
|
||||
else -> _viewEvents.post(
|
||||
else -> _viewEvents.post(
|
||||
OnboardingViewEvents.Failure(error)
|
||||
)
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
is OnboardingAction.HomeServerChange.SelectHomeServer -> {
|
||||
onHomeServerSelected(config, serverTypeOverride, authResult)
|
||||
}
|
||||
is OnboardingAction.HomeServerChange.EditHomeServer -> {
|
||||
is OnboardingAction.HomeServerChange.EditHomeServer -> {
|
||||
onHomeServerEdited(config, serverTypeOverride, authResult)
|
||||
}
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
OnboardingFlow.SignIn -> {
|
||||
updateSignMode(SignMode.SignIn)
|
||||
when (vectorFeatures.isOnboardingCombinedLoginEnabled()) {
|
||||
true -> _viewEvents.post(OnboardingViewEvents.OpenCombinedLogin)
|
||||
true -> _viewEvents.post(OnboardingViewEvents.OpenCombinedLogin)
|
||||
false -> _viewEvents.post(OnboardingViewEvents.OnSignModeSelected(SignMode.SignIn))
|
||||
}
|
||||
}
|
||||
|
@ -697,7 +697,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
internalRegisterAction(RegisterAction.StartRegistration, ::emitFlowResultViewEvent)
|
||||
}
|
||||
OnboardingFlow.SignInSignUp,
|
||||
null -> {
|
||||
null -> {
|
||||
_viewEvents.post(OnboardingViewEvents.OnLoginFlowRetrieved)
|
||||
}
|
||||
}
|
||||
|
@ -716,7 +716,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
updateServerSelection(config, serverTypeOverride, authResult)
|
||||
_viewEvents.post(OnboardingViewEvents.OnHomeserverEdited)
|
||||
}
|
||||
else -> throw IllegalArgumentException("developer error")
|
||||
else -> throw IllegalArgumentException("developer error")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -776,9 +776,9 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
private fun handlePersonalizeProfile() {
|
||||
withPersonalisationState {
|
||||
when {
|
||||
it.supportsChangingDisplayName -> _viewEvents.post(OnboardingViewEvents.OnChooseDisplayName)
|
||||
it.supportsChangingDisplayName -> _viewEvents.post(OnboardingViewEvents.OnChooseDisplayName)
|
||||
it.supportsChangingProfilePicture -> _viewEvents.post(OnboardingViewEvents.OnChooseProfilePicture)
|
||||
else -> {
|
||||
else -> {
|
||||
throw IllegalStateException("It should not be possible to personalize without supporting display name or avatar changing")
|
||||
}
|
||||
}
|
||||
|
@ -789,7 +789,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
withPersonalisationState {
|
||||
when {
|
||||
it.supportsChangingProfilePicture -> _viewEvents.post(OnboardingViewEvents.OnChooseProfilePicture)
|
||||
else -> completePersonalization()
|
||||
else -> completePersonalization()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -853,6 +853,6 @@ private fun LoginMode.supportsSignModeScreen(): Boolean {
|
|||
is LoginMode.SsoAndPassword -> true
|
||||
is LoginMode.Sso,
|
||||
LoginMode.Unknown,
|
||||
LoginMode.Unsupported -> false
|
||||
LoginMode.Unsupported -> false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,11 +116,11 @@ class FtueAuthCombinedLoginFragment @Inject constructor(
|
|||
showUsernamePassword()
|
||||
renderSsoProviders(state.deviceId, state.selectedHomeserver.preferredLoginMode.ssoIdentityProviders)
|
||||
}
|
||||
is LoginMode.Sso -> {
|
||||
is LoginMode.Sso -> {
|
||||
hideUsernamePassword()
|
||||
renderSsoProviders(state.deviceId, state.selectedHomeserver.preferredLoginMode.ssoIdentityProviders)
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
showUsernamePassword()
|
||||
hideSsoProviders()
|
||||
}
|
||||
|
|
|
@ -129,10 +129,10 @@ class FtueAuthVariant(
|
|||
|
||||
private fun handleOnboardingViewEvents(viewEvents: OnboardingViewEvents) {
|
||||
when (viewEvents) {
|
||||
is OnboardingViewEvents.RegistrationFlowResult -> {
|
||||
is OnboardingViewEvents.RegistrationFlowResult -> {
|
||||
onRegistrationFlow(viewEvents)
|
||||
}
|
||||
is OnboardingViewEvents.OutdatedHomeserver -> {
|
||||
is OnboardingViewEvents.OutdatedHomeserver -> {
|
||||
MaterialAlertDialogBuilder(activity)
|
||||
.setTitle(R.string.login_error_outdated_homeserver_title)
|
||||
.setMessage(R.string.login_error_outdated_homeserver_warning_content)
|
||||
|
@ -140,7 +140,7 @@ class FtueAuthVariant(
|
|||
.show()
|
||||
Unit
|
||||
}
|
||||
is OnboardingViewEvents.OpenServerSelection ->
|
||||
is OnboardingViewEvents.OpenServerSelection ->
|
||||
activity.addFragmentToBackstack(views.loginFragmentContainer,
|
||||
FtueAuthServerSelectionFragment::class.java,
|
||||
option = { ft ->
|
||||
|
@ -155,22 +155,22 @@ class FtueAuthVariant(
|
|||
// findViewById<View?>(R.id.loginSplashSubmit)?.let { ft.addSharedElement(it, ViewCompat.getTransitionName(it) ?: "") }
|
||||
}
|
||||
})
|
||||
is OnboardingViewEvents.OnServerSelectionDone -> onServerSelectionDone(viewEvents)
|
||||
is OnboardingViewEvents.OnSignModeSelected -> onSignModeSelected(viewEvents)
|
||||
is OnboardingViewEvents.OnLoginFlowRetrieved ->
|
||||
is OnboardingViewEvents.OnServerSelectionDone -> onServerSelectionDone(viewEvents)
|
||||
is OnboardingViewEvents.OnSignModeSelected -> onSignModeSelected(viewEvents)
|
||||
is OnboardingViewEvents.OnLoginFlowRetrieved ->
|
||||
activity.addFragmentToBackstack(
|
||||
views.loginFragmentContainer,
|
||||
FtueAuthSignUpSignInSelectionFragment::class.java,
|
||||
option = commonOption
|
||||
)
|
||||
is OnboardingViewEvents.OnWebLoginError -> onWebLoginError(viewEvents)
|
||||
is OnboardingViewEvents.OnForgetPasswordClicked ->
|
||||
is OnboardingViewEvents.OnWebLoginError -> onWebLoginError(viewEvents)
|
||||
is OnboardingViewEvents.OnForgetPasswordClicked ->
|
||||
activity.addFragmentToBackstack(
|
||||
views.loginFragmentContainer,
|
||||
FtueAuthResetPasswordFragment::class.java,
|
||||
option = commonOption
|
||||
)
|
||||
is OnboardingViewEvents.OnResetPasswordSendThreePidDone -> {
|
||||
is OnboardingViewEvents.OnResetPasswordSendThreePidDone -> {
|
||||
supportFragmentManager.popBackStack(FRAGMENT_LOGIN_TAG, POP_BACK_STACK_EXCLUSIVE)
|
||||
activity.addFragmentToBackstack(
|
||||
views.loginFragmentContainer,
|
||||
|
@ -178,7 +178,7 @@ class FtueAuthVariant(
|
|||
option = commonOption
|
||||
)
|
||||
}
|
||||
is OnboardingViewEvents.OnResetPasswordMailConfirmationSuccess -> {
|
||||
is OnboardingViewEvents.OnResetPasswordMailConfirmationSuccess -> {
|
||||
supportFragmentManager.popBackStack(FRAGMENT_LOGIN_TAG, POP_BACK_STACK_EXCLUSIVE)
|
||||
activity.addFragmentToBackstack(
|
||||
views.loginFragmentContainer,
|
||||
|
@ -190,10 +190,10 @@ class FtueAuthVariant(
|
|||
// Go back to the login fragment
|
||||
supportFragmentManager.popBackStack(FRAGMENT_LOGIN_TAG, POP_BACK_STACK_EXCLUSIVE)
|
||||
}
|
||||
is OnboardingViewEvents.OnSendEmailSuccess -> {
|
||||
is OnboardingViewEvents.OnSendEmailSuccess -> {
|
||||
openWaitForEmailVerification(viewEvents.email)
|
||||
}
|
||||
is OnboardingViewEvents.OnSendMsisdnSuccess -> {
|
||||
is OnboardingViewEvents.OnSendMsisdnSuccess -> {
|
||||
// Pop the enter Msisdn Fragment
|
||||
supportFragmentManager.popBackStack(FRAGMENT_REGISTRATION_STAGE_TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
addRegistrationStageFragmentToBackstack(
|
||||
|
@ -202,34 +202,34 @@ class FtueAuthVariant(
|
|||
)
|
||||
}
|
||||
is OnboardingViewEvents.Failure,
|
||||
is OnboardingViewEvents.Loading ->
|
||||
is OnboardingViewEvents.Loading ->
|
||||
// This is handled by the Fragments
|
||||
Unit
|
||||
OnboardingViewEvents.OpenUseCaseSelection -> {
|
||||
OnboardingViewEvents.OpenUseCaseSelection -> {
|
||||
activity.addFragmentToBackstack(
|
||||
views.loginFragmentContainer,
|
||||
FtueAuthUseCaseFragment::class.java,
|
||||
option = commonOption
|
||||
)
|
||||
}
|
||||
OnboardingViewEvents.OpenCombinedRegister -> openStartCombinedRegister()
|
||||
is OnboardingViewEvents.OnAccountCreated -> onAccountCreated()
|
||||
OnboardingViewEvents.OnAccountSignedIn -> onAccountSignedIn()
|
||||
OnboardingViewEvents.OnChooseDisplayName -> onChooseDisplayName()
|
||||
OnboardingViewEvents.OnTakeMeHome -> navigateToHome(createdAccount = true)
|
||||
OnboardingViewEvents.OnChooseProfilePicture -> onChooseProfilePicture()
|
||||
OnboardingViewEvents.OnPersonalizationComplete -> onPersonalizationComplete()
|
||||
OnboardingViewEvents.OnBack -> activity.popBackstack()
|
||||
OnboardingViewEvents.EditServerSelection -> {
|
||||
OnboardingViewEvents.OpenCombinedRegister -> openStartCombinedRegister()
|
||||
is OnboardingViewEvents.OnAccountCreated -> onAccountCreated()
|
||||
OnboardingViewEvents.OnAccountSignedIn -> onAccountSignedIn()
|
||||
OnboardingViewEvents.OnChooseDisplayName -> onChooseDisplayName()
|
||||
OnboardingViewEvents.OnTakeMeHome -> navigateToHome(createdAccount = true)
|
||||
OnboardingViewEvents.OnChooseProfilePicture -> onChooseProfilePicture()
|
||||
OnboardingViewEvents.OnPersonalizationComplete -> onPersonalizationComplete()
|
||||
OnboardingViewEvents.OnBack -> activity.popBackstack()
|
||||
OnboardingViewEvents.EditServerSelection -> {
|
||||
activity.addFragmentToBackstack(
|
||||
views.loginFragmentContainer,
|
||||
FtueAuthCombinedServerSelectionFragment::class.java,
|
||||
option = commonOption
|
||||
)
|
||||
}
|
||||
OnboardingViewEvents.OnHomeserverEdited -> activity.popBackstack()
|
||||
OnboardingViewEvents.OpenCombinedLogin -> onStartCombinedLogin()
|
||||
is OnboardingViewEvents.DeeplinkAuthenticationFailure -> onDeeplinkedHomeserverUnavailable(viewEvents)
|
||||
OnboardingViewEvents.OnHomeserverEdited -> activity.popBackstack()
|
||||
OnboardingViewEvents.OpenCombinedLogin -> onStartCombinedLogin()
|
||||
is OnboardingViewEvents.DeeplinkAuthenticationFailure -> onDeeplinkedHomeserverUnavailable(viewEvents)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,10 +255,10 @@ class FtueAuthVariant(
|
|||
|
||||
private fun onRegistrationFlow(viewEvents: OnboardingViewEvents.RegistrationFlowResult) {
|
||||
when {
|
||||
registrationShouldFallback(viewEvents) -> displayFallbackWebDialog()
|
||||
viewEvents.isRegistrationStarted -> handleRegistrationNavigation(viewEvents.flowResult.missingStages)
|
||||
registrationShouldFallback(viewEvents) -> displayFallbackWebDialog()
|
||||
viewEvents.isRegistrationStarted -> handleRegistrationNavigation(viewEvents.flowResult.missingStages)
|
||||
vectorFeatures.isOnboardingCombinedRegisterEnabled() -> openStartCombinedRegister()
|
||||
else -> openAuthLoginFragmentWithTag(FRAGMENT_REGISTRATION_STAGE_TAG)
|
||||
else -> openAuthLoginFragmentWithTag(FRAGMENT_REGISTRATION_STAGE_TAG)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,21 +303,21 @@ class FtueAuthVariant(
|
|||
when (onboardingViewEvents.serverType) {
|
||||
ServerType.MatrixOrg -> Unit // In this case, we wait for the login flow
|
||||
ServerType.EMS,
|
||||
ServerType.Other -> activity.addFragmentToBackstack(
|
||||
ServerType.Other -> activity.addFragmentToBackstack(
|
||||
views.loginFragmentContainer,
|
||||
FtueAuthServerUrlFormFragment::class.java,
|
||||
option = commonOption
|
||||
)
|
||||
ServerType.Unknown -> Unit /* Should not happen */
|
||||
ServerType.Unknown -> Unit /* Should not happen */
|
||||
}
|
||||
}
|
||||
|
||||
private fun onSignModeSelected(onboardingViewEvents: OnboardingViewEvents.OnSignModeSelected) = withState(onboardingViewModel) { state ->
|
||||
// state.signMode could not be ready yet. So use value from the ViewEvent
|
||||
when (onboardingViewEvents.signMode) {
|
||||
SignMode.Unknown -> error("Sign mode has to be set before calling this method")
|
||||
SignMode.SignUp -> Unit // This case is processed in handleOnboardingViewEvents
|
||||
SignMode.SignIn -> handleSignInSelected(state)
|
||||
SignMode.Unknown -> error("Sign mode has to be set before calling this method")
|
||||
SignMode.SignUp -> Unit // This case is processed in handleOnboardingViewEvents
|
||||
SignMode.SignIn -> handleSignInSelected(state)
|
||||
SignMode.SignInWithMatrixId -> handleSignInWithMatrixId(state)
|
||||
}
|
||||
}
|
||||
|
@ -332,9 +332,9 @@ class FtueAuthVariant(
|
|||
|
||||
private fun disambiguateLoginMode(state: OnboardingViewState) = when (state.selectedHomeserver.preferredLoginMode) {
|
||||
LoginMode.Unknown,
|
||||
is LoginMode.Sso -> error("Developer error")
|
||||
is LoginMode.Sso -> error("Developer error")
|
||||
is LoginMode.SsoAndPassword,
|
||||
LoginMode.Password -> openAuthLoginFragmentWithTag(FRAGMENT_LOGIN_TAG)
|
||||
LoginMode.Password -> openAuthLoginFragmentWithTag(FRAGMENT_LOGIN_TAG)
|
||||
LoginMode.Unsupported -> onLoginModeNotSupported(state.selectedHomeserver.supportedLoginTypes)
|
||||
}
|
||||
|
||||
|
@ -404,13 +404,13 @@ class FtueAuthVariant(
|
|||
|
||||
when (stage) {
|
||||
is Stage.ReCaptcha -> onCaptcha(stage)
|
||||
is Stage.Email -> onEmail(stage)
|
||||
is Stage.Msisdn -> addRegistrationStageFragmentToBackstack(
|
||||
is Stage.Email -> onEmail(stage)
|
||||
is Stage.Msisdn -> addRegistrationStageFragmentToBackstack(
|
||||
FtueAuthGenericTextInputFormFragment::class.java,
|
||||
FtueAuthGenericTextInputFormFragmentArgument(TextInputFormFragmentMode.SetMsisdn, stage.mandatory),
|
||||
)
|
||||
is Stage.Terms -> onTerms(stage)
|
||||
else -> Unit // Should not happen
|
||||
is Stage.Terms -> onTerms(stage)
|
||||
else -> Unit // Should not happen
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,7 +419,7 @@ class FtueAuthVariant(
|
|||
vectorFeatures.isOnboardingCombinedRegisterEnabled() -> addRegistrationStageFragmentToBackstack(
|
||||
FtueAuthEmailEntryFragment::class.java
|
||||
)
|
||||
else -> addRegistrationStageFragmentToBackstack(
|
||||
else -> addRegistrationStageFragmentToBackstack(
|
||||
FtueAuthGenericTextInputFormFragment::class.java,
|
||||
FtueAuthGenericTextInputFormFragmentArgument(TextInputFormFragmentMode.SetEmail, stage.mandatory),
|
||||
)
|
||||
|
@ -433,7 +433,7 @@ class FtueAuthVariant(
|
|||
FtueAuthWaitForEmailFragment::class.java,
|
||||
FtueAuthWaitForEmailFragmentArgument(email),
|
||||
)
|
||||
else -> addRegistrationStageFragmentToBackstack(
|
||||
else -> addRegistrationStageFragmentToBackstack(
|
||||
FtueAuthLegacyWaitForEmailFragment::class.java,
|
||||
FtueAuthWaitForEmailFragmentArgument(email),
|
||||
)
|
||||
|
@ -446,7 +446,7 @@ class FtueAuthVariant(
|
|||
FtueAuthTermsFragment::class.java,
|
||||
FtueAuthTermsLegacyStyleFragmentArgument(stage.policies.toLocalizedLoginTerms(activity.getString(R.string.resources_language))),
|
||||
)
|
||||
else -> addRegistrationStageFragmentToBackstack(
|
||||
else -> addRegistrationStageFragmentToBackstack(
|
||||
FtueAuthLegacyStyleTermsFragment::class.java,
|
||||
FtueAuthTermsLegacyStyleFragmentArgument(stage.policies.toLocalizedLoginTerms(activity.getString(R.string.resources_language))),
|
||||
)
|
||||
|
@ -459,7 +459,7 @@ class FtueAuthVariant(
|
|||
FtueAuthCaptchaFragment::class.java,
|
||||
FtueAuthCaptchaFragmentArgument(stage.publicKey),
|
||||
)
|
||||
else -> addRegistrationStageFragmentToBackstack(
|
||||
else -> addRegistrationStageFragmentToBackstack(
|
||||
FtueAuthLegacyStyleCaptchaFragment::class.java,
|
||||
FtueAuthLegacyStyleCaptchaFragmentArgument(stage.publicKey),
|
||||
)
|
||||
|
|
|
@ -31,16 +31,16 @@ class LoginErrorParser @Inject constructor(
|
|||
) {
|
||||
fun parse(throwable: Throwable, password: String): LoginErrorResult {
|
||||
return when {
|
||||
throwable.isInvalidUsername() -> {
|
||||
throwable.isInvalidUsername() -> {
|
||||
LoginErrorResult(throwable, usernameOrIdError = errorFormatter.toHumanReadable(throwable))
|
||||
}
|
||||
throwable.isLoginEmailUnknown() -> {
|
||||
throwable.isLoginEmailUnknown() -> {
|
||||
LoginErrorResult(throwable, usernameOrIdError = stringProvider.getString(R.string.login_login_with_email_error))
|
||||
}
|
||||
throwable.isInvalidPassword() && password.hasSurroundingSpaces() -> {
|
||||
LoginErrorResult(throwable, passwordError = stringProvider.getString(R.string.auth_invalid_login_param_space_in_password))
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
LoginErrorResult(throwable)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class LoginFieldsValidation @Inject constructor(
|
|||
private fun validateUsernameOrId(usernameOrId: String): String? {
|
||||
val accountError = when {
|
||||
usernameOrId.isEmpty() -> stringProvider.getString(R.string.error_empty_field_enter_user_name)
|
||||
else -> null
|
||||
else -> null
|
||||
}
|
||||
return accountError
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class LoginFieldsValidation @Inject constructor(
|
|||
private fun validatePassword(password: String): String? {
|
||||
val passwordError = when {
|
||||
password.isEmpty() -> stringProvider.getString(R.string.error_empty_field_your_password)
|
||||
else -> null
|
||||
else -> null
|
||||
}
|
||||
return passwordError
|
||||
}
|
||||
|
|
|
@ -79,8 +79,8 @@ class WebviewPermissionUtils @Inject constructor(
|
|||
fun onPermissionResult(result: Map<String, Boolean>) {
|
||||
if (permissionRequest == null) {
|
||||
fatalError(
|
||||
message = "permissionRequest was null! Make sure to call promptForPermissions first.",
|
||||
failFast = vectorPreferences.failFast()
|
||||
message = "permissionRequest was null! Make sure to call promptForPermissions first.",
|
||||
failFast = vectorPreferences.failFast()
|
||||
)
|
||||
return
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ class WebviewPermissionUtils @Inject constructor(
|
|||
return when (permission) {
|
||||
PermissionRequest.RESOURCE_AUDIO_CAPTURE -> Manifest.permission.RECORD_AUDIO
|
||||
PermissionRequest.RESOURCE_VIDEO_CAPTURE -> Manifest.permission.CAMERA
|
||||
else -> null
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@ class WebviewPermissionUtilsTest {
|
|||
fun filterPermissionsToBeGranted_selectedAndGrantedNothing() {
|
||||
val permissions = utils.filterPermissionsToBeGranted(
|
||||
selectedWebPermissions = listOf(),
|
||||
androidPermissionResult = mapOf())
|
||||
androidPermissionResult = mapOf()
|
||||
)
|
||||
permissions shouldBeEqualTo listOf()
|
||||
}
|
||||
|
||||
|
@ -46,7 +47,8 @@ class WebviewPermissionUtilsTest {
|
|||
fun filterPermissionsToBeGranted_selectedNothingGrantedCamera() {
|
||||
val permissions = utils.filterPermissionsToBeGranted(
|
||||
selectedWebPermissions = listOf(),
|
||||
androidPermissionResult = mapOf(Manifest.permission.CAMERA to true))
|
||||
androidPermissionResult = mapOf(Manifest.permission.CAMERA to true)
|
||||
)
|
||||
permissions shouldBeEqualTo listOf()
|
||||
}
|
||||
|
||||
|
@ -54,7 +56,8 @@ class WebviewPermissionUtilsTest {
|
|||
fun filterPermissionsToBeGranted_selectedAndPreviouslyGrantedCamera() {
|
||||
val permissions = utils.filterPermissionsToBeGranted(
|
||||
selectedWebPermissions = listOf(PermissionRequest.RESOURCE_VIDEO_CAPTURE),
|
||||
androidPermissionResult = mapOf())
|
||||
androidPermissionResult = mapOf()
|
||||
)
|
||||
permissions shouldBeEqualTo listOf(PermissionRequest.RESOURCE_VIDEO_CAPTURE)
|
||||
}
|
||||
|
||||
|
@ -62,7 +65,8 @@ class WebviewPermissionUtilsTest {
|
|||
fun filterPermissionsToBeGranted_selectedAndGrantedCamera() {
|
||||
val permissions = utils.filterPermissionsToBeGranted(
|
||||
selectedWebPermissions = listOf(PermissionRequest.RESOURCE_VIDEO_CAPTURE),
|
||||
androidPermissionResult = mapOf(Manifest.permission.CAMERA to true))
|
||||
androidPermissionResult = mapOf(Manifest.permission.CAMERA to true)
|
||||
)
|
||||
permissions shouldBeEqualTo listOf(PermissionRequest.RESOURCE_VIDEO_CAPTURE)
|
||||
}
|
||||
|
||||
|
@ -70,7 +74,8 @@ class WebviewPermissionUtilsTest {
|
|||
fun filterPermissionsToBeGranted_selectedAndDeniedCamera() {
|
||||
val permissions = utils.filterPermissionsToBeGranted(
|
||||
selectedWebPermissions = listOf(PermissionRequest.RESOURCE_VIDEO_CAPTURE),
|
||||
androidPermissionResult = mapOf(Manifest.permission.CAMERA to false))
|
||||
androidPermissionResult = mapOf(Manifest.permission.CAMERA to false)
|
||||
)
|
||||
permissions shouldBeEqualTo listOf()
|
||||
}
|
||||
|
||||
|
@ -78,7 +83,8 @@ class WebviewPermissionUtilsTest {
|
|||
fun filterPermissionsToBeGranted_selectedProtectedMediaGrantedNothing() {
|
||||
val permissions = utils.filterPermissionsToBeGranted(
|
||||
selectedWebPermissions = listOf(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID),
|
||||
androidPermissionResult = mapOf(Manifest.permission.CAMERA to false))
|
||||
androidPermissionResult = mapOf(Manifest.permission.CAMERA to false)
|
||||
)
|
||||
permissions shouldBeEqualTo listOf(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue