<commit_before>(ns status-im.ui.screens.chat.utils
  (:require [re-frame.core :as re-frame]
            [status-im.utils.gfycat.core :as gfycat]
            [status-im.utils.platform :as platform]
            [status-im.i18n :as i18n]
            [status-im.ui.components.react :as react]
            [status-im.ui.components.colors :as colors]
            [status-im.utils.http :as http]))

(defn format-author [from username]
  (str (when username (str username " :: "))
       (gfycat/generate-gfy from))) ; TODO: We defensively generate the name for now, to be revisited when new protocol is defined

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

(def ^:private styling->prop
  {:bold      (if platform/desktop?
                {:font :medium}
                {:style {:font-weight :bold}})
   :italic    (if platform/desktop?
                {:font :italic}
                {:style {:font-style  :italic}})
   :backquote {:style {:background-color colors/black
                       :color            colors/green}}})

(def ^:private action->prop-fn
  {:link   (fn [text {:keys [outgoing]}]
             {:style    {:color                (if platform/desktop?
                                                 colors/blue
                                                 (if outgoing colors/white colors/blue))
                         :text-decoration-line :underline}
              :on-press (if platform/desktop?
                          #(.openURL react/linking (http/normalize-url text))
                          #(re-frame/dispatch [:browser.ui/message-link-pressed text]))})<commit_msg>Make bold work on desktop again<commit_after>(ns status-im.ui.screens.chat.utils
  (:require [re-frame.core :as re-frame]
            [status-im.utils.gfycat.core :as gfycat]
            [status-im.utils.platform :as platform]
            [status-im.i18n :as i18n]
            [status-im.ui.components.react :as react]
            [status-im.ui.components.colors :as colors]
            [status-im.utils.http :as http]))

(defn format-author [from username]
  (str (when username (str username " :: "))
       (gfycat/generate-gfy from))) ; TODO: We defensively generate the name for now, to be revisited when new protocol is defined

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

(def ^:private styling->prop
  {:bold      {:style {:font-weight :bold}}
   :italic    {:style {:font-style  :italic}}
   :backquote {:style {:background-color colors/black
                       :color            colors/green}}})

(def ^:private action->prop-fn
  {:link   (fn [text {:keys [outgoing]}]
             {:style    {:color                (if platform/desktop?
                                                 colors/blue
                                                 (if outgoing colors/white colors/blue))
                         :text-decoration-line :underline}
              :on-press (if platform/desktop?
                          #(.openURL react/linking (http/normalize-url text))
                          #(re-frame/dispatch [:browser.ui/message-link-pressed text]))})
{'fraction_non_alphanumeric': 0.12832929782082325, 'fraction_numerical': 0.0036319612590799033, 'mean_word_length': 1.7961082910321489, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1070679', 'n_tokens_mistral': 967, 'n_tokens_neox': 916, 'n_words': 234}