fix local names , mute chat translation, replace null crash
Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
parent
32cb09c9c6
commit
59e226bab2
|
@ -10,18 +10,18 @@
|
||||||
[status-im.utils.datetime :as datetime]
|
[status-im.utils.datetime :as datetime]
|
||||||
[status-im.utils.fx :as fx]
|
[status-im.utils.fx :as fx]
|
||||||
["emojilib" :as emojis]
|
["emojilib" :as emojis]
|
||||||
[status-im.chat.models.mentions :as mentions]))
|
[status-im.chat.models.mentions :as mentions]
|
||||||
|
[status-im.utils.utils :as utils]))
|
||||||
|
|
||||||
(defn text->emoji
|
(defn text->emoji
|
||||||
"Replaces emojis in a specified `text`"
|
"Replaces emojis in a specified `text`"
|
||||||
[text]
|
[text]
|
||||||
(when text
|
(utils/safe-replace text
|
||||||
(string/replace text
|
#":([a-z_\-+0-9]*):"
|
||||||
#":([a-z_\-+0-9]*):"
|
(fn [[original emoji-id]]
|
||||||
(fn [[original emoji-id]]
|
(if-let [emoji-map (object/get (.-lib emojis) emoji-id)]
|
||||||
(if-let [emoji-map (object/get (.-lib emojis) emoji-id)]
|
(.-char ^js emoji-map)
|
||||||
(.-char ^js emoji-map)
|
original))))
|
||||||
original)))))
|
|
||||||
|
|
||||||
(fx/defn set-chat-input-text
|
(fx/defn set-chat-input-text
|
||||||
"Set input text for current-chat. Takes db and input text and cofx
|
"Set input text for current-chat. Takes db and input text and cofx
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
(when-not (string/blank? image-path)
|
(when-not (string/blank? image-path)
|
||||||
(chat.message/send-message {:chat-id current-chat-id
|
(chat.message/send-message {:chat-id current-chat-id
|
||||||
:content-type constants/content-type-image
|
:content-type constants/content-type-image
|
||||||
:image-path (string/replace image-path #"file://" "")
|
:image-path (utils/safe-replace image-path #"file://" "")
|
||||||
:text (i18n/label :t/update-to-see-image)})))))
|
:text (i18n/label :t/update-to-see-image)})))))
|
||||||
|
|
||||||
(fx/defn send-audio-message
|
(fx/defn send-audio-message
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
[status-im.utils.fx :as fx]
|
[status-im.utils.fx :as fx]
|
||||||
[status-im.contact.db :as contact.db]
|
[status-im.contact.db :as contact.db]
|
||||||
[status-im.utils.platform :as platform]
|
[status-im.utils.platform :as platform]
|
||||||
[taoensso.timbre :as log]))
|
[taoensso.timbre :as log]
|
||||||
|
[status-im.utils.utils :as utils]))
|
||||||
|
|
||||||
(def at-sign "@")
|
(def at-sign "@")
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@
|
||||||
:else users)]
|
:else users)]
|
||||||
(reduce
|
(reduce
|
||||||
(fn [acc [key {:keys [alias name identicon]}]]
|
(fn [acc [key {:keys [alias name identicon]}]]
|
||||||
(let [name (string/replace name ".stateofus.eth" "")]
|
(let [name (utils/safe-replace name ".stateofus.eth" "")]
|
||||||
(assoc acc alias {:alias alias
|
(assoc acc alias {:alias alias
|
||||||
:name (or name alias)
|
:name (or name alias)
|
||||||
:identicon identicon
|
:identicon identicon
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
[status-im.utils.security :as security]
|
[status-im.utils.security :as security]
|
||||||
[status-im.wallet.db :as wallet.db]
|
[status-im.wallet.db :as wallet.db]
|
||||||
[status-im.wallet.utils :as wallet.utils]
|
[status-im.wallet.utils :as wallet.utils]
|
||||||
|
[status-im.utils.utils :as utils]
|
||||||
status-im.ui.screens.keycard.subs
|
status-im.ui.screens.keycard.subs
|
||||||
status-im.ui.screens.keycard.settings.subs
|
status-im.ui.screens.keycard.settings.subs
|
||||||
status-im.ui.screens.keycard.pin.subs
|
status-im.ui.screens.keycard.pin.subs
|
||||||
|
@ -863,7 +864,7 @@
|
||||||
(reduce
|
(reduce
|
||||||
(fn [acc [key {:keys [alias name identicon]}]]
|
(fn [acc [key {:keys [alias name identicon]}]]
|
||||||
(if (and alias (not= alias ""))
|
(if (and alias (not= alias ""))
|
||||||
(let [name (string/replace name ".stateofus.eth" "")]
|
(let [name (utils/safe-replace name ".stateofus.eth" "")]
|
||||||
(assoc acc alias {:alias alias
|
(assoc acc alias {:alias alias
|
||||||
:name (or name alias)
|
:name (or name alias)
|
||||||
:identicon identicon
|
:identicon identicon
|
||||||
|
|
|
@ -80,20 +80,21 @@
|
||||||
|
|
||||||
(defn render-chat-settings [{:keys [public-key names]}]
|
(defn render-chat-settings [{:keys [public-key names]}]
|
||||||
(let [muted? (:muted @(re-frame/subscribe [:chats/chat public-key]))]
|
(let [muted? (:muted @(re-frame/subscribe [:chats/chat public-key]))]
|
||||||
[quo/list-item
|
[react/view
|
||||||
{:title (i18n/label :t/nickname)
|
[quo/list-item
|
||||||
:size :small
|
{:title (i18n/label :t/nickname)
|
||||||
:accessibility-label :profile-nickname-item
|
:size :small
|
||||||
:accessory :text
|
:accessibility-label :profile-nickname-item
|
||||||
:accessory-text (or (:nickname names) (i18n/label :t/none))
|
:accessory :text
|
||||||
:on-press #(re-frame/dispatch [:navigate-to :nickname])
|
:accessory-text (or (:nickname names) (i18n/label :t/none))
|
||||||
:chevron true}]
|
:on-press #(re-frame/dispatch [:navigate-to :nickname])
|
||||||
[quo/list-item
|
:chevron true}]
|
||||||
{:title (i18n/label :mute-chat)
|
[quo/list-item
|
||||||
:active muted?
|
{:title (i18n/label :t/mute)
|
||||||
:accessibility-label :mute-chat
|
:active muted?
|
||||||
:on-press #(re-frame/dispatch [::chat.models/mute-chat-toggled public-key (not muted?)])
|
:accessibility-label :mute-chat
|
||||||
:accessory :switch}]))
|
:on-press #(re-frame/dispatch [::chat.models/mute-chat-toggled public-key (not muted?)])
|
||||||
|
:accessory :switch}]]))
|
||||||
|
|
||||||
(defn chat-settings [contact]
|
(defn chat-settings [contact]
|
||||||
[react/view
|
[react/view
|
||||||
|
|
|
@ -118,3 +118,7 @@
|
||||||
(defn safe-trim [s]
|
(defn safe-trim [s]
|
||||||
(when (string? s)
|
(when (string? s)
|
||||||
(string/trim s)))
|
(string/trim s)))
|
||||||
|
|
||||||
|
(defn safe-replace [s m r]
|
||||||
|
(when (string? s)
|
||||||
|
(string/replace s m r)))
|
|
@ -1258,5 +1258,6 @@
|
||||||
"request-membership": "Request membership",
|
"request-membership": "Request membership",
|
||||||
"membership-description": "Group membership requires you to be accepted by the group admin",
|
"membership-description": "Group membership requires you to be accepted by the group admin",
|
||||||
"group-membership-request": "Group membership request",
|
"group-membership-request": "Group membership request",
|
||||||
"members-limit-reached": "Members limit reached"
|
"members-limit-reached": "Members limit reached",
|
||||||
|
"mute": "Mute"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue