mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-18 23:52:52 +00:00
refactor: add mulitple customization features
This commit is contained in:
@@ -1,35 +1,37 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
DEFAULT_APP_LINK_URL="your.deep.link.host.tld"
|
||||
APP_LINK_URL="${APP_LINK_URL:-$DEFAULT_APP_LINK_URL}"
|
||||
. $PWD/app.conf
|
||||
|
||||
if [ -n "$(xmlstarlet sel -T -t -v "/manifest/application/activity[intent-filter/@android:autoVerify='true']" app/android/app/src/main/AndroidManifest.xml)" ]; then
|
||||
echo "Deep link capability already defined in AndroidManifest.xml"
|
||||
else
|
||||
echo "Adding deep link capability to AndroidManifest.xml"
|
||||
xmlstarlet edit -L -s /manifest/application/activity -t elem -n tmpElement -v "" \
|
||||
-i //tmpElement -t attr -n "android:autoVerify" -v "true" \
|
||||
-r //tmpElement -v intent-filter \
|
||||
app/android/app/src/main/AndroidManifest.xml
|
||||
DEFAULT_APP_URL_SCHEME="de.anyschool.app"
|
||||
APP_URL_SCHEME="${APP_URL_SCHEME:-$DEFAULT_APP_URL_SCHEME}"
|
||||
|
||||
xmlstarlet edit -L -s "/manifest/application/activity/intent-filter[@android:autoVerify='true']" -t elem -n tmpElement -v "" \
|
||||
-i //tmpElement -t attr -n "android:name" -v "android.intent.action.VIEW" \
|
||||
-r //tmpElement -v action \
|
||||
app/android/app/src/main/AndroidManifest.xml
|
||||
ANDROID_MANIFEST_PATH="app/android/app/src/main/AndroidManifest.xml"
|
||||
ANDROID_STRINGS_PATH="app/android/app/src/main/res/values/strings.xml"
|
||||
|
||||
xmlstarlet edit -L -s "/manifest/application/activity/intent-filter[@android:autoVerify='true']" -t elem -n tmpElement -v "" \
|
||||
-i //tmpElement -t attr -n "android:name" -v "android.intent.action.DEFAULT" \
|
||||
-r //tmpElement -v category \
|
||||
app/android/app/src/main/AndroidManifest.xml
|
||||
|
||||
xmlstarlet edit -L -s "/manifest/application/activity/intent-filter[@android:autoVerify='true']" -t elem -n tmpElement -v "" \
|
||||
-i //tmpElement -t attr -n "android:name" -v "android.intent.action.BROWSABLE" \
|
||||
-r //tmpElement -v category \
|
||||
app/android/app/src/main/AndroidManifest.xml
|
||||
git -C app checkout -- android/build.gradle
|
||||
git -C app checkout -- android/app/src/main/AndroidManifest.xml
|
||||
|
||||
xmlstarlet edit -L -s "/manifest/application/activity/intent-filter[@android:autoVerify='true']" -t elem -n tmpElement -v "" \
|
||||
-i //tmpElement -t attr -n "android:scheme" -v "https" \
|
||||
-i //tmpElement -t attr -n "android:host" -v "$APP_LINK_URL" \
|
||||
-r //tmpElement -v data \
|
||||
app/android/app/src/main/AndroidManifest.xml
|
||||
fi
|
||||
# AndroidManifest.xml
|
||||
xmlstarlet edit --pf --inplace \
|
||||
--update "/manifest/@package" --value "$ANDROID_PACKAGE_NAME" \
|
||||
$ANDROID_MANIFEST_PATH
|
||||
|
||||
xmlstarlet edit --pf --inplace \
|
||||
--update "/manifest/application/activity/@android:name" --value "$ANDROID_PACKAGE_NAME".MainActivity \
|
||||
$ANDROID_MANIFEST_PATH
|
||||
|
||||
# strings.xml
|
||||
xmlstarlet edit --pf --inplace \
|
||||
--update "/resources/string[@name='package_name']" --value "$ANDROID_PACKAGE_NAME" \
|
||||
$ANDROID_STRINGS_PATH
|
||||
|
||||
xmlstarlet edit --pf --inplace \
|
||||
--update "/resources/string[@name='custom_url_scheme']" --value "$APP_URL_SCHEME" \
|
||||
$ANDROID_STRINGS_PATH
|
||||
|
||||
xmlstarlet edit --inplace \
|
||||
--delete "/resources/string[@name='app_host']" \
|
||||
--append "/resources/string[@name='custom_url_scheme']" --type elem -n string --value "$APP_LINK_HOST" \
|
||||
--insert "/resources/string[not(@name)]" --type attr -n name --value "app_host" \
|
||||
$ANDROID_STRINGS_PATH
|
||||
|
||||
Reference in New Issue
Block a user