Skip to content

Commit f6f80be

Browse files
committed
[#13283] Fix syncing of adding contact after removal
1 parent fbfab9f commit f6f80be

File tree

5 files changed

+28
-13
lines changed

5 files changed

+28
-13
lines changed

src/status_im/subs.cljs

+7
Original file line numberDiff line numberDiff line change
@@ -2339,6 +2339,13 @@
23392339
(fn [[contact] _]
23402340
(:added contact)))
23412341

2342+
(re-frame/reg-sub
2343+
:contacts/contact-blocked?
2344+
(fn [[_ identity] _]
2345+
[(re-frame/subscribe [:contacts/contact-by-identity identity])])
2346+
(fn [[contact] _]
2347+
(:blocked contact)))
2348+
23422349
(re-frame/reg-sub
23432350
:contacts/contact-two-names-by-identity
23442351
(fn [[_ identity] _]

src/status_im/ui/screens/add_new/new_chat/views.cljs

+14-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
[status-im.utils.identicon :as identicon]
2323
[status-im.ui.components.keyboard-avoid-presentation :as kb-presentation]
2424
[status-im.ui.components.animation :as animation]
25-
[status-im.ui.screens.chat.photos :as photos])
25+
[status-im.ui.screens.chat.photos :as photos]
26+
[status-im.utils.db :as utils.db])
2627
(:require-macros [status-im.utils.views :as views]))
2728

2829
(defn- render-row [row]
@@ -45,19 +46,20 @@
4546
icon])
4647

4748
(defn- input-icon
48-
[state new-contact? entered-nickname]
49+
[state new-contact? entered-nickname blocked?]
4950
(let [icon (if new-contact? :main-icons/add :main-icons/arrow-right)]
50-
(case state
51-
:searching
51+
(cond
52+
(= state :searching)
5253
[icon-wrapper colors/gray
5354
[react/activity-indicator {:color colors/white-persist}]]
5455

55-
:valid
56+
(and (= state :valid) (not blocked?))
5657
[react/touchable-highlight
5758
{:on-press #(debounce/dispatch-and-chill [:contact.ui/contact-code-submitted new-contact? entered-nickname] 3000)}
5859
[icon-wrapper colors/blue
5960
[icons/icon icon {:color colors/white-persist}]]]
6061

62+
:else
6163
[icon-wrapper colors/gray
6264
[icons/icon icon {:color colors/white-persist}]])))
6365

@@ -251,9 +253,12 @@
251253
:return-key-type :done
252254
:auto-correct false}])
253255

254-
(views/defview new-contact []
255-
(views/letsubs [{:keys [state ens-name public-key error]} [:contacts/new-identity]
256-
entered-nickname (reagent/atom "")]
256+
(defn new-contact []
257+
(let [{:keys [state ens-name public-key error]} @(re-frame/subscribe [:contacts/new-identity])
258+
entered-nickname (reagent/atom "")
259+
blocked? (and
260+
(utils.db/valid-public-key? (or public-key ""))
261+
@(re-frame/subscribe [:contacts/contact-blocked? public-key]))]
257262
[react/view {:style {:flex 1}}
258263
[topbar/topbar
259264
{:title (i18n/label :t/new-contact)
@@ -284,7 +289,7 @@
284289
:return-key-type :go}]]
285290
[react/view {:justify-content :center
286291
:align-items :center}
287-
[input-icon state true @entered-nickname]]]
292+
[input-icon state true @entered-nickname blocked?]]]
288293
[react/view {:min-height 30 :justify-content :flex-end :margin-bottom 16}
289294
[quo/text {:style {:margin-horizontal 16}
290295
:size :small

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
(i18n/label :t/group-membership-request)]]])))))
5050

5151
(defn add-contact-bar [public-key]
52-
(when-not @(re-frame/subscribe [:contacts/contact-added? public-key])
52+
(when-not (or @(re-frame/subscribe [:contacts/contact-added? public-key])
53+
@(re-frame/subscribe [:contacts/contact-blocked? public-key]))
5354
[react/touchable-highlight
5455
{:on-press
5556
#(re-frame/dispatch [:contact.ui/add-to-contact-pressed public-key])

src/status_im/ui/screens/profile/contact/views.cljs

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@
3737
:action #(re-frame/dispatch [:contact.ui/remove-contact-pressed contact])}]
3838
[{:label (i18n/label :t/add-to-contacts)
3939
:icon :main-icons/add-contact
40+
:disabled blocked?
4041
:accessibility-label :add-to-contacts-button
41-
:action #(re-frame/dispatch [:contact.ui/add-to-contact-pressed public-key nil ens-name])}])
42+
:action (when-not blocked?
43+
#(re-frame/dispatch [:contact.ui/add-to-contact-pressed public-key nil ens-name]))}])
4244
[{:label (i18n/label (if (or muted? blocked?) :t/unmute :t/mute))
4345
:icon :main-icons/notification
4446
:accessibility-label :mute-chat

status-go-version.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"owner": "status-im",
55
"repo": "status-go",
66
"version": "v0.98.4",
7-
"commit-sha1": "16197dc8075a6a67323d285af7593348f4289fd5",
8-
"src-sha256": "0znmgd2qr50gyksifi7x38smz0zy3ndv54x54f2g34z9l3kilyyn"
7+
"commit-sha1": "c531bf2ca1a32df659b0717149f541585939cb03",
8+
"src-sha256": "018kvnfnyys6rm7fa3miqyfcarvm95bz31w2vh820jj9963c46nx"
99
}

0 commit comments

Comments
 (0)