ios, android, desktop: choose a badge on the website

This commit is contained in:
spaced4ndy committed 2026-10-16 21:07:45 +04:00
1 parent e3324c6828
commit 898c6f1266
2 files changed
+62 -17

No files matched your search

@@ -63,18 +63,24 @@ fun BadgesSupportSimplexView(modalManager: ModalManager, unwindToDepth: Int) {
Spacer(Modifier.weight(1f))
// In-app purchase is not released: the badge is chosen on the site, and the code redeemed
// here. Revert this commit to restore the block below.
// Column(horizontalAlignment = Alignment.CenterHorizontally) {
// if (badgeStoreAvailable) {
// ChooseLevelButton(modalManager, unwindToDepth)
// if (badgeBrowserAllowed()) {
// BuyInBrowserTextButton()
// } else {
// RedeemCodeButton(modalManager, unwindToDepth)
// }
// } else {
// BuyInBrowserButton(modalManager, unwindToDepth)
// RedeemCodeButton(modalManager, unwindToDepth)
// }
// }
Column(horizontalAlignment = Alignment.CenterHorizontally) {
if (badgeStoreAvailable) {
ChooseLevelButton(modalManager, unwindToDepth)
if (badgeBrowserAllowed()) {
BuyInBrowserTextButton()
} else {
RedeemCodeButton(modalManager, unwindToDepth)
}
} else {
BuyInBrowserButton(modalManager, unwindToDepth)
RedeemCodeButton(modalManager, unwindToDepth)
}
ChooseBadgeOnSiteButton(modalManager, unwindToDepth)
RedeemCodeButton(modalManager, unwindToDepth)
}
}
}
@@ -134,6 +140,25 @@ private fun BuyInBrowserTextButton() {
)
}
// In-app purchase is not released: delete with the commented block above to restore it.
@Composable
private fun ChooseBadgeOnSiteButton(modalManager: ModalManager, unwindToDepth: Int) {
val uriHandler = LocalUriHandler.current
OnboardingActionButton(
modifier = if (appPlatform.isAndroid) Modifier.padding(horizontal = DEFAULT_ONBOARDING_HORIZONTAL_PADDING).fillMaxWidth() else Modifier.widthIn(min = 300.dp),
labelId = MR.strings.badges_choose_your_badge_title,
onboarding = null,
onclick = {
val linkReturns = appLinkSchemeRegistered()
uriHandler.openUriCatching(badgePageUrl(linkReturns))
// with no scheme to bring the code back, the code is pasted into this screen, opened beside the browser
if (!linkReturns && !modalManager.hasModalOpen(ModalViewId.BADGE_REDEEM_CODE)) {
modalManager.showModal(id = ModalViewId.BADGE_REDEEM_CODE) { BadgesRedeemCodeView(modalManager, unwindToDepth) }
}
}
)
}
@Composable
private fun BuyInBrowserButton(modalManager: ModalManager, unwindToDepth: Int) {
val uriHandler = LocalUriHandler.current