dev
sh 29 lines 837 Bytes
Raw
1 #!/bin/bash
2 source "$(cd "$(dirname "${BASH_SOURCE[0]}")/scripts" && pwd)/functions.sh"
3 # Get the current git branch
4 get_current_branch() {
5 if git rev-parse --git-dir > /dev/null 2>&1; then
6 branch=$(git rev-parse --abbrev-ref HEAD)
7 echo "$branch" | tr '-' '_'
8 else
9 echo "Error: Not a git repository."
10 return 1
11 fi
12 }
13
14 # Update the app.properties file
15 update_app_properties() {
16 local branch=$1
17 local file_path="./android/app.properties"
18 universal_sed "s/^id=.*/id=com.cakewallet.$branch/" "$file_path"
19 universal_sed "s/^name=.*/name=$branch-Cake Wallet/" "$file_path"
20 }
21
22 # only update app.properties if getting the current branch was successful
23 current_branch=$(get_current_branch)
24 if [[ $? -eq 0 ]]; then
25 update_app_properties "$current_branch"
26 fi
27
28 # run the app
29 flutter run