enhance(android): Add All Files Access permission UI

pull/3535/head
leizhe 2021-12-13 11:26:14 +08:00 committed by Tienson Qin
parent 3c69a82659
commit 571d83e6f6
1 changed files with 26 additions and 2 deletions

View File

@ -138,6 +138,28 @@
"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/defc android-permission-alert
[]
(when (mobile-util/native-android?)
(rum/with-context [[t] i18n/*tongue-context*]
[:div.flex.flex-col
[:h1.title "Storage access permission"]
[:div.text-sm
[:div
[:p "Logseq needs the permission to access your device storage. Read "
[:a {:href "https://developer.android.com/about/versions/11/privacy/storage#all-files-access"
:target "_blank"}
"more"]
"."]
[:div
(ui/button "Grant Permission"
:on-click #(page-handler/ls-dir-files! shortcut/refresh!))]
[:p.mb-1 "Note:"]
[:ol
[:li "We will never access files outside of your graph folders you choose."]
[:li "If you have granted the permission, you don't need to do it again."]]]
[:hr]]])))
(rum/defcs add-graph < (rum/defcs add-graph <
[state & {:keys [graph-types] [state & {:keys [graph-types]
:or {graph-types [:local :github]} :or {graph-types [:local :github]}
@ -151,8 +173,10 @@
"add-github-repo")) "add-github-repo"))
:local :local
(rum/with-key (add-local-directory) [(rum/with-key (android-permission-alert)
"add-local-directory") "andoird-permission-alert")
(rum/with-key (add-local-directory)
"add-local-directory")]
nil)) nil))
available-graph (->> (set graph-types) available-graph (->> (set graph-types)