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,30 @@ 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 (
38+ databaseID: Bundle . main. object ( forInfoDictionaryKey: " FIRESTORE_DATABASE_ID " ) as? String ,
39+ testFlightURL: Bundle . main. object ( forInfoDictionaryKey: " TESTFLIGHT_URL " ) as? String
40+ )
3841 var policyURL = Bundle . main. object ( forInfoDictionaryKey: " PRIVACY_POLICY_URL " ) as? String
3942
4043 var isLoading : Bool {
4144 loading. isLoading
4245 }
4346
47+ static func betaTestURL( databaseID: String ? , testFlightURL: String ? ) -> URL ? {
48+ guard databaseID? . trimmingCharacters ( in: . whitespacesAndNewlines) == " prod " ,
49+ let rawValue = testFlightURL else {
50+ return nil
51+ }
52+
53+ let urlString = rawValue. trimmingCharacters ( in: . whitespacesAndNewlines)
54+ guard !urlString. isEmpty, !urlString. hasPrefix ( " $( " ) else {
55+ return nil
56+ }
57+
58+ return URL ( string: urlString)
59+ }
60+
4461 private static func appVersion( ) -> String ? {
4562 let marketingVersion = Bundle . main. object ( forInfoDictionaryKey: " CFBundleShortVersionString " ) as? String
4663 let buildNumber = Bundle . main. object ( forInfoDictionaryKey: " CFBundleVersion " ) as? String
Original file line number Diff line number Diff line change @@ -71,17 +71,15 @@ 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+ Link ( destination: betaTestURL) {
76+ VStack ( alignment: . leading) {
77+ Text ( String ( localized: " settings_join_beta " ) )
78+ . foregroundStyle ( Color . primary)
79+ Text ( String ( localized: " settings_join_beta_subtitle " ) )
80+ . foregroundStyle ( Color . gray)
81+ . font ( . caption)
82+ }
8583 }
8684 }
8785 }
You can’t perform that action at this time.
0 commit comments