From a99104d851100d3bc47e34eabdaa7f1a71904aea Mon Sep 17 00:00:00 2001 From: AloneMonkey Date: Sat, 22 Jul 2017 13:36:46 +0800 Subject: [PATCH] add url scheme support --- Tools/pack.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tools/pack.sh b/Tools/pack.sh index 1945c21..28d55a8 100755 --- a/Tools/pack.sh +++ b/Tools/pack.sh @@ -6,6 +6,7 @@ DEMOTARGET_APP_PATH="/opt/MonkeyDev/Resource/TargetApp.app" OPTOOL="$MONKEYDEV_TOOLS/optool" FRAMEWORKS_TO_INJECT_PATH="/opt/MonkeyDev/Frameworks/" CUSTOM_DISPLAY_NAME=$(/usr/libexec/PlistBuddy -c "Print CFBundleDisplayName" "${SRCROOT}/$TARGET_NAME/Info.plist") +CUSTOM_URL_TYPE=$(/usr/libexec/PlistBuddy -x -c "Print CFBundleURLTypes" "${SRCROOT}/$TARGET_NAME/Info.plist") CUSTOM_BUNDLE_ID="$PRODUCT_BUNDLE_IDENTIFIER" rm -rf "$TEMP_PATH" || true @@ -76,6 +77,17 @@ if [[ "$CUSTOM_DISPLAY_NAME" != "" ]]; then fi /usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $PRODUCT_BUNDLE_IDENTIFIER" "$BUILD_APP_PATH/Info.plist" +#support URL Scheme +if [[ "$CUSTOM_URL_TYPE" != "" ]]; then + CUSTOM_URL_TYPE_FILE="$TEMP_PATH"/url_type.plist + echo "$CUSTOM_URL_TYPE" >> "$CUSTOM_URL_TYPE_FILE" + ORIGIN_URL_TYPE=$(/usr/libexec/PlistBuddy -c "Print CFBundleURLTypes" "$BUILD_APP_PATH/Info.plist") + if [[ "$ORIGIN_URL_TYPE" == "" ]]; then + /usr/libexec/PlistBuddy -x -c 'add CFBundleURLTypes dict' "$BUILD_APP_PATH/Info.plist" + fi + /usr/libexec/PlistBuddy -x -c "merge $CUSTOM_URL_TYPE_FILE CFBundleURLTypes" "$BUILD_APP_PATH/Info.plist" +fi + #codesign if [ -d "$TARGET_APP_FRAMEWORKS_PATH" ]; then for FRAMEWORK in "$TARGET_APP_FRAMEWORKS_PATH/"*