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"}
svg/refresh])
(when-not (util/electron?)
(when (and
(not (mobile-util/is-native-platform?))
(not (util/electron?)))
(login logged?))
(repo/sync-status current-repo)

View File

@ -86,15 +86,7 @@
(rum/with-context [[t] i18n/*tongue-context*]
[:div.flex.flex-col
[:h1.title "Add a graph"]
(if (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?)]
(let [nfs-supported? (or (nfs/supported?) (mobile/is-native-platform?))]
[:div.cp__widgets-open-local-directory
[:div.select-file-wrap.cursor
(when nfs-supported?
@ -115,7 +107,7 @@
[:a {:href "https://web.dev/file-system-access/"
:target "_blank"}
"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 <
[state & {:keys [graph-types]

View File

@ -67,6 +67,7 @@
(defrecord Capacitorfs []
protocol/Fs
(mkdir! [this dir]
(prn "mkdir: " dir)
(p/let [result (.mkdir Filesystem
(clj->js
{:path dir
@ -111,7 +112,11 @@
(rename! [this repo old-path new-path]
nil)
(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]
(case (util/platform)
"android"