mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-19 08:02:55 +00:00
Initial commit
This commit is contained in:
35
static/scripts/android.sh
Executable file
35
static/scripts/android.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
DEFAULT_APP_LINK_URL="your.deep.link.host.tld"
|
||||
APP_LINK_URL="${APP_LINK_URL:-$DEFAULT_APP_LINK_URL}"
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
18
static/scripts/clone_app.sh
Executable file
18
static/scripts/clone_app.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# get semantical versioning string linke 2.0.0 (if $1 is v2.0.0) or $1
|
||||
DEFAULT_VERSION="0.0.0"
|
||||
APP_VERSION="${APP_VERSION:-$DEFAULT_VERSION}"
|
||||
|
||||
if echo -n $1 | grep -Eq 'v[0-9]+\.[0-9]+\.[0-9]+'; then
|
||||
APP_VERSION=$(echo -n "$1" | cut -c 2-);
|
||||
else
|
||||
APP_VERSION=$1;
|
||||
fi
|
||||
|
||||
if [ "$APP_VERSION" = "0.0.0" ]; then
|
||||
echo "Unsupported app version was set!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
git clone --depth 1 --branch $APP_VERSION https://gitlab.com/openstapps/app.git app
|
||||
35
static/scripts/ionic.sh
Executable file
35
static/scripts/ionic.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
DEFAULT_APP_NAME="Open StApps"
|
||||
DEFAULT_APP_DISPLAY_NAME="StApps"
|
||||
DEFAULT_APP_ID="de.any_school.app"
|
||||
|
||||
APP_NAME="${APP_NAME:-$DEFAULT_APP_NAME}"
|
||||
APP_DISPLAY_NAME="${APP_DISPLAY_NAME:-$DEFAULT_APP_DISPLAY_NAME}"
|
||||
APP_ID="${APP_ID:-$DEFAULT_APP_ID}"
|
||||
|
||||
APP_VERSION=$(jq '.version' app/package.json)
|
||||
|
||||
# ionic config
|
||||
cat app/ionic.config.json | jq '.name = $newName' --arg newName "$APP_NAME" > tmp.$$.json && mv tmp.$$.json app/ionic.config.json
|
||||
|
||||
# capacitor config
|
||||
awk "/appName:.*,/ && !done { gsub(/appName:.*,/, \"appName: '$APP_NAME',\"); done=1}; 1" app/capacitor.config.ts > tmp.$$.json && mv tmp.$$.json app/capacitor.config.ts
|
||||
awk "/appId:.*,/ && !done { gsub(/appId:.*,/, \"appId: '$APP_ID',\"); done=1}; 1" app/capacitor.config.ts > tmp.$$.json && mv tmp.$$.json app/capacitor.config.ts
|
||||
|
||||
# cordova config
|
||||
xmlstarlet edit -L --update "/widget/@id" --value "$APP_ID" app/config.xml
|
||||
xmlstarlet edit -L --update "/widget/@version" --value "$APP_VERSION" app/config.xml
|
||||
xmlstarlet edit -L -N x="http://www.w3.org/ns/widgets" --update "//x:name" --value "$APP_NAME" app/config.xml
|
||||
|
||||
if [ -n $(xmlstarlet sel -N x="http://www.w3.org/ns/widgets" -T -t -v "//x:name[@short]" app/config.xml) ]; then
|
||||
#insert
|
||||
xmlstarlet edit -L -N x="http://www.w3.org/ns/widgets" -s "//x:name" -t attr -n "short" -v "$APP_DISPLAY_NAME" app/config.xml
|
||||
else
|
||||
#update
|
||||
xmlstarlet edit -L -N x="http://www.w3.org/ns/widgets" --update "//x:name[@short]" -v "$APP_DISPLAY_NAME" app/config.xml
|
||||
fi
|
||||
|
||||
# environment config
|
||||
awk "/backend_url:.*,/ && !done { gsub(/backend_url:.*,/, \"backend_url: '$BACKEND_URL',\"); done=1}; 1" app/src/environments/environment.prod.ts > tmp.$$.json && mv tmp.$$.json app/src/environments/environment.prod.t
|
||||
awk "/backend_version:.*,/ && !done { gsub(/backend_version:.*,/, \"backend_version: '$BACKEND_VERSION',\"); done=1}; 1" app/src/environments/environment.prod.t > tmp.$$.json && mv tmp.$$.json app/src/environments/environment.prod.t
|
||||
9
static/scripts/ios.sh
Executable file
9
static/scripts/ios.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
DEFAULT_APP_LINK_URL="your.deep.link.host.tld"
|
||||
APP_LINK_URL="${APP_LINK_URL:-$DEFAULT_APP_LINK_URL}"
|
||||
ENTITLEMENTS_FILE="app/ios/App/App/App.entitlements"
|
||||
|
||||
/usr/libexec/PlistBuddy -c "Delete :com.apple.developer.associated-domains string $APP_LINK_URL" $ENTITLEMENTS_FILE
|
||||
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.associated-domains array" $ENTITLEMENTS_FILE
|
||||
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.associated-domains:0 string $APP_LINK_URL" $ENTITLEMENTS_FILE
|
||||
Reference in New Issue
Block a user