瀏覽代碼

enhance(iOS): refresh when launching/switching app

leizhe 3 年之前
父節點
當前提交
cdfe9f5ccc
共有 1 個文件被更改,包括 12 次插入2 次删除
  1. 12 2
      src/main/frontend/mobile/core.cljs

+ 12 - 2
src/main/frontend/mobile/core.cljs

@@ -6,7 +6,11 @@
             [reitit.frontend.easy :as rfe]
             [clojure.string :as string]
             [frontend.handler.notification :as notification]
-            [frontend.fs.capacitor-fs :as fs]))
+            [frontend.fs.capacitor-fs :as fs]
+            [frontend.handler.page :as page-handler]
+            [frontend.modules.shortcut.core :as shortcut]
+            [frontend.components.repo :as repo]
+            [frontend.handler.web.nfs :as nfs-handler]))
 
 (defn init!
   []
@@ -39,4 +43,10 @@
     (.addListener Keyboard "keyboardWillShow"
                   #(state/pub-event! [:mobile/keyboard-will-show]))
     (.addListener Keyboard "keyboardDidShow"
-                  #(state/pub-event! [:mobile/keyboard-did-show]))))
+                  #(state/pub-event! [:mobile/keyboard-did-show]))
+    
+    (.addListener App "appStateChange"
+                  #(let [repo (state/get-current-repo)]
+                     (nfs-handler/refresh! repo repo/refresh-cb)
+                     ;; (notification/show! "Notes updated!" :success true)
+                     ))))