mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Rename members for clarity
This commit is contained in:
committed by
Benoit Marty
parent
1e71ca35ac
commit
936579ddcc
+2
-2
@@ -140,8 +140,8 @@ class AdvancedSettingsPresenter @Inject constructor(
|
|||||||
isSharePresenceEnabled = isSharePresenceEnabled,
|
isSharePresenceEnabled = isSharePresenceEnabled,
|
||||||
theme = theme,
|
theme = theme,
|
||||||
showChangeThemeDialog = showChangeThemeDialog,
|
showChangeThemeDialog = showChangeThemeDialog,
|
||||||
pushDistributor = currentDistributorName,
|
currentPushDistributor = currentDistributorName,
|
||||||
pushDistributors = distributorNames.toImmutableList(),
|
availablePushDistributors = distributorNames.toImmutableList(),
|
||||||
showChangePushProviderDialog = showChangePushProviderDialog,
|
showChangePushProviderDialog = showChangePushProviderDialog,
|
||||||
eventSink = { handleEvents(it) }
|
eventSink = { handleEvents(it) }
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-2
@@ -25,8 +25,8 @@ data class AdvancedSettingsState(
|
|||||||
val isSharePresenceEnabled: Boolean,
|
val isSharePresenceEnabled: Boolean,
|
||||||
val theme: Theme,
|
val theme: Theme,
|
||||||
val showChangeThemeDialog: Boolean,
|
val showChangeThemeDialog: Boolean,
|
||||||
val pushDistributor: AsyncAction<String>,
|
val currentPushDistributor: AsyncAction<String>,
|
||||||
val pushDistributors: ImmutableList<String>,
|
val availablePushDistributors: ImmutableList<String>,
|
||||||
val showChangePushProviderDialog: Boolean,
|
val showChangePushProviderDialog: Boolean,
|
||||||
val eventSink: (AdvancedSettingsEvents) -> Unit
|
val eventSink: (AdvancedSettingsEvents) -> Unit
|
||||||
)
|
)
|
||||||
|
|||||||
+6
-6
@@ -29,8 +29,8 @@ open class AdvancedSettingsStateProvider : PreviewParameterProvider<AdvancedSett
|
|||||||
aAdvancedSettingsState(showChangeThemeDialog = true),
|
aAdvancedSettingsState(showChangeThemeDialog = true),
|
||||||
aAdvancedSettingsState(isSendPublicReadReceiptsEnabled = true),
|
aAdvancedSettingsState(isSendPublicReadReceiptsEnabled = true),
|
||||||
aAdvancedSettingsState(showChangePushProviderDialog = true),
|
aAdvancedSettingsState(showChangePushProviderDialog = true),
|
||||||
aAdvancedSettingsState(pushDistributor = AsyncAction.Loading),
|
aAdvancedSettingsState(currentPushDistributor = AsyncAction.Loading),
|
||||||
aAdvancedSettingsState(pushDistributor = AsyncAction.Failure(Exception("Failed to change distributor"))),
|
aAdvancedSettingsState(currentPushDistributor = AsyncAction.Failure(Exception("Failed to change distributor"))),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,16 +38,16 @@ fun aAdvancedSettingsState(
|
|||||||
isDeveloperModeEnabled: Boolean = false,
|
isDeveloperModeEnabled: Boolean = false,
|
||||||
isSendPublicReadReceiptsEnabled: Boolean = false,
|
isSendPublicReadReceiptsEnabled: Boolean = false,
|
||||||
showChangeThemeDialog: Boolean = false,
|
showChangeThemeDialog: Boolean = false,
|
||||||
pushDistributor: AsyncAction<String> = AsyncAction.Success("Firebase"),
|
currentPushDistributor: AsyncAction<String> = AsyncAction.Success("Firebase"),
|
||||||
pushDistributors: List<String> = listOf("Firebase", "ntfy"),
|
availablePushDistributors: List<String> = listOf("Firebase", "ntfy"),
|
||||||
showChangePushProviderDialog: Boolean = false,
|
showChangePushProviderDialog: Boolean = false,
|
||||||
) = AdvancedSettingsState(
|
) = AdvancedSettingsState(
|
||||||
isDeveloperModeEnabled = isDeveloperModeEnabled,
|
isDeveloperModeEnabled = isDeveloperModeEnabled,
|
||||||
isSharePresenceEnabled = isSendPublicReadReceiptsEnabled,
|
isSharePresenceEnabled = isSendPublicReadReceiptsEnabled,
|
||||||
theme = Theme.System,
|
theme = Theme.System,
|
||||||
showChangeThemeDialog = showChangeThemeDialog,
|
showChangeThemeDialog = showChangeThemeDialog,
|
||||||
pushDistributor = pushDistributor,
|
currentPushDistributor = currentPushDistributor,
|
||||||
pushDistributors = pushDistributors.toImmutableList(),
|
availablePushDistributors = availablePushDistributors.toImmutableList(),
|
||||||
showChangePushProviderDialog = showChangePushProviderDialog,
|
showChangePushProviderDialog = showChangePushProviderDialog,
|
||||||
eventSink = {}
|
eventSink = {}
|
||||||
)
|
)
|
||||||
|
|||||||
+5
-5
@@ -90,7 +90,7 @@ fun AdvancedSettingsView(
|
|||||||
headlineContent = {
|
headlineContent = {
|
||||||
Text(text = stringResource(id = R.string.screen_advanced_settings_push_provider_android))
|
Text(text = stringResource(id = R.string.screen_advanced_settings_push_provider_android))
|
||||||
},
|
},
|
||||||
trailingContent = when (state.pushDistributor) {
|
trailingContent = when (state.currentPushDistributor) {
|
||||||
AsyncAction.Uninitialized,
|
AsyncAction.Uninitialized,
|
||||||
AsyncAction.Confirming,
|
AsyncAction.Confirming,
|
||||||
AsyncAction.Loading -> ListItemContent.Custom {
|
AsyncAction.Loading -> ListItemContent.Custom {
|
||||||
@@ -105,11 +105,11 @@ fun AdvancedSettingsView(
|
|||||||
stringResource(id = CommonStrings.common_error)
|
stringResource(id = CommonStrings.common_error)
|
||||||
)
|
)
|
||||||
is AsyncAction.Success -> ListItemContent.Text(
|
is AsyncAction.Success -> ListItemContent.Text(
|
||||||
state.pushDistributor.dataOrNull() ?: ""
|
state.currentPushDistributor.dataOrNull() ?: ""
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onClick = {
|
onClick = {
|
||||||
if (state.pushDistributor.isReady()) {
|
if (state.currentPushDistributor.isReady()) {
|
||||||
state.eventSink(AdvancedSettingsEvents.ChangePushProvider)
|
state.eventSink(AdvancedSettingsEvents.ChangePushProvider)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,10 +134,10 @@ fun AdvancedSettingsView(
|
|||||||
if (state.showChangePushProviderDialog) {
|
if (state.showChangePushProviderDialog) {
|
||||||
SingleSelectionDialog(
|
SingleSelectionDialog(
|
||||||
title = stringResource(id = R.string.screen_advanced_settings_choose_distributor_dialog_title_android),
|
title = stringResource(id = R.string.screen_advanced_settings_choose_distributor_dialog_title_android),
|
||||||
options = state.pushDistributors.map {
|
options = state.availablePushDistributors.map {
|
||||||
ListOption(title = it)
|
ListOption(title = it)
|
||||||
}.toImmutableList(),
|
}.toImmutableList(),
|
||||||
initialSelection = state.pushDistributors.indexOf(state.pushDistributor.dataOrNull()),
|
initialSelection = state.availablePushDistributors.indexOf(state.currentPushDistributor.dataOrNull()),
|
||||||
onOptionSelected = { index ->
|
onOptionSelected = { index ->
|
||||||
state.eventSink(
|
state.eventSink(
|
||||||
AdvancedSettingsEvents.SetPushProvider(index)
|
AdvancedSettingsEvents.SetPushProvider(index)
|
||||||
|
|||||||
+6
-6
@@ -117,8 +117,8 @@ class AdvancedSettingsPresenterTest {
|
|||||||
presenter.present()
|
presenter.present()
|
||||||
}.test {
|
}.test {
|
||||||
val initialState = awaitLastSequentialItem()
|
val initialState = awaitLastSequentialItem()
|
||||||
assertThat(initialState.pushDistributor).isEqualTo(AsyncAction.Success("aDistributorName0"))
|
assertThat(initialState.currentPushDistributor).isEqualTo(AsyncAction.Success("aDistributorName0"))
|
||||||
assertThat(initialState.pushDistributors).containsExactly("aDistributorName0", "aDistributorName1")
|
assertThat(initialState.availablePushDistributors).containsExactly("aDistributorName0", "aDistributorName1")
|
||||||
initialState.eventSink.invoke(AdvancedSettingsEvents.ChangePushProvider)
|
initialState.eventSink.invoke(AdvancedSettingsEvents.ChangePushProvider)
|
||||||
val withDialog = awaitItem()
|
val withDialog = awaitItem()
|
||||||
assertThat(withDialog.showChangePushProviderDialog).isTrue()
|
assertThat(withDialog.showChangePushProviderDialog).isTrue()
|
||||||
@@ -131,9 +131,9 @@ class AdvancedSettingsPresenterTest {
|
|||||||
withDialog.eventSink(AdvancedSettingsEvents.SetPushProvider(1))
|
withDialog.eventSink(AdvancedSettingsEvents.SetPushProvider(1))
|
||||||
val withNewProvider = awaitItem()
|
val withNewProvider = awaitItem()
|
||||||
assertThat(withNewProvider.showChangePushProviderDialog).isFalse()
|
assertThat(withNewProvider.showChangePushProviderDialog).isFalse()
|
||||||
assertThat(withNewProvider.pushDistributor).isEqualTo(AsyncAction.Loading)
|
assertThat(withNewProvider.currentPushDistributor).isEqualTo(AsyncAction.Loading)
|
||||||
val lastItem = awaitItem()
|
val lastItem = awaitItem()
|
||||||
assertThat(lastItem.pushDistributor).isEqualTo(AsyncAction.Success("aDistributorName1"))
|
assertThat(lastItem.currentPushDistributor).isEqualTo(AsyncAction.Success("aDistributorName1"))
|
||||||
cancelAndIgnoreRemainingEvents()
|
cancelAndIgnoreRemainingEvents()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,9 +157,9 @@ class AdvancedSettingsPresenterTest {
|
|||||||
withDialog.eventSink(AdvancedSettingsEvents.SetPushProvider(1))
|
withDialog.eventSink(AdvancedSettingsEvents.SetPushProvider(1))
|
||||||
val withNewProvider = awaitItem()
|
val withNewProvider = awaitItem()
|
||||||
assertThat(withNewProvider.showChangePushProviderDialog).isFalse()
|
assertThat(withNewProvider.showChangePushProviderDialog).isFalse()
|
||||||
assertThat(withNewProvider.pushDistributor).isEqualTo(AsyncAction.Loading)
|
assertThat(withNewProvider.currentPushDistributor).isEqualTo(AsyncAction.Loading)
|
||||||
val lastItem = awaitItem()
|
val lastItem = awaitItem()
|
||||||
assertThat(lastItem.pushDistributor).isInstanceOf(AsyncAction.Failure::class.java)
|
assertThat(lastItem.currentPushDistributor).isInstanceOf(AsyncAction.Failure::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user