From b63602e1fff16acd68e05ec4e7a556dde90dcd79 Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Wed, 10 Oct 2018 10:25:48 +0200 Subject: [PATCH] [#6232] Link is not visible when sending it as my own message Signed-off-by: Andrey Shovkoplyas --- src/status_im/ui/screens/chat/message/message.cljs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/status_im/ui/screens/chat/message/message.cljs b/src/status_im/ui/screens/chat/message/message.cljs index 54beee6306..328ab1781c 100644 --- a/src/status_im/ui/screens/chat/message/message.cljs +++ b/src/status_im/ui/screens/chat/message/message.cljs @@ -104,14 +104,15 @@ (fn [text-seq] (map (fn [text] {:text text :url? false}) text-seq)))) -(defn- autolink [string event-on-press] +(defn- autolink [string event-on-press outgoing] (->> (parse-url string) (map-indexed (fn [idx {:keys [text url?]}] (if url? (let [[url _ _ _ text] (re-matches #"(?i)^((\w+://)?(www\d{0,3}[.])?)?(.*)$" text)] [react/text {:key idx - :style {:color colors/blue} + :style {:color (if outgoing colors/white colors/blue) + :text-decoration-line :underline} :on-press #(re-frame/dispatch [event-on-press url])} url]) text))) @@ -127,7 +128,7 @@ replacements)) ;; todo rewrite this, naive implementation -(defn- parse-text [string event-on-press] +(defn- parse-text [string event-on-press outgoing] (parse-str-regx string regx-styled (fn [text-seq] @@ -142,7 +143,7 @@ (map-indexed (fn [idx string] (apply react/text {:key (str idx "_" string)} - (autolink string event-on-press))) + (autolink string event-on-press outgoing))) text-seq)))) ; We can't use CSS as nested Text element don't accept margins nor padding @@ -180,7 +181,7 @@ (defn text-message [{:keys [content timestamp-str group-chat outgoing current-public-key] :as message}] [message-view message - (let [parsed-text (cached-parse-text (:text content) :browser.ui/message-link-pressed) + (let [parsed-text (cached-parse-text (:text content) :browser.ui/message-link-pressed outgoing) ref (reagent/atom nil) collapsible? (should-collapse? (:text content) group-chat) collapsed? (reagent/atom collapsible?)