<commit_before>(ns status-im.ui.components.list-selection
  (:require [re-frame.core :as re-frame]
            [status-im.i18n :as i18n]
            [status-im.ui.components.action-sheet :as action-sheet]
            [status-im.ui.components.dialog :as dialog]
            [status-im.ui.components.react :as react]
            [status-im.utils.platform :as platform]))

(defn- open-share [content]
  (when (or (:message content)
            (:url content))
    (.share react/sharing (clj->js content))))

(defn share-options [text]
  [{:label  (i18n/label :t/sharing-copy-to-clipboard)
    :action #(react/copy-to-clipboard text)}
   {:label  (i18n/label :t/sharing-share)
    :action #(open-share {:message text})}])

(defn show [options]
  (if platform/ios?
    (action-sheet/show options)
    (dialog/show options)))

(defn share [text dialog-title]
  (show {:title       dialog-title
         :options     (share-options text)
         :cancel-text (i18n/label :t/sharing-cancel)}))

(defn browse [link]
  (show {:title       (i18n/label :t/browsing-title)
         :options     [{:text   (i18n/label :t/browsing-open-in-browser)
                        :action (re-frame/dispatch [:open-browser {:url link}])}
                       {:text   (i18n/label :t/browsing-open-in-web-browser)
                        :action (.openURL react/linking link)}]
         :cancel-text (i18n/label :t/browsing-cancel)}))<commit_msg>[ISSUE #3246] Fixed regression when opening URL<commit_after>(ns status-im.ui.components.list-selection
  (:require [re-frame.core :as re-frame]
            [status-im.i18n :as i18n]
            [status-im.ui.components.action-sheet :as action-sheet]
            [status-im.ui.components.dialog :as dialog]
            [status-im.ui.components.react :as react]
            [status-im.utils.platform :as platform]))

(defn- open-share [content]
  (when (or (:message content)
            (:url content))
    (.share react/sharing (clj->js content))))

(defn share-options [text]
  [{:label  (i18n/label :t/sharing-copy-to-clipboard)
    :action #(react/copy-to-clipboard text)}
   {:label  (i18n/label :t/sharing-share)
    :action #(open-share {:message text})}])

(defn show [options]
  (if platform/ios?
    (action-sheet/show options)
    (dialog/show options)))

(defn share [text dialog-title]
  (show {:title       dialog-title
         :options     (share-options text)
         :cancel-text (i18n/label :t/sharing-cancel)}))

(defn browse [link]
  (show {:title       (i18n/label :t/browsing-title)
         :options     [{:label  (i18n/label :t/browsing-open-in-browser)
                        :action #(re-frame/dispatch [:open-browser {:url link}])}
                       {:label  (i18n/label :t/browsing-open-in-web-browser)
                        :action #(.openURL react/linking link)}]
         :cancel-text (i18n/label :t/browsing-cancel)}))
{'fraction_non_alphanumeric': 0.15638002773925105, 'fraction_numerical': 0.013869625520110958, 'mean_word_length': 2.406139315230224, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6979375', 'n_tokens_mistral': 1021, 'n_tokens_neox': 950, 'n_words': 201}