diff --git a/.gitignore b/.gitignore index ad4dd9f005d..e4c7e47f89c 100644 --- a/.gitignore +++ b/.gitignore @@ -194,3 +194,6 @@ test/appium/tests/users.py ## git hooks lefthook.yml + +## metro server logs +metro-server-logs.log diff --git a/Makefile b/Makefile index 03654c49c20..11a8d1de954 100644 --- a/Makefile +++ b/Makefile @@ -214,7 +214,7 @@ build-fdroid: ##@build Build release for F-Droid build-android: export BUILD_ENV ?= prod build-android: export BUILD_TYPE ?= nightly -build-android: export BUILD_NUMBER ?= $(TMP_BUILD_NUMBER) +build-android: export ORG_GRADLE_PROJECT_versionCode ?= $(TMP_BUILD_NUMBER) build-android: export ANDROID_ABI_SPLIT ?= false build-android: export ANDROID_ABI_INCLUDE ?= armeabi-v7a;arm64-v8a;x86 build-android: ##@build Build unsigned Android APK @@ -267,7 +267,7 @@ run-clojure: ##@run Watch for and build Clojure changes for mobile run-metro: export TARGET := clojure run-metro: ##@run Start Metro to build React Native changes - @scripts/start-react-native.sh + @scripts/run-metro.sh run-re-frisk: export TARGET := clojure run-re-frisk: ##@run Start re-frisk server @@ -278,22 +278,15 @@ 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 -# INFO: If it's empty (no devices attached, parsing issues, script error) - for Nix it's the same as not set. -run-android: export ANDROID_ABI_INCLUDE ?= $(shell ./scripts/adb_devices_abis.sh) run-android: ##@run Build Android APK and start it on the device - npx react-native run-android --appIdSuffix debug + @scripts/run-android.sh SIMULATOR=iPhone 13 # TODO: fix IOS_STATUS_GO_TARGETS to be either amd64 or arm64 when RN is upgraded run-ios: export TARGET := ios run-ios: export IOS_STATUS_GO_TARGETS := ios/arm64;iossimulator/amd64 -run-ios: export XCBeautify=$(shell which xcbeautify) # for react-native-cli to pick this up and to auto format output -run-ios: ##@run Build iOS app and start it in a simulator/device -ifneq ("$(SIMULATOR)", "") - npx react-native run-ios --simulator="$(SIMULATOR)" -else - npx react-native run-ios -endif +run-ios: ##@run Build iOS app and start it in on the simulator + @scripts/run-ios.sh "${SIMULATOR}" show-ios-devices: ##@other shows connected ios device and its name xcrun xctrace list devices diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index c4a72bd47c9..9385128c5a3 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.5' +library 'status-jenkins-lib@v1.8.7' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() diff --git a/ci/Jenkinsfile.combined b/ci/Jenkinsfile.combined index 02eb9e1b834..c2a2f72d246 100644 --- a/ci/Jenkinsfile.combined +++ b/ci/Jenkinsfile.combined @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.5' +library 'status-jenkins-lib@v1.8.7' pipeline { agent { label 'linux' } diff --git a/ci/Jenkinsfile.e2e-nightly b/ci/Jenkinsfile.e2e-nightly index 7495d9eee57..14c8f27b360 100644 --- a/ci/Jenkinsfile.e2e-nightly +++ b/ci/Jenkinsfile.e2e-nightly @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.5' +library 'status-jenkins-lib@v1.8.7' pipeline { agent { label 'linux' } diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index 84305e791c4..fd18541eb85 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.5' +library 'status-jenkins-lib@v1.8.7' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() diff --git a/ci/Jenkinsfile.tests b/ci/Jenkinsfile.tests index 02a0825e6c2..d41585373b6 100644 --- a/ci/Jenkinsfile.tests +++ b/ci/Jenkinsfile.tests @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.5' +library 'status-jenkins-lib@v1.8.7' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() diff --git a/ci/tests/Jenkinsfile.e2e-nightly b/ci/tests/Jenkinsfile.e2e-nightly index 439135c4f64..071ca89df19 100644 --- a/ci/tests/Jenkinsfile.e2e-nightly +++ b/ci/tests/Jenkinsfile.e2e-nightly @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.5' +library 'status-jenkins-lib@v1.8.7' pipeline { diff --git a/ci/tests/Jenkinsfile.e2e-prs b/ci/tests/Jenkinsfile.e2e-prs index a472efe55e3..6ecbcc7c680 100644 --- a/ci/tests/Jenkinsfile.e2e-prs +++ b/ci/tests/Jenkinsfile.e2e-prs @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.5' +library 'status-jenkins-lib@v1.8.7' pipeline { diff --git a/ci/tests/Jenkinsfile.e2e-upgrade b/ci/tests/Jenkinsfile.e2e-upgrade index 51b3b5c6b49..aea81c25190 100644 --- a/ci/tests/Jenkinsfile.e2e-upgrade +++ b/ci/tests/Jenkinsfile.e2e-upgrade @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.5' +library 'status-jenkins-lib@v1.8.7' pipeline { diff --git a/ci/tools/Jenkinsfile.fastlane-clean b/ci/tools/Jenkinsfile.fastlane-clean index 6b4c1dda351..e2b23ddd3a7 100644 --- a/ci/tools/Jenkinsfile.fastlane-clean +++ b/ci/tools/Jenkinsfile.fastlane-clean @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.5' +library 'status-jenkins-lib@v1.8.7' pipeline { agent { label 'macos' } diff --git a/ci/tools/Jenkinsfile.nix-cache b/ci/tools/Jenkinsfile.nix-cache index e4db22adf32..fbb4bc6be49 100644 --- a/ci/tools/Jenkinsfile.nix-cache +++ b/ci/tools/Jenkinsfile.nix-cache @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.5' +library 'status-jenkins-lib@v1.8.7' pipeline { agent { label params.AGENT_LABEL } @@ -82,7 +82,7 @@ pipeline { env.NIXPKGS_SYSTEM_OVERRIDE = nixSysOverride(os, arch, 'android') /* Build/fetch deps required to build android release. */ nix.build( - attr: 'targets.mobile.android.release.buildInputs', + attr: 'targets.mobile.android.build.buildInputs', sandbox: false, pure: false, link: false diff --git a/ci/tools/Jenkinsfile.playstore-meta b/ci/tools/Jenkinsfile.playstore-meta index 80e0e0f49fa..be389599f54 100644 --- a/ci/tools/Jenkinsfile.playstore-meta +++ b/ci/tools/Jenkinsfile.playstore-meta @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.5' +library 'status-jenkins-lib@v1.8.7' pipeline { agent { label 'linux' } diff --git a/ci/tools/Jenkinsfile.xcode-clean b/ci/tools/Jenkinsfile.xcode-clean index 52f6d58c6a6..3a6c32e7eec 100644 --- a/ci/tools/Jenkinsfile.xcode-clean +++ b/ci/tools/Jenkinsfile.xcode-clean @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.5' +library 'status-jenkins-lib@v1.8.7' pipeline { agent { diff --git a/doc/ide-setup.md b/doc/ide-setup.md index d1085018b5f..aa400509d7c 100644 --- a/doc/ide-setup.md +++ b/doc/ide-setup.md @@ -122,10 +122,9 @@ See below: Do the following: -Ensure you have 3 terminals running the following +Ensure you have 2 terminals running the following - `make run-clojure` -- `make run-metro` - `make run-ios` / `make run-android` [See the STARTING GUIDE for details](STARTING_GUIDE.md#development) diff --git a/doc/starting-guide.md b/doc/starting-guide.md index 9f8e55721b5..0d1fff25140 100644 --- a/doc/starting-guide.md +++ b/doc/starting-guide.md @@ -15,8 +15,7 @@ This step will take a while the first time as it will download all dependencies. There are three steps necessary to start development, in this case for Android: 1. `make run-clojure` - Compiles Clojure into JavaScript, watches for changes on cljs files, and hot-reloads code in the app. -2. `make run-metro` - Starts metro bundler and watches JavaScript code. -3. `make run-android` or `make run-ios` - Builds the Android/iOS app and starts it on the device. +2. `make run-android` or `make run-ios` - Builds the Android/iOS app, starts it on the device and starts metro bundler. The first two will continue watching for changes and keep re-building the app. They need to be ready first. The last one will exit once the app is up and ready. diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 486b75e8554..f539dec0ed2 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -793,7 +793,7 @@ CHECKOUT OPTIONS: :submodules: true SPEC CHECKSUMS: - boost: 57d2868c099736d80fcd648bf211b4431e51a558 + boost: 64032b9e9b938fda23325e68a3771f0fabf414dc BVLinearGradient: 612a04ff38e8480291f3379ee5b5a2c571f03fe0 CryptoSwift: c4f2debceb38bf44c80659afe009f71e23e4a082 DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 diff --git a/nix/DETAILS.md b/nix/DETAILS.md index 79ff45535ce..b295bf97f54 100644 --- a/nix/DETAILS.md +++ b/nix/DETAILS.md @@ -61,7 +61,7 @@ We will use the `make jsbundle` target as an example of a derivation you can bui 3. [`build.sh`](/nix/scripts/build.sh) calls `nix-build --attr targets.mobile.jsbundle` with extra arguments 4. `nix-build` builds the derivation from [`nix/mobile/jsbundle/default.nix`](/nix/mobile/jsbundle/default.nix) -The same can be done for other targets like `targets.mobile.android.release`. +The same can be done for other targets like `targets.mobile.android.build`. Except in that case extra arguments are required which is why the [`scripts/release-android.sh`](/scripts/release-android.sh) is used in the `make release-android` target. If you run `make release-android` you'll see the `nix-build` command used: @@ -71,14 +71,14 @@ nix-build \ --fallback \ --no-out-link \ --show-trace \ - --attr targets.mobile.android.release \ + --attr targets.mobile.android.build \ --argstr secrets-file '/tmp/tmp-status-mobile-559a3a441/tmp.xAnrPuNtAP' \ --option extra-sandbox-paths '/home/joe/.gradle/status-im.keystore /tmp/tmp-status-mobile-559a3a441/tmp.xAnrPuNtAP' \ default.nix ``` Some of those are required which is why just calling: ``` -nix-build --attr targets.mobile.android.release +nix-build --attr targets.mobile.android.build ``` Would fail. diff --git a/nix/README.md b/nix/README.md index cbcd376136d..86057e71886 100644 --- a/nix/README.md +++ b/nix/README.md @@ -28,7 +28,7 @@ export STATUS_GO_IPFS_GATEWAY_URL="https://ipfs.status.im/" ``` You can see the defaults in code: - [`nix/status-go/default.nix`](./status-go/default.nix) -- [`nix/mobile/android/release.nix`](./mobile/android/release.nix) +- [`nix/mobile/android/release.nix`](./mobile/android/build.nix) ## Shell diff --git a/nix/deps/gradle/README.md b/nix/deps/gradle/README.md index 138c524de9b..4d8a47ec8d8 100644 --- a/nix/deps/gradle/README.md +++ b/nix/deps/gradle/README.md @@ -6,7 +6,7 @@ This directory contains the tools and the data that allows Nix to manage Gradle Simply calling `generate.sh` should result in a `deps.json` file which is used in the derivation that provides Gradle dependencies when building the Android app. -You can see in [`nix/mobile/android/release.nix`](../../mobile/android/release.nix) that it's used via the `-Dmaven.repo.local='${deps.gradle}'` Gradle flag. +You can see in [`nix/mobile/android/release.nix`](../../mobile/android/build.nix) that it's used via the `-Dmaven.repo.local='${deps.gradle}'` Gradle flag. # Files diff --git a/nix/mobile/android/release.nix b/nix/mobile/android/build.nix similarity index 87% rename from nix/mobile/android/release.nix rename to nix/mobile/android/build.nix index 160e548562a..a11dba4509a 100644 --- a/nix/mobile/android/release.nix +++ b/nix/mobile/android/build.nix @@ -7,15 +7,15 @@ # Path to the file containing secret environment variables secretsFile ? "", # Build type (influences which .env file gets used for feature flags) - # TODO: pr or relase for default? buildType ? lib.getEnvWithDefault "BUILD_TYPE" "release", # Used for versionCode - buildNumber ? lib.getEnvWithDefault "BUILD_NUMBER" 9999, + versionCode ? lib.getEnvWithDefault "ORG_GRADLE_PROJECT_versionCode" 9999, # Included in APK Manifest for easier identification. - # TODO: or GIT_COMMIT from Jenkins? - commitHash ? lib.getEnvWithDefault "COMMIT_HASH" "unknown", - # Gradle options passed for Android builds - androidGradleOpts ? lib.getEnvWithDefault "ANDROID_GRADLE_OPTS" null, + commitHash ? lib.getEnvWithDefault "ORG_GRADLE_PROJECT_commitHash" "unknown", + # 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", + buildUrl ? lib.getEnvWithDefault "ORG_GRADLE_PROJECT_buildUrl" null, statusGoSrcOverride ? lib.getEnvWithDefault "STATUS_GO_SRC_OVERRIDE" null, # If APKs should be split based on architectures androidAbiSplit ? lib.getEnvWithDefault "ANDROID_ABI_SPLIT" "false", @@ -40,8 +40,10 @@ let else if (elem buildType ["pr" "manual"]) then ".env.jenkins" else ".env"; - # There are only two types of Gradle build targets: pr and release - gradleBuildType = if buildType == "pr" then "Pr" else "Release"; + gradleBuildType = + if buildType == "pr" then "Pr" + else if buildType == "debug" then "Debug" + else "Release"; apksPath = "./android/app/build/outputs/apk/${toLower gradleBuildType}"; @@ -81,7 +83,10 @@ in stdenv.mkDerivation rec { ANDROID_ABI_INCLUDE = androidAbiInclude; # Disabled for debug builds to avoid 'maximum call stack exceeded' errors. # https://github.com/status-im/status-mobile/issues/18493 - ORG_GRADLE_PROJECT_hermesEnabled = true; + ORG_GRADLE_PROJECT_versionCode = versionCode; + ORG_GRADLE_PROJECT_commitHash = commitHash; + ORG_GRADLE_PROJECT_buildUrl = buildUrl; + ORG_GRADLE_PROJECT_hermesEnabled = hermesEnabled; # Fix for ERR_OSSL_EVP_UNSUPPORTED error. NODE_OPTIONS = "--openssl-legacy-provider"; @@ -116,8 +121,6 @@ in stdenv.mkDerivation rec { # Symlink React Native entrypoint. cp -Lr ${builtJsBundle} ./result - pwd - find -L result # Copy android/ directory mkdir -p ./android/build @@ -144,7 +147,6 @@ in stdenv.mkDerivation rec { "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${makeLibraryPath [ pkgs.zlib ]}"; gradleCommand = '' ${pkgs.gradle}/bin/gradle \ - ${toString androidGradleOpts} \ --console=plain \ --offline \ --no-daemon \ @@ -152,8 +154,6 @@ in stdenv.mkDerivation rec { --no-watch-fs \ --no-build-cache \ -Dmaven.repo.local='${deps.gradle}' \ - -PversionCode=${toString buildNumber} \ - -PcommitHash=${commitHash} \ assemble${gradleBuildType} ''; in @@ -171,12 +171,14 @@ in stdenv.mkDerivation rec { ${adhocEnvVars} ${gradleCommand} popd > /dev/null ''; - doCheck = true; - checkPhase = '' + + doCheck = buildType != "debug"; + checkPhase = '' ls ${apksPath}/*.apk \ | xargs -n1 ${pkgs.unzip}/bin/unzip -qql \ | grep 'index.android.bundle' ''; + installPhase = '' mkdir -p $out cp ${apksPath}/*.apk $out/ diff --git a/nix/mobile/android/default.nix b/nix/mobile/android/default.nix index 69fe75016b9..371d53859d8 100644 --- a/nix/mobile/android/default.nix +++ b/nix/mobile/android/default.nix @@ -2,7 +2,7 @@ , jsbundle, status-go, androidPkgs, androidShell }: rec { - release = callPackage ./release.nix { + build = callPackage ./build.nix { inherit jsbundle status-go; }; @@ -15,7 +15,7 @@ rec { ]; inputsFrom = [ - (release {}) + (build {}) androidShell ]; diff --git a/nix/scripts/build.sh b/nix/scripts/build.sh index d9dd8f656ad..d7ad408abbe 100755 --- a/nix/scripts/build.sh +++ b/nix/scripts/build.sh @@ -45,7 +45,7 @@ if [[ -z "${TARGET}" ]]; then fi # Hack fix for missing Android SDK for aarch64 on Darwin. See systemOverride in `nix/pkgs.nix`. -if [[ "${TARGET}" =~ ^(targets.status-go.mobile.android|targets.mobile.android.release)$ ]]; then +if [[ "${TARGET}" =~ ^(targets.status-go.mobile.android|targets.mobile.android.build)$ ]]; then os=$(uname -s | tr '[:upper:]' '[:lower:]') export NIXPKGS_SYSTEM_OVERRIDE="x86_64-${os}" fi diff --git a/scripts/build-android.sh b/scripts/build-android.sh index fdba77923d9..eeb3a8e5731 100755 --- a/scripts/build-android.sh +++ b/scripts/build-android.sh @@ -21,8 +21,6 @@ function append_env_export() { VAR_VALUE=$(must_get_env "${VAR_NAME}") echo "export ${VAR_NAME}=\"${VAR_VALUE}\";" >> "${SECRETS_FILE_PATH}" } - -export COMMIT_HASH="$(git rev-parse --verify HEAD)" nixOpts=() # We create if now so the trap knows its location @@ -73,4 +71,4 @@ else fi -"${GIT_ROOT}/nix/scripts/build.sh" targets.mobile.android.release "${nixOpts[@]}" +"${GIT_ROOT}/nix/scripts/build.sh" targets.mobile.android.build "${nixOpts[@]}" diff --git a/scripts/run-android.sh b/scripts/run-android.sh new file mode 100755 index 00000000000..8f4c11aa84a --- /dev/null +++ b/scripts/run-android.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +set -euo pipefail +set -m # needed to access jobs + +GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel) + +# We run Metro in background while calling adb. +cleanupMetro() { + pkill -f run-metro.sh + rm -f metro-server-logs.log +} + +# Using function gives a neater jobspec name. +runMetro() { + nohup "${GIT_ROOT}/scripts/run-metro.sh" 2>&1 \ + | tee metro-server-logs.log +} + +waitForMetro() { + set +e # Allow grep command to fail in the loop. + TIMEOUT=5 + echo "Waiting for Metro server..." >&2 + while ! grep -q "Welcome to Metro" metro-server-logs.log; do + echo -n "." >&2 + sleep 1 + if ((TIMEOUT == 0)); then + echo -e "\nMetro server timed out, exiting" >&2 + set -e # Restore errexit for rest of script. + return 1 + fi + ((TIMEOUT--)) + done + set -e # Restore errexit for rest of script. +} + +# Generate android debug build. +export ANDROID_ABI_INCLUDE=$("${GIT_ROOT}/scripts/adb_devices_abis.sh") +export BUILD_ENV=debug +export BUILD_TYPE=debug +"${GIT_ROOT}/scripts/build-android.sh" + +# Install the APK on running emulator or android device. +adb install ./result/app-debug.apk + +trap cleanupMetro EXIT ERR INT QUIT +runMetro & +waitForMetro + +# Start the installed app. +adb shell monkey -p im.status.ethereum.debug 1 + +# bring metro job to foreground +fg 'runMetro' diff --git a/scripts/run-ios.sh b/scripts/run-ios.sh new file mode 100755 index 00000000000..f9f94c661b5 --- /dev/null +++ b/scripts/run-ios.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash +set -euo pipefail +set -m # needed to access jobs + +GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel) + +# We run Metro in background while calling adb. +cleanupMetro() { + pkill -f run-metro.sh + rm -f metro-server-logs.log +} + +# Using function gives a neater jobspec name. +runMetro() { + nohup "${GIT_ROOT}/scripts/run-metro.sh" 2>&1 \ + | tee metro-server-logs.log +} + +waitForMetro() { + set +e # Allow grep command to fail in the loop. + TIMEOUT=5 + echo "Waiting for Metro server..." >&2 + while ! grep -q "Welcome to Metro" metro-server-logs.log; do + echo -n "." >&2 + sleep 1 + if ((TIMEOUT == 0)); then + echo -e "\nMetro server timed out, exiting" >&2 + set -e # Restore errexit for rest of script. + return 1 + fi + ((TIMEOUT--)) + done + set -e # Restore errexit for rest of script. +} + +# Check if the first argument is provided +if [ -z "${1-}" ]; then + echo "Error: No simulator name provided." >&2 + exit 1 +fi + +SIMULATOR=${1} + +# get our desired UUID +UUID=$(xcrun simctl list devices | grep -E "$SIMULATOR \(" | head -n 1 | awk -F '[()]' '{print $2}') + +# get simulator status +SIMULATOR_STATE=$(xcrun simctl list devices | grep -E "$SIMULATOR \(" | head -n 1 | awk '{print $NF}') + +# sometimes a simulator is already running, shut it down to avoid errors +if [ "$SIMULATOR_STATE" != "(Shutdown)" ]; then + xcrun simctl shutdown "$UUID" +fi + +# boot up iOS for simulator +xcrun simctl boot "$UUID" + +# start the simulator +open -a Simulator --args -CurrentDeviceUDID "$UUID" + +BUILD_DIR="${GIT_ROOT}/build" + +#iOS build of debug scheme +xcodebuild -workspace "ios/StatusIm.xcworkspace" -configuration Debug -scheme StatusIm -destination id="$UUID" -derivedDataPath "${BUILD_DIR}" | xcbeautify + +APP_PATH="${BUILD_DIR}/Build/Products/Debug-iphonesimulator/StatusIm.app" + +# Install on the simulator +xcrun simctl install "$UUID" "$APP_PATH" + +trap cleanupMetro EXIT ERR INT QUIT +runMetro & +waitForMetro + +# launch the app when metro is ready +xcrun simctl launch "$UUID" im.status.ethereum.debug + +# bring metro job to foreground +fg 'runMetro' diff --git a/scripts/run-metro.sh b/scripts/run-metro.sh new file mode 100755 index 00000000000..37741881c60 --- /dev/null +++ b/scripts/run-metro.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +pkill -f 'react-native start' + +react-native start --reset-cache diff --git a/scripts/start-react-native.sh b/scripts/start-react-native.sh deleted file mode 100755 index f137844bbbb..00000000000 --- a/scripts/start-react-native.sh +++ /dev/null @@ -1,17 +0,0 @@ - -#!/usr/bin/env bash - -GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel) -source "${GIT_ROOT}/scripts/colors.sh" - -METRO_PORT=8081 -METRO_PID="$(lsof -i :${METRO_PORT} | awk 'NR!=1 {print $2}' | sort -u | tr '\r\n' ' ')" -if [ ! -z "$METRO_PID" ]; then - echo -e "${YLW}TCP port ${METRO_PORT} is required by the Metro packager.\nThe following processes currently have the port open, preventing Metro from starting:${RST}" - ps -fp $METRO_PID - echo -e "${YLW}Do you want to terminate them (y/n)?${RST}" - read -n 1 term - [[ $term == 'y' ]] && kill $METRO_PID -fi - -react-native start --reset-cache diff --git a/src/quo/components/dividers/strength_divider/style.cljs b/src/quo/components/dividers/strength_divider/style.cljs index e59381a0b59..c328006c8ec 100644 --- a/src/quo/components/dividers/strength_divider/style.cljs +++ b/src/quo/components/dividers/strength_divider/style.cljs @@ -3,7 +3,7 @@ (def container {:height 40 :flex-direction :row - :padding-horizontal 20 + :padding-horizontal 16 :align-items :center}) (defn text diff --git a/src/quo/components/dividers/strength_divider/view.cljs b/src/quo/components/dividers/strength_divider/view.cljs index b98d93ccdd7..f18c1fccf62 100644 --- a/src/quo/components/dividers/strength_divider/view.cljs +++ b/src/quo/components/dividers/strength_divider/view.cljs @@ -30,7 +30,7 @@ (defn circular-progress [{:keys [color percentage]}] - (let [strength-indicator-radius 6.5 + (let [strength-indicator-radius 7.5 strength-indicator-circumference (* 2 Math/PI strength-indicator-radius)] [svg/svg {:view-box "0 0 16 16" @@ -63,7 +63,10 @@ :alert [icon/icon :i/alert {:color color :size 16}] - [circular-progress {:color color :percentage percentage}]))) + [rn/view + {:padding-left 4 + :padding-right 2} + [circular-progress {:color color :percentage percentage}]]))) (defn view "Options diff --git a/src/status_im/contexts/communities/actions/addresses_for_permissions/view.cljs b/src/status_im/contexts/communities/actions/addresses_for_permissions/view.cljs index bd2d4da638d..26e7b794628 100644 --- a/src/status_im/contexts/communities/actions/addresses_for_permissions/view.cljs +++ b/src/status_im/contexts/communities/actions/addresses_for_permissions/view.cljs @@ -27,17 +27,17 @@ :collectible-img-src (resources/get-mock-image :collectible)) (= type constants/community-token-type-erc20) - (assoc :amount (str (money/with-precision (money/token->unit amount decimals) 3)) + (assoc :amount (str (money/token->unit amount decimals)) :token (:symbol balance))))) (defn- account-item - [{:keys [customization-color address name emoji]} _ _ [selected-addresses community-id]] + [{:keys [color address name emoji]} _ _ [selected-addresses community-id]] (let [balances (rf/sub [:communities/permissioned-balances-by-address community-id address])] [quo/account-permissions {:account {:name name :address address :emoji emoji - :customization-color customization-color} + :customization-color color} :token-details (balances->components-props balances) :checked? (contains? selected-addresses address) :on-change #(rf/dispatch [:communities/toggle-selected-permission-address @@ -51,7 +51,7 @@ (fn [] (let [{:keys [name color images]} (rf/sub [:communities/community id]) {:keys [highest-permission-role]} (rf/sub [:community/token-gated-overview id]) - accounts (rf/sub [:wallet/accounts-with-customization-color]) + accounts (rf/sub [:wallet/accounts-without-watched-accounts]) selected-addresses (rf/sub [:communities/selected-permission-addresses id]) highest-role-text (when highest-permission-role (i18n/label (communities.utils/role->translation-key diff --git a/src/status_im/contexts/communities/actions/token_gating/view.cljs b/src/status_im/contexts/communities/actions/token_gating/view.cljs index 5d237930dad..a18407409d7 100644 --- a/src/status_im/contexts/communities/actions/token_gating/view.cljs +++ b/src/status_im/contexts/communities/actions/token_gating/view.cljs @@ -8,8 +8,7 @@ (defn token-requirements [] (fn [id] - (let [{:keys [can-request-access? - number-of-hold-tokens tokens]} (rf/sub [:community/token-gated-overview id])] + (let [{:keys [can-request-access? tokens]} (rf/sub [:community/token-gated-overview id])] [rn/view {:style {:padding-horizontal 12}} [quo/text {:weight :medium} (if can-request-access? @@ -17,7 +16,6 @@ (i18n/label :t/you-not-eligible-to-join))] [quo/text {:style {:padding-bottom 18} :size :paragraph-2} (if can-request-access? - (i18n/label :t/you-hold-number-of-hold-tokens-of-these - {:number-of-hold-tokens number-of-hold-tokens}) + (i18n/label :t/you-hodl) (i18n/label :t/you-must-hold))] [quo/token-requirement-list {:tokens tokens}]]))) diff --git a/src/status_im/contexts/onboarding/create_password/style.cljs b/src/status_im/contexts/onboarding/create_password/style.cljs index 98dd4bf864c..5d7fe1afd5e 100644 --- a/src/status_im/contexts/onboarding/create_password/style.cljs +++ b/src/status_im/contexts/onboarding/create_password/style.cljs @@ -8,30 +8,8 @@ (def heading-subtitle {:color colors/white}) (def heading-title (assoc heading-subtitle :margin-bottom 8)) -(def label-container - {:margin-top 8 - :flex-direction :row - :align-items :center - :height 16}) - -(def label-icon - {:width 16 - :height 18 - :margin-right 4}) - -(defn label-icon-color - [status] - (get {:neutral colors/neutral-40 - :success colors/success-60 - :danger colors/danger-60} - status)) - -(defn label-color - [status] - (let [colors {:neutral colors/white-opa-70 - :success colors/success-60 - :danger colors/danger-60}] - {:color (get colors status)})) +(def info-message + {:margin-top 8}) (def space-between-inputs {:height 16}) diff --git a/src/status_im/contexts/onboarding/create_password/view.cljs b/src/status_im/contexts/onboarding/create_password/view.cljs index 7a2df8afefc..1c67b242416 100644 --- a/src/status_im/contexts/onboarding/create_password/view.cljs +++ b/src/status_im/contexts/onboarding/create_password/view.cljs @@ -2,6 +2,7 @@ (:require [oops.core :refer [ocall]] [quo.core :as quo] + [quo.foundations.colors :as colors] [react-native.core :as rn] [react-native.safe-area :as safe-area] [reagent.core :as reagent] @@ -33,24 +34,25 @@ (dissoc :hint) (assoc :type :password :blur? true))] - [rn/view {:style style/label-container} + [rn/view {:style style/info-message} (when shown - [:<> - [quo/icon (if (= status :success) :i/check-circle :i/info) - {:container-style style/label-icon - :color (style/label-icon-color status) - :size 16}] - [quo/text - {:style (style/label-color status) - :size :paragraph-2} - text]])]]) + [quo/info-message + {:type status + :size :default + :icon (if (= status :success) :i/positive-state :i/info) + :text-color (when (= status :default) + colors/white-70-blur) + :icon-color (when (= status :default) + colors/white-70-blur) + :style {}} + text])]]) (defn password-inputs [{:keys [passwords-match? on-change-password on-change-repeat-password on-input-focus password-long-enough? empty-password? show-password-validation? on-blur-repeat-password]}] - (let [hint-1-status (if password-long-enough? :success :neutral) - hint-2-status (if passwords-match? :success :danger) + (let [hint-1-status (if password-long-enough? :success :default) + hint-2-status (if passwords-match? :success :error) hint-2-text (if passwords-match? (i18n/label :t/password-creation-match) (i18n/label :t/password-creation-dont-match)) diff --git a/src/status_im/contexts/wallet/events.cljs b/src/status_im/contexts/wallet/events.cljs index c755e3991a3..634fc5f45d5 100644 --- a/src/status_im/contexts/wallet/events.cljs +++ b/src/status_im/contexts/wallet/events.cljs @@ -148,12 +148,12 @@ (rf/defn scan-address-success {:events [:wallet/scan-address-success]} [{:keys [db]} address] - {:db (assoc db :wallet/scanned-address address)}) + {:db (assoc-in db [:wallet :ui :scanned-address] address)}) (rf/defn clean-scanned-address {:events [:wallet/clean-scanned-address]} [{:keys [db]}] - {:db (dissoc db :wallet/scanned-address :wallet/send-address)}) + {:db (update-in db [:wallet :ui] dissoc :scanned-address)}) (rf/reg-event-fx :wallet/create-derived-addresses (fn [{:keys [db]} [{:keys [sha3-pwd path]} on-success]] diff --git a/src/status_im/contexts/wallet/events_test.cljs b/src/status_im/contexts/wallet/events_test.cljs index 32e2b7edd2d..1813f58a4c0 100644 --- a/src/status_im/contexts/wallet/events_test.cljs +++ b/src/status_im/contexts/wallet/events_test.cljs @@ -10,15 +10,16 @@ (deftest scan-address-success (let [db {}] (testing "scan-address-success" - (let [expected-db {:wallet/scanned-address address} + (let [expected-db {:wallet {:ui {:scanned-address address}}} effects (events/scan-address-success {:db db} address) result-db (:db effects)] (is (match? result-db expected-db)))))) (deftest clean-scanned-address - (let [db {:wallet/scanned-address address}] + (let [db {:wallet {:ui {:scanned-address address}}}] (testing "clean-scanned-address" - (let [expected-db {:wallet {:ui {:send nil}}} + (let [expected-db {:wallet {:ui {:send nil + :scanned-address nil}}} effects (events/clean-scanned-address {:db db}) result-db (:db effects)] (is (match? result-db expected-db)))))) diff --git a/src/status_im/subs/communities.cljs b/src/status_im/subs/communities.cljs index 97140c05594..cb8112dbc89 100644 --- a/src/status_im/subs/communities.cljs +++ b/src/status_im/subs/communities.cljs @@ -370,7 +370,7 @@ (re-frame/reg-sub :communities/selected-permission-accounts (fn [[_ community-id]] - [(re-frame/subscribe [:wallet/accounts-with-customization-color]) + [(re-frame/subscribe [:wallet/accounts-without-watched-accounts]) (re-frame/subscribe [:communities/selected-permission-addresses community-id])]) (fn [[accounts selected-permission-addresses]] (filter #(contains? selected-permission-addresses (:address %)) accounts))) diff --git a/src/status_im/subs/root.cljs b/src/status_im/subs/root.cljs index a5ec336f62c..4198c0772b2 100644 --- a/src/status_im/subs/root.cljs +++ b/src/status_im/subs/root.cljs @@ -156,8 +156,6 @@ ;;wallet (reg-root-key-sub :wallet :wallet) -(reg-root-key-sub :wallet/scanned-address :wallet/scanned-address) -(reg-root-key-sub :wallet/create-account :wallet/create-account) (reg-root-key-sub :wallet/local-suggestions :wallet/local-suggestions) (reg-root-key-sub :wallet/valid-ens-or-address? :wallet/valid-ens-or-address?) diff --git a/src/status_im/subs/wallet/wallet.cljs b/src/status_im/subs/wallet/wallet.cljs index 53f70d18149..c65daec6b05 100644 --- a/src/status_im/subs/wallet/wallet.cljs +++ b/src/status_im/subs/wallet/wallet.cljs @@ -28,6 +28,11 @@ :<- [:wallet] :-> :ui) +(rf/reg-sub + :wallet/scanned-address + :<- [:wallet/ui] + :-> :scanned-address) + (rf/reg-sub :wallet/tokens-loading? :<- [:wallet/ui] @@ -185,7 +190,7 @@ (rf/reg-sub :wallet/accounts-without-watched-accounts - :<- [:wallet/accounts] + :<- [:wallet/accounts-with-customization-color] (fn [accounts] (remove #(:watch-only? %) accounts))) diff --git a/src/status_im/subs/wallet/wallet_test.cljs b/src/status_im/subs/wallet/wallet_test.cljs index 14e17cc0755..8b4c19d964a 100644 --- a/src/status_im/subs/wallet/wallet_test.cljs +++ b/src/status_im/subs/wallet/wallet_test.cljs @@ -367,52 +367,55 @@ (assoc-in [:wallet :accounts] accounts) (assoc-in [:wallet :networks] network-data))) (is - (= (list - {:path "m/44'/60'/0'/0/0" - :emoji "😃" - :key-uid "0x2f5ea39" - :address "0x1" - :wallet false - :name "Account One" - :type :generated - :watch-only? false - :chat false - :test-preferred-chain-ids #{5 420 421613} - :color :blue - :hidden false - :prod-preferred-chain-ids #{1 10 42161} - :network-preferences-names #{:ethereum :arbitrum :optimism} - :position 0 - :clock 1698945829328 - :created-at 1698928839000 - :operable "fully" - :mixedcase-address "0x7bcDfc75c431" - :public-key "0x04371e2d9d66b82f056bc128064" - :removed false - :tokens tokens-0x1} - {:path "m/44'/60'/0'/0/1" - :emoji "💎" - :key-uid "0x2f5ea39" - :address "0x2" - :wallet false - :name "Account Two" - :type :generated - :watch-only? false - :chat false - :test-preferred-chain-ids #{5 420 421613} - :color :purple - :hidden false - :prod-preferred-chain-ids #{1 10 42161} - :network-preferences-names #{:ethereum :arbitrum :optimism} - :position 1 - :clock 1698945829328 - :created-at 1698928839000 - :operable "fully" - :mixedcase-address "0x7bcDfc75c431" - :public-key "0x04371e2d9d66b82f056bc128064" - :removed false - :tokens tokens-0x2}) - (rf/sub [sub-name]))))) + (= + (list + {:path "m/44'/60'/0'/0/0" + :emoji "😃" + :key-uid "0x2f5ea39" + :address "0x1" + :wallet false + :name "Account One" + :type :generated + :watch-only? false + :chat false + :test-preferred-chain-ids #{5 420 421613} + :color :blue + :customization-color :blue + :hidden false + :prod-preferred-chain-ids #{1 10 42161} + :network-preferences-names #{:ethereum :arbitrum :optimism} + :position 0 + :clock 1698945829328 + :created-at 1698928839000 + :operable "fully" + :mixedcase-address "0x7bcDfc75c431" + :public-key "0x04371e2d9d66b82f056bc128064" + :removed false + :tokens tokens-0x1} + {:path "m/44'/60'/0'/0/1" + :emoji "💎" + :key-uid "0x2f5ea39" + :address "0x2" + :wallet false + :name "Account Two" + :type :generated + :watch-only? false + :chat false + :test-preferred-chain-ids #{5 420 421613} + :color :purple + :customization-color :purple + :hidden false + :prod-preferred-chain-ids #{1 10 42161} + :network-preferences-names #{:ethereum :arbitrum :optimism} + :position 1 + :clock 1698945829328 + :created-at 1698928839000 + :operable "fully" + :mixedcase-address "0x7bcDfc75c431" + :public-key "0x04371e2d9d66b82f056bc128064" + :removed false + :tokens tokens-0x2}) + (rf/sub [sub-name]))))) (h/deftest-sub :wallet/network-preference-details [sub-name] diff --git a/status-go-version.json b/status-go-version.json index ff87880d127..fcb954a6ecf 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -3,7 +3,7 @@ "_comment": "Instead use: scripts/update-status-go.sh ", "owner": "status-im", "repo": "status-go", - "version": "v0.174.5", - "commit-sha1": "1ea2bd99d4c11f591df554c089aa9283b9742c59", - "src-sha256": "0b9411581gmxrrrbgbjk34db8xgz5qlhvrhp9hngggar1b7vmp1w" + "version": "v0.174.6", + "commit-sha1": "f95dd35d131f68645b7c4dc5fbcea955c16e25bd", + "src-sha256": "188chrifz4h3j6fpsrqq83v2vcnpp8y4282k9lhlrkkknfgwz5v2" } diff --git a/translations/en.json b/translations/en.json index 1987074ea25..589b9dde6cb 100644 --- a/translations/en.json +++ b/translations/en.json @@ -1138,9 +1138,9 @@ "password-creation-hint": "Minimum 10 characters", "password-creation-placeholder-1": "Type password", "password-creation-placeholder-2": "Repeat password", - "password-creation-tips-title": "Tips to improve password", + "password-creation-tips-title": "Tips to improve", "password-creation-tips-1": "Lower case", - "password-creation-tips-2": "Upper-case", + "password-creation-tips-2": "Upper case", "password-creation-tips-3": "Numbers", "password-creation-tips-4": "Symbols", "password-creation-disclaimer": "I understand my password can't be recovered", @@ -2039,7 +2039,7 @@ "blank-messages-text": "Your messages will be here", "blank-contacts-text": "Your contacts will be here", "groups": "Groups", - "you-must-hold": "You must hold:", + "you-must-hold": "You must hodl:", "you-must-now-hold": "You must now hold:", "you-must-always-hold": "You must always hold:", "shell-placeholder-title": "Your open tabs will be here",