diff --git a/src/status_im/profile/handlers.cljs b/src/status_im/profile/handlers.cljs index ea71c85c52..3b7b2b9a51 100644 --- a/src/status_im/profile/handlers.cljs +++ b/src/status_im/profile/handlers.cljs @@ -5,7 +5,8 @@ [status-im.utils.image-processing :refer [img->base64]] [status-im.i18n :refer [label]] [status-im.utils.handlers :as u :refer [get-hashtags]] - [taoensso.timbre :as log])) + [taoensso.timbre :as log] + [status-im.constants :refer [console-chat-id]])) (defn message-user [identity] (when identity @@ -35,3 +36,11 @@ 1 (dispatch [:open-image-picker]) :default)) :cancel-text (label :t/image-source-cancel)})))) + +(register-handler :phone-number-change-requested + ;; Switch user to the console issuing the !phone command automatically to let him change his phone number. + ;; We allow to change phone number only from console because this requires entering SMS verification code. + (u/side-effect! + (fn [db _] + (dispatch [:navigate-to :chat console-chat-id]) + (dispatch [:set-chat-command :phone])))) diff --git a/src/status_im/profile/screen.cljs b/src/status_im/profile/screen.cljs index b89767a1aa..afa24d8878 100644 --- a/src/status_im/profile/screen.cljs +++ b/src/status_im/profile/screen.cljs @@ -114,13 +114,6 @@ [status-view {:style (st/status-text (:height (r/state component))) :status status}])])}))) -(defn- navigate-to-phone-change - "Switch user to the console issuing the !phone command automatically to let him change his phone number." - [] - (dispatch [:navigate-to :chat console-chat-id]) - (dispatch [:set-chat-command :phone]) - ) - (defview profile [] [{whisper-identity :whisper-identity address :address @@ -163,13 +156,10 @@ [view st/profile-property-with-top-spacing [selectable-field {:label (label :t/phone-number) - :editable? false :value (if (and phone (not (str/blank? phone))) (format-phone-number phone) - (label :t/not-specified)) - ;; TODO: should this be changed? - :on-press navigate-to-phone-change}] + (label :t/not-specified))}] [view st/underline-container]] (when address @@ -223,7 +213,7 @@ :value (if (and phone (not (str/blank? phone))) (format-phone-number phone) (label :t/not-specified)) - :on-press navigate-to-phone-change}] + :on-press #(dispatch [:phone-number-change-requested])}] [view st/underline-container]] [view st/profile-property