소스 검색

fix(ios): ensure fallback system image

Tienson Qin 3 달 전
부모
커밋
3eb0846bba
2개의 변경된 파일28개의 추가작업 그리고 7개의 파일을 삭제
  1. 12 3
      ios/App/App/LiquidTabsPlugin.swift
  2. 16 4
      src/main/mobile/bottom_tabs.cljs

+ 12 - 3
ios/App/App/LiquidTabsPlugin.swift

@@ -39,11 +39,20 @@ public class LiquidTabsPlugin: CAPPlugin, CAPBridgedPlugin {
 
         let tabs: [LiquidTab] = tabsArray.compactMap { dict in
             guard
-                let id = dict["id"] as? String,
-                let title = dict["title"] as? String
+              let id = dict["id"] as? String,
+              let title = dict["title"] as? String
             else { return nil }
 
-            let systemImage = dict["systemImage"] as? String ?? "square"
+            let rawSystemImage = dict["systemImage"] as? String ?? "square"
+
+            let systemImage: String = {
+                if UIImage(systemName: rawSystemImage) != nil {
+                    return rawSystemImage
+                } else {
+                    return "square"
+                }
+            }()
+
             let roleStr = dict["role"] as? String ?? "normal"
             let role: LiquidTab.Role = (roleStr == "search") ? .search : .normal
 

+ 16 - 4
src/main/mobile/bottom_tabs.cljs

@@ -122,7 +122,19 @@
 (defn configure
   []
   (configure-tabs
-   [{:id "home"       :title "Home"       :systemImage "house" :role "normal"}
-    {:id "graphs"     :title "Graphs"     :systemImage "app.background.dotted"  :role "normal"}
-    {:id "capture"    :title "Capture"    :systemImage "tray"  :role "normal"}
-    {:id "go to"  :title "Go To"  :systemImage "square.stack.3d.down.right"  :role "normal"}]))
+   [{:id "home"
+     :title "Home"
+     :systemImage "house"
+     :role "normal"}
+    {:id "graphs"
+     :title "Graphs"
+     :systemImage "app.background.dotted"
+     :role "normal"}
+    {:id "capture"
+     :title "Capture"
+     :systemImage "tray"
+     :role "normal"}
+    {:id "go to"
+     :title "Go To"
+     :systemImage "square.stack.3d.down.right"
+     :role "normal"}]))