enhance(ios): add sync progress

This commit is contained in:
Andelf
2022-10-09 14:38:55 +08:00
committed by Tienson Qin
parent bc89d60664
commit ad4fec8ce7
2 changed files with 10 additions and 4 deletions

View File

@@ -323,7 +323,7 @@
[_state]
(let [_ (state/sub :auth/id-token)
online? (state/sub :network/online?)
enabled-progress-panel? (util/electron?)
enabled-progress-panel? (or (util/electron?) (mobile-util/native-ios?))
current-repo (state/get-current-repo)
creating-remote-graph? (state/sub [:ui/loading? :graph/create-remote?])
current-graph-id (state/sub-current-file-sync-graph-uuid)
@@ -428,7 +428,7 @@
synced-file-graph?
(concat
(if (and no-active-files? idle?)
[(when-not (util/electron?)
[(when-not (or (util/electron?) (mobile-util/native-ios?))
{:item [:div.flex.justify-center.w-full.py-2
[:span.opacity-60 "Everything is synced!"]]
:as-link? false})]
@@ -503,7 +503,7 @@
;; options
{:outer-header
[:<>
(when (util/electron?)
(when (or (util/electron?) (mobile-util/native-ios?))
(indicator-progress-pane
sync-state sync-progress
{:idle? idle?

View File

@@ -37,9 +37,15 @@
(mobile-util/check-ios-zoomed-display)
;; keep this the same logic as src/main/electron/listener.cljs
(.addListener mobile-util/file-sync "debug"
(fn [event]
(js/console.log "🔄" event))))
(js/console.log "🔄" event)
(let [event (js->clj event :keywordize-keys true)
payload (:data event)]
(when (or (= (:event event) "download:progress")
(= (:event event) "upload:progress"))
(state/set-state! [:file-sync/graph-state (:graphUUID payload) :file-sync/progress (:file payload)] payload))))))
(defn- android-init
"Initialize Android-specified event listeners"