Files
session-ios/SessionUIKit/Screens/Settings/SessionProSettings/SessionProPaymentScreen+NoBillingAccess.swift
Morgan Pretty 7dfa2a77ae Merge remote-tracking branch 'upstream/dev' into feature/libsession-message-wrapping
# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Conversations/ConversationVC+Interaction.swift
#	Session/Conversations/ConversationVC.swift
#	Session/Conversations/Settings/ThreadSettingsViewModel.swift
#	Session/Home/App Review/AppReviewPromptModel.swift
#	Session/Home/HomeViewModel.swift
#	Session/Media Viewing & Editing/MessageInfoScreen.swift
#	Session/Meta/AppDelegate.swift
#	Session/Settings/DeveloperSettings/DeveloperSettingsProViewModel.swift
#	Session/Settings/SettingsViewModel.swift
#	Session/Shared/BaseVC.swift
#	Session/Utilities/UIContextualAction+Utilities.swift
#	SessionMessagingKit/Database/Models/SessionThread.swift
#	SessionMessagingKit/SessionPro/SessionProPaymentScreenContent.swift
#	SessionMessagingKit/SessionPro/SessionProSettingsViewModel.swift
#	SessionMessagingKit/SessionPro/SessionProState.swift
#	SessionMessagingKit/Shared Models/SessionThreadViewModel.swift
#	SessionNotificationServiceExtension/NotificationServiceExtension.swift
#	SessionUIKit/Components/Input View/InputView.swift
#	SessionUIKit/Components/SwiftUI/ProCTAModal.swift
#	SessionUIKit/Screens/Settings/SessionProSettings/SessionProPaymentScreen+CancelPlan.swift
#	SessionUIKit/Screens/Settings/SessionProSettings/SessionProPaymentScreen+Models.swift
#	SessionUIKit/Screens/Settings/SessionProSettings/SessionProPaymentScreen+Purchase.swift
#	SessionUIKit/Screens/Settings/SessionProSettings/SessionProPaymentScreen+Renew.swift
#	SessionUIKit/Screens/Settings/SessionProSettings/SessionProPaymentScreen+RequestRefund.swift
#	SessionUIKit/Screens/Settings/SessionProSettings/SessionProPaymentScreen+UpdatePlan.swift
#	SessionUIKit/Screens/Settings/SessionProSettings/SessionProPaymentScreen.swift
#	SessionUIKit/Screens/Settings/SessionProSettings/SessionProPlanUpdatedScreen.swift
#	SessionUIKit/Style Guide/Constants+Apple.swift
#	SignalUtilitiesKit/Media Viewing & Editing/Attachment Approval/AttachmentApprovalViewController.swift
#	SignalUtilitiesKit/Media Viewing & Editing/Attachment Approval/AttachmentTextToolbar.swift
2025-12-17 09:36:05 +11:00

178 lines
8.7 KiB
Swift

// Copyright © 2025 Rangeproof Pty Ltd. All rights reserved.
import SwiftUI
import Lucide
// MARK: - No Billing Access Content
struct NoBillingAccessContent: View {
let isRenewingPro: Bool
let originatingPlatform: SessionProUI.ClientPlatform
let openProRoadmapAction: (() -> Void)?
let openPlatformStoreWebsiteAction: (() -> Void)?
public init(
isRenewingPro: Bool,
originatingPlatform: SessionProUI.ClientPlatform,
openProRoadmapAction: (() -> Void)?,
openPlatformStoreWebsiteAction: (() -> Void)? = nil
) {
self.isRenewingPro = isRenewingPro
self.originatingPlatform = originatingPlatform
self.openProRoadmapAction = openProRoadmapAction
self.openPlatformStoreWebsiteAction = openPlatformStoreWebsiteAction
}
var approaches: [ApproachCell.Info] {
isRenewingPro ?
[
ApproachCell.Info(
title: "onLinkedDevice".localized(),
description: "proRenewDesktopLinked"
.put(key: "app_name", value: Constants.app_name)
.put(key: "app_pro", value: Constants.app_pro)
.put(key: "platform_store", value: SNUIKit.proClientPlatformStringProvider(for: .iOS).store)
.put(key: "platform_store_other", value: SNUIKit.proClientPlatformStringProvider(for: .android).store)
.put(key: "pro", value: Constants.pro)
.localizedFormatted(),
variant: .link
),
ApproachCell.Info(
title: "proNewInstallation".localized(),
description: "proNewInstallationDescription"
.put(key: "app_name", value: Constants.app_name)
.put(key: "platform_store", value: SNUIKit.proClientPlatformStringProvider(for: .iOS).store)
.put(key: "app_pro", value: Constants.app_pro)
.put(key: "pro", value: Constants.pro)
.localizedFormatted(),
variant: .device
),
ApproachCell.Info(
title: "onPlatformWebsite"
.put(key: "platform", value: originatingPlatform.store)
.localized(),
description: "proAccessRenewPlatformWebsite"
.put(key: "platform_account", value: originatingPlatform.platformAccount)
.put(key: "platform", value: originatingPlatform.platform)
.put(key: "pro", value: Constants.pro)
.localizedFormatted(Fonts.Body.baseRegular),
variant: .website
)
] :
[
ApproachCell.Info(
title: "onLinkedDevice".localized(),
description: "proUpgradeDesktopLinked"
.put(key: "app_name", value: Constants.app_name)
.put(key: "app_pro", value: Constants.app_pro)
.put(key: "platform_store", value: SNUIKit.proClientPlatformStringProvider(for: .iOS).store)
.put(key: "platform_store_other", value: SNUIKit.proClientPlatformStringProvider(for: .android).store)
.put(key: "pro", value: Constants.pro)
.localizedFormatted(),
variant: .link
),
ApproachCell.Info(
title: "proNewInstallation".localized(),
description: isRenewingPro ?
"proNewInstallationDescription"
.put(key: "app_name", value: Constants.app_name)
.put(key: "platform_store", value: SNUIKit.proClientPlatformStringProvider(for: .iOS).store)
.put(key: "app_pro", value: Constants.app_pro)
.put(key: "pro", value: Constants.pro)
.localizedFormatted() :
"proNewInstallationUpgrade"
.put(key: "app_name", value: Constants.app_name)
.put(key: "platform_store", value: SNUIKit.proClientPlatformStringProvider(for: .iOS).store)
.put(key: "app_pro", value: Constants.app_pro)
.put(key: "pro", value: Constants.pro)
.localizedFormatted(),
variant: .device
)
]
}
var body: some View {
VStack(spacing: Values.mediumSpacing) {
VStack(
alignment: .leading,
spacing: Values.mediumSpacing
) {
VStack(
alignment: .leading,
spacing: Values.verySmallSpacing
) {
Text(
isRenewingPro ?
"renewingPro"
.put(key: "pro", value: Constants.pro)
.localized() :
"proUpgradingTo"
.put(key: "pro", value: Constants.pro)
.localized()
)
.font(.Headings.H7)
.foregroundColor(themeColor: .textPrimary)
AttributedText(
isRenewingPro ?
"proRenewingNoAccessBilling"
.put(key: "pro", value: Constants.pro)
.put(key: "platform_store", value: SNUIKit.proClientPlatformStringProvider(for: .iOS).store)
.put(key: "platform_store_other", value: SNUIKit.proClientPlatformStringProvider(for: .android).store)
.put(key: "app_name", value: Constants.app_name)
.put(key: "build_variant", value: SNUIKit.buildVariantStringProvider().ipa)
.put(key: "icon", value: Lucide.Icon.squareArrowUpRight)
.localizedFormatted(Fonts.Body.baseRegular) :
"proUpgradeNoAccessBilling"
.put(key: "pro", value: Constants.pro)
.put(key: "platform_store", value: SNUIKit.proClientPlatformStringProvider(for: .iOS).store)
.put(key: "platform_store_other", value: SNUIKit.proClientPlatformStringProvider(for: .android).store)
.put(key: "app_name", value: Constants.app_name)
.put(key: "build_variant", value: SNUIKit.buildVariantStringProvider().ipa)
.put(key: "icon", value: Lucide.Icon.squareArrowUpRight)
.localizedFormatted(Fonts.Body.baseRegular)
)
.font(.Body.baseRegular)
.foregroundColor(themeColor: .textPrimary)
.onTapGesture {
self.openProRoadmapAction?()
}
}
Text(isRenewingPro ? "proOptionsRenewalSubtitle".localized() : "proUpgradeOptionsTwo".localized())
.font(.Body.baseRegular)
.foregroundColor(themeColor: .textSecondary)
ForEach(approaches.indices, id: \.self) { index in
ApproachCell(info: approaches[index])
}
}
.padding(Values.mediumSpacing)
.background(
RoundedRectangle(cornerRadius: 11)
.fill(themeColor: .backgroundSecondary)
)
if isRenewingPro {
Button {
openPlatformStoreWebsiteAction?()
} label: {
Text("openPlatformStoreWebsite".put(key: "platform_store", value: originatingPlatform.store).localized())
.font(.Body.largeRegular)
.foregroundColor(themeColor: .sessionButton_primaryFilledText)
.framing(
maxWidth: .infinity,
height: 50,
alignment: .center
)
.background(
RoundedRectangle(cornerRadius: 7)
.fill(themeColor: .sessionButton_primaryFilledBackground)
)
.padding(.vertical, Values.smallSpacing)
}
}
}
}
}