Skip to content

Commit 998e37d

Browse files
authored
Merge branch 'develop' into share-community-qr-17993
2 parents cede632 + 1d2c01c commit 998e37d

File tree

17 files changed

+209
-97
lines changed

17 files changed

+209
-97
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,6 @@ test/appium/tests/users.py
194194

195195
## git hooks
196196
lefthook.yml
197+
198+
## metro server logs
199+
metro-server-logs.log

Makefile

+4-11
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ run-clojure: ##@run Watch for and build Clojure changes for mobile
267267

268268
run-metro: export TARGET := clojure
269269
run-metro: ##@run Start Metro to build React Native changes
270-
@scripts/start-react-native.sh
270+
@scripts/run-metro.sh
271271

272272
run-re-frisk: export TARGET := clojure
273273
run-re-frisk: ##@run Start re-frisk server
@@ -278,22 +278,15 @@ run-android: export TARGET := android
278278
# Disabled for debug builds to avoid 'maximum call stack exceeded' errors.
279279
# https://github.com/status-im/status-mobile/issues/18493
280280
run-android: export ORG_GRADLE_PROJECT_hermesEnabled := false
281-
# INFO: If it's empty (no devices attached, parsing issues, script error) - for Nix it's the same as not set.
282-
run-android: export ANDROID_ABI_INCLUDE ?= $(shell ./scripts/adb_devices_abis.sh)
283281
run-android: ##@run Build Android APK and start it on the device
284-
npx react-native run-android --appIdSuffix debug
282+
@scripts/run-android.sh
285283

286284
SIMULATOR=iPhone 13
287285
# TODO: fix IOS_STATUS_GO_TARGETS to be either amd64 or arm64 when RN is upgraded
288286
run-ios: export TARGET := ios
289287
run-ios: export IOS_STATUS_GO_TARGETS := ios/arm64;iossimulator/amd64
290-
run-ios: export XCBeautify=$(shell which xcbeautify) # for react-native-cli to pick this up and to auto format output
291-
run-ios: ##@run Build iOS app and start it in a simulator/device
292-
ifneq ("$(SIMULATOR)", "")
293-
npx react-native run-ios --simulator="$(SIMULATOR)"
294-
else
295-
npx react-native run-ios
296-
endif
288+
run-ios: ##@run Build iOS app and start it in on the simulator
289+
@scripts/run-ios.sh "${SIMULATOR}"
297290

298291
show-ios-devices: ##@other shows connected ios device and its name
299292
xcrun xctrace list devices

doc/ide-setup.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,9 @@ See below:
122122

123123
Do the following:
124124

125-
Ensure you have 3 terminals running the following
125+
Ensure you have 2 terminals running the following
126126

127127
- `make run-clojure`
128-
- `make run-metro`
129128
- `make run-ios` / `make run-android`
130129

131130
[See the STARTING GUIDE for details](STARTING_GUIDE.md#development)

doc/starting-guide.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ This step will take a while the first time as it will download all dependencies.
1515
There are three steps necessary to start development, in this case for Android:
1616

1717
1. `make run-clojure` - Compiles Clojure into JavaScript, watches for changes on cljs files, and hot-reloads code in the app.
18-
2. `make run-metro` - Starts metro bundler and watches JavaScript code.
19-
3. `make run-android` or `make run-ios` - Builds the Android/iOS app and starts it on the device.
18+
2. `make run-android` or `make run-ios` - Builds the Android/iOS app, starts it on the device and starts metro bundler.
2019

2120
The first two will continue watching for changes and keep re-building the app. They need to be ready first.
2221
The last one will exit once the app is up and ready.

ios/Podfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ CHECKOUT OPTIONS:
793793
:submodules: true
794794

795795
SPEC CHECKSUMS:
796-
boost: 57d2868c099736d80fcd648bf211b4431e51a558
796+
boost: 64032b9e9b938fda23325e68a3771f0fabf414dc
797797
BVLinearGradient: 612a04ff38e8480291f3379ee5b5a2c571f03fe0
798798
CryptoSwift: c4f2debceb38bf44c80659afe009f71e23e4a082
799799
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54

nix/mobile/android/release.nix

+8-4
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ let
4040
else if (elem buildType ["pr" "manual"]) then ".env.jenkins"
4141
else ".env";
4242

43-
# There are only two types of Gradle build targets: pr and release
44-
gradleBuildType = if buildType == "pr" then "Pr" else "Release";
43+
gradleBuildType =
44+
if buildType == "pr" then "Pr"
45+
else if buildType == "debug" then "Debug"
46+
else "Release";
4547

4648
apksPath = "./android/app/build/outputs/apk/${toLower gradleBuildType}";
4749

@@ -171,12 +173,14 @@ in stdenv.mkDerivation rec {
171173
${adhocEnvVars} ${gradleCommand}
172174
popd > /dev/null
173175
'';
174-
doCheck = true;
175-
checkPhase = ''
176+
177+
doCheck = buildType != "debug";
178+
checkPhase = ''
176179
ls ${apksPath}/*.apk \
177180
| xargs -n1 ${pkgs.unzip}/bin/unzip -qql \
178181
| grep 'index.android.bundle'
179182
'';
183+
180184
installPhase = ''
181185
mkdir -p $out
182186
cp ${apksPath}/*.apk $out/

scripts/run-android.sh

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
set -m # needed to access jobs
4+
5+
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
6+
7+
# We run Metro in background while calling adb.
8+
cleanupMetro() {
9+
pkill -f run-metro.sh
10+
rm -f metro-server-logs.log
11+
}
12+
13+
# Using function gives a neater jobspec name.
14+
runMetro() {
15+
nohup "${GIT_ROOT}/scripts/run-metro.sh" 2>&1 \
16+
| tee metro-server-logs.log
17+
}
18+
19+
waitForMetro() {
20+
set +e # Allow grep command to fail in the loop.
21+
TIMEOUT=5
22+
echo "Waiting for Metro server..." >&2
23+
while ! grep -q "Welcome to Metro" metro-server-logs.log; do
24+
echo -n "." >&2
25+
sleep 1
26+
if ((TIMEOUT == 0)); then
27+
echo -e "\nMetro server timed out, exiting" >&2
28+
set -e # Restore errexit for rest of script.
29+
return 1
30+
fi
31+
((TIMEOUT--))
32+
done
33+
set -e # Restore errexit for rest of script.
34+
}
35+
36+
# Generate android debug build.
37+
export ANDROID_ABI_INCLUDE=$("${GIT_ROOT}/scripts/adb_devices_abis.sh")
38+
export BUILD_ENV=debug
39+
export BUILD_TYPE=debug
40+
"${GIT_ROOT}/scripts/build-android.sh"
41+
42+
# Install the APK on running emulator or android device.
43+
adb install ./result/app-debug.apk
44+
45+
trap cleanupMetro EXIT ERR INT QUIT
46+
runMetro &
47+
waitForMetro
48+
49+
# Start the installed app.
50+
adb shell monkey -p im.status.ethereum.debug 1
51+
52+
# bring metro job to foreground
53+
fg 'runMetro'

scripts/run-ios.sh

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
set -m # needed to access jobs
4+
5+
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
6+
7+
# We run Metro in background while calling adb.
8+
cleanupMetro() {
9+
pkill -f run-metro.sh
10+
rm -f metro-server-logs.log
11+
}
12+
13+
# Using function gives a neater jobspec name.
14+
runMetro() {
15+
nohup "${GIT_ROOT}/scripts/run-metro.sh" 2>&1 \
16+
| tee metro-server-logs.log
17+
}
18+
19+
waitForMetro() {
20+
set +e # Allow grep command to fail in the loop.
21+
TIMEOUT=5
22+
echo "Waiting for Metro server..." >&2
23+
while ! grep -q "Welcome to Metro" metro-server-logs.log; do
24+
echo -n "." >&2
25+
sleep 1
26+
if ((TIMEOUT == 0)); then
27+
echo -e "\nMetro server timed out, exiting" >&2
28+
set -e # Restore errexit for rest of script.
29+
return 1
30+
fi
31+
((TIMEOUT--))
32+
done
33+
set -e # Restore errexit for rest of script.
34+
}
35+
36+
# Check if the first argument is provided
37+
if [ -z "${1-}" ]; then
38+
echo "Error: No simulator name provided." >&2
39+
exit 1
40+
fi
41+
42+
SIMULATOR=${1}
43+
44+
# get our desired UUID
45+
UUID=$(xcrun simctl list devices | grep -E "$SIMULATOR \(" | head -n 1 | awk -F '[()]' '{print $2}')
46+
47+
# get simulator status
48+
SIMULATOR_STATE=$(xcrun simctl list devices | grep -E "$SIMULATOR \(" | head -n 1 | awk '{print $NF}')
49+
50+
# sometimes a simulator is already running, shut it down to avoid errors
51+
if [ "$SIMULATOR_STATE" != "(Shutdown)" ]; then
52+
xcrun simctl shutdown "$UUID"
53+
fi
54+
55+
# boot up iOS for simulator
56+
xcrun simctl boot "$UUID"
57+
58+
# start the simulator
59+
open -a Simulator --args -CurrentDeviceUDID "$UUID"
60+
61+
#iOS build of debug scheme
62+
xcodebuild -workspace "ios/StatusIm.xcworkspace" -configuration Debug -scheme StatusIm -destination id="$UUID" | xcbeautify
63+
64+
trap cleanupMetro EXIT ERR INT QUIT
65+
runMetro &
66+
waitForMetro
67+
68+
# launch the app when metro is ready
69+
xcrun simctl launch "$UUID" im.status.ethereum.debug
70+
71+
# bring metro job to foreground
72+
fg 'runMetro'

scripts/run-metro.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
pkill -f 'react-native start'
4+
5+
react-native start --reset-cache

scripts/start-react-native.sh

-17
This file was deleted.

src/status_im/contexts/communities/actions/addresses_for_permissions/view.cljs

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@
2727
:collectible-img-src (resources/get-mock-image :collectible))
2828

2929
(= type constants/community-token-type-erc20)
30-
(assoc :amount (str (money/with-precision (money/token->unit amount decimals) 3))
30+
(assoc :amount (str (money/token->unit amount decimals))
3131
:token (:symbol balance)))))
3232

3333
(defn- account-item
34-
[{:keys [customization-color address name emoji]} _ _ [selected-addresses community-id]]
34+
[{:keys [color address name emoji]} _ _ [selected-addresses community-id]]
3535
(let [balances (rf/sub [:communities/permissioned-balances-by-address community-id address])]
3636
[quo/account-permissions
3737
{:account {:name name
3838
:address address
3939
:emoji emoji
40-
:customization-color customization-color}
40+
:customization-color color}
4141
:token-details (balances->components-props balances)
4242
:checked? (contains? selected-addresses address)
4343
:on-change #(rf/dispatch [:communities/toggle-selected-permission-address
@@ -51,7 +51,7 @@
5151
(fn []
5252
(let [{:keys [name color images]} (rf/sub [:communities/community id])
5353
{:keys [highest-permission-role]} (rf/sub [:community/token-gated-overview id])
54-
accounts (rf/sub [:wallet/accounts-with-customization-color])
54+
accounts (rf/sub [:wallet/accounts-without-watched-accounts])
5555
selected-addresses (rf/sub [:communities/selected-permission-addresses id])
5656
highest-role-text (when highest-permission-role
5757
(i18n/label (communities.utils/role->translation-key

src/status_im/contexts/communities/actions/token_gating/view.cljs

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@
88
(defn token-requirements
99
[]
1010
(fn [id]
11-
(let [{:keys [can-request-access?
12-
number-of-hold-tokens tokens]} (rf/sub [:community/token-gated-overview id])]
11+
(let [{:keys [can-request-access? tokens]} (rf/sub [:community/token-gated-overview id])]
1312
[rn/view {:style {:padding-horizontal 12}}
1413
[quo/text {:weight :medium}
1514
(if can-request-access?
1615
(i18n/label :t/you-eligible-to-join)
1716
(i18n/label :t/you-not-eligible-to-join))]
1817
[quo/text {:style {:padding-bottom 18} :size :paragraph-2}
1918
(if can-request-access?
20-
(i18n/label :t/you-hold-number-of-hold-tokens-of-these
21-
{:number-of-hold-tokens number-of-hold-tokens})
19+
(i18n/label :t/you-hodl)
2220
(i18n/label :t/you-must-hold))]
2321
[quo/token-requirement-list {:tokens tokens}]])))

src/status_im/subs/communities.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@
370370
(re-frame/reg-sub
371371
:communities/selected-permission-accounts
372372
(fn [[_ community-id]]
373-
[(re-frame/subscribe [:wallet/accounts-with-customization-color])
373+
[(re-frame/subscribe [:wallet/accounts-without-watched-accounts])
374374
(re-frame/subscribe [:communities/selected-permission-addresses community-id])])
375375
(fn [[accounts selected-permission-addresses]]
376376
(filter #(contains? selected-permission-addresses (:address %)) accounts)))

src/status_im/subs/wallet/wallet.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190

191191
(rf/reg-sub
192192
:wallet/accounts-without-watched-accounts
193-
:<- [:wallet/accounts]
193+
:<- [:wallet/accounts-with-customization-color]
194194
(fn [accounts]
195195
(remove #(:watch-only? %) accounts)))
196196

0 commit comments

Comments
 (0)