[#17351] remove status-im.utils.platform (#17352)

This commit is contained in:
flexsurfer 2023-09-20 14:17:52 +02:00 committed by GitHub
parent 6a169bd0bd
commit 5bb954f8a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 33 additions and 87 deletions

View File

@ -196,10 +196,6 @@ status-im.desktop.core/init
status-im.chat.models-test/test-db status-im.chat.models-test/test-db
quo.design-system.spacing/padding-vertical quo.design-system.spacing/padding-vertical
status-im.utils.money/percent-change status-im.utils.money/percent-change
status-im.utils.platform/isMacOs?
status-im.utils.platform/isNix?
status-im.utils.platform/isWin?
status-im.utils.platform/android-version>=
utils.debounce/clear-all utils.debounce/clear-all
status-im.transport.db/create-chat status-im.transport.db/create-chat
status-im.utils.priority-map/priority-map status-im.utils.priority-map/priority-map

View File

@ -18,7 +18,7 @@
[status-im.ui.components.list-selection :as list-selection] [status-im.ui.components.list-selection :as list-selection]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[utils.url :as url] [utils.url :as url]
[status-im.utils.platform :as platform] [react-native.platform :as platform]
[status-im.utils.random :as random] [status-im.utils.random :as random]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[status-im.utils.universal-links.utils :as links] [status-im.utils.universal-links.utils :as links]

View File

@ -7,7 +7,7 @@
[react-native.fs :as fs] [react-native.fs :as fs]
[status-im2.constants :as constants] [status-im2.constants :as constants]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.platform :as platform] [react-native.platform :as platform]
[taoensso.timbre :as log])) [taoensso.timbre :as log]))
(def temp-image-url (str (fs/cache-dir) "/StatusIm_Image.jpeg")) (def temp-image-url (str (fs/cache-dir) "/StatusIm_Image.jpeg"))

View File

@ -4,7 +4,7 @@
[status-im.chat.models.loading :as chat.loading] [status-im.chat.models.loading :as chat.loading]
[status-im.data-store.messages :as data-store.messages] [status-im.data-store.messages :as data-store.messages]
[status-im.transport.message.protocol :as protocol] [status-im.transport.message.protocol :as protocol]
[status-im.utils.platform :as platform] [react-native.platform :as platform]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[status-im2.contexts.chat.messages.delete-message.events :as delete-message] [status-im2.contexts.chat.messages.delete-message.events :as delete-message]
[status-im2.contexts.chat.messages.list.events :as message-list] [status-im2.contexts.chat.messages.list.events :as message-list]

View File

@ -10,7 +10,7 @@
[utils.re-frame :as rf] [utils.re-frame :as rf]
[utils.datetime :as datetime] [utils.datetime :as datetime]
[status-im.utils.keychain.core :as keychain] [status-im.utils.keychain.core :as keychain]
[status-im.utils.platform :as platform] [react-native.platform :as platform]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[status-im2.navigation.events :as navigation] [status-im2.navigation.events :as navigation]
[taoensso.timbre :as log])) [taoensso.timbre :as log]))

View File

@ -5,7 +5,7 @@
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
[status-im.keycard.keycard :as keycard] [status-im.keycard.keycard :as keycard]
[native-module.core :as native-module] [native-module.core :as native-module]
[status-im.utils.platform :as platform] [react-native.platform :as platform]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[taoensso.timbre :as log])) [taoensso.timbre :as log]))

View File

@ -15,7 +15,7 @@
[utils.re-frame :as rf] [utils.re-frame :as rf]
[utils.datetime :as datetime] [utils.datetime :as datetime]
[status-im.utils.keychain.core :as keychain] [status-im.utils.keychain.core :as keychain]
[status-im.utils.platform :as platform] [react-native.platform :as platform]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[status-im2.navigation.events :as navigation] [status-im2.navigation.events :as navigation]
[taoensso.timbre :as log] [taoensso.timbre :as log]

View File

@ -5,7 +5,7 @@
[native-module.core :as native-module] [native-module.core :as native-module]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.platform :as platform] [react-native.platform :as platform]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[utils.security.core :as security])) [utils.security.core :as security]))

View File

@ -3,9 +3,9 @@
[native-module.core :as native-module] [native-module.core :as native-module]
[status-im2.config :as config] [status-im2.config :as config]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.platform :as utils.platform]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[clojure.string :as string])) [clojure.string :as string]
[react-native.platform :as platform]))
(defn- add-custom-bootnodes (defn- add-custom-bootnodes
[config network all-bootnodes] [config network all-bootnodes]
@ -173,7 +173,7 @@
:WakuV2Config (merge (assoc wakuv2-config :Enabled wakuv2-enabled) :WakuV2Config (merge (assoc wakuv2-config :Enabled wakuv2-enabled)
wakuv2-default-config) wakuv2-default-config)
:ShhextConfig :ShhextConfig
{:BackupDisabledDataDir (utils.platform/no-backup-directory) {:BackupDisabledDataDir (if platform/android? "/../no_backup" "/")
:InstallationID installation-id :InstallationID installation-id
:MaxMessageDeliveryAttempts config/max-message-delivery-attempts :MaxMessageDeliveryAttempts config/max-message-delivery-attempts
:MailServerConfirmations config/mailserver-confirmations-enabled? :MailServerConfirmations config/mailserver-confirmations-enabled?
@ -205,7 +205,7 @@
which will take care of building up the proper config based on settings in which will take care of building up the proper config based on settings in
app-db" app-db"
{:events [::save-new-config]} {:events [::save-new-config]}
[{:keys [db]} config {:keys [on-success]}] [_ config {:keys [on-success]}]
{:json-rpc/call [{:method "settings_saveSetting" {:json-rpc/call [{:method "settings_saveSetting"
:params [:node-config config] :params [:node-config config]
:on-success on-success}]}) :on-success on-success}]})

View File

@ -4,7 +4,7 @@
[status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im2.config :as config] [status-im2.config :as config]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.platform :as utils.platform] [react-native.platform :as utils.platform]
[status-im2.common.json-rpc.events :as json-rpc] [status-im2.common.json-rpc.events :as json-rpc]
[status-im2.navigation.events :as navigation] [status-im2.navigation.events :as navigation]
[taoensso.timbre :as log])) [taoensso.timbre :as log]))

View File

@ -4,7 +4,7 @@
[reagent.core :as reagent] [reagent.core :as reagent]
[status-im.ui.components.animation :as anim] [status-im.ui.components.animation :as anim]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[status-im.utils.platform :as platform]) [react-native.platform :as platform])
(:require-macros [status-im.utils.views :as views])) (:require-macros [status-im.utils.views :as views]))
(def back-listener (atom nil)) (def back-listener (atom nil))

View File

@ -1,7 +1,7 @@
(ns status-im.ui.components.emoji-thumbnail.styles (ns status-im.ui.components.emoji-thumbnail.styles
(:require [quo.design-system.colors :as colors] (:require [quo.design-system.colors :as colors]
[status-im.ui.components.emoji-thumbnail.utils :as emoji-utils] [status-im.ui.components.emoji-thumbnail.utils :as emoji-utils]
[status-im.utils.platform :as platform])) [react-native.platform :as platform]))
(defn emoji-thumbnail-icon (defn emoji-thumbnail-icon
[color size] [color size]

View File

@ -1,5 +1,5 @@
(ns status-im.ui.components.emoji-thumbnail.utils (ns status-im.ui.components.emoji-thumbnail.utils
(:require [status-im.utils.platform :as platform])) (:require [react-native.platform :as platform]))
(defn emoji-font-size (defn emoji-font-size
[container_size] [container_size]

View File

@ -3,7 +3,7 @@
[reagent.core :as reagent] [reagent.core :as reagent]
[status-im.ui.components.list.styles :as styles] [status-im.ui.components.list.styles :as styles]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[status-im.utils.platform :as platform])) [react-native.platform :as platform]))
(def flat-list-class (reagent/adapt-react-class (.-FlatList react-native))) (def flat-list-class (reagent/adapt-react-class (.-FlatList react-native)))
(def section-list-class (reagent/adapt-react-class (.-SectionList react-native))) (def section-list-class (reagent/adapt-react-class (.-SectionList react-native)))

View File

@ -5,7 +5,7 @@
[status-im.ui.components.dialog :as dialog] [status-im.ui.components.dialog :as dialog]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[utils.url :as url] [utils.url :as url]
[status-im.utils.platform :as platform])) [react-native.platform :as platform]))
(defn open-share (defn open-share
[content] [content]

View File

@ -12,7 +12,7 @@
[reagent.core :as reagent] [reagent.core :as reagent]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im.ui.components.typography :as typography] [status-im.ui.components.typography :as typography]
[status-im.utils.platform :as platform] [react-native.platform :as platform]
[status-im.utils.utils :as utils]) [status-im.utils.utils :as utils])
(:require-macros [status-im.utils.views :as views])) (:require-macros [status-im.utils.views :as views]))

View File

@ -1,10 +0,0 @@
(ns status-im.ui.components.tabbar.core
(:require [status-im.utils.platform :as platform]))
(defn get-height
[]
(if platform/android?
56
(if platform/iphone-x?
84
50)))

View File

@ -2,7 +2,7 @@
(:require ["react-native-webview" :default rn-webview] (:require ["react-native-webview" :default rn-webview]
[reagent.core :as reagent] [reagent.core :as reagent]
[status-im2.config :as config] [status-im2.config :as config]
[status-im.utils.platform :as platform])) [react-native.platform :as platform]))
(def webview-class (def webview-class
(reagent/adapt-react-class rn-webview)) (reagent/adapt-react-class rn-webview))

View File

@ -5,7 +5,7 @@
[status-im2.constants :as constants] [status-im2.constants :as constants]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[status-im.utils.platform :as platform] [react-native.platform :as platform]
[utils.debounce :as debounce]) [utils.debounce :as debounce])
(:require-macros [status-im.utils.views :refer [defview letsubs]])) (:require-macros [status-im.utils.views :refer [defview letsubs]]))

View File

@ -9,7 +9,7 @@
[status-im.ui.components.icons.icons :as icons] [status-im.ui.components.icons.icons :as icons]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[status-im.ui.screens.keycard.pin.styles :as styles] [status-im.ui.screens.keycard.pin.styles :as styles]
[status-im.utils.platform :as platform])) [react-native.platform :as platform]))
(def default-pin-retries-number 3) (def default-pin-retries-number 3)
(def default-puk-retries-number 5) (def default-puk-retries-number 5)

View File

@ -14,7 +14,7 @@
[status-im.ui.screens.signing.views :as signing] [status-im.ui.screens.signing.views :as signing]
[status-im.ui.screens.wallet.request.views :as request] [status-im.ui.screens.wallet.request.views :as request]
[status-im.ui.screens.wallet.signing-phrase.views :as signing-phrase] [status-im.ui.screens.wallet.signing-phrase.views :as signing-phrase]
[status-im.utils.platform :as platform])) [react-native.platform :as platform]))
(defn hide-panel-anim (defn hide-panel-anim
[bottom-anim-value alpha-value window-height] [bottom-anim-value alpha-value window-height]

View File

@ -8,7 +8,7 @@
[status-im.ui.components.common.common :as components.common] [status-im.ui.components.common.common :as components.common]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[status-im2.config :as config] [status-im2.config :as config]
[status-im.utils.platform :as platform]) [react-native.platform :as platform])
(:require-macros [status-im.utils.views :as views])) (:require-macros [status-im.utils.views :as views]))
(defn separator (defn separator

View File

@ -12,7 +12,7 @@
[status-im.ui.screens.profile.visibility-status.styles :as styles] [status-im.ui.screens.profile.visibility-status.styles :as styles]
[status-im.ui.screens.profile.visibility-status.utils :as utils] [status-im.ui.screens.profile.visibility-status.utils :as utils]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.platform :as platform])) [react-native.platform :as platform]))
;; === Code Related to visibility-status-button === ;; === Code Related to visibility-status-button ===

View File

@ -22,7 +22,7 @@
[status-im.ui.screens.signing.sheets :as sheets] [status-im.ui.screens.signing.sheets :as sheets]
[status-im.ui.screens.signing.styles :as styles] [status-im.ui.screens.signing.styles :as styles]
[status-im.ui.screens.wallet.components.views :as wallet.components] [status-im.ui.screens.wallet.components.views :as wallet.components]
[status-im.utils.platform :as platform] [react-native.platform :as platform]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[status-im.utils.utils :as utils] [status-im.utils.utils :as utils]
[status-im.wallet.utils :as wallet.utils] [status-im.wallet.utils :as wallet.utils]

View File

@ -11,7 +11,7 @@
[status-im.utils.build :as build] [status-im.utils.build :as build]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[utils.datetime :as datetime] [utils.datetime :as datetime]
[status-im.utils.platform :as platform] [react-native.platform :as platform]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[status-im2.common.log :as log] [status-im2.common.log :as log]
[status-im2.config :as config])) [status-im2.config :as config]))

View File

@ -1,40 +0,0 @@
(ns status-im.utils.platform
(:require ["react-native" :as react-native :refer (Dimensions)]))
(def platform
(.-Platform react-native))
(def os
(when platform
(.-OS ^js platform)))
(def version
(when platform
(.-Version ^js platform)))
;; iPhone X dimensions
(def x-height 812)
(def xs-height 896)
(defn iphone-x-dimensions?
[]
(let [{:keys [height]} (-> Dimensions
(.get "window")
(js->clj :keywordize-keys true))]
(or (= height x-height) (= height xs-height))))
(def android? (= os "android"))
(def ios? (= os "ios"))
(def iphone-x? (and ios? (iphone-x-dimensions?)))
(defn no-backup-directory
[]
(cond
android? "/../no_backup"
ios? "/"))
(defn android-version>=
[v]
(and android? (>= version v)))
(def low-device? (and android? (< version 29)))

View File

@ -4,7 +4,7 @@
[style] [style]
`(let [style# ~style `(let [style# ~style
common# (dissoc style# :android :ios) common# (dissoc style# :android :ios)
platform# (keyword status-im.utils.platform/os) platform# (keyword react-native.platform/os)
platform-specific# (get style# platform#)] platform-specific# (get style# platform#)]
(if platform-specific# (if platform-specific#
(merge common# platform-specific#) (merge common# platform-specific#)

View File

@ -1,3 +1,3 @@
(ns status-im.utils.styles (ns status-im.utils.styles
(:require-macros status-im.utils.styles) (:require-macros status-im.utils.styles)
(:require status-im.utils.platform)) (:require react-native.platform))

View File

@ -1,7 +1,7 @@
(ns status-im2.common.bottom-sheet.style (ns status-im2.common.bottom-sheet.style
(:require [quo2.foundations.colors :as colors] (:require [quo2.foundations.colors :as colors]
[quo2.theme :as theme] [quo2.theme :as theme]
[status-im.utils.platform :as platform])) [react-native.platform :as platform]))
(defn handle (defn handle
[theme] [theme]

View File

@ -3,13 +3,13 @@
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.data-store.settings :as data-store.settings] [status-im.data-store.settings :as data-store.settings]
[status-im.node.core :as node] [status-im.node.core :as node]
[status-im.utils.platform :as utils.platform]
[status-im2.config :as config] [status-im2.config :as config]
[status-im2.constants :as constants] [status-im2.constants :as constants]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[utils.security.core :as security] [utils.security.core :as security]
[utils.transforms :as transforms])) [utils.transforms :as transforms]
[react-native.platform :as platform]))
(rf/defn local-pairing-update-role (rf/defn local-pairing-update-role
{:events [:syncing/update-role]} {:events [:syncing/update-role]}
@ -60,7 +60,7 @@
{:receiverConfig {:kdfIterations config/default-kdf-iterations {:receiverConfig {:kdfIterations config/default-kdf-iterations
:nodeConfig final-node-config :nodeConfig final-node-config
:settingCurrentNetwork config/default-network :settingCurrentNetwork config/default-network
:deviceType utils.platform/os :deviceType platform/os
:deviceName :deviceName
(native-module/get-installation-name)}}))] (native-module/get-installation-name)}}))]
(rf/dispatch [:syncing/update-role constants/local-pairing-role-receiver]) (rf/dispatch [:syncing/update-role constants/local-pairing-role-receiver])
@ -87,7 +87,7 @@
(clj->js {:senderConfig {:keyUID key-uid (clj->js {:senderConfig {:keyUID key-uid
:keystorePath "" :keystorePath ""
:password sha3-pwd :password sha3-pwd
:deviceType utils.platform/os} :deviceType platform/os}
:serverConfig {:timeout 0}}))] :serverConfig {:timeout 0}}))]
(native-module/get-connection-string-for-bootstrapping-another-device (native-module/get-connection-string-for-bootstrapping-another-device
config-map config-map