browse from message bug
This commit is contained in:
parent
a8baf43681
commit
29030db2b6
|
@ -12,6 +12,7 @@
|
|||
[status-im.data-store.chats :as chats-store]
|
||||
[status-im.protocol.core :as protocol]
|
||||
[status-im.constants :as const]
|
||||
[status-im.components.list-selection :as list-selection]
|
||||
status-im.chat.events.input
|
||||
status-im.chat.events.commands
|
||||
status-im.chat.events.animation
|
||||
|
@ -78,6 +79,11 @@
|
|||
(fn [params]
|
||||
(protocol/send-seen! params)))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:browse
|
||||
(fn [[command link]]
|
||||
(list-selection/browse command link)))
|
||||
|
||||
;;;; Helper fns
|
||||
|
||||
(defn init-console-chat
|
||||
|
@ -251,3 +257,8 @@
|
|||
{:db (assoc-in [:chats current-chat-id :messages] (get-stored-messages current-chat-id))
|
||||
;; TODO(janherich): make this dispatch into fn call once commands loading is refactored
|
||||
:dispatch [:load-commands! current-chat-id]}))))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:browse-link-from-message
|
||||
(fn [{{:keys [global-commands]} :db} [_ link]]
|
||||
{:browse [(:browse global-commands) link]}))
|
|
@ -15,7 +15,7 @@
|
|||
get-dimensions
|
||||
dismiss-keyboard!]]
|
||||
[status-im.components.animation :as anim]
|
||||
[status-im.components.list-selection :refer [share browse share-or-open-map]]
|
||||
[status-im.components.list-selection :refer [share share-or-open-map]]
|
||||
[status-im.chat.constants :as chat-consts]
|
||||
[status-im.chat.models.commands :as commands]
|
||||
[status-im.chat.styles.message.message :as st]
|
||||
|
@ -200,7 +200,7 @@
|
|||
(if simple-text?
|
||||
[autolink {:style (st/text-message message)
|
||||
:text (apply str parsed-text)
|
||||
:onPress #(browse %)}]
|
||||
:onPress #(dispatch [:browse-link-from-message %])}]
|
||||
[text {:style (st/text-message message)} parsed-text]))])
|
||||
|
||||
(defmulti message-content (fn [_ message _] (message :content-type)))
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
:default))
|
||||
:cancel-text (label :t/sharing-cancel)})))
|
||||
|
||||
(defn browse [link]
|
||||
(defn browse [command link]
|
||||
(let [list-selection-fn (:list-selection-fn platform-specific)]
|
||||
(list-selection-fn {:title (label :t/browsing-title)
|
||||
:options [{:text (label :t/browsing-browse)}
|
||||
|
@ -37,9 +37,10 @@
|
|||
(case index
|
||||
0 (do
|
||||
(dispatch [:select-chat-input-command
|
||||
{:bot "browse"
|
||||
:prefill [link]}])
|
||||
(js/setTimeout #(dispatch [:send-current-message]) 500))
|
||||
(assoc (first command) :prefill [link])
|
||||
nil
|
||||
true])
|
||||
(js/setTimeout #(dispatch [:send-current-message]) 100))
|
||||
1 (.openURL linking link)
|
||||
:default))
|
||||
:cancel-text (label :t/browsing-cancel)})))
|
||||
|
|
Loading…
Reference in New Issue