mobile(fs): stat

pull/3175/head
Tienson Qin 2021-09-27 16:02:37 +08:00
parent e5916bd69d
commit 38d78739af
3 changed files with 29 additions and 30 deletions

View File

@ -240,7 +240,9 @@
[:div {:class "animate-spin-reverse"} [:div {:class "animate-spin-reverse"}
svg/refresh]) svg/refresh])
(when-not (util/electron?) (when (and
(not (mobile-util/is-native-platform?))
(not (util/electron?)))
(login logged?)) (login logged?))
(repo/sync-status current-repo) (repo/sync-status current-repo)

View File

@ -86,15 +86,7 @@
(rum/with-context [[t] i18n/*tongue-context*] (rum/with-context [[t] i18n/*tongue-context*]
[:div.flex.flex-col [:div.flex.flex-col
[:h1.title "Add a graph"] [:h1.title "Add a graph"]
(if (mobile/is-native-platform?) (let [nfs-supported? (or (nfs/supported?) (mobile/is-native-platform?))]
(ui/button "Open mobile graph test"
:on-click
(fn []
(p/let [folder (.pickFolder mobile/folder-picker)]
(js/console.log folder)
;;TODO
nil)))
(let [nfs-supported? (nfs/supported?)]
[:div.cp__widgets-open-local-directory [:div.cp__widgets-open-local-directory
[:div.select-file-wrap.cursor [:div.select-file-wrap.cursor
(when nfs-supported? (when nfs-supported?
@ -115,7 +107,7 @@
[:a {:href "https://web.dev/file-system-access/" [:a {:href "https://web.dev/file-system-access/"
:target "_blank"} :target "_blank"}
"new native filesystem API"] "new native filesystem API"]
[:span ", please use any Chromium 86+ based browser like Chrome, Vivaldi, Edge, etc. Notice that the API doesn't support mobile browsers at the moment."]]))]]]))])) [:span ", please use any Chromium 86+ based browser like Chrome, Vivaldi, Edge, etc. Notice that the API doesn't support mobile browsers at the moment."]]))]]])]))
(rum/defcs add-graph < (rum/defcs add-graph <
[state & {:keys [graph-types] [state & {:keys [graph-types]

View File

@ -67,6 +67,7 @@
(defrecord Capacitorfs [] (defrecord Capacitorfs []
protocol/Fs protocol/Fs
(mkdir! [this dir] (mkdir! [this dir]
(prn "mkdir: " dir)
(p/let [result (.mkdir Filesystem (p/let [result (.mkdir Filesystem
(clj->js (clj->js
{:path dir {:path dir
@ -111,7 +112,11 @@
(rename! [this repo old-path new-path] (rename! [this repo old-path new-path]
nil) nil)
(stat [this dir path] (stat [this dir path]
nil) (let [path (str dir path)]
(p/let [result (.stat Filesystem (clj->js
{:path path
:directory (.-ExternalStorage Directory)}))]
result)))
(open-dir [this ok-handler] (open-dir [this ok-handler]
(case (util/platform) (case (util/platform)
"android" "android"