Skip to content

Commit 4a723c3

Browse files
committed
bugfixes
1 parent d3b785c commit 4a723c3

File tree

22 files changed

+128
-83
lines changed

22 files changed

+128
-83
lines changed

src/status_im/add_new/core.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
(i18n/label :t/use-valid-contact-code)
8888
:yourself
8989
(i18n/label :t/can-not-add-yourself))
90-
:on-dismiss #(re-frame/dispatch [:navigate-to :home])}})))
90+
:on-dismiss #(re-frame/dispatch [:pop-to-root-tab :chat-stack])}})))
9191

9292
(fx/defn qr-code-scanned
9393
{:events [:contact/qr-code-scanned]}

src/status_im/chat/models.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
(deactivate-chat chat-id)
199199
(offload-messages chat-id)
200200
(when (not (= (:view-id db) :home))
201-
(navigation/navigate-to-cofx :home {}))))
201+
(navigation/pop-to-root-tab :chat-stack))))
202202

203203
(fx/defn preload-chat-data
204204
"Takes chat-id and coeffects map, returns effects necessary when navigating to chat"

src/status_im/communities/core.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
[cofx response-js]
8787
(fx/merge cofx
8888
(handle-response cofx response-js)
89-
(navigation/navigate-to-cofx :home {})))
89+
(navigation/pop-to-root-tab :chat-stack)))
9090

9191
(fx/defn joined
9292
{:events [::joined ::requested-to-join]}

src/status_im/contact/block.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
(re-frame/dispatch [:hide-popover])))
5959
;; reset navigation to avoid going back to non existing one to one chat
6060
(if from-one-to-one-chat?
61-
(navigation/navigate-to-cofx :home {})
61+
(navigation/pop-to-root-tab :chat-stack)
6262
(navigation/navigate-back)))))
6363

6464
(fx/defn unblock-contact

src/status_im/core.cljs

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
[status-im.utils.universal-links.core :as utils.universal-links]
1717
[status-im.i18n.i18n :as i18n]
1818
[status-im.ui.components.react :as react]
19-
["react-native" :as rn :refer (DevSettings LogBox)]
19+
["react-native" :refer (DevSettings LogBox)]
2020
["react-native-languages" :default react-native-languages]
2121
["react-native-shake" :as react-native-shake]))
2222

23-
(def splash-screen (-> rn .-NativeModules .-SplashScreen))
24-
2523
(set! interop/next-tick js/setTimeout)
2624
(set! batching/fake-raf #(js/setTimeout % 0))
2725
(.ignoreAllLogs LogBox)
@@ -39,7 +37,6 @@
3937

4038
(re-frame/dispatch-sync [:init/app-started])
4139

42-
(.hide ^js splash-screen)
4340
(utils.universal-links/initialize)
4441

4542
;;DEV

src/status_im/group_chats/core.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{:events [:chat-removed]}
2323
[_ response]
2424
{:dispatch-n [[:sanitize-messages-and-process-response response]
25-
[:navigate-to :home]]})
25+
[:pop-to-root-tab :chat-stack]]})
2626

2727
(fx/defn handle-chat-update
2828
{:events [:chat-updated]}
@@ -108,7 +108,7 @@
108108
[cofx chat-id]
109109
(fx/merge cofx
110110
(models.chat/deactivate-chat chat-id)
111-
(navigation/navigate-to-cofx :home {})))
111+
(navigation/pop-to-root-tab :chat-stack)))
112112

113113
(def not-blank?
114114
(complement string/blank?))

src/status_im/navigation/core.cljs

+53-26
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@
1010
[status-im.ui.components.react :as react]
1111
[quo.components.text-input :as quo.text-input]
1212
[status-im.ui.components.icons.icons :as icons]
13-
[quo.design-system.colors :as quo.colors]))
13+
[quo.design-system.colors :as quo.colors]
14+
["react-native" :as rn]))
1415

1516
(def debug? ^boolean js/goog.DEBUG)
1617

18+
(def splash-screen (-> rn .-NativeModules .-SplashScreen))
19+
1720
(defonce root-comp-id (atom nil))
21+
(defonce root-id (atom nil))
1822
(defonce pushed-screen-id (atom nil))
1923
(defonce curr-modal (atom nil))
2024
(defonce modals (atom []))
25+
(defonce dissmissing (atom false))
2126

2227
;; REGISTER COMPONENT (LAZY)
2328
(defn reg-comp [key]
@@ -57,24 +62,30 @@
5762
:icon (icons/icon-source :main-icons/close)}}
5863
options)))
5964

60-
(re-frame/reg-fx
61-
:open-modal-fx
62-
(fn [comp]
63-
(let [{:keys [options]} (get views/screens comp)]
64-
(reset! curr-modal true)
65-
(swap! modals conj comp)
66-
(.showModal Navigation
67-
(clj->js {:stack {:children
68-
[{:component
69-
{:name comp
70-
:id comp
71-
:options (update-modal-topbar-options
72-
(merge (roots/status-bar-options)
73-
(roots/default-root)
74-
options))}}]}})))))
65+
(defn open-modal [comp]
66+
(let [{:keys [options]} (get views/screens comp)]
67+
(if @dissmissing
68+
(reset! dissmissing comp)
69+
(do
70+
(println "SHOW MODAL" comp)
71+
(reset! curr-modal true)
72+
(swap! modals conj comp)
73+
(.showModal Navigation
74+
(clj->js {:stack {:children
75+
[{:component
76+
{:name comp
77+
:id comp
78+
:options (update-modal-topbar-options
79+
(merge (roots/status-bar-options)
80+
(roots/default-root)
81+
options))}}]}}))))))
82+
83+
(re-frame/reg-fx :open-modal-fx open-modal)
7584

7685
;; DISSMISS MODAL
7786
(defn dissmissModal []
87+
(println "dissmissModal" @modals)
88+
(reset! dissmissing true)
7889
(.dismissModal Navigation (name (last @modals))))
7990

8091
(defonce register-nav-button-reg
@@ -83,24 +94,31 @@
8394
(fn [^js evn]
8495
(let [id (.-buttonId evn)]
8596
(if (= "dismiss-modal" id)
86-
(dissmissModal)
97+
(do
98+
(when-let [event (get-in views/screens [(last @modals) :on-dissmiss])]
99+
(re-frame/dispatch event))
100+
(dissmissModal))
87101
(when-let [handler (get-in views/screens [(keyword id) :right-handler])]
88102
(handler)))))))
89103

90104
(defonce register-modal-reg
91105
(.registerModalDismissedListener
92106
(.events Navigation)
93107
(fn [_]
94-
(when-let [event (get-in views/screens [(last @modals) :on-dissmiss])]
95-
(re-frame/dispatch event))
108+
(println "DismissedListener" @dissmissing @modals)
96109
(if (> (count @modals) 1)
97110
(let [new-modals (butlast @modals)]
98111
(reset! modals (vec new-modals))
99112
(re-frame/dispatch [:set :view-id (last new-modals)]))
100113
(do
101114
(reset! modals [])
102115
(reset! curr-modal false)
103-
(re-frame/dispatch [:set :view-id @pushed-screen-id]))))))
116+
(re-frame/dispatch [:set :view-id @pushed-screen-id])))
117+
118+
(let [comp @dissmissing]
119+
(reset! dissmissing false)
120+
(when (keyword? comp)
121+
(open-modal comp))))))
104122

105123
;; SCREEN DID APPEAR
106124
(defonce screen-appear-reg
@@ -129,9 +147,18 @@
129147
;; SET ROOT
130148
(re-frame/reg-fx
131149
:init-root-fx
132-
(fn [root-id]
133-
(reset! root-comp-id root-id)
134-
(.setRoot Navigation (clj->js (get (roots/roots) root-id)))))
150+
(fn [new-root-id]
151+
(reset! root-comp-id new-root-id)
152+
(reset! root-id new-root-id)
153+
(.setRoot Navigation (clj->js (get (roots/roots) new-root-id)))))
154+
155+
(defonce rset-app-launched
156+
(.registerAppLaunchedListener (.events Navigation)
157+
(fn []
158+
(when @root-id
159+
(reset! root-comp-id @root-id)
160+
(.setRoot Navigation (clj->js (get (roots/roots) @root-id))))
161+
(.hide ^js splash-screen))))
135162

136163
(defn get-screen-component [comp]
137164
(let [{:keys [options]} (get views/screens comp)]
@@ -214,9 +241,9 @@
214241
(clj->js
215242
{:component {:name comp
216243
:id comp
217-
:options (merge (if platform/android?
218-
{:statusBar {:translucent true}}
219-
(roots/status-bar-options))
244+
:options (merge (cond-> (roots/status-bar-options)
245+
platform/android?
246+
(assoc-in [:statusBar :translucent] true))
220247
{:layout {:componentBackgroundColor (if platform/android?
221248
(:backdrop @quo.colors/theme)
222249
"transparent")}

src/status_im/navigation/roots.cljs

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@
6565
{:bottomTabs
6666
{:id :tabs-stack
6767
:options (merge (default-root)
68-
{:bottomTabs {:tabsAttachMode :afterInitialTab
69-
:titleDisplayMode :alwaysHide
68+
{:bottomTabs {:titleDisplayMode :alwaysHide
7069
:backgroundColor colors/white}})
7170
:children [;CHAT STACK
7271
{:stack {:id :chat-stack

src/status_im/qr_scanner/core.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
:else
7272
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
7373
:content (i18n/label :t/ens-name-not-found)
74-
:on-dismiss #(re-frame/dispatch [:navigate-to :home])}})))
74+
:on-dismiss #(re-frame/dispatch [:pop-to-root-tab :chat-stack])}})))
7575

7676
(fx/defn handle-eip681 [cofx data]
7777
(fx/merge cofx
@@ -89,7 +89,7 @@
8989
:browser (handle-browse cofx data)
9090
:eip681 (handle-eip681 cofx data)
9191
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
92-
:on-dismiss #(re-frame/dispatch [:navigate-to :home])}}))
92+
:on-dismiss #(re-frame/dispatch [:pop-to-root-tab :chat-stack])}}))
9393

9494
(fx/defn on-scan
9595
{:events [::on-scan-success]}

src/status_im/ui/screens/communities/channel_details.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
[clojure.string :as string]
77
[status-im.communities.core :as communities]))
88

9-
(defn view [route]
10-
(let [chat-id (get-in route [:route :params :chat-id])
9+
(defn view []
10+
(let [{:keys [chat-id]} (<sub [:get-screen-params])
1111
current-chat (<sub [:chat-by-id chat-id])
1212
{:keys [chat-name color description community-id]} current-chat
1313
{:keys [admin]} (<sub [:communities/community community-id])]

src/status_im/ui/screens/communities/community.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@
194194
[topbar/topbar {:title (i18n/label :t/not-found)}]
195195
[blank-page (i18n/label :t/community-info-not-found)]])
196196

197-
(defn community [route]
198-
(let [{:keys [community-id]} (get-in route [:route :params])
197+
(defn community []
198+
(let [{:keys [community-id]} (<sub [:get-screen-params])
199199
{:keys [id chats name images members permissions color joined can-request-access?
200200
can-join? requested-to-join-at admin]
201201
:as community} (<sub [:communities/community community-id])]

src/status_im/ui/screens/communities/invite.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
(defn invite []
4343
(let [user-pk (reagent/atom "")
4444
contacts-selected (reagent/atom #{})]
45-
(fn [route]
45+
(fn []
4646
(let [contacts-data (<sub [:contacts/active])
47-
invite? (get-in route [:route :params :invite?])
47+
{:keys [invite?]} (<sub [:get-screen-params])
4848
{:keys [permissions
4949
can-manage-users?]} (<sub [:communities/edited-community])
5050
selected @contacts-selected

src/status_im/ui/screens/communities/members.cljs

+4-4
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@
8585
:title (i18n/label :t/membership-requests)}]
8686
[quo/separator {:style {:margin-vertical 8}}]]))
8787

88-
(defn members [route]
89-
(let [{:keys [community-id]} (get-in route [:route :params])
88+
(defn members []
89+
(let [{:keys [community-id]} (<sub [:get-screen-params])
9090
my-public-key (<sub [:multiaccount/public-key])
9191
{:keys [members
9292
permissions
@@ -108,9 +108,9 @@
108108
:key-fn identity
109109
:render-fn render-member}]]))
110110

111-
(defn members-container [route]
111+
(defn members-container []
112112
(reagent/create-class
113113
{:display-name "community-members-view"
114114
:component-did-mount (fn []
115-
(communities/fetch-requests-to-join! (get-in route [:route :params :community-id])))
115+
(communities/fetch-requests-to-join! (get (<sub [:get-screen-params]) :community-id)))
116116
:reagent-render members}))

src/status_im/ui/screens/communities/profile.cljs

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
[quo.react-native :as rn]
1515
[clojure.string :as string]))
1616

17-
(defn management [route]
18-
(let [{:keys [community-id]} (get-in route [:route :params])
17+
(defn management []
18+
(let [{:keys [community-id]} (<sub [:get-screen-params])
1919
requests-to-join (<sub [:communities/requests-to-join-for-community community-id])
2020
community (<sub [:communities/community community-id])
2121
{:keys [color members permissions description name admin]} community
@@ -98,9 +98,9 @@
9898
:title (i18n/label :t/delete)
9999
:on-press #(>evt [::communities/delete-community community-id])}])]]]))
100100

101-
(defn management-container [route]
101+
(defn management-container []
102102
(reagent/create-class
103103
{:display-name "community-profile-view"
104104
:component-did-mount (fn []
105-
(communities/fetch-requests-to-join! (get-in route [:route :params :community-id])))
105+
(communities/fetch-requests-to-join! (get (<sub [:get-screen-params]) :community-id)))
106106
:reagent-render management}))

src/status_im/ui/screens/communities/requests_to_join.cljs

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
:icon [chat-icon/contact-icon-contacts-tab
4343
(multiaccounts/displayed-photo member)]}]))
4444

45-
(defn requests-to-join [route]
45+
(defn requests-to-join []
4646
(fn []
47-
(let [{:keys [community-id]} (get-in route [:route :params])
47+
(let [{:keys [community-id]} (<sub [:get-screen-params])
4848
requests (<sub [:communities/requests-to-join-for-community community-id])
4949
{:keys [can-manage-users?]} (<sub [:communities/community community-id])]
5050
[:<>
@@ -56,9 +56,9 @@
5656
:key-fn :id
5757
:render-fn render-request}]])))
5858

59-
(defn requests-to-join-container [route]
59+
(defn requests-to-join-container []
6060
(reagent/create-class
6161
{:display-name "community-requests-to-join-view"
6262
:component-did-mount (fn []
63-
(communities/fetch-requests-to-join! (get-in route [:route :params :community-id])))
63+
(communities/fetch-requests-to-join! (get (<sub [:get-screen-params]) :community-id)))
6464
:reagent-render requests-to-join}))

src/status_im/ui/screens/default_sync_period_settings/view.cljs

+6-9
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
[status-im.i18n.i18n :as i18n]
55
[status-im.constants :as constants]
66
[quo.core :as quo]
7-
[re-frame.core :as re-frame]
8-
[status-im.ui.components.topbar :as topbar]))
7+
[re-frame.core :as re-frame]))
98

109
(def titles {constants/one-day (i18n/label :t/one-day)
1110
constants/three-days (i18n/label :t/three-days)
@@ -21,10 +20,8 @@
2120

2221
(views/defview default-sync-period-settings []
2322
(views/letsubs [{:keys [default-sync-period]} [:multiaccount]]
24-
[react/view {:flex 1}
25-
[topbar/topbar {:title (i18n/label :t/default-sync-period)}]
26-
[react/view {:margin-top 8}
27-
[radio-item constants/one-day default-sync-period]
28-
[radio-item constants/three-days default-sync-period]
29-
[radio-item constants/one-week default-sync-period]
30-
[radio-item constants/one-month default-sync-period]]]))
23+
[react/view {:margin-top 8}
24+
[radio-item constants/one-day default-sync-period]
25+
[radio-item constants/three-days default-sync-period]
26+
[radio-item constants/one-week default-sync-period]
27+
[radio-item constants/one-month default-sync-period]]))

src/status_im/ui/screens/group/views.cljs

+4-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@
101101
(views/letsubs [contacts [:selected-group-contacts]
102102
group-name [:new-chat-name]]
103103
(let [group-name-empty? (not (spec/valid? :global/not-empty-string group-name))]
104-
[kb-presentation/keyboard-avoiding-view {:style styles/group-container}
104+
[react/keyboard-avoiding-view {:style styles/group-container
105+
:ignore-offset true}
105106
[react/view {:flex 1}
106107
[topbar/topbar {:use-insets false
107108
:title (i18n/label :t/new-group-chat)
@@ -162,7 +163,8 @@
162163
(views/defview contact-toggle-list []
163164
(views/letsubs [contacts [:contacts/active]
164165
selected-contacts-count [:selected-contacts-count]]
165-
[kb-presentation/keyboard-avoiding-view {:style styles/group-container}
166+
[react/keyboard-avoiding-view {:style styles/group-container
167+
:ignore-offset true}
166168
[topbar/topbar {:use-insets false
167169
:border-bottom false
168170
:title (i18n/label :t/new-group-chat)

0 commit comments

Comments
 (0)