File tree Expand file tree Collapse file tree
Application/Presentation/ProfileTab/Sources/Settings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,13 +34,28 @@ struct SettingsFeature {
3434 var loading = LoadingFeature . State ( )
3535 var alertType : Action . AlertType ?
3636 var appVersion = Self . appVersion ( )
37- var appstoreUrl = Bundle . main . object ( forInfoDictionaryKey : " TESTFLIGHT_URL " ) as? String
37+ var betaTestURL = Self . betaTestURL ( )
3838 var policyURL = Bundle . main. object ( forInfoDictionaryKey: " PRIVACY_POLICY_URL " ) as? String
3939
4040 var isLoading : Bool {
4141 loading. isLoading
4242 }
4343
44+ private static func betaTestURL( ) -> URL ? {
45+ let databaseID = Bundle . main. object ( forInfoDictionaryKey: " FIRESTORE_DATABASE_ID " ) as? String
46+ guard databaseID? . trimmingCharacters ( in: . whitespacesAndNewlines) == " prod " ,
47+ let rawValue = Bundle . main. object ( forInfoDictionaryKey: " TESTFLIGHT_URL " ) as? String else {
48+ return nil
49+ }
50+
51+ let urlString = rawValue. trimmingCharacters ( in: . whitespacesAndNewlines)
52+ guard !urlString. isEmpty, !urlString. hasPrefix ( " $( " ) else {
53+ return nil
54+ }
55+
56+ return URL ( string: urlString)
57+ }
58+
4459 private static func appVersion( ) -> String ? {
4560 let marketingVersion = Bundle . main. object ( forInfoDictionaryKey: " CFBundleShortVersionString " ) as? String
4661 let buildNumber = Bundle . main. object ( forInfoDictionaryKey: " CFBundleVersion " ) as? String
Original file line number Diff line number Diff line change @@ -71,17 +71,16 @@ struct SettingsView: View {
7171 . foregroundColor ( Color . blue)
7272 }
7373 }
74- Button ( action: {
75- if let appStoreString = store. appstoreUrl,
76- let url = URL ( string: appStoreString) {
77- UIApplication . shared. open ( url)
78- }
79- } ) {
80- VStack ( alignment: . leading) {
81- Text ( String ( localized: " settings_join_beta " ) )
82- Text ( String ( localized: " settings_join_beta_subtitle " ) )
83- . foregroundStyle ( Color . gray)
84- . font ( . caption)
74+ if let betaTestURL = store. betaTestURL {
75+ Button {
76+ UIApplication . shared. open ( betaTestURL)
77+ } label: {
78+ VStack ( alignment: . leading) {
79+ Text ( String ( localized: " settings_join_beta " ) )
80+ Text ( String ( localized: " settings_join_beta_subtitle " ) )
81+ . foregroundStyle ( Color . gray)
82+ . font ( . caption)
83+ }
8584 }
8685 }
8786 }
You can’t perform that action at this time.
0 commit comments