Browse Source

Remove hardcoded urls

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Milen Pivchev 1 year ago
parent
commit
5965eda67e
2 changed files with 11 additions and 5 deletions
  1. 9 5
      iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift
  2. 2 0
      iOSClient/NCGlobal.swift

+ 9 - 5
iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift

@@ -29,26 +29,30 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell {
     }
 
     @objc func talkTapped() {
-        let url = URL(string: "nextcloudtalk://")!
+        guard let url = URL(string: NCGlobal.shared.talkSchemeUrl) else { return }
 
         if UIApplication.shared.canOpenURL(url) {
             UIApplication.shared.open(url)
         } else {
-            UIApplication.shared.open(URL(string: NCGlobal.shared.talkAppStoreUrl)!)
+            guard let url = URL(string: NCGlobal.shared.talkAppStoreUrl) else { return }
+            UIApplication.shared.open(url)
         }
     }
 
     @objc func notesTapped() {
-        let url = URL(string: "nextcloudnotes://")!
+        guard let url = URL(string: NCGlobal.shared.notesSchemeUrl) else { return }
 
         if UIApplication.shared.canOpenURL(url) {
             UIApplication.shared.open(url)
         } else {
-            UIApplication.shared.open(URL(string: NCGlobal.shared.notesAppStoreUrl)!)
+            guard let url = URL(string: NCGlobal.shared.notesAppStoreUrl) else { return }
+            UIApplication.shared.open(url)
         }
     }
 
     @objc func moreAppsTapped() {
-        UIApplication.shared.open(URL(string: NCGlobal.shared.moreAppsUrl)!)
+        guard let url = URL(string: NCGlobal.shared.moreAppsUrl) else { return }
+
+        UIApplication.shared.open(url)
     }
 }

+ 2 - 0
iOSClient/NCGlobal.swift

@@ -443,6 +443,8 @@ class NCGlobal: NSObject {
     var capabilityGroupfoldersEnabled: Bool                     = false // NC27
 
     // MORE APPS
+    let talkSchemeUrl = "nextcloudtalk://"
+    let notesSchemeUrl = "nextcloudnotes://"
     let talkAppStoreUrl                                         = "https://apps.apple.com/de/app/nextcloud-talk/id1296825574"
     let notesAppStoreUrl                                        = "https://apps.apple.com/de/app/nextcloud-notes/id813973264"
     let moreAppsUrl                                             = "https://www.apple.com/us/search/nextcloud?src=globalnav"