[Wallet] remove syncing animation (#2011)

* [design] remove syncing animation outside of chat views

replace no-sync-bar? parameter by show-sync-bar? parameter as not showing
the sync bar is the norm and showing it the exception (only appears in chats)

* add suscription and spec for sync-state
This commit is contained in:
Eric Dvorsak 2017-10-05 19:16:41 +02:00 committed by Roman Volosovskyi
parent ba5bd2b511
commit d022c286bb
11 changed files with 17 additions and 14 deletions

View File

@ -114,7 +114,7 @@
[view
[status-bar]
(let [hide-nav? (or (empty? accounts) show-actions? creating?)]
[toolbar/toolbar2 {}
[toolbar/toolbar2 {:show-sync-bar? true}
(when-not hide-nav? toolbar/default-nav-back)
[toolbar-content-view]
[toolbar-action]])

View File

@ -71,7 +71,7 @@
show-actions? [:chat-ui-props :show-actions?]
accounts [:get-accounts]
contact [:get-in [:contacts/contacts @chat-id]]
sync-state [:get :sync-state]
sync-state [:sync-state]
creating? [:get :accounts/creating-account?]]
[view (st/chat-name-view (or (empty? accounts)
show-actions?

View File

@ -74,7 +74,7 @@
(defn sync-state-gradient-view []
(let [sync-state (subscribe [:get :sync-state])
(let [sync-state (subscribe [:sync-state])
gradient-position (anim/create-value 0)
sync-state-opacity (anim/create-value 0.0)
in-progress-opacity (anim/create-value 0.0)
@ -117,4 +117,4 @@
:locations [0 0.3 0.7 1]
:style (st/gradient gradient-width)}]]
(when (not= @sync-state :in-progress)
[animated-view {:style (st/synced-wrapper synced-opacity window-width)}])]])})))
[animated-view {:style (st/synced-wrapper synced-opacity window-width)}])]])})))

View File

@ -17,7 +17,7 @@
:duration 250})))
(defn offline-view [_]
(let [sync-state (subscribe [:get :sync-state])
(let [sync-state (subscribe [:sync-state])
network-status (subscribe [:get :network-status])
offline-opacity (anim/create-value 0.0)
on-update (fn [_ _]

View File

@ -98,7 +98,7 @@
([title] (toolbar2 nil title))
([props title] (toolbar2 props default-nav-back [content-title title]))
([props nav-item content-item] (toolbar2 props nav-item content-item [actions [{:image :blank}]]))
([{:keys [background-color style flat? no-sync-bar?]}
([{:keys [background-color style flat? show-sync-bar?]}
nav-item
content-item
action-items]
@ -114,7 +114,7 @@
[rn/view st/flex]
content-item)
action-items]
(when-not no-sync-bar? [sync-state-gradient-view/sync-state-gradient-view])]))
(when show-sync-bar? [sync-state-gradient-view/sync-state-gradient-view])]))
(defn toolbar
"DEPRECATED

View File

@ -54,7 +54,7 @@
[{:keys [id] :as transaction} [:get :selected-transaction]
{:keys [password]} [:get :confirm-transactions]
confirmed? [:get-in [:transaction-details-ui-props :confirmed?]]
sync-state [:get :sync-state]
sync-state [:sync-state]
network-status [:get :network-status]]
{:component-did-update #(when-not transaction (rf/dispatch [:navigate-to-modal :unsigned-transactions]))
:component-will-unmount #(rf/dispatch [:set-in [:transaction-details-ui-props :confirmed?] false])}

View File

@ -45,7 +45,7 @@
[transactions [:transactions]
{:keys [password]} [:get :confirm-transactions]
confirmed? [:get-in [:transactions-list-ui-props :confirmed?]]
sync-state [:get :sync-state]
sync-state [:sync-state]
network-status [:get :network-status]]
{:component-did-update #(when-not (seq transactions) (rf/dispatch [:navigate-back]))
:component-will-unmount #(rf/dispatch [:set-in [:transactions-list-ui-props :confirmed?] false])}

View File

@ -38,7 +38,7 @@
(act/add #(re-frame/dispatch [:navigate-to :new-chat]))])
(defn toolbar-view []
[toolbar/toolbar2 {}
[toolbar/toolbar2 {:show-sync-bar? true}
[toolbar/nav-button (act/hamburger drawer/open-drawer!)]
[toolbar/content-title (i18n/label :t/chats)]
[toolbar/actions
@ -47,7 +47,7 @@
(android-toolbar-actions))]])
(defn toolbar-edit []
[toolbar/toolbar2 {}
[toolbar/toolbar2 {:show-sync-bar? true}
[toolbar/nav-button (act/back #(re-frame/dispatch [:set-in [:chat-list-ui-props :edit?] false]))]
[toolbar/content-title (i18n/label :t/edit-chats)]])

View File

@ -63,7 +63,7 @@
;;;;NODE
(spec/def ::sync-listening-started (spec/nilable boolean?))
(spec/def ::sync-state (spec/nilable keyword?))
(spec/def ::sync-state (spec/nilable #{:pending :in-progress :synced :done :offline}))
(spec/def ::sync-data (spec/nilable map?))
;;;;NAVIGATION

View File

@ -49,3 +49,7 @@
(reg-sub :network
(fn [db]
(:network db)))
(reg-sub :sync-state
(fn [db]
(:sync-state db)))

View File

@ -24,8 +24,7 @@
:params {:hide-actions? true}}]))
(defn toolbar-view [camera-flashlight]
[toolbar/toolbar2 {:style wallet.styles/toolbar
:no-sync-bar? true}
[toolbar/toolbar2 {:style wallet.styles/toolbar}
[toolbar/nav-button (act/back-white act/default-handler)]
[toolbar/content-title {:color :white} (i18n/label :t/wallet-choose-recipient)]
[toolbar/actions [{:icon (if (= :on camera-flashlight) :icons/flash-active