-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor #1507: migrated settings screen to compose
- Loading branch information
1 parent
251c82d
commit e203eab
Showing
7 changed files
with
78 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
core/ui/src/main/kotlin/org/mifos/mobilewallet/mifospay/ui/utility/DialogState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.mifos.mobilewallet.mifospay.ui.utility | ||
|
||
data class DialogState( | ||
val type: DialogType = DialogType.NONE, | ||
val onConfirm: () -> Unit = {} | ||
) |
2 changes: 1 addition & 1 deletion
2
...wallet/mifospay/settings/ui/DialogType.kt → ...ewallet/mifospay/ui/utility/DialogType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/settings/ui/DialogManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.mifos.mobilewallet.mifospay.settings.ui | ||
|
||
import MifosDialogBox | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import org.mifos.mobilewallet.mifospay.R | ||
import org.mifos.mobilewallet.mifospay.ui.utility.DialogState | ||
import org.mifos.mobilewallet.mifospay.ui.utility.DialogType | ||
|
||
@Composable | ||
fun DialogManager(dialogState: DialogState, onDismiss: () -> Unit) { | ||
when (dialogState.type) { | ||
DialogType.DISABLE_ACCOUNT -> MifosDialogBox( | ||
showDialogState = remember { mutableStateOf(true) }, | ||
title = R.string.alert_disable_account, | ||
message = R.string.alert_disable_account_desc, | ||
confirmButtonText = R.string.ok, | ||
dismissButtonText = R.string.cancel, | ||
onConfirm = dialogState.onConfirm, | ||
onDismiss = onDismiss | ||
) | ||
|
||
DialogType.LOGOUT -> MifosDialogBox( | ||
showDialogState = remember { mutableStateOf(true) }, | ||
title = R.string.log_out_title, | ||
message = R.string.empty, | ||
confirmButtonText = R.string.yes, | ||
dismissButtonText = R.string.no, | ||
onConfirm = dialogState.onConfirm, | ||
onDismiss = onDismiss | ||
) | ||
|
||
DialogType.NONE -> {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters