diff --git a/src/status_im/common/parallax/blacklist.cljs b/src/status_im/common/parallax/blacklist.cljs new file mode 100644 index 0000000000..3e9a1da5ac --- /dev/null +++ b/src/status_im/common/parallax/blacklist.cljs @@ -0,0 +1,18 @@ +(ns status-im.common.parallax.blacklist + (:require + [native-module.core :as native-module])) + +(def ^:private device-id (:device-id (native-module/get-device-model-info))) + +(defn- get-model-code + [model] + (if-let [[_ code] (and model (re-find #"iPhone(\d+)" model))] + (js/parseInt code 10) + 0)) + +(def ^:private minimum-device-code 11) + +(def blacklisted? + (-> device-id + get-model-code + (< minimum-device-code))) diff --git a/src/status_im/common/parallax/whitelist.cljs b/src/status_im/common/parallax/whitelist.cljs deleted file mode 100644 index efa8ebac5d..0000000000 --- a/src/status_im/common/parallax/whitelist.cljs +++ /dev/null @@ -1,13 +0,0 @@ -(ns status-im.common.parallax.whitelist - (:require - [clojure.string :as string] - [native-module.core :as native-module])) - -(def ^:const device-id (:device-id (native-module/get-device-model-info))) - -;; iPhone 14 is 15 for some reason -(def ^:const whitelist #{"iPhone11" "iPhone12" "iPhone13" "iPhone14" "iPhone15"}) - -(def whitelisted? - (let [device-type (first (string/split (str device-id) ","))] - (whitelist device-type))) diff --git a/src/status_im/contexts/onboarding/enable_biometrics/view.cljs b/src/status_im/contexts/onboarding/enable_biometrics/view.cljs index d7fa5e669d..d1d8fddc32 100644 --- a/src/status_im/contexts/onboarding/enable_biometrics/view.cljs +++ b/src/status_im/contexts/onboarding/enable_biometrics/view.cljs @@ -4,8 +4,8 @@ [react-native.core :as rn] [react-native.safe-area :as safe-area] [status-im.common.biometric.events :as biometric] + [status-im.common.parallax.blacklist :as blacklist] [status-im.common.parallax.view :as parallax] - [status-im.common.parallax.whitelist :as whitelist] [status-im.common.resources :as resources] [status-im.contexts.onboarding.enable-biometrics.style :as style] [status-im.navigation.state :as state] @@ -71,9 +71,9 @@ (let [insets (safe-area/get-insets)] [rn/view {:style (style/page-container insets)} [page-title] - (if whitelist/whitelisted? - [enable-biometrics-parallax] - [enable-biometrics-simple]) + (if blacklist/blacklisted? + [enable-biometrics-simple] + [enable-biometrics-parallax]) [enable-biometrics-buttons insets]])) (defn view diff --git a/src/status_im/contexts/onboarding/enable_notifications/view.cljs b/src/status_im/contexts/onboarding/enable_notifications/view.cljs index 279c4bd5d6..f1452f3fc7 100644 --- a/src/status_im/contexts/onboarding/enable_notifications/view.cljs +++ b/src/status_im/contexts/onboarding/enable_notifications/view.cljs @@ -4,8 +4,8 @@ [react-native.core :as rn] [react-native.platform :as platform] [react-native.safe-area :as safe-area] + [status-im.common.parallax.blacklist :as blacklist] [status-im.common.parallax.view :as parallax] - [status-im.common.parallax.whitelist :as whitelist] [status-im.common.resources :as resources] [status-im.contexts.onboarding.enable-notifications.style :as style] [status-im.contexts.shell.jump-to.utils :as shell.utils] @@ -78,9 +78,9 @@ :icon-name :i/arrow-left :on-press #(rf/dispatch [:navigate-back-within-stack :enable-biometrics])}] [page-title]] - (if whitelist/whitelisted? - [enable-notifications-parallax] - [enable-notifications-simple]) + (if blacklist/blacklisted? + [enable-notifications-simple] + [enable-notifications-parallax]) [enable-notification-buttons {:insets insets}]])) (defn view diff --git a/src/status_im/contexts/onboarding/generating_keys/view.cljs b/src/status_im/contexts/onboarding/generating_keys/view.cljs index 91691a2d57..f15a96d680 100644 --- a/src/status_im/contexts/onboarding/generating_keys/view.cljs +++ b/src/status_im/contexts/onboarding/generating_keys/view.cljs @@ -4,8 +4,8 @@ [react-native.core :as rn] [react-native.reanimated :as reanimated] [react-native.safe-area :as safe-area] + [status-im.common.parallax.blacklist :as blacklist] [status-im.common.parallax.view :as parallax] - [status-im.common.parallax.whitelist :as whitelist] [status-im.common.resources :as resources] [status-im.contexts.onboarding.generating-keys.style :as style] [utils.i18n :as i18n])) @@ -149,9 +149,9 @@ [] (let [insets (safe-area/get-insets)] [rn/view {:style (style/page-container insets)} - (if whitelist/whitelisted? - [parallax-page insets] - [:f> f-simple-page insets])])) + (if blacklist/blacklisted? + [:f> f-simple-page insets] + [parallax-page insets])])) (defn generating-keys []