mirror of https://github.com/logseq/logseq
Move mobile startup to mobile.core/init to not have warning on every shadow reload
It is also the more appropriate place to have init code. Side effecting on a namespace require should be avoided as much as possible Cherry-pick #4482pull/4518/head
parent
5dd0234b9a
commit
d8bc074be1
|
@ -16,11 +16,6 @@
|
|||
[]
|
||||
(.ensureDocuments mobile-util/ios-file-container)))
|
||||
|
||||
(when (mobile-util/is-native-platform?)
|
||||
(.addListener mobile-util/fs-watcher "watcher"
|
||||
(fn [event]
|
||||
(state/pub-event! [:file-watcher/changed event]))))
|
||||
|
||||
(defn check-permission-android []
|
||||
(p/let [permission (.checkPermissions Filesystem)
|
||||
permission (-> permission
|
||||
|
|
|
@ -15,6 +15,17 @@
|
|||
[frontend.util :as util]
|
||||
[frontend.config :as config]))
|
||||
|
||||
(defn- ios-init
|
||||
[]
|
||||
(let [path (fs/iOS-ensure-documents!)]
|
||||
(println "iOS container path: " path))
|
||||
|
||||
;; Keyboard watcher
|
||||
;; (.addListener Keyboard "keyboardWillShow"
|
||||
;; #(state/pub-event! [:mobile/keyboard-will-show]))
|
||||
(.addListener Keyboard "keyboardDidShow"
|
||||
#(state/pub-event! [:mobile/keyboard-did-show])))
|
||||
|
||||
(defn init!
|
||||
[]
|
||||
;; patch back navigation
|
||||
|
@ -38,17 +49,15 @@
|
|||
(not (string/includes? href "#/")))
|
||||
(.exitApp App)
|
||||
(js/window.history.back))))))
|
||||
(when (mobile-util/native-ios?)
|
||||
(let [path (fs/iOS-ensure-documents!)]
|
||||
(println "iOS container path: " path))
|
||||
|
||||
;; Keyboard watcher
|
||||
;; (.addListener Keyboard "keyboardWillShow"
|
||||
;; #(state/pub-event! [:mobile/keyboard-will-show]))
|
||||
(.addListener Keyboard "keyboardDidShow"
|
||||
#(state/pub-event! [:mobile/keyboard-did-show])))
|
||||
(when (mobile-util/native-ios?)
|
||||
(ios-init))
|
||||
|
||||
(when (mobile-util/is-native-platform?)
|
||||
(.addListener mobile-util/fs-watcher "watcher"
|
||||
(fn [event]
|
||||
(state/pub-event! [:file-watcher/changed event])))
|
||||
|
||||
(.addEventListener js/window "statusTap"
|
||||
#(util/scroll-to-top true))
|
||||
|
||||
|
@ -60,7 +69,7 @@
|
|||
(if is-active?
|
||||
(p/do!
|
||||
(when (mobile-util/native-ios?)
|
||||
(mobile-util/sync-icloud-repo repo-dir))
|
||||
(mobile-util/sync-icloud-repo repo-dir))
|
||||
(nfs-handler/refresh! repo repo/refresh-cb)
|
||||
(notification/show! "Notes updated!" :success true))
|
||||
(editor-handler/save-current-block!))))))))
|
||||
|
|
Loading…
Reference in New Issue