Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable new architecture for android PR,Release builds only #20950

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,10 @@ run-re-frisk: ##@run Start re-frisk server
run-android: export TARGET := android
# Disabled for debug builds to avoid 'maximum call stack exceeded' errors.
# https://github.com/status-im/status-mobile/issues/18493
run-android: export ORG_GRADLE_PROJECT_hermesEnabled := false
run-android: export ORG_GRADLE_PROJECT_universalApk := false
run-android: export ORG_GRADLE_PROJECT_hermesEnabled := true
# enabling new architecture requires hermes to be enabled
run-android: export ORG_GRADLE_PROJECT_newArchEnabled := true
run-android: ##@run Build Android APK and start it on the device
@scripts/run-android.sh

Expand Down
5 changes: 3 additions & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ commitHash=unknown
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false
# enabling new architecture requires hermes to be enabled
newArchEnabled=true

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
# Disabled for debug builds to avoid 'maximum call stack exceeded' errors.
# https://github.com/status-im/status-mobile/issues/18493
hermesEnabled=false
hermesEnabled=true
4 changes: 4 additions & 0 deletions nix/mobile/android/build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# Disabled for debug builds to avoid 'maximum call stack exceeded' errors.
# https://github.com/status-im/status-mobile/issues/18493
hermesEnabled ? lib.getEnvWithDefault "ORG_GRADLE_PROJECT_hermesEnabled" "true",
# enabling new architecture requires hermes to be enabled
newArchEnabled ? lib.getEnvWithDefault "ORG_GRADLE_PROJECT_newArchEnabled" "true",
buildUrl ? lib.getEnvWithDefault "ORG_GRADLE_PROJECT_buildUrl" null,
statusGoSrcOverride ? lib.getEnvWithDefault "STATUS_GO_SRC_OVERRIDE" null,
reactMetroPort ? lib.getEnvWithDefault "RCT_METRO_PORT" 8081,
Expand Down Expand Up @@ -91,6 +93,8 @@ in stdenv.mkDerivation rec {
ORG_GRADLE_PROJECT_buildUrl = buildUrl;
ORG_GRADLE_PROJECT_hermesEnabled = hermesEnabled;
ORG_GRADLE_PROJECT_universalApk = universalApk;
# enabling new architecture requires hermes to be enabled
ORG_GRADLE_PROJECT_newArchEnabled = newArchEnabled;

# Fix for ERR_OSSL_EVP_UNSUPPORTED error.
NODE_OPTIONS = "--openssl-legacy-provider";
Expand Down
6 changes: 6 additions & 0 deletions react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
module.exports = {
project: {
android: {
// https://github.com/reactwg/react-native-new-architecture/discussions/135
unstable_reactLegacyComponentNames: ['BVLinearGradient', 'CKCameraManager', 'FastImageView'],
},
},
dependencies: {
'react-native-config': {
platforms: {
Expand Down
3 changes: 2 additions & 1 deletion src/quo/components/profile/profile_card/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
[]
[{:x 20
:y 108
:width (- width 40)
;; https://github.com/status-im/status-mobile/pull/20950#issuecomment-2351505926
:width (- (int width) 40)
:height 50
:borderRadius 16}])}
[rn/view
Expand Down
2 changes: 1 addition & 1 deletion src/quo/components/tags/token_tag/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
[rn/view {:on-layout on-layout}
[hole-view/hole-view
{:holes (if options
[{:x (- container-width
[{:x (- (int container-width)
(case size
:size-24 10
:size-32 12
Expand Down
2 changes: 1 addition & 1 deletion src/quo/components/wallet/approval_label/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{:holes [{:x 0
:y 0
:height style/top-hole-view-height
:width container-width
:width (int container-width)
:borderBottomStartRadius 16
:borderBottomEndRadius 16}]
:style {:margin-top (- style/top-hole-view-height)}
Expand Down
41 changes: 22 additions & 19 deletions src/quo/foundations/colors.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,32 @@
(defn alpha
[value opacity]
(when value
(if (string/starts-with? value "#")
(let [hex (string/replace value #"#" "")
r (js/parseInt (subs hex 0 2) 16)
g (js/parseInt (subs hex 2 4) 16)
b (js/parseInt (subs hex 4 6) 16)]
(str "rgba(" r "," g "," b "," opacity ")"))
(let [rgb (string/split value #",")]
(str (string/join "," (butlast rgb)) "," opacity ")")))))
;; https://github.com/status-im/status-mobile/pull/20950#issuecomment-2328228947
(let [opacity (if (zero? opacity) 0.002 opacity)]
(if (string/starts-with? value "#")
(let [hex (string/replace value #"#" "")
r (js/parseInt (subs hex 0 2) 16)
g (js/parseInt (subs hex 2 4) 16)
b (js/parseInt (subs hex 4 6) 16)]
(str "rgba(" r "," g "," b "," opacity ")"))
(let [rgb (string/split value #",")]
(str (string/join "," (butlast rgb)) "," opacity ")"))))))

(defn- alpha-opaque
[value opacity]
(when value
(if (string/starts-with? value "#")
(let [hex (string/replace value #"#" "")
r (- 255 (* opacity (- 255 (js/parseInt (subs hex 0 2) 16))))
g (- 255 (* opacity (- 255 (js/parseInt (subs hex 2 4) 16))))
b (- 255 (* opacity (- 255 (js/parseInt (subs hex 4 6) 16))))]
(str "rgb(" r "," g "," b ")"))
(let [rgb (string/split value #",")
r (- 255 (* opacity (- 255 (get rgb 0))))
g (- 255 (* opacity (- 255 (get rgb 1))))
b (- 255 (* opacity (- 255 (get rgb 2))))]
(str "rgb(" r "," g "," b ")")))))
(let [opacity (if (zero? opacity) 0.002 opacity)]
(if (string/starts-with? value "#")
(let [hex (string/replace value #"#" "")
r (- 255 (* opacity (- 255 (js/parseInt (subs hex 0 2) 16))))
g (- 255 (* opacity (- 255 (js/parseInt (subs hex 2 4) 16))))
b (- 255 (* opacity (- 255 (js/parseInt (subs hex 4 6) 16))))]
(str "rgb(" r "," g "," b ")"))
(let [rgb (string/split value #",")
r (- 255 (* opacity (- 255 (get rgb 0))))
g (- 255 (* opacity (- 255 (get rgb 1))))
b (- 255 (* opacity (- 255 (get rgb 2))))]
(str "rgb(" r "," g "," b ")"))))))

(def theme-alpha
(memoize
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/common/alert_banner/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
[]
[{:x 0
:y constants/alert-banner-height
:width (:width (rn/get-window))
:width (int (:width (rn/get-window)))
:height constants/alert-banner-height
:borderRadius style/border-radius}])}
[quo/text
Expand All @@ -54,7 +54,7 @@
{:style {:padding-bottom 0.5}
:holes [{:x 0
:y (+ safe-area-top (* constants/alert-banner-height banners-count))
:width (:width (rn/get-window))
:width (int (:width (rn/get-window)))
:height constants/alert-banner-height
:borderRadius style/border-radius}]}
[rn/view {:style {:background-color colors/neutral-100}}
Expand Down