From 8edaa256dbd4a39a0b82669041570c6fb4c927fa Mon Sep 17 00:00:00 2001 From: Andelf Date: Tue, 4 Apr 2023 10:39:51 +0800 Subject: [PATCH] fix(ios): no permission warning See-also #9002 --- src/main/frontend/handler.cljs | 5 ++++- src/main/frontend/mobile/core.cljs | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/frontend/handler.cljs b/src/main/frontend/handler.cljs index 60cd95d9be..bdc91a7cce 100644 --- a/src/main/frontend/handler.cljs +++ b/src/main/frontend/handler.cljs @@ -41,7 +41,8 @@ [frontend.util.persist-var :as persist-var] [goog.object :as gobj] [lambdaisland.glogi :as log] - [promesa.core :as p])) + [promesa.core :as p] + [frontend.mobile.core :as mobile])) (defn set-global-error-notification! [] @@ -216,6 +217,8 @@ (events/run!) (p/do! + (when (mobile-util/native-platform?) + (mobile/mobile-preinit)) (-> (p/let [repos (get-repos) _ (state/set-repos! repos) _ (restore-and-setup! repos)] diff --git a/src/main/frontend/mobile/core.cljs b/src/main/frontend/mobile/core.cljs index 249e7bd9f1..cc40acc1e0 100644 --- a/src/main/frontend/mobile/core.cljs +++ b/src/main/frontend/mobile/core.cljs @@ -21,6 +21,13 @@ (def *last-shared-url (atom nil)) (def *last-shared-seconds (atom 0)) +(defn mobile-preinit + "preinit logic of mobile platforms: setup document folder permission" + [] + (when (mobile-util/native-ios?) + ;; Caution: This must be called before any file accessing + (capacitor-fs/ios-ensure-documents!))) + (defn- ios-init "Initialize iOS-specified event listeners" []