remove navigate-to-nav2 event (#15454)
This commit is contained in:
parent
45da51bea6
commit
5c92b7eb1e
|
@ -276,7 +276,7 @@
|
||||||
(vals (get-in db [:communities community-id :chats])))]
|
(vals (get-in db [:communities community-id :chats])))]
|
||||||
(when (and id
|
(when (and id
|
||||||
(not= (:current-chat-id db) (str community-id id)))
|
(not= (:current-chat-id db) (str community-id id)))
|
||||||
(chat.events/navigate-to-chat cofx (str community-id id) nil))))
|
(chat.events/navigate-to-chat cofx (str community-id id)))))
|
||||||
|
|
||||||
(rf/defn fetch
|
(rf/defn fetch
|
||||||
[_]
|
[_]
|
||||||
|
@ -817,7 +817,7 @@
|
||||||
[cofx community-id]
|
[cofx community-id]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
(navigation/pop-to-root :shell-stack)
|
(navigation/pop-to-root :shell-stack)
|
||||||
(navigation/navigate-to-nav2 :community community-id true)))
|
(navigation/navigate-to-cofx :community-overview community-id)))
|
||||||
|
|
||||||
(rf/defn member-role-updated
|
(rf/defn member-role-updated
|
||||||
{:events [:community.member/role-updated]}
|
{:events [:community.member/role-updated]}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
{:events [:navigate-chat-updated]}
|
{:events [:navigate-chat-updated]}
|
||||||
[cofx chat-id]
|
[cofx chat-id]
|
||||||
(when (get-in cofx [:db :chats chat-id])
|
(when (get-in cofx [:db :chats chat-id])
|
||||||
(chat.events/navigate-to-chat cofx chat-id nil)))
|
(chat.events/navigate-to-chat cofx chat-id)))
|
||||||
|
|
||||||
(rf/defn handle-chat-removed
|
(rf/defn handle-chat-removed
|
||||||
{:events [:chat-removed]}
|
{:events [:chat-removed]}
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
[status-im2.navigation.events :as navigation]
|
[status-im2.navigation.events :as navigation]
|
||||||
[status-im2.common.log :as logging]
|
[status-im2.common.log :as logging]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
|
[status-im2.contexts.shell.animation :as shell.animation]
|
||||||
[utils.security.core :as security]))
|
[utils.security.core :as security]))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
|
@ -520,6 +521,7 @@
|
||||||
tos-accepted? (get db :tos/accepted?)
|
tos-accepted? (get db :tos/accepted?)
|
||||||
{:networks/keys [current-network networks]} db
|
{:networks/keys [current-network networks]} db
|
||||||
network-id (str (get-in networks [current-network :config :NetworkId]))]
|
network-id (str (get-in networks [current-network :config :NetworkId]))]
|
||||||
|
(shell.animation/change-selected-stack-id :communities-stack true)
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(dissoc :multiaccounts/login)
|
(dissoc :multiaccounts/login)
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
:on-press (fn []
|
:on-press (fn []
|
||||||
(rf/dispatch [:communities/load-category-states id])
|
(rf/dispatch [:communities/load-category-states id])
|
||||||
(rf/dispatch [:dismiss-keyboard])
|
(rf/dispatch [:dismiss-keyboard])
|
||||||
(rf/dispatch [:navigate-to-nav2 :community {:community-id id}]))
|
(rf/dispatch [:navigate-to :community-overview id]))
|
||||||
:on-long-press #(rf/dispatch [:bottom-sheet/show-sheet
|
:on-long-press #(rf/dispatch [:bottom-sheet/show-sheet
|
||||||
{:content (fn []
|
{:content (fn []
|
||||||
[community/community-actions community])}])}
|
[community/community-actions community])}])}
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
(i18n/label :t/open-membership))]]
|
(i18n/label :t/open-membership))]]
|
||||||
:on-press #(do
|
:on-press #(do
|
||||||
(rf/dispatch [:dismiss-keyboard])
|
(rf/dispatch [:dismiss-keyboard])
|
||||||
(rf/dispatch [:navigate-to-nav2 :community {:community-id id}]))}]))
|
(rf/dispatch [:navigate-to :community-overview id]))}]))
|
||||||
|
|
||||||
(defn communities-actions
|
(defn communities-actions
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -384,7 +384,7 @@
|
||||||
[rn/touchable-opacity
|
[rn/touchable-opacity
|
||||||
{:on-press #(re-frame/dispatch
|
{:on-press #(re-frame/dispatch
|
||||||
[:communities/navigate-to-community
|
[:communities/navigate-to-community
|
||||||
{:community-id (:id community)}])}
|
(:id community)])}
|
||||||
[rn/text
|
[rn/text
|
||||||
{:style {:text-align :center
|
{:style {:text-align :center
|
||||||
:color quo.colors/blue}} (i18n/label :t/view)]]]])))
|
:color quo.colors/blue}} (i18n/label :t/view)]]]])))
|
||||||
|
|
|
@ -202,9 +202,9 @@
|
||||||
(rf/defn navigate-to-chat
|
(rf/defn navigate-to-chat
|
||||||
"Takes coeffects map and chat-id, returns effects necessary for navigation and preloading data"
|
"Takes coeffects map and chat-id, returns effects necessary for navigation and preloading data"
|
||||||
{:events [:chat/navigate-to-chat]}
|
{:events [:chat/navigate-to-chat]}
|
||||||
[{db :db :as cofx} chat-id from-shell?]
|
[{db :db :as cofx} chat-id]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:dispatch [:navigate-to-nav2 :chat chat-id from-shell?]}
|
{:dispatch [:navigate-to :chat chat-id]}
|
||||||
(when-not (or (= (:view-id db) :community) (= (:view-id db) :community-overview))
|
(when-not (or (= (:view-id db) :community) (= (:view-id db) :community-overview))
|
||||||
(navigation/pop-to-root :shell-stack))
|
(navigation/pop-to-root :shell-stack))
|
||||||
(close-chat false)
|
(close-chat false)
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
(let [chat-id "test_chat"
|
(let [chat-id "test_chat"
|
||||||
db {:pagination-info {chat-id {:all-loaded? true}}}]
|
db {:pagination-info {chat-id {:all-loaded? true}}}]
|
||||||
(testing "Pagination info should be reset on navigation"
|
(testing "Pagination info should be reset on navigation"
|
||||||
(let [res (chat/navigate-to-chat {:db db} chat-id false)]
|
(let [res (chat/navigate-to-chat {:db db} chat-id)]
|
||||||
(is (nil? (get-in res [:db :pagination-info chat-id :all-loaded?])))))))
|
(is (nil? (get-in res [:db :pagination-info chat-id :all-loaded?])))))))
|
||||||
|
|
||||||
(deftest camera-roll-loading-more-test
|
(deftest camera-roll-loading-more-test
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
{:on-press (fn []
|
{:on-press (fn []
|
||||||
(rf/dispatch [:communities/load-category-states (:id item)])
|
(rf/dispatch [:communities/load-category-states (:id item)])
|
||||||
(rf/dispatch [:dismiss-keyboard])
|
(rf/dispatch [:dismiss-keyboard])
|
||||||
(rf/dispatch [:navigate-to :community {:community-id (:id item)}]))
|
(rf/dispatch [:navigate-to :community-overview (:id item)]))
|
||||||
:on-long-press #(rf/dispatch
|
:on-long-press #(rf/dispatch
|
||||||
[:bottom-sheet/show-sheet
|
[:bottom-sheet/show-sheet
|
||||||
{:content (fn []
|
{:content (fn []
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
{:on-press (fn []
|
{:on-press (fn []
|
||||||
(rf/dispatch [:communities/load-category-states (:id community)])
|
(rf/dispatch [:communities/load-category-states (:id community)])
|
||||||
(rf/dispatch [:dismiss-keyboard])
|
(rf/dispatch [:dismiss-keyboard])
|
||||||
(rf/dispatch [:navigate-to :community (:id community)]))
|
(rf/dispatch [:navigate-to :community-overview (:id community)]))
|
||||||
:on-long-press #(rf/dispatch [:bottom-sheet/show-sheet
|
:on-long-press #(rf/dispatch [:bottom-sheet/show-sheet
|
||||||
{:content (fn []
|
{:content (fn []
|
||||||
;; TODO implement with quo2
|
;; TODO implement with quo2
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
item (merge item unviewed-counts)]
|
item (merge item unviewed-counts)]
|
||||||
[quo/communities-membership-list-item
|
[quo/communities-membership-list-item
|
||||||
{:style {:padding-horizontal 18}
|
{:style {:padding-horizontal 18}
|
||||||
:on-press #(rf/dispatch [:navigate-to-nav2 :community-overview id])
|
:on-press #(rf/dispatch [:navigate-to :community-overview id])
|
||||||
:on-long-press #(rf/dispatch
|
:on-long-press #(rf/dispatch
|
||||||
[:bottom-sheet/show-sheet
|
[:bottom-sheet/show-sheet
|
||||||
{:content (fn []
|
{:content (fn []
|
||||||
|
|
|
@ -26,6 +26,16 @@
|
||||||
(or (= state shell.constants/open-with-animation)
|
(or (= state shell.constants/open-with-animation)
|
||||||
(= state shell.constants/open-without-animation))))
|
(= state shell.constants/open-without-animation))))
|
||||||
|
|
||||||
|
(defn calculate-home-stack-state-value
|
||||||
|
[stack-id & animate?]
|
||||||
|
(if animate?
|
||||||
|
(if (some? stack-id)
|
||||||
|
shell.constants/open-with-animation
|
||||||
|
shell.constants/close-with-animation)
|
||||||
|
(if (some? stack-id)
|
||||||
|
shell.constants/open-without-animation
|
||||||
|
shell.constants/close-without-animation)))
|
||||||
|
|
||||||
(defn load-stack
|
(defn load-stack
|
||||||
[stack-id]
|
[stack-id]
|
||||||
(case stack-id
|
(case stack-id
|
||||||
|
@ -35,14 +45,14 @@
|
||||||
:browser-stack (reset! load-browser-stack? true)
|
:browser-stack (reset! load-browser-stack? true)
|
||||||
""))
|
""))
|
||||||
|
|
||||||
(defn selected-stack-id-loaded
|
(defn change-selected-stack-id
|
||||||
[stack-id]
|
[stack-id & [store? home-stack-state-value]]
|
||||||
(reset! selected-stack-id stack-id)
|
(let [home-stack-state-value (or home-stack-state-value
|
||||||
(reset!
|
(calculate-home-stack-state-value stack-id))]
|
||||||
home-stack-state
|
(reset! selected-stack-id stack-id)
|
||||||
(if (some? stack-id)
|
(reset! home-stack-state home-stack-state-value)
|
||||||
shell.constants/open-with-animation
|
(when store?
|
||||||
shell.constants/close-with-animation)))
|
(async-storage/set-item! :selected-stack-id stack-id))))
|
||||||
|
|
||||||
(defn calculate-home-stack-position
|
(defn calculate-home-stack-position
|
||||||
[]
|
[]
|
||||||
|
@ -133,28 +143,17 @@
|
||||||
|
|
||||||
(defn open-home-stack
|
(defn open-home-stack
|
||||||
[stack-id animate?]
|
[stack-id animate?]
|
||||||
(let [home-stack-state-value (if animate?
|
(let [home-stack-state-value (calculate-home-stack-state-value stack-id animate?)]
|
||||||
shell.constants/open-with-animation
|
(reanimated/set-shared-value (:selected-stack-id @shared-values-atom) (name stack-id))
|
||||||
shell.constants/open-without-animation)]
|
(reanimated/set-shared-value (:home-stack-state @shared-values-atom) home-stack-state-value)
|
||||||
(reanimated/set-shared-value
|
(js/setTimeout change-root-status-bar-style shell.constants/shell-animation-time)
|
||||||
(:selected-stack-id @shared-values-atom)
|
(change-selected-stack-id stack-id true home-stack-state-value)))
|
||||||
(name stack-id))
|
|
||||||
(reanimated/set-shared-value
|
|
||||||
(:home-stack-state @shared-values-atom)
|
|
||||||
home-stack-state-value)
|
|
||||||
(reset! home-stack-state home-stack-state-value)
|
|
||||||
(js/setTimeout
|
|
||||||
change-root-status-bar-style
|
|
||||||
shell.constants/shell-animation-time)
|
|
||||||
(reset! selected-stack-id stack-id)
|
|
||||||
(async-storage/set-item! :selected-stack-id stack-id)))
|
|
||||||
|
|
||||||
(defn change-tab
|
(defn change-tab
|
||||||
[stack-id]
|
[stack-id]
|
||||||
(reanimated/set-shared-value (:animate-home-stack-left @shared-values-atom) false)
|
(reanimated/set-shared-value (:animate-home-stack-left @shared-values-atom) false)
|
||||||
(reanimated/set-shared-value (:selected-stack-id @shared-values-atom) (name stack-id))
|
(reanimated/set-shared-value (:selected-stack-id @shared-values-atom) (name stack-id))
|
||||||
(reset! selected-stack-id stack-id)
|
(change-selected-stack-id stack-id true))
|
||||||
(async-storage/set-item! :selected-stack-id stack-id))
|
|
||||||
|
|
||||||
(defn bottom-tab-on-press
|
(defn bottom-tab-on-press
|
||||||
[stack-id]
|
[stack-id]
|
||||||
|
@ -169,16 +168,9 @@
|
||||||
|
|
||||||
(defn close-home-stack
|
(defn close-home-stack
|
||||||
[animate?]
|
[animate?]
|
||||||
(let [home-stack-state-value (if animate?
|
(let [stack-id nil
|
||||||
shell.constants/close-with-animation
|
home-stack-state-value (calculate-home-stack-state-value stack-id animate?)]
|
||||||
shell.constants/close-without-animation)]
|
(reanimated/set-shared-value (:animate-home-stack-left @shared-values-atom) true)
|
||||||
(reanimated/set-shared-value
|
(reanimated/set-shared-value (:home-stack-state @shared-values-atom) home-stack-state-value)
|
||||||
(:animate-home-stack-left @shared-values-atom)
|
|
||||||
true)
|
|
||||||
(reanimated/set-shared-value
|
|
||||||
(:home-stack-state @shared-values-atom)
|
|
||||||
home-stack-state-value)
|
|
||||||
(reset! home-stack-state home-stack-state-value)
|
|
||||||
(change-root-status-bar-style)
|
(change-root-status-bar-style)
|
||||||
(reset! selected-stack-id nil)
|
(change-selected-stack-id stack-id true home-stack-state-value)))
|
||||||
(async-storage/set-item! :selected-stack-id nil)))
|
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
(utils.universal-links/initialize)
|
(utils.universal-links/initialize)
|
||||||
|
|
||||||
;; TODO(parvesh) - Remove while moving functionality to status-go
|
;; TODO(parvesh) - Remove while moving functionality to status-go
|
||||||
(async-storage/get-item :selected-stack-id #(animation/selected-stack-id-loaded %))
|
(async-storage/get-item :selected-stack-id #(animation/change-selected-stack-id %))
|
||||||
|
|
||||||
(async-storage/get-item :screen-height #(reset! animation/screen-height %))
|
(async-storage/get-item :screen-height #(reset! animation/screen-height %))
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,16 @@
|
||||||
(assoc-in [:navigation/screen-params view] screen-params)))
|
(assoc-in [:navigation/screen-params view] screen-params)))
|
||||||
|
|
||||||
(rf/defn navigate-to-cofx
|
(rf/defn navigate-to-cofx
|
||||||
[{:keys [db]} go-to-view-id screen-params]
|
[{:keys [db] :as cofx} go-to-view-id screen-params]
|
||||||
{:db
|
(merge
|
||||||
(-> (assoc db :view-id go-to-view-id)
|
{:db (-> (assoc db :view-id go-to-view-id)
|
||||||
(all-screens-params go-to-view-id screen-params))
|
(all-screens-params go-to-view-id screen-params))
|
||||||
:navigate-to-fx go-to-view-id})
|
:navigate-to-fx go-to-view-id}
|
||||||
|
(when (#{:chat :community-overview} go-to-view-id)
|
||||||
|
{:dispatch-later
|
||||||
|
;; 300 ms delay because, navigation is priority over shell card update
|
||||||
|
[{:dispatch [:shell/add-switcher-card go-to-view-id screen-params]
|
||||||
|
:ms 300}]})))
|
||||||
|
|
||||||
(rf/defn navigate-to
|
(rf/defn navigate-to
|
||||||
{:events [:navigate-to]}
|
{:events [:navigate-to]}
|
||||||
|
@ -100,14 +105,6 @@
|
||||||
{:shell/reset-bottom-tabs nil
|
{:shell/reset-bottom-tabs nil
|
||||||
:dispatch [:init-root :shell-stack]})
|
:dispatch [:init-root :shell-stack]})
|
||||||
|
|
||||||
(rf/defn navigate-to-nav2
|
|
||||||
{:events [:navigate-to-nav2]}
|
|
||||||
[cofx view-id screen-params from-shell?]
|
|
||||||
(rf/merge
|
|
||||||
cofx
|
|
||||||
{:dispatch [:shell/add-switcher-card view-id screen-params from-shell?]}
|
|
||||||
(navigate-to-cofx view-id screen-params)))
|
|
||||||
|
|
||||||
(rf/defn change-root-status-bar-style
|
(rf/defn change-root-status-bar-style
|
||||||
{:events [:change-root-status-bar-style]}
|
{:events [:change-root-status-bar-style]}
|
||||||
[_ style]
|
[_ style]
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
(str profile-picture "&addRing=0"))}
|
(str profile-picture "&addRing=0"))}
|
||||||
:customization-color (or (:customization-color contact) :primary)
|
:customization-color (or (:customization-color contact) :primary)
|
||||||
:on-close #(re-frame/dispatch [:shell/close-switcher-card id])
|
:on-close #(re-frame/dispatch [:shell/close-switcher-card id])
|
||||||
:on-press #(re-frame/dispatch [:chat/navigate-to-chat id true])
|
:on-press #(re-frame/dispatch [:chat/navigate-to-chat id])
|
||||||
:content (get-card-content chat communities)}))
|
:content (get-card-content chat communities)}))
|
||||||
|
|
||||||
(defn private-group-chat-card
|
(defn private-group-chat-card
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
:avatar-params {}
|
:avatar-params {}
|
||||||
:customization-color (or (:customization-color chat) :primary)
|
:customization-color (or (:customization-color chat) :primary)
|
||||||
:on-close #(re-frame/dispatch [:shell/close-switcher-card id])
|
:on-close #(re-frame/dispatch [:shell/close-switcher-card id])
|
||||||
:on-press #(re-frame/dispatch [:chat/navigate-to-chat id true])
|
:on-press #(re-frame/dispatch [:chat/navigate-to-chat id])
|
||||||
:content (get-card-content chat communities)})
|
:content (get-card-content chat communities)})
|
||||||
|
|
||||||
(defn community-card
|
(defn community-card
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
{:name (:name community)})
|
{:name (:name community)})
|
||||||
:customization-color (or (:customization-color community) :primary)
|
:customization-color (or (:customization-color community) :primary)
|
||||||
:on-close #(re-frame/dispatch [:shell/close-switcher-card id])
|
:on-close #(re-frame/dispatch [:shell/close-switcher-card id])
|
||||||
:on-press #(re-frame/dispatch [:navigate-to-nav2 :community-overview id true])
|
:on-press #(re-frame/dispatch [:navigate-to :community-overview id])
|
||||||
:content {:community-info {:type :permission}}}))
|
:content {:community-info {:type :permission}}}))
|
||||||
|
|
||||||
(defn community-channel-card
|
(defn community-channel-card
|
||||||
|
@ -98,9 +98,9 @@
|
||||||
{:content {:community-channel {:emoji (:emoji channel)
|
{:content {:community-channel {:emoji (:emoji channel)
|
||||||
:channel-name (str "# " (:name channel))}}
|
:channel-name (str "# " (:name channel))}}
|
||||||
:on-press (fn []
|
:on-press (fn []
|
||||||
(re-frame/dispatch [:navigate-to-nav2 :community-overview community-id true])
|
(re-frame/dispatch [:navigate-to :community-overview community-id])
|
||||||
(js/setTimeout
|
(js/setTimeout
|
||||||
#(re-frame/dispatch [:chat/navigate-to-chat channel-id true])
|
#(re-frame/dispatch [:chat/navigate-to-chat channel-id])
|
||||||
100))}))
|
100))}))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
|
|
Loading…
Reference in New Issue