Skip to content

Commit

Permalink
add url scheme support
Browse files Browse the repository at this point in the history
  • Loading branch information
AloneMonkey committed Jul 22, 2017
1 parent 636ad9f commit a99104d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Tools/pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/"*
Expand Down

0 comments on commit a99104d

Please sign in to comment.