Skip to content

Commit e95eb34

Browse files
committed
Merge branch 'always-refresh-relay-file-opportunistically-ios-1097'
2 parents 3912566 + d8ea338 commit e95eb34

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

ios/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,6 @@ ios/convert-assets.rb --additional-assets
100100

101101
## Cached relays
102102

103-
The script `relays-prebuild.sh` runs on each Xcode build and updates the cached relay list whenever there *IS NO* relay file. To get a fresh relay file on demand, simply remove `MullvadREST/Assets/relays.json` and build the Xcode project.
103+
The script `relays-prebuild.sh` runs on each Xcode build and will download and cache a list of relays if it is not already present for a given configuration.
104+
The cached list for a given configuration will always override the current relays file.
105+
To get a fresh relay file on demand, issue a `clean` command to Xcode and re-build the project.

ios/relays-prebuild.sh

+17-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,27 @@ fi
77

88
RELAYS_FILE="$PROJECT_DIR/MullvadREST/Assets/relays.json"
99

10+
# Do not download the file for release builds, a different script will take care of that.
11+
if [ "$CONFIGURATION" == "Release" ]; then
12+
# Fail loudly if the required file is not already present.
13+
if [ ! -f "$RELAYS_FILE" ]; then
14+
echo "No file found at $RELAYS_FILE"
15+
exit 1
16+
fi
17+
return 0
18+
fi
19+
20+
BACKUP_FILE="$CONFIGURATION_TEMP_DIR/relays.json"
21+
1022
if [ "$CONFIGURATION" == "Staging" ]; then
1123
API_ENDPOINT="api.stagemole.eu"
1224
else
1325
API_ENDPOINT="api.mullvad.net"
1426
fi
1527

16-
if [ ! -f "$RELAYS_FILE" ]; then
17-
echo "Download relays file"
18-
curl https://"$API_ENDPOINT"/app/v1/relays -s -o "$RELAYS_FILE"
28+
if [ ! -f "$BACKUP_FILE" ]; then
29+
echo "Downloading relays file for $CONFIGURATION"
30+
curl https://"$API_ENDPOINT"/app/v1/relays -s -o "$BACKUP_FILE"
1931
fi
32+
33+
cp "$BACKUP_FILE" "$RELAYS_FILE"

0 commit comments

Comments
 (0)