mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-27 17:58:47 +00:00
ios, android: keep the badge link screen open while it redeems, and redeem once
This commit is contained in:
@@ -327,9 +327,13 @@ struct BadgesRedeemLinkView: View {
|
||||
.padding(.bottom, 20)
|
||||
.frame(maxHeight: .infinity)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
// the outcome closes what is on screen, which after a close here would be some other screen
|
||||
.interactiveDismissDisabled(true)
|
||||
}
|
||||
|
||||
private func redeemFromLink() {
|
||||
// a second tap before the screen changes must not send the code again
|
||||
guard step == .confirming else { return }
|
||||
guard let user = chatModel.currentUser else { return dismissAllSheets() }
|
||||
step = .issuing
|
||||
Task {
|
||||
|
||||
+4
-1
@@ -276,6 +276,8 @@ fun BadgesRedeemLinkView(rhId: Long?, code: String, close: () -> Unit) {
|
||||
val step = remember { mutableStateOf(BadgeLinkStep.Confirming) }
|
||||
|
||||
fun redeemFromLink() {
|
||||
// a second tap before the screen changes must not send the code again
|
||||
if (step.value != BadgeLinkStep.Confirming) return
|
||||
val user = chatModel.currentUser.value ?: return close()
|
||||
step.value = BadgeLinkStep.Issuing
|
||||
withBGApi {
|
||||
@@ -295,7 +297,8 @@ fun BadgesRedeemLinkView(rhId: Long?, code: String, close: () -> Unit) {
|
||||
|
||||
when (step.value) {
|
||||
BadgeLinkStep.Confirming -> ModalView(close) { Confirming(onConfirm = ::redeemFromLink, onCancel = close) }
|
||||
BadgeLinkStep.Issuing -> ModalView(close) { BeingIssued() }
|
||||
// the outcome closes what is on screen, which after a close here would be some other screen
|
||||
BadgeLinkStep.Issuing -> ModalView(close, enableClose = false) { BeingIssued() }
|
||||
BadgeLinkStep.Redeemed -> BadgesView(ModalManager.end, close)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user