[#13283] Fix syncing of adding contact after removal
This commit is contained in:
parent
fbfab9fd3b
commit
f6f80be30a
|
@ -2339,6 +2339,13 @@
|
||||||
(fn [[contact] _]
|
(fn [[contact] _]
|
||||||
(:added contact)))
|
(:added contact)))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
:contacts/contact-blocked?
|
||||||
|
(fn [[_ identity] _]
|
||||||
|
[(re-frame/subscribe [:contacts/contact-by-identity identity])])
|
||||||
|
(fn [[contact] _]
|
||||||
|
(:blocked contact)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:contacts/contact-two-names-by-identity
|
:contacts/contact-two-names-by-identity
|
||||||
(fn [[_ identity] _]
|
(fn [[_ identity] _]
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
[status-im.utils.identicon :as identicon]
|
[status-im.utils.identicon :as identicon]
|
||||||
[status-im.ui.components.keyboard-avoid-presentation :as kb-presentation]
|
[status-im.ui.components.keyboard-avoid-presentation :as kb-presentation]
|
||||||
[status-im.ui.components.animation :as animation]
|
[status-im.ui.components.animation :as animation]
|
||||||
[status-im.ui.screens.chat.photos :as photos])
|
[status-im.ui.screens.chat.photos :as photos]
|
||||||
|
[status-im.utils.db :as utils.db])
|
||||||
(:require-macros [status-im.utils.views :as views]))
|
(:require-macros [status-im.utils.views :as views]))
|
||||||
|
|
||||||
(defn- render-row [row]
|
(defn- render-row [row]
|
||||||
|
@ -45,19 +46,20 @@
|
||||||
icon])
|
icon])
|
||||||
|
|
||||||
(defn- input-icon
|
(defn- input-icon
|
||||||
[state new-contact? entered-nickname]
|
[state new-contact? entered-nickname blocked?]
|
||||||
(let [icon (if new-contact? :main-icons/add :main-icons/arrow-right)]
|
(let [icon (if new-contact? :main-icons/add :main-icons/arrow-right)]
|
||||||
(case state
|
(cond
|
||||||
:searching
|
(= state :searching)
|
||||||
[icon-wrapper colors/gray
|
[icon-wrapper colors/gray
|
||||||
[react/activity-indicator {:color colors/white-persist}]]
|
[react/activity-indicator {:color colors/white-persist}]]
|
||||||
|
|
||||||
:valid
|
(and (= state :valid) (not blocked?))
|
||||||
[react/touchable-highlight
|
[react/touchable-highlight
|
||||||
{:on-press #(debounce/dispatch-and-chill [:contact.ui/contact-code-submitted new-contact? entered-nickname] 3000)}
|
{:on-press #(debounce/dispatch-and-chill [:contact.ui/contact-code-submitted new-contact? entered-nickname] 3000)}
|
||||||
[icon-wrapper colors/blue
|
[icon-wrapper colors/blue
|
||||||
[icons/icon icon {:color colors/white-persist}]]]
|
[icons/icon icon {:color colors/white-persist}]]]
|
||||||
|
|
||||||
|
:else
|
||||||
[icon-wrapper colors/gray
|
[icon-wrapper colors/gray
|
||||||
[icons/icon icon {:color colors/white-persist}]])))
|
[icons/icon icon {:color colors/white-persist}]])))
|
||||||
|
|
||||||
|
@ -251,9 +253,12 @@
|
||||||
:return-key-type :done
|
:return-key-type :done
|
||||||
:auto-correct false}])
|
:auto-correct false}])
|
||||||
|
|
||||||
(views/defview new-contact []
|
(defn new-contact []
|
||||||
(views/letsubs [{:keys [state ens-name public-key error]} [:contacts/new-identity]
|
(let [{:keys [state ens-name public-key error]} @(re-frame/subscribe [:contacts/new-identity])
|
||||||
entered-nickname (reagent/atom "")]
|
entered-nickname (reagent/atom "")
|
||||||
|
blocked? (and
|
||||||
|
(utils.db/valid-public-key? (or public-key ""))
|
||||||
|
@(re-frame/subscribe [:contacts/contact-blocked? public-key]))]
|
||||||
[react/view {:style {:flex 1}}
|
[react/view {:style {:flex 1}}
|
||||||
[topbar/topbar
|
[topbar/topbar
|
||||||
{:title (i18n/label :t/new-contact)
|
{:title (i18n/label :t/new-contact)
|
||||||
|
@ -284,7 +289,7 @@
|
||||||
:return-key-type :go}]]
|
:return-key-type :go}]]
|
||||||
[react/view {:justify-content :center
|
[react/view {:justify-content :center
|
||||||
:align-items :center}
|
:align-items :center}
|
||||||
[input-icon state true @entered-nickname]]]
|
[input-icon state true @entered-nickname blocked?]]]
|
||||||
[react/view {:min-height 30 :justify-content :flex-end :margin-bottom 16}
|
[react/view {:min-height 30 :justify-content :flex-end :margin-bottom 16}
|
||||||
[quo/text {:style {:margin-horizontal 16}
|
[quo/text {:style {:margin-horizontal 16}
|
||||||
:size :small
|
:size :small
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
(i18n/label :t/group-membership-request)]]])))))
|
(i18n/label :t/group-membership-request)]]])))))
|
||||||
|
|
||||||
(defn add-contact-bar [public-key]
|
(defn add-contact-bar [public-key]
|
||||||
(when-not @(re-frame/subscribe [:contacts/contact-added? public-key])
|
(when-not (or @(re-frame/subscribe [:contacts/contact-added? public-key])
|
||||||
|
@(re-frame/subscribe [:contacts/contact-blocked? public-key]))
|
||||||
[react/touchable-highlight
|
[react/touchable-highlight
|
||||||
{:on-press
|
{:on-press
|
||||||
#(re-frame/dispatch [:contact.ui/add-to-contact-pressed public-key])
|
#(re-frame/dispatch [:contact.ui/add-to-contact-pressed public-key])
|
||||||
|
|
|
@ -37,8 +37,10 @@
|
||||||
:action #(re-frame/dispatch [:contact.ui/remove-contact-pressed contact])}]
|
:action #(re-frame/dispatch [:contact.ui/remove-contact-pressed contact])}]
|
||||||
[{:label (i18n/label :t/add-to-contacts)
|
[{:label (i18n/label :t/add-to-contacts)
|
||||||
:icon :main-icons/add-contact
|
:icon :main-icons/add-contact
|
||||||
|
:disabled blocked?
|
||||||
:accessibility-label :add-to-contacts-button
|
:accessibility-label :add-to-contacts-button
|
||||||
:action #(re-frame/dispatch [:contact.ui/add-to-contact-pressed public-key nil ens-name])}])
|
:action (when-not blocked?
|
||||||
|
#(re-frame/dispatch [:contact.ui/add-to-contact-pressed public-key nil ens-name]))}])
|
||||||
[{:label (i18n/label (if (or muted? blocked?) :t/unmute :t/mute))
|
[{:label (i18n/label (if (or muted? blocked?) :t/unmute :t/mute))
|
||||||
:icon :main-icons/notification
|
:icon :main-icons/notification
|
||||||
:accessibility-label :mute-chat
|
:accessibility-label :mute-chat
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
"owner": "status-im",
|
"owner": "status-im",
|
||||||
"repo": "status-go",
|
"repo": "status-go",
|
||||||
"version": "v0.98.4",
|
"version": "v0.98.4",
|
||||||
"commit-sha1": "16197dc8075a6a67323d285af7593348f4289fd5",
|
"commit-sha1": "c531bf2ca1a32df659b0717149f541585939cb03",
|
||||||
"src-sha256": "0znmgd2qr50gyksifi7x38smz0zy3ndv54x54f2g34z9l3kilyyn"
|
"src-sha256": "018kvnfnyys6rm7fa3miqyfcarvm95bz31w2vh820jj9963c46nx"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue