Fix compilation warning (exhaustive when)
This commit is contained in:
parent
7502158ba9
commit
57bee40211
@ -83,6 +83,7 @@ class PushRulePreference : VectorPreference {
|
|||||||
NotificationIndex.NOISY -> {
|
NotificationIndex.NOISY -> {
|
||||||
radioGroup?.check(R.id.bingPreferenceRadioBingRuleNoisy)
|
radioGroup?.check(R.id.bingPreferenceRadioBingRuleNoisy)
|
||||||
}
|
}
|
||||||
|
null -> Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
radioGroup?.setOnCheckedChangeListener { _, checkedId ->
|
radioGroup?.setOnCheckedChangeListener { _, checkedId ->
|
||||||
|
@ -77,13 +77,10 @@ class KeysBackupBanner @JvmOverloads constructor(
|
|||||||
|
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
when (state) {
|
when (state) {
|
||||||
is State.Setup -> {
|
is State.Setup -> delegate?.setupKeysBackup()
|
||||||
delegate?.setupKeysBackup()
|
|
||||||
}
|
|
||||||
is State.Update,
|
is State.Update,
|
||||||
is State.Recover -> {
|
is State.Recover -> delegate?.recoverKeysBackup()
|
||||||
delegate?.recoverKeysBackup()
|
else -> Unit
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ class PresenceStateImageView @JvmOverloads constructor(
|
|||||||
setImageResource(R.drawable.ic_presence_offline)
|
setImageResource(R.drawable.ic_presence_offline)
|
||||||
contentDescription = context.getString(R.string.a11y_presence_offline)
|
contentDescription = context.getString(R.string.a11y_presence_offline)
|
||||||
}
|
}
|
||||||
|
null -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,21 +40,21 @@ class ShieldImageView @JvmOverloads constructor(
|
|||||||
isVisible = roomEncryptionTrustLevel != null
|
isVisible = roomEncryptionTrustLevel != null
|
||||||
|
|
||||||
when (roomEncryptionTrustLevel) {
|
when (roomEncryptionTrustLevel) {
|
||||||
RoomEncryptionTrustLevel.Default -> {
|
RoomEncryptionTrustLevel.Default -> {
|
||||||
contentDescription = context.getString(R.string.a11y_trust_level_default)
|
contentDescription = context.getString(R.string.a11y_trust_level_default)
|
||||||
setImageResource(
|
setImageResource(
|
||||||
if (borderLess) R.drawable.ic_shield_black_no_border
|
if (borderLess) R.drawable.ic_shield_black_no_border
|
||||||
else R.drawable.ic_shield_black
|
else R.drawable.ic_shield_black
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
RoomEncryptionTrustLevel.Warning -> {
|
RoomEncryptionTrustLevel.Warning -> {
|
||||||
contentDescription = context.getString(R.string.a11y_trust_level_warning)
|
contentDescription = context.getString(R.string.a11y_trust_level_warning)
|
||||||
setImageResource(
|
setImageResource(
|
||||||
if (borderLess) R.drawable.ic_shield_warning_no_border
|
if (borderLess) R.drawable.ic_shield_warning_no_border
|
||||||
else R.drawable.ic_shield_warning
|
else R.drawable.ic_shield_warning
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
RoomEncryptionTrustLevel.Trusted -> {
|
RoomEncryptionTrustLevel.Trusted -> {
|
||||||
contentDescription = context.getString(R.string.a11y_trust_level_trusted)
|
contentDescription = context.getString(R.string.a11y_trust_level_trusted)
|
||||||
setImageResource(
|
setImageResource(
|
||||||
if (borderLess) R.drawable.ic_shield_trusted_no_border
|
if (borderLess) R.drawable.ic_shield_trusted_no_border
|
||||||
@ -65,6 +65,7 @@ class ShieldImageView @JvmOverloads constructor(
|
|||||||
contentDescription = context.getString(R.string.a11y_trust_level_trusted)
|
contentDescription = context.getString(R.string.a11y_trust_level_trusted)
|
||||||
setImageResource(R.drawable.ic_warning_badge)
|
setImageResource(R.drawable.ic_warning_badge)
|
||||||
}
|
}
|
||||||
|
null -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,9 +73,9 @@ class ShieldImageView @JvmOverloads constructor(
|
|||||||
@DrawableRes
|
@DrawableRes
|
||||||
fun RoomEncryptionTrustLevel.toDrawableRes(): Int {
|
fun RoomEncryptionTrustLevel.toDrawableRes(): Int {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
RoomEncryptionTrustLevel.Default -> R.drawable.ic_shield_black
|
RoomEncryptionTrustLevel.Default -> R.drawable.ic_shield_black
|
||||||
RoomEncryptionTrustLevel.Warning -> R.drawable.ic_shield_warning
|
RoomEncryptionTrustLevel.Warning -> R.drawable.ic_shield_warning
|
||||||
RoomEncryptionTrustLevel.Trusted -> R.drawable.ic_shield_trusted
|
RoomEncryptionTrustLevel.Trusted -> R.drawable.ic_shield_trusted
|
||||||
RoomEncryptionTrustLevel.E2EWithUnsupportedAlgorithm -> R.drawable.ic_warning_badge
|
RoomEncryptionTrustLevel.E2EWithUnsupportedAlgorithm -> R.drawable.ic_warning_badge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,7 @@ class CallControlsView @JvmOverloads constructor(
|
|||||||
views.ringingControls.isVisible = false
|
views.ringingControls.isVisible = false
|
||||||
views.connectedControls.isVisible = false
|
views.connectedControls.isVisible = false
|
||||||
}
|
}
|
||||||
|
null -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,8 +525,7 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||||||
navigator.openCallTransfer(this, callTransferActivityResultLauncher, callId)
|
navigator.openCallTransfer(this, callTransferActivityResultLauncher, callId)
|
||||||
}
|
}
|
||||||
is VectorCallViewEvents.FailToTransfer -> showSnackbar(getString(R.string.call_transfer_failure))
|
is VectorCallViewEvents.FailToTransfer -> showSnackbar(getString(R.string.call_transfer_failure))
|
||||||
null -> {
|
else -> Unit
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ import com.airbnb.mvrx.Async
|
|||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.viewModel
|
import com.airbnb.mvrx.viewModel
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
@ -167,6 +168,7 @@ class CreateDirectRoomActivity : SimpleFragmentActivity() {
|
|||||||
|
|
||||||
private fun renderCreateAndInviteState(state: Async<String>) {
|
private fun renderCreateAndInviteState(state: Async<String>) {
|
||||||
when (state) {
|
when (state) {
|
||||||
|
Uninitialized,
|
||||||
is Loading -> renderCreationLoading()
|
is Loading -> renderCreationLoading()
|
||||||
is Success -> renderCreationSuccess(state())
|
is Success -> renderCreationSuccess(state())
|
||||||
is Fail -> renderCreationFailure(state.error)
|
is Fail -> renderCreationFailure(state.error)
|
||||||
|
@ -140,6 +140,7 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(
|
|||||||
|
|
||||||
isBackupAlreadySetup = true
|
isBackupAlreadySetup = true
|
||||||
}
|
}
|
||||||
|
null -> Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBackupAlreadySetup) {
|
if (isBackupAlreadySetup) {
|
||||||
|
@ -116,12 +116,13 @@ class SharedSecureStorageActivity :
|
|||||||
is SharedSecureStorageViewEvent.FinishSuccess -> {
|
is SharedSecureStorageViewEvent.FinishSuccess -> {
|
||||||
val dataResult = Intent()
|
val dataResult = Intent()
|
||||||
dataResult.putExtra(EXTRA_DATA_RESULT, it.cypherResult)
|
dataResult.putExtra(EXTRA_DATA_RESULT, it.cypherResult)
|
||||||
setResult(Activity.RESULT_OK, dataResult)
|
setResult(RESULT_OK, dataResult)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
is SharedSecureStorageViewEvent.ShowResetBottomSheet -> {
|
is SharedSecureStorageViewEvent.ShowResetBottomSheet -> {
|
||||||
navigator.open4SSetup(this, SetupMode.HARD_RESET)
|
navigator.open4SSetup(this, SetupMode.HARD_RESET)
|
||||||
}
|
}
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@ class SharedSecuredStorageKeyFragment @Inject constructor() : VectorBaseFragment
|
|||||||
is SharedSecureStorageViewEvent.KeyInlineError -> {
|
is SharedSecureStorageViewEvent.KeyInlineError -> {
|
||||||
views.ssssKeyEnterTil.error = it.message
|
views.ssssKeyEnterTil.error = it.message
|
||||||
}
|
}
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@ class SharedSecuredStoragePassphraseFragment @Inject constructor(
|
|||||||
is SharedSecureStorageViewEvent.InlineError -> {
|
is SharedSecureStorageViewEvent.InlineError -> {
|
||||||
views.ssssPassphraseEnterTil.error = it.message
|
views.ssssPassphraseEnterTil.error = it.message
|
||||||
}
|
}
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,6 +252,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
|||||||
VerificationConclusionFragment.Args(false, state.sasTransactionState.cancelCode.value, state.isMe)
|
VerificationConclusionFragment.Args(false, state.sasTransactionState.cancelCode.value, state.isMe)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
return@withState
|
return@withState
|
||||||
|
@ -139,6 +139,7 @@ class VerificationEmojiCodeViewModel @AssistedInject constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ package im.vector.app.features.crypto.verification.request
|
|||||||
|
|
||||||
import androidx.core.text.toSpannable
|
import androidx.core.text.toSpannable
|
||||||
import com.airbnb.epoxy.EpoxyController
|
import com.airbnb.epoxy.EpoxyController
|
||||||
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
@ -153,6 +154,7 @@ class VerificationRequestController @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
is Fail -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ class DiscoverySettingsController @Inject constructor(
|
|||||||
|
|
||||||
override fun buildModels(data: DiscoverySettingsState) {
|
override fun buildModels(data: DiscoverySettingsState) {
|
||||||
when (data.identityServer) {
|
when (data.identityServer) {
|
||||||
|
Uninitialized,
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("identityServerLoading")
|
id("identityServerLoading")
|
||||||
@ -209,18 +210,19 @@ class DiscoverySettingsController @Inject constructor(
|
|||||||
titleResId(R.string.settings_discovery_emails_title)
|
titleResId(R.string.settings_discovery_emails_title)
|
||||||
}
|
}
|
||||||
when (emails) {
|
when (emails) {
|
||||||
is Incomplete -> {
|
Uninitialized,
|
||||||
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("emailsLoading")
|
id("emailsLoading")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("emailsError")
|
id("emailsError")
|
||||||
helperText(emails.error.message)
|
helperText(emails.error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
if (emails().isEmpty()) {
|
if (emails().isEmpty()) {
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("emailsEmpty")
|
id("emailsEmpty")
|
||||||
@ -277,18 +279,19 @@ class DiscoverySettingsController @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
when (msisdns) {
|
when (msisdns) {
|
||||||
is Incomplete -> {
|
Uninitialized,
|
||||||
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("msisdnLoading")
|
id("msisdnLoading")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("msisdnListError")
|
id("msisdnListError")
|
||||||
helperText(msisdns.error.message)
|
helperText(msisdns.error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
if (msisdns().isEmpty()) {
|
if (msisdns().isEmpty()) {
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("no_msisdn")
|
id("no_msisdn")
|
||||||
@ -353,6 +356,7 @@ class DiscoverySettingsController @Inject constructor(
|
|||||||
colorProvider(host.colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
stringProvider(host.stringProvider)
|
stringProvider(host.stringProvider)
|
||||||
when (pidInfo.isShared) {
|
when (pidInfo.isShared) {
|
||||||
|
Uninitialized,
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
buttonIndeterminate(true)
|
buttonIndeterminate(true)
|
||||||
}
|
}
|
||||||
@ -384,6 +388,7 @@ class DiscoverySettingsController @Inject constructor(
|
|||||||
else -> iconMode(IconMode.NONE)
|
else -> iconMode(IconMode.NONE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
null -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,6 +273,7 @@ class HomeDetailViewModel @AssistedInject constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
null -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.launchIn(viewModelScope)
|
.launchIn(viewModelScope)
|
||||||
|
@ -1782,6 +1782,7 @@ class TimelineFragment @Inject constructor(
|
|||||||
transactionId = data.transactionId,
|
transactionId = data.transactionId,
|
||||||
).show(parentFragmentManager, "REQ")
|
).show(parentFragmentManager, "REQ")
|
||||||
}
|
}
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2236,6 +2237,8 @@ class TimelineFragment @Inject constructor(
|
|||||||
is EventSharedAction.EndPoll -> {
|
is EventSharedAction.EndPoll -> {
|
||||||
askConfirmationToEndPoll(action.eventId)
|
askConfirmationToEndPoll(action.eventId)
|
||||||
}
|
}
|
||||||
|
is EventSharedAction.ReportContent -> Unit /* Not clickable */
|
||||||
|
EventSharedAction.Separator -> Unit /* Not clickable */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,9 +95,10 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||||||
override fun onDeleteVoiceMessage() = callback.onDeleteVoiceMessage()
|
override fun onDeleteVoiceMessage() = callback.onDeleteVoiceMessage()
|
||||||
override fun onWaveformClicked() {
|
override fun onWaveformClicked() {
|
||||||
when (lastKnownState) {
|
when (lastKnownState) {
|
||||||
RecordingUiState.Draft -> callback.onVoicePlaybackButtonClicked()
|
RecordingUiState.Draft -> callback.onVoicePlaybackButtonClicked()
|
||||||
is RecordingUiState.Recording,
|
is RecordingUiState.Recording,
|
||||||
is RecordingUiState.Locked -> callback.onRecordingWaveformClicked()
|
is RecordingUiState.Locked -> callback.onRecordingWaveformClicked()
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +120,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||||||
fun render(recordingState: RecordingUiState) {
|
fun render(recordingState: RecordingUiState) {
|
||||||
if (lastKnownState == recordingState) return
|
if (lastKnownState == recordingState) return
|
||||||
when (recordingState) {
|
when (recordingState) {
|
||||||
RecordingUiState.Idle -> {
|
RecordingUiState.Idle -> {
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
is RecordingUiState.Recording -> {
|
is RecordingUiState.Recording -> {
|
||||||
@ -137,7 +138,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||||||
voiceMessageViews.showRecordingLockedViews(recordingState)
|
voiceMessageViews.showRecordingLockedViews(recordingState)
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
RecordingUiState.Draft -> {
|
RecordingUiState.Draft -> {
|
||||||
stopRecordingTicker()
|
stopRecordingTicker()
|
||||||
voiceMessageViews.showDraftViews()
|
voiceMessageViews.showDraftViews()
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.args
|
import com.airbnb.mvrx.args
|
||||||
import com.airbnb.mvrx.fragmentViewModel
|
import com.airbnb.mvrx.fragmentViewModel
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
@ -88,6 +89,7 @@ class SearchFragment @Inject constructor(
|
|||||||
override fun invalidate() = withState(searchViewModel) { state ->
|
override fun invalidate() = withState(searchViewModel) { state ->
|
||||||
if (state.searchResult.isNullOrEmpty()) {
|
if (state.searchResult.isNullOrEmpty()) {
|
||||||
when (state.asyncSearchRequest) {
|
when (state.asyncSearchRequest) {
|
||||||
|
Uninitialized,
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
views.stateView.state = StateView.State.Loading
|
views.stateView.state = StateView.State.Loading
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,9 @@ package im.vector.app.features.home.room.detail.timeline.edithistory
|
|||||||
import android.text.Spannable
|
import android.text.Spannable
|
||||||
import com.airbnb.epoxy.TypedEpoxyController
|
import com.airbnb.epoxy.TypedEpoxyController
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Incomplete
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.date.DateFormatKind
|
import im.vector.app.core.date.DateFormatKind
|
||||||
import im.vector.app.core.date.VectorDateFormatter
|
import im.vector.app.core.date.VectorDateFormatter
|
||||||
@ -54,18 +55,19 @@ class ViewEditHistoryEpoxyController @Inject constructor(
|
|||||||
override fun buildModels(state: ViewEditHistoryViewState) {
|
override fun buildModels(state: ViewEditHistoryViewState) {
|
||||||
val host = this
|
val host = this
|
||||||
when (state.editList) {
|
when (state.editList) {
|
||||||
is Incomplete -> {
|
Uninitialized,
|
||||||
|
is Loading -> {
|
||||||
genericLoaderItem {
|
genericLoaderItem {
|
||||||
id("Spinner")
|
id("Spinner")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("failure")
|
id("failure")
|
||||||
text(host.stringProvider.getString(R.string.unknown_error).toEpoxyCharSequence())
|
text(host.stringProvider.getString(R.string.unknown_error).toEpoxyCharSequence())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
state.editList()?.let { renderEvents(it, state.isOriginalAReply) }
|
state.editList()?.let { renderEvents(it, state.isOriginalAReply) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,9 +96,10 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
|
|||||||
voiceMessagePlaybackTracker.track(attributes.informationData.eventId, object : VoiceMessagePlaybackTracker.Listener {
|
voiceMessagePlaybackTracker.track(attributes.informationData.eventId, object : VoiceMessagePlaybackTracker.Listener {
|
||||||
override fun onUpdate(state: VoiceMessagePlaybackTracker.Listener.State) {
|
override fun onUpdate(state: VoiceMessagePlaybackTracker.Listener.State) {
|
||||||
when (state) {
|
when (state) {
|
||||||
is VoiceMessagePlaybackTracker.Listener.State.Idle -> renderIdleState(holder)
|
is VoiceMessagePlaybackTracker.Listener.State.Idle -> renderIdleState(holder)
|
||||||
is VoiceMessagePlaybackTracker.Listener.State.Playing -> renderPlayingState(holder, state)
|
is VoiceMessagePlaybackTracker.Listener.State.Playing -> renderPlayingState(holder, state)
|
||||||
is VoiceMessagePlaybackTracker.Listener.State.Paused -> renderPausedState(holder, state)
|
is VoiceMessagePlaybackTracker.Listener.State.Paused -> renderPausedState(holder, state)
|
||||||
|
is VoiceMessagePlaybackTracker.Listener.State.Recording -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -18,8 +18,9 @@ package im.vector.app.features.home.room.detail.timeline.reactions
|
|||||||
|
|
||||||
import com.airbnb.epoxy.TypedEpoxyController
|
import com.airbnb.epoxy.TypedEpoxyController
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Incomplete
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import im.vector.app.EmojiSpanify
|
import im.vector.app.EmojiSpanify
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
@ -41,18 +42,19 @@ class ViewReactionsEpoxyController @Inject constructor(
|
|||||||
override fun buildModels(state: DisplayReactionsViewState) {
|
override fun buildModels(state: DisplayReactionsViewState) {
|
||||||
val host = this
|
val host = this
|
||||||
when (state.mapReactionKeyToMemberList) {
|
when (state.mapReactionKeyToMemberList) {
|
||||||
is Incomplete -> {
|
Uninitialized,
|
||||||
|
is Loading -> {
|
||||||
genericLoaderItem {
|
genericLoaderItem {
|
||||||
id("Spinner")
|
id("Spinner")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("failure")
|
id("failure")
|
||||||
text(host.stringProvider.getString(R.string.unknown_error).toEpoxyCharSequence())
|
text(host.stringProvider.getString(R.string.unknown_error).toEpoxyCharSequence())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
state.mapReactionKeyToMemberList()?.forEach { reactionInfo ->
|
state.mapReactionKeyToMemberList()?.forEach { reactionInfo ->
|
||||||
reactionInfoSimpleItem {
|
reactionInfoSimpleItem {
|
||||||
id(reactionInfo.eventId)
|
id(reactionInfo.eventId)
|
||||||
|
@ -29,6 +29,7 @@ import androidx.lifecycle.lifecycleScope
|
|||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.extensions.exhaustive
|
import im.vector.app.core.extensions.exhaustive
|
||||||
import im.vector.app.core.extensions.hideKeyboard
|
import im.vector.app.core.extensions.hideKeyboard
|
||||||
@ -269,6 +270,7 @@ class LoginFragment @Inject constructor() : AbstractSSOLoginFragment<FragmentLog
|
|||||||
setupButtons(state)
|
setupButtons(state)
|
||||||
|
|
||||||
when (state.asyncLoginAction) {
|
when (state.asyncLoginAction) {
|
||||||
|
Uninitialized,
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
// Ensure password is hidden
|
// Ensure password is hidden
|
||||||
views.passwordField.hidePassword()
|
views.passwordField.hidePassword()
|
||||||
@ -300,7 +302,7 @@ class LoginFragment @Inject constructor() : AbstractSSOLoginFragment<FragmentLog
|
|||||||
views.passwordField.hidePassword()
|
views.passwordField.hidePassword()
|
||||||
}
|
}
|
||||||
// Success is handled by the LoginActivity
|
// Success is handled by the LoginActivity
|
||||||
is Success -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ import android.view.ViewGroup
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.extensions.hideKeyboard
|
import im.vector.app.core.extensions.hideKeyboard
|
||||||
@ -129,7 +128,7 @@ class LoginResetPasswordFragment @Inject constructor() : AbstractLoginFragment<F
|
|||||||
is Fail -> {
|
is Fail -> {
|
||||||
views.resetPasswordEmailTil.error = errorFormatter.toHumanReadable(state.asyncResetPassword.error)
|
views.resetPasswordEmailTil.error = errorFormatter.toHumanReadable(state.asyncResetPassword.error)
|
||||||
}
|
}
|
||||||
is Success -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Success
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.databinding.FragmentLoginResetPasswordMailConfirmationBinding
|
import im.vector.app.databinding.FragmentLoginResetPasswordMailConfirmationBinding
|
||||||
@ -59,7 +58,7 @@ class LoginResetPasswordMailConfirmationFragment @Inject constructor() : Abstrac
|
|||||||
setupUi(state)
|
setupUi(state)
|
||||||
|
|
||||||
when (state.asyncResetMailConfirmed) {
|
when (state.asyncResetMailConfirmed) {
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
// Link in email not yet clicked ?
|
// Link in email not yet clicked ?
|
||||||
val message = if (state.asyncResetMailConfirmed.error.is401()) {
|
val message = if (state.asyncResetMailConfirmed.error.is401()) {
|
||||||
getString(R.string.auth_reset_password_error_unauthorized)
|
getString(R.string.auth_reset_password_error_unauthorized)
|
||||||
@ -73,7 +72,7 @@ class LoginResetPasswordMailConfirmationFragment @Inject constructor() : Abstrac
|
|||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(R.string.ok, null)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
is Success -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,7 @@ class LoginViewModel @AssistedInject constructor(
|
|||||||
.withAllowedFingerPrints(listOf(action.fingerprint))
|
.withAllowedFingerPrints(listOf(action.fingerprint))
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ package im.vector.app.features.login2
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.lifecycle.viewModelScope
|
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MavericksViewModelFactory
|
import com.airbnb.mvrx.MavericksViewModelFactory
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
@ -172,6 +171,7 @@ class LoginViewModel2 @AssistedInject constructor(
|
|||||||
handleSetUserPassword(finalLastAction)
|
handleSetUserPassword(finalLastAction)
|
||||||
is LoginAction2.LoginWith ->
|
is LoginAction2.LoginWith ->
|
||||||
handleLoginWith(finalLastAction)
|
handleLoginWith(finalLastAction)
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,18 +65,17 @@ class MatrixToBottomSheet :
|
|||||||
override fun invalidate() = withState(viewModel) { state ->
|
override fun invalidate() = withState(viewModel) { state ->
|
||||||
super.invalidate()
|
super.invalidate()
|
||||||
when (state.linkType) {
|
when (state.linkType) {
|
||||||
is PermalinkData.RoomLink -> {
|
is PermalinkData.RoomLink -> {
|
||||||
views.matrixToCardContentLoading.isVisible = state.roomPeekResult is Incomplete
|
views.matrixToCardContentLoading.isVisible = state.roomPeekResult is Incomplete
|
||||||
showFragment(MatrixToRoomSpaceFragment::class, Bundle())
|
showFragment(MatrixToRoomSpaceFragment::class, Bundle())
|
||||||
}
|
}
|
||||||
is PermalinkData.UserLink -> {
|
is PermalinkData.UserLink -> {
|
||||||
views.matrixToCardContentLoading.isVisible = state.matrixItem is Incomplete
|
views.matrixToCardContentLoading.isVisible = state.matrixItem is Incomplete
|
||||||
showFragment(MatrixToUserFragment::class, Bundle())
|
showFragment(MatrixToUserFragment::class, Bundle())
|
||||||
}
|
}
|
||||||
is PermalinkData.GroupLink -> {
|
is PermalinkData.GroupLink -> Unit
|
||||||
}
|
is PermalinkData.FallbackLink -> Unit
|
||||||
is PermalinkData.FallbackLink -> {
|
is PermalinkData.RoomEmailInviteLink -> Unit
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ class MatrixToBottomSheetViewModel @AssistedInject constructor(
|
|||||||
private val session: Session,
|
private val session: Session,
|
||||||
private val stringProvider: StringProvider,
|
private val stringProvider: StringProvider,
|
||||||
private val directRoomHelper: DirectRoomHelper,
|
private val directRoomHelper: DirectRoomHelper,
|
||||||
private val errorFormatter: ErrorFormatter) :
|
private val errorFormatter: ErrorFormatter
|
||||||
VectorViewModel<MatrixToBottomSheetState, MatrixToAction, MatrixToViewEvents>(initialState) {
|
) : VectorViewModel<MatrixToBottomSheetState, MatrixToAction, MatrixToViewEvents>(initialState) {
|
||||||
|
|
||||||
@AssistedFactory
|
@AssistedFactory
|
||||||
interface Factory : MavericksAssistedViewModelFactory<MatrixToBottomSheetViewModel, MatrixToBottomSheetState> {
|
interface Factory : MavericksAssistedViewModelFactory<MatrixToBottomSheetViewModel, MatrixToBottomSheetState> {
|
||||||
@ -61,22 +61,23 @@ class MatrixToBottomSheetViewModel @AssistedInject constructor(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
when (initialState.linkType) {
|
when (initialState.linkType) {
|
||||||
is PermalinkData.RoomLink -> {
|
is PermalinkData.RoomLink -> {
|
||||||
setState {
|
setState {
|
||||||
copy(roomPeekResult = Loading())
|
copy(roomPeekResult = Loading())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is PermalinkData.UserLink -> {
|
is PermalinkData.UserLink -> {
|
||||||
setState {
|
setState {
|
||||||
copy(matrixItem = Loading())
|
copy(matrixItem = Loading())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is PermalinkData.GroupLink -> {
|
is PermalinkData.GroupLink -> {
|
||||||
// Not yet supported
|
// Not yet supported
|
||||||
}
|
}
|
||||||
is PermalinkData.FallbackLink -> {
|
is PermalinkData.FallbackLink -> {
|
||||||
// Not yet supported
|
// Not yet supported
|
||||||
}
|
}
|
||||||
|
is PermalinkData.RoomEmailInviteLink -> Unit
|
||||||
}
|
}
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
resolveLink(initialState)
|
resolveLink(initialState)
|
||||||
|
@ -320,6 +320,7 @@ class DefaultNavigator @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
null -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,6 +377,7 @@ class DefaultNavigator @Inject constructor(
|
|||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
null -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,11 +47,9 @@ class NotificationRenderer @Inject constructor(private val notificationDisplayer
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Remove summary first to avoid briefly displaying it after dismissing the last notification
|
// Remove summary first to avoid briefly displaying it after dismissing the last notification
|
||||||
when (summaryNotification) {
|
if (summaryNotification == SummaryNotification.Removed) {
|
||||||
SummaryNotification.Removed -> {
|
Timber.d("Removing summary notification")
|
||||||
Timber.d("Removing summary notification")
|
notificationDisplayer.cancelNotificationMessage(null, SUMMARY_NOTIFICATION_ID)
|
||||||
notificationDisplayer.cancelNotificationMessage(null, SUMMARY_NOTIFICATION_ID)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
roomNotifications.forEach { wrapper ->
|
roomNotifications.forEach { wrapper ->
|
||||||
@ -94,11 +92,9 @@ class NotificationRenderer @Inject constructor(private val notificationDisplayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update summary last to avoid briefly displaying it before other notifications
|
// Update summary last to avoid briefly displaying it before other notifications
|
||||||
when (summaryNotification) {
|
if (summaryNotification is SummaryNotification.Update) {
|
||||||
is SummaryNotification.Update -> {
|
Timber.d("Updating summary notification")
|
||||||
Timber.d("Updating summary notification")
|
notificationDisplayer.showNotificationMessage(null, SUMMARY_NOTIFICATION_ID, summaryNotification.notification)
|
||||||
notificationDisplayer.showNotificationMessage(null, SUMMARY_NOTIFICATION_ID, summaryNotification.notification)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,6 +222,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||||||
.withAllowedFingerPrints(listOf(action.fingerprint))
|
.withAllowedFingerPrints(listOf(action.fingerprint))
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ import androidx.core.view.isVisible
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.extensions.exhaustive
|
import im.vector.app.core.extensions.exhaustive
|
||||||
import im.vector.app.core.extensions.hideKeyboard
|
import im.vector.app.core.extensions.hideKeyboard
|
||||||
@ -299,7 +298,7 @@ class FtueAuthLoginFragment @Inject constructor() : AbstractSSOFtueAuthFragment<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Success is handled by the LoginActivity
|
// Success is handled by the LoginActivity
|
||||||
is Success -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
when (state.asyncRegistration) {
|
when (state.asyncRegistration) {
|
||||||
@ -308,7 +307,7 @@ class FtueAuthLoginFragment @Inject constructor() : AbstractSSOFtueAuthFragment<
|
|||||||
views.passwordField.hidePassword()
|
views.passwordField.hidePassword()
|
||||||
}
|
}
|
||||||
// Success is handled by the LoginActivity
|
// Success is handled by the LoginActivity
|
||||||
is Success -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ import android.view.ViewGroup
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.extensions.hideKeyboard
|
import im.vector.app.core.extensions.hideKeyboard
|
||||||
@ -125,7 +124,7 @@ class FtueAuthResetPasswordFragment @Inject constructor() : AbstractFtueAuthFrag
|
|||||||
is Fail -> {
|
is Fail -> {
|
||||||
views.resetPasswordEmailTil.error = errorFormatter.toHumanReadable(state.asyncResetPassword.error)
|
views.resetPasswordEmailTil.error = errorFormatter.toHumanReadable(state.asyncResetPassword.error)
|
||||||
}
|
}
|
||||||
is Success -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Success
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.databinding.FragmentLoginResetPasswordMailConfirmationBinding
|
import im.vector.app.databinding.FragmentLoginResetPasswordMailConfirmationBinding
|
||||||
@ -61,7 +60,7 @@ class FtueAuthResetPasswordMailConfirmationFragment @Inject constructor() : Abst
|
|||||||
setupUi(state)
|
setupUi(state)
|
||||||
|
|
||||||
when (state.asyncResetMailConfirmed) {
|
when (state.asyncResetMailConfirmed) {
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
// Link in email not yet clicked ?
|
// Link in email not yet clicked ?
|
||||||
val message = if (state.asyncResetMailConfirmed.error.is401()) {
|
val message = if (state.asyncResetMailConfirmed.error.is401()) {
|
||||||
getString(R.string.auth_reset_password_error_unauthorized)
|
getString(R.string.auth_reset_password_error_unauthorized)
|
||||||
@ -75,7 +74,7 @@ class FtueAuthResetPasswordMailConfirmationFragment @Inject constructor() : Abst
|
|||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(R.string.ok, null)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
is Success -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,8 @@ class RoomDirectoryActivity : VectorBaseActivity<ActivitySimpleBinding>(), Matri
|
|||||||
.stream()
|
.stream()
|
||||||
.onEach { sharedAction ->
|
.onEach { sharedAction ->
|
||||||
when (sharedAction) {
|
when (sharedAction) {
|
||||||
is RoomDirectorySharedAction.Back -> popBackstack()
|
is RoomDirectorySharedAction.Back -> popBackstack()
|
||||||
is RoomDirectorySharedAction.CreateRoom -> {
|
is RoomDirectorySharedAction.CreateRoom -> {
|
||||||
// Transmit the filter to the CreateRoomFragment
|
// Transmit the filter to the CreateRoomFragment
|
||||||
withState(roomDirectoryViewModel) {
|
withState(roomDirectoryViewModel) {
|
||||||
addFragmentToBackstack(
|
addFragmentToBackstack(
|
||||||
@ -73,9 +73,10 @@ class RoomDirectoryActivity : VectorBaseActivity<ActivitySimpleBinding>(), Matri
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is RoomDirectorySharedAction.ChangeProtocol ->
|
is RoomDirectorySharedAction.ChangeProtocol ->
|
||||||
addFragmentToBackstack(views.simpleFragmentContainer, RoomDirectoryPickerFragment::class.java)
|
addFragmentToBackstack(views.simpleFragmentContainer, RoomDirectoryPickerFragment::class.java)
|
||||||
is RoomDirectorySharedAction.Close -> finish()
|
is RoomDirectorySharedAction.Close -> finish()
|
||||||
|
is RoomDirectorySharedAction.CreateRoomSuccess -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.launchIn(lifecycleScope)
|
.launchIn(lifecycleScope)
|
||||||
|
@ -22,7 +22,6 @@ import android.view.inputmethod.EditorInfo
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import com.airbnb.epoxy.TypedEpoxyController
|
import com.airbnb.epoxy.TypedEpoxyController
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Incomplete
|
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
@ -60,7 +59,7 @@ class RoomDirectoryPickerController @Inject constructor(
|
|||||||
val host = this
|
val host = this
|
||||||
|
|
||||||
when (val asyncThirdPartyProtocol = data.asyncThirdPartyRequest) {
|
when (val asyncThirdPartyProtocol = data.asyncThirdPartyRequest) {
|
||||||
is Success -> {
|
is Success -> {
|
||||||
data.directories.join(
|
data.directories.join(
|
||||||
each = { _, roomDirectoryServer -> buildDirectory(roomDirectoryServer) },
|
each = { _, roomDirectoryServer -> buildDirectory(roomDirectoryServer) },
|
||||||
between = { idx, _ -> buildDivider(idx) }
|
between = { idx, _ -> buildDivider(idx) }
|
||||||
@ -71,12 +70,13 @@ class RoomDirectoryPickerController @Inject constructor(
|
|||||||
heightInPx(host.dimensionConverter.dpToPx(16))
|
heightInPx(host.dimensionConverter.dpToPx(16))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Incomplete -> {
|
Uninitialized,
|
||||||
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("error")
|
id("error")
|
||||||
text(host.errorFormatter.toHumanReadable(asyncThirdPartyProtocol.error))
|
text(host.errorFormatter.toHumanReadable(asyncThirdPartyProtocol.error))
|
||||||
|
@ -25,8 +25,9 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Incomplete
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.args
|
import com.airbnb.mvrx.args
|
||||||
import com.airbnb.mvrx.fragmentViewModel
|
import com.airbnb.mvrx.fragmentViewModel
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
@ -198,18 +199,19 @@ class RoomMemberProfileFragment @Inject constructor(
|
|||||||
|
|
||||||
override fun invalidate() = withState(viewModel) { state ->
|
override fun invalidate() = withState(viewModel) { state ->
|
||||||
when (val asyncUserMatrixItem = state.userMatrixItem) {
|
when (val asyncUserMatrixItem = state.userMatrixItem) {
|
||||||
is Incomplete -> {
|
Uninitialized,
|
||||||
|
is Loading -> {
|
||||||
views.matrixProfileToolbarTitleView.text = state.userId
|
views.matrixProfileToolbarTitleView.text = state.userId
|
||||||
avatarRenderer.render(MatrixItem.UserItem(state.userId, null, null), views.matrixProfileToolbarAvatarImageView)
|
avatarRenderer.render(MatrixItem.UserItem(state.userId, null, null), views.matrixProfileToolbarAvatarImageView)
|
||||||
headerViews.memberProfileStateView.state = StateView.State.Loading
|
headerViews.memberProfileStateView.state = StateView.State.Loading
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
avatarRenderer.render(MatrixItem.UserItem(state.userId, null, null), views.matrixProfileToolbarAvatarImageView)
|
avatarRenderer.render(MatrixItem.UserItem(state.userId, null, null), views.matrixProfileToolbarAvatarImageView)
|
||||||
views.matrixProfileToolbarTitleView.text = state.userId
|
views.matrixProfileToolbarTitleView.text = state.userId
|
||||||
val failureMessage = errorFormatter.toHumanReadable(asyncUserMatrixItem.error)
|
val failureMessage = errorFormatter.toHumanReadable(asyncUserMatrixItem.error)
|
||||||
headerViews.memberProfileStateView.state = StateView.State.Error(failureMessage)
|
headerViews.memberProfileStateView.state = StateView.State.Error(failureMessage)
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
val userMatrixItem = asyncUserMatrixItem()
|
val userMatrixItem = asyncUserMatrixItem()
|
||||||
headerViews.memberProfileStateView.state = StateView.State.Content
|
headerViews.memberProfileStateView.state = StateView.State.Content
|
||||||
headerViews.memberProfileIdView.text = userMatrixItem.id
|
headerViews.memberProfileIdView.text = userMatrixItem.id
|
||||||
|
@ -199,12 +199,13 @@ class RoomAliasController @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
when (val localAliases = data.localAliases) {
|
when (val localAliases = data.localAliases) {
|
||||||
is Uninitialized -> {
|
Uninitialized,
|
||||||
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loadingAliases")
|
id("loadingAliases")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
if (localAliases().isEmpty()) {
|
if (localAliases().isEmpty()) {
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("locEmpty")
|
id("locEmpty")
|
||||||
@ -220,7 +221,7 @@ class RoomAliasController @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("alt_error")
|
id("alt_error")
|
||||||
text(host.errorFormatter.toHumanReadable(localAliases.error))
|
text(host.errorFormatter.toHumanReadable(localAliases.error))
|
||||||
|
@ -24,6 +24,7 @@ import androidx.core.content.ContextCompat
|
|||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.parentFragmentViewModel
|
import com.airbnb.mvrx.parentFragmentViewModel
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
@ -91,6 +92,7 @@ class RoomUploadsFilesFragment @Inject constructor(
|
|||||||
override fun invalidate() = withState(uploadsViewModel) { state ->
|
override fun invalidate() = withState(uploadsViewModel) { state ->
|
||||||
if (state.fileEvents.isEmpty()) {
|
if (state.fileEvents.isEmpty()) {
|
||||||
when (state.asyncEventsRequest) {
|
when (state.asyncEventsRequest) {
|
||||||
|
Uninitialized,
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
views.genericStateViewListStateView.state = StateView.State.Loading
|
views.genericStateViewListStateView.state = StateView.State.Loading
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import androidx.recyclerview.widget.GridLayoutManager
|
|||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.parentFragmentViewModel
|
import com.airbnb.mvrx.parentFragmentViewModel
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
import com.google.android.material.appbar.AppBarLayout
|
import com.google.android.material.appbar.AppBarLayout
|
||||||
@ -188,6 +189,7 @@ class RoomUploadsMediaFragment @Inject constructor(
|
|||||||
override fun invalidate() = withState(uploadsViewModel) { state ->
|
override fun invalidate() = withState(uploadsViewModel) { state ->
|
||||||
if (state.mediaEvents.isEmpty()) {
|
if (state.mediaEvents.isEmpty()) {
|
||||||
when (state.asyncEventsRequest) {
|
when (state.asyncEventsRequest) {
|
||||||
|
Uninitialized,
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
views.genericStateViewListStateView.state = StateView.State.Loading
|
views.genericStateViewListStateView.state = StateView.State.Loading
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import com.airbnb.epoxy.TypedEpoxyController
|
|||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.epoxy.loadingItem
|
import im.vector.app.core.epoxy.loadingItem
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
@ -45,6 +46,7 @@ class AccountDataEpoxyController @Inject constructor(
|
|||||||
if (data == null) return
|
if (data == null) return
|
||||||
val host = this
|
val host = this
|
||||||
when (data.accountData) {
|
when (data.accountData) {
|
||||||
|
Uninitialized,
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
package im.vector.app.features.settings.locale
|
package im.vector.app.features.settings.locale
|
||||||
|
|
||||||
import com.airbnb.epoxy.TypedEpoxyController
|
import com.airbnb.epoxy.TypedEpoxyController
|
||||||
import com.airbnb.mvrx.Incomplete
|
import com.airbnb.mvrx.Fail
|
||||||
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
|
import im.vector.app.core.epoxy.errorWithRetryItem
|
||||||
import im.vector.app.core.epoxy.loadingItem
|
import im.vector.app.core.epoxy.loadingItem
|
||||||
import im.vector.app.core.epoxy.noResultItem
|
import im.vector.app.core.epoxy.noResultItem
|
||||||
import im.vector.app.core.epoxy.profiles.profileSectionItem
|
import im.vector.app.core.epoxy.profiles.profileSectionItem
|
||||||
|
import im.vector.app.core.error.ErrorFormatter
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
import im.vector.app.core.utils.safeCapitalize
|
import im.vector.app.core.utils.safeCapitalize
|
||||||
import im.vector.app.features.settings.VectorLocale
|
import im.vector.app.features.settings.VectorLocale
|
||||||
@ -32,7 +36,8 @@ import javax.inject.Inject
|
|||||||
|
|
||||||
class LocalePickerController @Inject constructor(
|
class LocalePickerController @Inject constructor(
|
||||||
private val vectorPreferences: VectorPreferences,
|
private val vectorPreferences: VectorPreferences,
|
||||||
private val stringProvider: StringProvider
|
private val stringProvider: StringProvider,
|
||||||
|
private val errorFormatter: ErrorFormatter
|
||||||
) : TypedEpoxyController<LocalePickerViewState>() {
|
) : TypedEpoxyController<LocalePickerViewState>() {
|
||||||
|
|
||||||
var listener: Listener? = null
|
var listener: Listener? = null
|
||||||
@ -58,13 +63,14 @@ class LocalePickerController @Inject constructor(
|
|||||||
title(host.stringProvider.getString(R.string.choose_locale_other_locales_title))
|
title(host.stringProvider.getString(R.string.choose_locale_other_locales_title))
|
||||||
}
|
}
|
||||||
when (list) {
|
when (list) {
|
||||||
is Incomplete -> {
|
Uninitialized,
|
||||||
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
loadingText(host.stringProvider.getString(R.string.choose_locale_loading_locales))
|
loadingText(host.stringProvider.getString(R.string.choose_locale_loading_locales))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success ->
|
is Success ->
|
||||||
if (list().isEmpty()) {
|
if (list().isEmpty()) {
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("noResult")
|
id("noResult")
|
||||||
@ -84,6 +90,11 @@ class LocalePickerController @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
is Fail ->
|
||||||
|
errorWithRetryItem {
|
||||||
|
id("error")
|
||||||
|
text(host.errorFormatter.toHumanReadable(list.error))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import com.airbnb.epoxy.TypedEpoxyController
|
|||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.epoxy.loadingItem
|
import im.vector.app.core.epoxy.loadingItem
|
||||||
import im.vector.app.core.epoxy.noResultItem
|
import im.vector.app.core.epoxy.noResultItem
|
||||||
@ -78,6 +79,7 @@ class ThreePidsSettingsController @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
when (data.threePids) {
|
when (data.threePids) {
|
||||||
|
Uninitialized,
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
|
@ -18,8 +18,9 @@ package im.vector.app.features.signout.soft
|
|||||||
|
|
||||||
import com.airbnb.epoxy.EpoxyController
|
import com.airbnb.epoxy.EpoxyController
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Incomplete
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.epoxy.loadingItem
|
import im.vector.app.core.epoxy.loadingItem
|
||||||
import im.vector.app.core.error.ErrorFormatter
|
import im.vector.app.core.error.ErrorFormatter
|
||||||
@ -89,19 +90,20 @@ class SoftLogoutController @Inject constructor(
|
|||||||
private fun buildForm(state: SoftLogoutViewState) {
|
private fun buildForm(state: SoftLogoutViewState) {
|
||||||
val host = this
|
val host = this
|
||||||
when (state.asyncHomeServerLoginFlowRequest) {
|
when (state.asyncHomeServerLoginFlowRequest) {
|
||||||
is Incomplete -> {
|
Uninitialized,
|
||||||
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
loginErrorWithRetryItem {
|
loginErrorWithRetryItem {
|
||||||
id("errorRetry")
|
id("errorRetry")
|
||||||
text(host.errorFormatter.toHumanReadable(state.asyncHomeServerLoginFlowRequest.error))
|
text(host.errorFormatter.toHumanReadable(state.asyncHomeServerLoginFlowRequest.error))
|
||||||
listener { host.listener?.retry() }
|
listener { host.listener?.retry() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
when (state.asyncHomeServerLoginFlowRequest.invoke()) {
|
when (state.asyncHomeServerLoginFlowRequest.invoke()) {
|
||||||
LoginMode.Password -> {
|
LoginMode.Password -> {
|
||||||
loginPasswordFormItem {
|
loginPasswordFormItem {
|
||||||
|
@ -22,8 +22,9 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.airbnb.epoxy.EpoxyTouchHelper
|
import com.airbnb.epoxy.EpoxyTouchHelper
|
||||||
import com.airbnb.mvrx.Incomplete
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.fragmentViewModel
|
import com.airbnb.mvrx.fragmentViewModel
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
import im.vector.app.core.extensions.cleanup
|
import im.vector.app.core.extensions.cleanup
|
||||||
@ -121,8 +122,10 @@ class SpaceListFragment @Inject constructor(
|
|||||||
|
|
||||||
override fun invalidate() = withState(viewModel) { state ->
|
override fun invalidate() = withState(viewModel) { state ->
|
||||||
when (state.asyncSpaces) {
|
when (state.asyncSpaces) {
|
||||||
is Incomplete -> views.stateView.state = StateView.State.Loading
|
Uninitialized,
|
||||||
is Success -> views.stateView.state = StateView.State.Content
|
is Loading -> views.stateView.state = StateView.State.Loading
|
||||||
|
is Success -> views.stateView.state = StateView.State.Content
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
spaceController.update(state)
|
spaceController.update(state)
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@ class SpaceManageActivity : VectorBaseActivity<ActivitySimpleLoadingBinding>() {
|
|||||||
when (sharedAction) {
|
when (sharedAction) {
|
||||||
is RoomDirectorySharedAction.Back,
|
is RoomDirectorySharedAction.Back,
|
||||||
is RoomDirectorySharedAction.Close -> finish()
|
is RoomDirectorySharedAction.Close -> finish()
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.launchIn(lifecycleScope)
|
.launchIn(lifecycleScope)
|
||||||
|
@ -17,8 +17,9 @@ package im.vector.app.features.terms
|
|||||||
|
|
||||||
import com.airbnb.epoxy.TypedEpoxyController
|
import com.airbnb.epoxy.TypedEpoxyController
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Incomplete
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.epoxy.errorWithRetryItem
|
import im.vector.app.core.epoxy.errorWithRetryItem
|
||||||
import im.vector.app.core.epoxy.loadingItem
|
import im.vector.app.core.epoxy.loadingItem
|
||||||
@ -38,19 +39,20 @@ class TermsController @Inject constructor(
|
|||||||
val host = this
|
val host = this
|
||||||
|
|
||||||
when (data.termsList) {
|
when (data.termsList) {
|
||||||
is Incomplete -> {
|
Uninitialized,
|
||||||
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("errorRetry")
|
id("errorRetry")
|
||||||
text(host.errorFormatter.toHumanReadable(data.termsList.error))
|
text(host.errorFormatter.toHumanReadable(data.termsList.error))
|
||||||
listener { host.listener?.retry() }
|
listener { host.listener?.retry() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> buildTerms(data.termsList.invoke())
|
is Success -> buildTerms(data.termsList.invoke())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +69,7 @@ class TermsController @Inject constructor(
|
|||||||
description(host.description)
|
description(host.description)
|
||||||
checked(term.accepted)
|
checked(term.accepted)
|
||||||
|
|
||||||
clickListener { host.listener?.review(term) }
|
clickListener { host.listener?.review(term) }
|
||||||
checkChangeListener { _, isChecked ->
|
checkChangeListener { _, isChecked ->
|
||||||
host.listener?.setChecked(term, isChecked)
|
host.listener?.setChecked(term, isChecked)
|
||||||
}
|
}
|
||||||
|
@ -62,12 +62,12 @@ class UserCodeSharedViewModel @AssistedInject constructor(
|
|||||||
|
|
||||||
override fun handle(action: UserCodeActions) {
|
override fun handle(action: UserCodeActions) {
|
||||||
when (action) {
|
when (action) {
|
||||||
UserCodeActions.DismissAction -> _viewEvents.post(UserCodeShareViewEvents.Dismiss)
|
UserCodeActions.DismissAction -> _viewEvents.post(UserCodeShareViewEvents.Dismiss)
|
||||||
is UserCodeActions.SwitchMode -> setState { copy(mode = action.mode) }
|
is UserCodeActions.SwitchMode -> setState { copy(mode = action.mode) }
|
||||||
is UserCodeActions.DecodedQRCode -> handleQrCodeDecoded(action)
|
is UserCodeActions.DecodedQRCode -> handleQrCodeDecoded(action)
|
||||||
is UserCodeActions.StartChattingWithUser -> handleStartChatting(action)
|
is UserCodeActions.StartChattingWithUser -> handleStartChatting(action)
|
||||||
is UserCodeActions.CameraPermissionNotGranted -> _viewEvents.post(UserCodeShareViewEvents.CameraPermissionNotGranted(action.deniedPermanently))
|
is UserCodeActions.CameraPermissionNotGranted -> _viewEvents.post(UserCodeShareViewEvents.CameraPermissionNotGranted(action.deniedPermanently))
|
||||||
UserCodeActions.ShareByText -> handleShareByText()
|
UserCodeActions.ShareByText -> handleShareByText()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,11 +110,11 @@ class UserCodeSharedViewModel @AssistedInject constructor(
|
|||||||
_viewEvents.post(UserCodeShareViewEvents.ShowWaitingScreen)
|
_viewEvents.post(UserCodeShareViewEvents.ShowWaitingScreen)
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
when (linkedId) {
|
when (linkedId) {
|
||||||
is PermalinkData.RoomLink -> {
|
is PermalinkData.RoomLink -> {
|
||||||
// not yet supported
|
// not yet supported
|
||||||
_viewEvents.post(UserCodeShareViewEvents.ToastMessage(stringProvider.getString(R.string.not_implemented)))
|
_viewEvents.post(UserCodeShareViewEvents.ToastMessage(stringProvider.getString(R.string.not_implemented)))
|
||||||
}
|
}
|
||||||
is PermalinkData.UserLink -> {
|
is PermalinkData.UserLink -> {
|
||||||
val user = tryOrNull { session.resolveUser(linkedId.userId) }
|
val user = tryOrNull { session.resolveUser(linkedId.userId) }
|
||||||
// Create raw Uxid in case the user is not searchable
|
// Create raw Uxid in case the user is not searchable
|
||||||
?: User(linkedId.userId, null, null)
|
?: User(linkedId.userId, null, null)
|
||||||
@ -125,14 +125,15 @@ class UserCodeSharedViewModel @AssistedInject constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is PermalinkData.GroupLink -> {
|
is PermalinkData.GroupLink -> {
|
||||||
// not yet supported
|
// not yet supported
|
||||||
_viewEvents.post(UserCodeShareViewEvents.ToastMessage(stringProvider.getString(R.string.not_implemented)))
|
_viewEvents.post(UserCodeShareViewEvents.ToastMessage(stringProvider.getString(R.string.not_implemented)))
|
||||||
}
|
}
|
||||||
is PermalinkData.FallbackLink -> {
|
is PermalinkData.FallbackLink -> {
|
||||||
// not yet supported
|
// not yet supported
|
||||||
_viewEvents.post(UserCodeShareViewEvents.ToastMessage(stringProvider.getString(R.string.not_implemented)))
|
_viewEvents.post(UserCodeShareViewEvents.ToastMessage(stringProvider.getString(R.string.not_implemented)))
|
||||||
}
|
}
|
||||||
|
is PermalinkData.RoomEmailInviteLink -> Unit
|
||||||
}
|
}
|
||||||
_viewEvents.post(UserCodeShareViewEvents.HideWaitingScreen)
|
_viewEvents.post(UserCodeShareViewEvents.HideWaitingScreen)
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,7 @@ class WidgetActivity : VectorBaseActivity<ActivityWidgetBinding>() {
|
|||||||
viewModel.observeViewEvents {
|
viewModel.observeViewEvents {
|
||||||
when (it) {
|
when (it) {
|
||||||
is WidgetViewEvents.Close -> handleClose(it)
|
is WidgetViewEvents.Close -> handleClose(it)
|
||||||
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ import android.view.ViewGroup
|
|||||||
import androidx.core.view.isInvisible
|
import androidx.core.view.isInvisible
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
import com.airbnb.mvrx.Incomplete
|
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
@ -87,6 +86,7 @@ class WidgetFragment @Inject constructor() :
|
|||||||
is WidgetViewEvents.OnURLFormatted -> loadFormattedUrl(it)
|
is WidgetViewEvents.OnURLFormatted -> loadFormattedUrl(it)
|
||||||
is WidgetViewEvents.DisplayIntegrationManager -> displayIntegrationManager(it)
|
is WidgetViewEvents.DisplayIntegrationManager -> displayIntegrationManager(it)
|
||||||
is WidgetViewEvents.Failure -> displayErrorDialog(it.throwable)
|
is WidgetViewEvents.Failure -> displayErrorDialog(it.throwable)
|
||||||
|
is WidgetViewEvents.Close -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viewModel.handle(WidgetAction.LoadFormattedUrl)
|
viewModel.handle(WidgetAction.LoadFormattedUrl)
|
||||||
@ -192,13 +192,14 @@ class WidgetFragment @Inject constructor() :
|
|||||||
override fun invalidate() = withState(viewModel) { state ->
|
override fun invalidate() = withState(viewModel) { state ->
|
||||||
Timber.v("Invalidate state: $state")
|
Timber.v("Invalidate state: $state")
|
||||||
when (state.formattedURL) {
|
when (state.formattedURL) {
|
||||||
is Incomplete -> {
|
Uninitialized,
|
||||||
|
is Loading -> {
|
||||||
setStateError(null)
|
setStateError(null)
|
||||||
views.widgetWebView.isInvisible = true
|
views.widgetWebView.isInvisible = true
|
||||||
views.widgetProgressBar.isIndeterminate = true
|
views.widgetProgressBar.isIndeterminate = true
|
||||||
views.widgetProgressBar.isVisible = true
|
views.widgetProgressBar.isVisible = true
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
setStateError(null)
|
setStateError(null)
|
||||||
when (state.webviewLoadedUrl) {
|
when (state.webviewLoadedUrl) {
|
||||||
Uninitialized -> {
|
Uninitialized -> {
|
||||||
@ -221,7 +222,7 @@ class WidgetFragment @Inject constructor() :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
// we need to show Error
|
// we need to show Error
|
||||||
views.widgetWebView.isInvisible = true
|
views.widgetWebView.isInvisible = true
|
||||||
views.widgetProgressBar.isVisible = false
|
views.widgetProgressBar.isVisible = false
|
||||||
|
@ -93,6 +93,7 @@ class RoomWidgetPermissionViewModel @AssistedInject constructor(@Assisted val in
|
|||||||
when (action) {
|
when (action) {
|
||||||
RoomWidgetPermissionActions.AllowWidget -> handleAllowWidget()
|
RoomWidgetPermissionActions.AllowWidget -> handleAllowWidget()
|
||||||
RoomWidgetPermissionActions.BlockWidget -> handleRevokeWidget()
|
RoomWidgetPermissionActions.BlockWidget -> handleRevokeWidget()
|
||||||
|
RoomWidgetPermissionActions.DoClose -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user