Skip to content

Commit

Permalink
Update for improved StoreHelper subscriptions config
Browse files Browse the repository at this point in the history
  • Loading branch information
russell-archer committed Feb 12, 2023
1 parent 7d411d2 commit 12487a1
Show file tree
Hide file tree
Showing 17 changed files with 453 additions and 10 deletions.
Binary file added Images/com.rarcher.amber.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/com.rarcher.green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/com.rarcher.red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Shared/Assets.xcassets/com.rarcher.amber.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "com.rarcher.amber.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Shared/Assets.xcassets/com.rarcher.green.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "com.rarcher.green.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Shared/Assets.xcassets/com.rarcher.red.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "com.rarcher.red.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 104 additions & 3 deletions Shared/Products.plist
Original file line number Diff line number Diff line change
@@ -1,6 +1,86 @@
<?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">
<!--
The structure of the product definition property list may take one of two alternative formats, as described below.
Format 1.
All in-app purchase products (consumable, non-consumable and subscription) are listed together under the top-level
"Products" key. When using this format all subscriptions must use the
`com.{author}.subscription.{subscription-group-name}.{product-name}`
naming convention, so that subscription group names can be determined. Other products do not need to adhere to a
naming convention.
Format 2.
Consumable and non-consumable products are listed together under the top-level "Products" key.
Subscriptions are listed under the top-level "Subscriptions" key.
Example 1. Products listed together. Subscriptions must use the required naming convention:
<?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>Products</key>
<array>
<string>com.rarcher.nonconsumable.flowers.large</string>
<string>com.rarcher.nonconsumable.flowers.small</string>
<string>com.rarcher.consumable.plant.installation</string>
<string>com.rarcher.subscription.vip.gold</string>
<string>com.rarcher.subscription.vip.silver</string>
<string>com.rarcher.subscription.vip.bronze</string>
</array>
</dict>
</plist>
Example 2. All consumables and non-consumables listed together. Subscriptions listed separately,
with two subscription groups named "vip" and "standard" defined:
<?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>Products</key>
<array>
<string>com.rarcher.nonconsumable.flowers.large</string>
<string>com.rarcher.nonconsumable.flowers.small</string>
<string>com.rarcher.consumable.plant.installation</string>
</array>
<key>Subscriptions</key>
<array>
<dict>
<key>Group</key>
<string>vip</string>
<key>Products</key>
<array>
<string>com.rarcher.gold</string>
<string>com.rarcher.silver</string>
<string>com.rarcher.bronze</string>
</array>
</dict>
<dict>
<key>Group</key>
<string>standard</string>
<key>Products</key>
<array>
<string>com.rarcher.sub1</string>
<string>com.rarcher.sub2</string>
<string>com.rarcher.sub3</string>
</array>
</dict>
</array>
</dict>
</plist>
Also, service level relies on the ordering of product ids within a subscription group in the
Products.plist file. A product appearing higher (towards the top of the group) will have a higher
service level than one appearing lower down.
-->

<dict>
<key>Products</key>
<array>
Expand All @@ -9,10 +89,31 @@
<string>com.rarcher.nonconsumable.roses.large</string>
<string>com.rarcher.nonconsumable.chocolates.small</string>
<string>com.rarcher.consumable.plant.installation</string>
<string>com.rarcher.subscription.vip.gold</string>
<string>com.rarcher.subscription.vip.silver</string>
<string>com.rarcher.subscription.vip.bronze</string>
</array>
<key>Subscriptions</key>
<array>
<dict>
<key>Group</key>
<string>vip</string>
<key>Products</key>
<array>
<string>com.rarcher.subscription.vip.gold</string>
<string>com.rarcher.subscription.vip.silver</string>
<string>com.rarcher.subscription.vip.bronze</string>
</array>
</dict>
<dict>
<key>Group</key>
<string>standard</string>
<key>Products</key>
<array>
<string>com.rarcher.green</string>
<string>com.rarcher.amber</string>
<string>com.rarcher.red</string>
</array>
</dict>
</array>
</dict>

</plist>

84 changes: 84 additions & 0 deletions Shared/Products.storekit
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,90 @@
"type" : "RecurringSubscription"
}
]
},
{
"id" : "1A156646",
"localizations" : [

],
"name" : "Standard",
"subscriptions" : [
{
"adHocOffers" : [

],
"codeOffers" : [

],
"displayPrice" : "2.99",
"familyShareable" : false,
"groupNumber" : 1,
"internalID" : "C766AFC0",
"introductoryOffer" : null,
"localizations" : [
{
"description" : "A lovely green product",
"displayName" : "Perfect Green",
"locale" : "en_US"
}
],
"productID" : "com.rarcher.green",
"recurringSubscriptionPeriod" : "P1M",
"referenceName" : "Green",
"subscriptionGroupID" : "1A156646",
"type" : "RecurringSubscription"
},
{
"adHocOffers" : [

],
"codeOffers" : [

],
"displayPrice" : "1.99",
"familyShareable" : false,
"groupNumber" : 2,
"internalID" : "B13AAE77",
"introductoryOffer" : null,
"localizations" : [
{
"description" : "A nice amber product",
"displayName" : "Warning Amber",
"locale" : "en_US"
}
],
"productID" : "com.rarcher.amber",
"recurringSubscriptionPeriod" : "P1M",
"referenceName" : "Amber",
"subscriptionGroupID" : "1A156646",
"type" : "RecurringSubscription"
},
{
"adHocOffers" : [

],
"codeOffers" : [

],
"displayPrice" : "0.99",
"familyShareable" : false,
"groupNumber" : 3,
"internalID" : "89E7058E",
"introductoryOffer" : null,
"localizations" : [
{
"description" : "A dangerous red product",
"displayName" : "Dangerous Red",
"locale" : "en_US"
}
],
"productID" : "com.rarcher.red",
"recurringSubscriptionPeriod" : "P1M",
"referenceName" : "Red",
"subscriptionGroupID" : "1A156646",
"type" : "RecurringSubscription"
}
]
}
],
"subscriptionOffersKeyPair" : {
Expand Down
36 changes: 32 additions & 4 deletions StoreHelperDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
68B56A5A286DE20F0093F3EE /* StoreHelper in Frameworks */ = {isa = PBXBuildFile; productRef = 68B56A59286DE20F0093F3EE /* StoreHelper */; };
68B62999290060B0000843FA /* SimplePurchaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68B62998290060B0000843FA /* SimplePurchaseView.swift */; };
68B6299A290060B0000843FA /* SimplePurchaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68B62998290060B0000843FA /* SimplePurchaseView.swift */; };
68DB9C58298D282700E3CE23 /* StoreHelperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68DB9C57298D282700E3CE23 /* StoreHelperTests.swift */; };
68D231A029994CA0009F367D /* ProductConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68D2319D29994CA0009F367D /* ProductConfigurationTests.swift */; };
68D231A129994CA0009F367D /* PurchaseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68D2319E29994CA0009F367D /* PurchaseTests.swift */; };
68D231A229994CA0009F367D /* SubscriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68D2319F29994CA0009F367D /* SubscriptionTests.swift */; };
68DB9C5F298D296400E3CE23 /* Configuration.plist in Resources */ = {isa = PBXBuildFile; fileRef = 68DB9C5E298D296400E3CE23 /* Configuration.plist */; };
68DB9C60298D296400E3CE23 /* Configuration.plist in Resources */ = {isa = PBXBuildFile; fileRef = 68DB9C5E298D296400E3CE23 /* Configuration.plist */; };
68E622AC27EFB88200836E6F /* SubscriptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68E622AB27EFB88200836E6F /* SubscriptionView.swift */; };
Expand Down Expand Up @@ -73,8 +75,10 @@
6885967D27A0321C00251729 /* ProductView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductView.swift; sourceTree = "<group>"; };
6890B16F2813086F00119657 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS15.4.sdk/System/Library/Frameworks/StoreKit.framework; sourceTree = DEVELOPER_DIR; };
68B62998290060B0000843FA /* SimplePurchaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimplePurchaseView.swift; sourceTree = "<group>"; };
68D2319D29994CA0009F367D /* ProductConfigurationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductConfigurationTests.swift; sourceTree = "<group>"; };
68D2319E29994CA0009F367D /* PurchaseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PurchaseTests.swift; sourceTree = "<group>"; };
68D2319F29994CA0009F367D /* SubscriptionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionTests.swift; sourceTree = "<group>"; };
68DB9C55298D282700E3CE23 /* StoreHelperTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = StoreHelperTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
68DB9C57298D282700E3CE23 /* StoreHelperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreHelperTests.swift; sourceTree = "<group>"; };
68DB9C5E298D296400E3CE23 /* Configuration.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Configuration.plist; sourceTree = "<group>"; };
68E622AB27EFB88200836E6F /* SubscriptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -187,7 +191,9 @@
68DB9C56298D282700E3CE23 /* StoreHelperTests */ = {
isa = PBXGroup;
children = (
68DB9C57298D282700E3CE23 /* StoreHelperTests.swift */,
68D2319D29994CA0009F367D /* ProductConfigurationTests.swift */,
68D2319E29994CA0009F367D /* PurchaseTests.swift */,
68D2319F29994CA0009F367D /* SubscriptionTests.swift */,
);
path = StoreHelperTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -272,6 +278,7 @@
};
68DB9C54298D282700E3CE23 = {
CreatedOnToolsVersion = 14.2;
LastSwiftMigration = 1420;
TestTargetID = 686DA128279F6C3700576175;
};
};
Expand Down Expand Up @@ -364,7 +371,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
68DB9C58298D282700E3CE23 /* StoreHelperTests.swift in Sources */,
68D231A129994CA0009F367D /* PurchaseTests.swift in Sources */,
68D231A229994CA0009F367D /* SubscriptionTests.swift in Sources */,
68D231A029994CA0009F367D /* ProductConfigurationTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -626,16 +635,26 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = R6BE99W3FU;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.rarcher.StoreHelperTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StoreHelperDemo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StoreHelperDemo";
Expand All @@ -647,15 +666,24 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = R6BE99W3FU;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.rarcher.StoreHelperTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"location" : "https://github.com/russell-archer/StoreHelper.git",
"state" : {
"branch" : "main",
"revision" : "4ce7a8cc23cbd93ff8f56359d4c259e952c151ff"
"revision" : "189e324004970003b74c081f20d24b7e3db52460"
}
},
{
Expand Down
Loading

0 comments on commit 12487a1

Please sign in to comment.