remove some unnecessary iCloud sync functions.

pull/4450/head
llcc 2022-03-18 13:04:15 +08:00
parent 71cba1d314
commit 61bff0ae93
5 changed files with 6 additions and 44 deletions

View File

@ -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()

View File

@ -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]

View File

@ -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

View File

@ -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!))))))))

View File

@ -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)))