diff --git a/src/main/frontend/handler.cljs b/src/main/frontend/handler.cljs index 96bb9c9e14..7c33be906c 100644 --- a/src/main/frontend/handler.cljs +++ b/src/main/frontend/handler.cljs @@ -58,6 +58,14 @@ (f) (js/setInterval f 5000))) +(defn- icloud-sync! + [] + (let [f (fn [] + (when (state/get-current-repo) + (.downloadFilesFromiCloud mobile-util/download-icloud-files)))] + (f) + (js/setInterval f 300000))) + (defn- instrument! [] (let [total (srs/get-srs-cards-total)] @@ -130,6 +138,8 @@ (js/console.error "Failed to request GitHub app tokens.")))) (watch-for-date!) + (when (mobile-util/native-ios?) + (icloud-sync!)) (file-handler/watch-for-current-graph-dir!))) (p/catch (fn [error] (log/error :exception error)))))) diff --git a/src/main/frontend/handler/page.cljs b/src/main/frontend/handler/page.cljs index 4b7a6803b1..7e7c91e282 100644 --- a/src/main/frontend/handler/page.cljs +++ b/src/main/frontend/handler/page.cljs @@ -721,9 +721,7 @@ (config/get-file-extension format)) file-path (str "/" path) repo-dir (config/get-repo-dir repo)] - (p/let [_ (when (mobile-util/native-ios?) - (.downloadFilesFromiCloud mobile-util/download-icloud-files)) - file-exists? (fs/file-exists? repo-dir file-path) + (p/let [file-exists? (fs/file-exists? repo-dir file-path) file-content (when file-exists? (fs/read-file repo-dir file-path))] (when (and (db/page-empty? repo today-page)