purple: disable apple IAP ui by default
We do not have Apple In-app purchases ready for the upcoming release. This commit hides IAP UI/UX behind a developer feature flag which is off by default, and shows a link inviting the user to visit the website to learn more. It also makes the link go to the normal Damus website. Signed-off-by: Daniel D’Aquino <daniel@daquino.me> Reviewed-by: William Casarin <jb55@jb55.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
e649c49981
commit
cdd5327829
@@ -31,6 +31,12 @@ class DamusPurple: StoreObserverDelegate {
|
||||
// TODO: On release, we could just replace this with `true` (or some other feature flag)
|
||||
return self.settings.enable_experimental_purple_api
|
||||
}
|
||||
|
||||
// Whether to enable Apple In-app purchase support
|
||||
var enable_purple_iap_support: Bool {
|
||||
// TODO: When we have full support for Apple In-app purchases, we can replace this with `true` (or another feature flag)
|
||||
return self.settings.enable_experimental_purple_iap_support
|
||||
}
|
||||
|
||||
func profile_purple_badge_info(pubkey: Pubkey) async -> UserBadgeInfo? {
|
||||
if let cached_result = self.starred_profiles_cache[pubkey] {
|
||||
|
||||
@@ -208,6 +208,9 @@ class UserSettingsStore: ObservableObject {
|
||||
@StringSetting(key: "purple_environment", default_value: .production)
|
||||
var purple_enviroment: DamusPurpleEnvironment
|
||||
|
||||
@Setting(key: "enable_experimental_purple_iap_support", default_value: false)
|
||||
var enable_experimental_purple_iap_support: Bool
|
||||
|
||||
@Setting(key: "emoji_reactions", default_value: default_emoji_reactions)
|
||||
var emoji_reactions: [String]
|
||||
|
||||
|
||||
@@ -362,18 +362,20 @@ struct DamusPurpleView: View {
|
||||
|
||||
var ProductStateView: some View {
|
||||
Group {
|
||||
switch self.products {
|
||||
case .failed:
|
||||
ProductLoadError
|
||||
case .loaded(let products):
|
||||
if let purchased {
|
||||
PurchasedView(purchased)
|
||||
} else {
|
||||
ProductsView(products)
|
||||
}
|
||||
case .loading:
|
||||
ProgressView()
|
||||
.progressViewStyle(.circular)
|
||||
if damus_state.purple.enable_purple_iap_support {
|
||||
switch self.products {
|
||||
case .failed:
|
||||
ProductLoadError
|
||||
case .loaded(let products):
|
||||
if let purchased {
|
||||
PurchasedView(purchased)
|
||||
} else {
|
||||
ProductsView(products)
|
||||
}
|
||||
case .loading:
|
||||
ProgressView()
|
||||
.progressViewStyle(.circular)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -457,8 +459,11 @@ struct DamusPurpleView: View {
|
||||
HStack {
|
||||
Spacer()
|
||||
Link(
|
||||
NSLocalizedString("Learn more", comment: "Label for a link to the Damus Purple landing page"),
|
||||
destination: damus_state.purple.environment.purple_landing_page_url()
|
||||
damus_state.purple.enable_purple_iap_support ?
|
||||
NSLocalizedString("Learn more about the features", comment: "Label for a link to the Damus website, to allow the user to learn more about the features of Purple")
|
||||
:
|
||||
NSLocalizedString("Coming soon! Visit our website to learn more", comment: "Label announcing Purple, and inviting the user to learn more on the website"),
|
||||
destination: damus_state.purple.environment.damus_website_url()
|
||||
)
|
||||
.foregroundColor(DamusColors.pink)
|
||||
.padding()
|
||||
|
||||
@@ -34,6 +34,9 @@ struct DeveloperSettingsView: View {
|
||||
.tag(purple_environment.rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
Toggle("Enable experimental Purple In-app purchase support", isOn: $settings.enable_experimental_purple_iap_support)
|
||||
.toggleStyle(.switch)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user