Skip to content

Commit

Permalink
Add script to create entitlements file
Browse files Browse the repository at this point in the history
  • Loading branch information
markmur committed Nov 11, 2024
1 parent 054485a commit d8f1dc3
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
.DS_Store
xcuserdata
**/Storefront.xcconfig

*.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,10 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = MobileBuyIntegration/MobileBuyIntegration.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = A7XGC83MZE;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = MobileBuyIntegration/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
Expand All @@ -446,6 +448,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = MobileBuyIntegration/MobileBuyIntegration.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = A7XGC83MZE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
},
"No logs available" : {

},
"Not supported in < iOS 15" : {

},
"OK" : {
"comment" : "Default action"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:{STOREFRONT_DOMAIN}</string>
<string>applinks:{STOREFRONT_DOMAIN}</string>
</array>
</dict>
</plist>
18 changes: 13 additions & 5 deletions Samples/MobileBuyIntegration/Storefront.xcconfig.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
STOREFRONT_DOMAIN = <yourdomainhere.myshopify.com>
STOREFRONT_ACCESS_TOKEN = <storefront access token>
// --- Storefront
// --- Find your Storefront API access token under:
// ----- https://admin.shopify.com/store/{STOREFRONT}/settings/apps/development/{APP_ID}/api_credentials

STOREFRONT_DOMAIN = <INSERT_STOREFRONT_DOMAIN>
STOREFRONT_ACCESS_TOKEN = <INSERT_STOREFRONT_ACCESS_TOKEN>

// --- Buyer preference data
EMAIL = [email protected]

FIRST_NAME = Test
LAST_NAME = Test

ADDRESS_1 = The Cloak & Dagger
ADDRESS_2 = 1st Street Southeast
CITY = Calgary
COUNTRY = CA
FIRST_NAME = Test
LAST_NAME = McTest
PROVINCE = AB
ZIP = T1X 0L3
EMAIL = [email protected]
PHONE = +155565708743
23 changes: 23 additions & 0 deletions Samples/MobileBuyIntegration/scripts/generate_entitlements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

CONFIG_FILE="Storefront.xcconfig"
STOREFRONT_DOMAIN=$(grep '^STOREFRONT_DOMAIN' "$CONFIG_FILE" | cut -d '=' -f2 | tr -d ' ')

TEMPLATE_FILE="MobileBuyIntegration/MobileBuyIntegration.entitlements.template"
OUTPUT_FILE="MobileBuyIntegration/MobileBuyIntegration.entitlements"

if [ -z "$STOREFRONT_DOMAIN" ]; then
echo "Error: STOREFRONT_DOMAIN is not set in Storefront.xcconfig"
exit 1
fi

if [ -e "$OUTPUT_FILE" ]; then
echo "Warning: $OUTPUT_FILE already exists."
exit 0
fi

sed "s/{STOREFRONT_DOMAIN}/$STOREFRONT_DOMAIN?mode=developer/g" "$TEMPLATE_FILE" > "$OUTPUT_FILE"

echo "Success: Entitlements file generated at $OUTPUT_FILE with domain $STOREFRONT_DOMAIN"
5 changes: 5 additions & 0 deletions Scripts/setup_entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -e

(cd samples/MobileBuyIntegration && ./scripts/generate_entitlements.sh)

0 comments on commit d8f1dc3

Please sign in to comment.