From 252452f5b0661af7d6715e13373844351633be41 Mon Sep 17 00:00:00 2001 From: virvar Date: Mon, 9 May 2016 10:25:15 +0300 Subject: [PATCH] 'Message' button on profile view --- src/syng_im/components/profile.cljs | 9 ++++++--- src/syng_im/models/contacts.cljs | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/syng_im/components/profile.cljs b/src/syng_im/components/profile.cljs index 5711d694e2..de3661937d 100644 --- a/src/syng_im/components/profile.cljs +++ b/src/syng_im/components/profile.cljs @@ -34,6 +34,10 @@ [text {:style st/profile-property-view-value} value]]]) +(defn message-user [navigator identity] + (when identity + (dispatch [:show-chat identity navigator :push]))) + (defn profile [{:keys [navigator]}] (let [contact (subscribe [:contact])] (fn [{:keys [navigator]}] @@ -54,9 +58,8 @@ [text {:style st/status} "!not implemented"] [view {:style st/btns-container} - [touchable-highlight {:onPress (fn [] - ;; TODO not implemented - ) + [touchable-highlight {:onPress #(message-user navigator + (:whisper-identity @contact)) :underlay-color :transparent} [view {:style st/message-btn} [text {:style st/message-btn-text} diff --git a/src/syng_im/models/contacts.cljs b/src/syng_im/models/contacts.cljs index 072a2ebe98..3468cd7eab 100644 --- a/src/syng_im/models/contacts.cljs +++ b/src/syng_im/models/contacts.cljs @@ -107,7 +107,12 @@ (r/sorted :name :asc)))) (defn contact-by-identity [identity] - (r/single-cljs (r/get-by-field :contacts :whisper-identity identity))) + (if (= identity "console") + {:phone-number "" + :whisper-identity "console" + :name "Console" + :photo-path ""} + (r/single-cljs (r/get-by-field :contacts :whisper-identity identity)))) ;;;;;;;;;;;;;;;;;;;;----------------------------------------------