diff --git a/ios/App/App/DownloadiCloudFiles.swift b/ios/App/App/DownloadiCloudFiles.swift index b01940179..62f43aab9 100644 --- a/ios/App/App/DownloadiCloudFiles.swift +++ b/ios/App/App/DownloadiCloudFiles.swift @@ -50,19 +50,6 @@ public class DownloadiCloudFiles: CAPPlugin, UIDocumentPickerDelegate { call.resolve(["success": downloaded]) } - @objc func iCloudSync(_ call: CAPPluginCall) { - - if let url = self.containerUrl, fileManager.fileExists(atPath: url.path) { - do { - downloaded = try self.downloadAllFilesFromCloud(at: url, ignorePattern: [".git", ".Trash", "bak", ".recycle"]) - } catch { - print(error.localizedDescription) - } - } - - call.resolve(["success": downloaded]) - } - func appendUndownloadedFile(at url: URL){ var lastPathComponent = url.lastPathComponent lastPathComponent.removeFirst() diff --git a/src/main/frontend/handler.cljs b/src/main/frontend/handler.cljs index f7ec1008a..bbabeba9c 100644 --- a/src/main/frontend/handler.cljs +++ b/src/main/frontend/handler.cljs @@ -129,9 +129,6 @@ (js/console.error "Failed to request GitHub app tokens.")))) (watch-for-date!) - (when (and (state/get-current-repo) - (mobile-util/native-ios?)) - (mobile-util/icloud-sync!)) (file-handler/watch-for-current-graph-dir!))) (p/then (state/pub-event! [:graph/ready (state/get-current-repo)])) (p/catch (fn [error] diff --git a/src/main/frontend/handler/repo.cljs b/src/main/frontend/handler/repo.cljs index f96bc8c33..542c7d992 100644 --- a/src/main/frontend/handler/repo.cljs +++ b/src/main/frontend/handler/repo.cljs @@ -26,7 +26,6 @@ [lambdaisland.glogi :as log] [promesa.core :as p] [shadow.resource :as rc] - [frontend.mobile.util :as mobile-util] [frontend.db.persist :as db-persist] [electron.ipc :as ipc] [clojure.set :as set])) @@ -630,12 +629,9 @@ [nfs-rebuild-index! ok-handler] (route-handler/redirect-to-home!) (when-let [repo (state/get-current-repo)] - (let [local? (config/local-db? repo) - repo-dir (config/get-repo-dir repo)] + (let [local? (config/local-db? repo)] (if local? - (p/let [_ (when (mobile-util/native-ios?) - (mobile-util/sync-icloud-repo repo-dir)) - _ (metadata-handler/set-pages-metadata! repo)] + (p/let [_ (metadata-handler/set-pages-metadata! repo)] (nfs-rebuild-index! repo ok-handler)) (rebuild-index! repo)) (js/setTimeout diff --git a/src/main/frontend/mobile/core.cljs b/src/main/frontend/mobile/core.cljs index de4e2da2a..7426da15f 100644 --- a/src/main/frontend/mobile/core.cljs +++ b/src/main/frontend/mobile/core.cljs @@ -7,12 +7,8 @@ ["@capacitor/status-bar" :refer [^js StatusBar]] [clojure.string :as string] [frontend.fs.capacitor-fs :as fs] - [frontend.components.repo :as repo] - [frontend.handler.web.nfs :as nfs-handler] [frontend.handler.editor :as editor-handler] - [promesa.core :as p] - [frontend.util :as util] - [frontend.config :as config])) + [frontend.util :as util])) (defn- ios-init [] @@ -62,13 +58,7 @@ (.addListener App "appStateChange" (fn [^js state] - (when-let [repo (state/get-current-repo)] - (let [is-active? (.-isActive state) - repo-dir (config/get-repo-dir repo)] - (if is-active? - (p/do! - (when (mobile-util/native-ios?) - (mobile-util/sync-icloud-repo repo-dir)) - (nfs-handler/refresh! repo repo/refresh-cb) - (notification/show! "Notes updated!" :success true)) + (when (state/get-current-repo) + (let [is-active? (.-isActive state)] + (when is-active? (editor-handler/save-current-block!)))))))) diff --git a/src/main/frontend/mobile/util.cljs b/src/main/frontend/mobile/util.cljs index 35cbe8c49..f3f4808c3 100644 --- a/src/main/frontend/mobile/util.cljs +++ b/src/main/frontend/mobile/util.cljs @@ -78,7 +78,6 @@ :iPhoneSE4 {:width 320 :height 568 :statusbar 20} :iPodtouch5 {:width 320 :height 568 :statusbar 20}})) - (defn get-idevice-model [] (when (native-ios?) @@ -129,10 +128,3 @@ (if (and model landscape?) 20 (:statusbar (model @idevice-info))))) - -(defn icloud-sync! - [] - (let [f (fn [] - (.downloadFilesFromiCloud download-icloud-files))] - (f) - (js/setInterval f 300000)))