#!/bin/bash
TITLE="$1"
echo "Setting the application title to $TITLE"
sed -i "s/android:label=\"[^\"]\+\"/android:label=\"$TITLE\"/" android/app/src/main/AndroidManfest.xml
NAME_LENGTH="${#TITLE}"
LONG_NAME="$(( $NAME_LENGTH > 15))" # 1 if long name
BUNDLE_NAME="$(cut -c -15 $TITLE)"
perl -0777 -i -pe "s/\tCFBundleName\n[^\n]+/\tCFBundleName\n\t$BUNDLE_NAME/igs"
if [ "$LONG_NAME" = "1" ] ; then
# todo : set bundleDisplayName
fi