ios, android, desktop: choose a badge in the app

This commit is contained in:
spacedandy-agents-simplex committed 2026-10-19 11:18:25 +00:00
1 parent d50488460d
commit ea359edb66
2 files changed
+17 -62

No files matched your search

@@ -45,25 +45,15 @@ struct BadgesSupportSimplexView: View {
Spacer(minLength: 0)
// 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.
// VStack(spacing: 10) {
// chooseLevelButton()
// .padding(.vertical, 10)
// Group {
// if badgeBrowserAllowed {
// buyInBrowserButton()
// } else {
// RedeemCodeButton()
// }
// }
// .frame(height: 22)
// }
VStack(spacing: 10) {
chooseBadgeOnSiteButton()
chooseLevelButton()
.padding(.vertical, 10)
Group {
RedeemCodeButton()
if badgeBrowserAllowed {
buyInBrowserButton()
} else {
RedeemCodeButton()
}
}
.frame(height: 22)
}
@@ -141,16 +131,6 @@ struct BadgesSupportSimplexView: View {
}
}
// In-app purchase is not released: delete with the commented block above to restore it.
private func chooseBadgeOnSiteButton() -> some View {
Button {
UIApplication.shared.open(URL(string: badgePageUrl)!)
} label: {
Text("Choose your badge")
}
.buttonStyle(OnboardingButtonStyle(isDisabled: false))
}
private func buyInBrowserButton() -> some View {
Button {
UIApplication.shared.open(URL(string: badgePageUrl)!)
@@ -63,24 +63,18 @@ 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) {
ChooseBadgeOnSiteButton(modalManager, unwindToDepth)
RedeemCodeButton(modalManager, unwindToDepth)
if (badgeStoreAvailable) {
ChooseLevelButton(modalManager, unwindToDepth)
if (badgeBrowserAllowed()) {
BuyInBrowserTextButton()
} else {
RedeemCodeButton(modalManager, unwindToDepth)
}
} else {
BuyInBrowserButton(modalManager, unwindToDepth)
RedeemCodeButton(modalManager, unwindToDepth)
}
}
}
}
@@ -140,25 +134,6 @@ 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