<commit_before>(ns status-im.ui.screens.chat.components.reply
  (:require [quo.core :as quo]
            [quo.react-native :as rn]
            [status-im.i18n :as i18n]
            [quo.design-system.colors :as colors]
            [quo.components.animated.pressable :as pressable]
            [status-im.ui.components.icons.vector-icons :as icons]
            [status-im.ethereum.stateofus :as stateofus]
            [status-im.ui.screens.chat.components.style :as styles]
            [re-frame.core :as re-frame]))

(def ^:private reply-symbol "↪ ")

(defn format-author [contact-name]
  (if (or (= (aget contact-name 0) "@")
          ;; in case of replies
          (= (aget contact-name 1) "@"))
    (or (stateofus/username contact-name)
        (subs contact-name 0 81))
    contact-name))

(defn format-reply-author [from username current-public-key]
  (or (and (= from current-public-key)
           (str reply-symbol (i18n/label :t/You)))
      (format-author (str reply-symbol username))))

(defn reply-message [{:keys [from content]}]
  (let [contact-name       @(re-frame/subscribe [:contacts/contact-name-by-identity from])
        current-public-key @(re-frame/subscribe [:multiaccount/public-key])]
    [rn/view {:style (styles/reply-container false)}
     [rn/view {:style (styles/reply-content)}
      [quo/text {:weight          :medium
                 :number-of-lines 1
                 :style           {:line-height 18}
                 :size            :small}
       (format-reply-author from contact-name current-public-key)]
      [quo/text {:size            :small
                 :number-of-lines 1
                 :style           {:line-height 18}}
       (:text content)]]
     [rn/view
      [pressable/pressable {:on-press            #(re-frame/dispatch [:chat.ui/cancel-message-reply])
                            :accessibility-label :cancel-message-reply}
       [icons/icon :main-icons/close-circle {:container-style (styles/close-button)
                                             :color           (:icon-01 @colors/theme)}]]]]))

(defn send-image [{:keys [uri]}]
  [rn/view {:style (styles/reply-container true)}
   [rn/view {:style (styles/reply-content)}
    [rn/image {:source {:uri uri}
               :style  {:width         56
                        :height        56
                        :border-radius 4}}]]
   [rn/view
    [pressable/pressable {:on-press            #(re-frame/dispatch [:chat.ui/cancel-sending-image])
                          :accessibility-label :cancel-send-image}
     [icons/icon :main-icons/close-circle {:container-style (styles/close-button)
                                           :color           colors/white}]]]])
<commit_msg>image reply fix<commit_after>(ns status-im.ui.screens.chat.components.reply
  (:require [quo.core :as quo]
            [quo.react-native :as rn]
            [status-im.i18n :as i18n]
            [quo.design-system.colors :as colors]
            [quo.components.animated.pressable :as pressable]
            [status-im.ui.components.icons.vector-icons :as icons]
            [status-im.ethereum.stateofus :as stateofus]
            [status-im.ui.screens.chat.components.style :as styles]
            [re-frame.core :as re-frame]
            [status-im.ui.components.react :as react]))

(def ^:private reply-symbol "↪ ")

(defn format-author [contact-name]
  (if (or (= (aget contact-name 0) "@")
          ;; in case of replies
          (= (aget contact-name 1) "@"))
    (or (stateofus/username contact-name)
        (subs contact-name 0 81))
    contact-name))

(defn format-reply-author [from username current-public-key]
  (or (and (= from current-public-key)
           (str reply-symbol (i18n/label :t/You)))
      (format-author (str reply-symbol username))))

(defn reply-message [{:keys [from content]}]
  (let [contact-name       @(re-frame/subscribe [:contacts/contact-name-by-identity from])
        current-public-key @(re-frame/subscribe [:multiaccount/public-key])
        {:keys [image text]} content]
    [rn/view {:style (styles/reply-container false)}
     [rn/view {:style (styles/reply-content)}
      [quo/text {:weight          :medium
                 :number-of-lines 1
                 :style           {:line-height 18}
                 :size            :small}
       (format-reply-author from contact-name current-public-key)]
      (if image
        [react/image {:style  {:width            56
                               :height           56
                               :background-color :black
                               :margin-top       2
                               :border-radius    4}
                      :source {:uri image}}]
        [quo/text {:size            :small
                   :number-of-lines 1
                   :style           {:line-height 18}}
         text])]
     [rn/view
      [pressable/pressable {:on-press            #(re-frame/dispatch [:chat.ui/cancel-message-reply])
                            :accessibility-label :cancel-message-reply}
       [icons/icon :main-icons/close-circle {:container-style (styles/close-button)
                                             :color           (:icon-01 @colors/theme)}]]]]))

(defn send-image [{:keys [uri]}]
  [rn/view {:style (styles/reply-container true)}
   [rn/view {:style (styles/reply-content)}
    [rn/image {:source {:uri uri}
               :style  {:width         56
                        :height        56
                        :border-radius 4}}]]
   [rn/view
    [pressable/pressable {:on-press            #(re-frame/dispatch [:chat.ui/cancel-sending-image])
                          :accessibility-label :cancel-send-image}
     [icons/icon :main-icons/close-circle {:container-style (styles/close-button)
                                           :color           colors/white}]]]])

{'fraction_non_alphanumeric': 0.13857998289136014, 'fraction_numerical': 0.009238665526090676, 'mean_word_length': 1.687816091954023, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '930259', 'n_tokens_mistral': 1782, 'n_tokens_neox': 1681, 'n_words': 359}