@@ -74,6 +74,8 @@ enum DistributorType: String {
7474@MainActor
7575final class ThemeExpansionManager : ObservableObject {
7676 static let productIdentifier = " SD_Theme_Expansion "
77+ static let comingSoonMessage = " Theme Expansion is coming soon on this store. "
78+ static let unavailableMessage = " Theme Expansion isn’t available. "
7779
7880 @Published private( set) var hasThemeExpansion = false
7981 @Published private( set) var themeExpansionProduct : Product ?
@@ -84,6 +86,13 @@ final class ThemeExpansionManager: ObservableObject {
8486 // New: distribution awareness
8587 @Published private( set) var distributor : DistributorType
8688 var isAppStoreBuild : Bool { distributor == . appStore }
89+ var shouldShowThemeExpansionUpsell : Bool {
90+ guard isAppStoreBuild else { return false }
91+ if let lastError, lastError == Self . unavailableMessage {
92+ return false
93+ }
94+ return true
95+ }
8796
8897 private var updatesTask : Task < Void , Never > ?
8998 private let isPreviewInstance : Bool
@@ -163,7 +172,7 @@ final class ThemeExpansionManager: ObservableObject {
163172 func restorePurchases( ) async {
164173 guard !isPreviewInstance else { return }
165174 guard isAppStoreBuild else {
166- lastError = " Theme Expansion is coming soon on this store. "
175+ lastError = Self . comingSoonMessage
167176 return
168177 }
169178 isProcessing = true
@@ -180,7 +189,7 @@ final class ThemeExpansionManager: ObservableObject {
180189 func purchaseThemeExpansion( ) async {
181190 guard !isPreviewInstance else { return }
182191 guard isAppStoreBuild else {
183- lastError = " Theme Expansion is coming soon on this store. "
192+ lastError = Self . comingSoonMessage
184193 return
185194 }
186195
@@ -195,13 +204,9 @@ final class ThemeExpansionManager: ObservableObject {
195204 product = first
196205 } else {
197206 #if targetEnvironment(simulator)
198- lastError = """
199- Theme Expansion isn’t available.
200- """
207+ lastError = Self . unavailableMessage
201208 #else
202- lastError = """
203- Theme Expansion isn’t available.
204- """
209+ lastError = Self . unavailableMessage
205210 #endif
206211 return
207212 }
0 commit comments