mobile: make mobile flag runtime-configurable

we need to pass a few more things around but it's not that bad. This
will allow you to launch damus with --mobile for mobile testing without
recompilation.
This commit is contained in:
William Casarin
2024-05-31 00:52:27 -05:00
parent 83eab71148
commit 2305f1e50a
15 changed files with 101 additions and 99 deletions

20
preview
View File

@@ -1,20 +1,4 @@
#!/usr/bin/env bash
MOBILE_FLAG=0
FILTERED_ARGS=()
# Loop through the command line arguments
for arg in "$@"; do
if [[ "$arg" == "--mobile" ]]; then
MOBILE_FLAG=1
else
# Add non '--mobile' arguments to the filtered list
FILTERED_ARGS+=("$arg")
fi
done
if [[ "$MOBILE_FLAG" -eq 1 ]]; then
cargo run --bin ui_preview --features emulate_mobile --release -- "${FILTERED_ARGS[@]}"
else
cargo run --bin ui_preview --release -- "$@"
fi
# pass --mobile for mobile previews
cargo run --bin ui_preview --release -- "$@"