diff --git a/src/InAppBilling.sln b/src/InAppBilling.sln index 6d868e7..9b8fbf9 100644 --- a/src/InAppBilling.sln +++ b/src/InAppBilling.sln @@ -11,7 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\nuget\readme.txt = ..\nuget\readme.txt EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin.InAppBilling", "Plugin.InAppBilling\Plugin.InAppBilling.csproj", "{C570E25E-259F-4D4C-88F0-B2982815192D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.InAppBilling", "Plugin.InAppBilling\Plugin.InAppBilling.csproj", "{C570E25E-259F-4D4C-88F0-B2982815192D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{6A41C44D-4B82-4039-B2AC-07D668168569}" ProjectSection(SolutionItems) = preProject @@ -38,6 +38,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InAppBillingTests.UWP", "In EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InAppBillingTests", "InAppBillingTests\InAppBillingTests\InAppBillingTests.csproj", "{6D4D9135-F225-4626-A9CE-32BDF97AEA89}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InAppBillingTests.Mac", "InAppBillingTests\InAppBillingTests.Mac\InAppBillingTests.Mac.csproj", "{04BF1C8C-EACA-466D-80D8-C2B9012A37F1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Ad-Hoc|Any CPU = Ad-Hoc|Any CPU @@ -328,6 +330,54 @@ Global {6D4D9135-F225-4626-A9CE-32BDF97AEA89}.Release|x64.Build.0 = Release|Any CPU {6D4D9135-F225-4626-A9CE-32BDF97AEA89}.Release|x86.ActiveCfg = Release|Any CPU {6D4D9135-F225-4626-A9CE-32BDF97AEA89}.Release|x86.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Ad-Hoc|ARM.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Ad-Hoc|x64.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Ad-Hoc|x86.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.AppStore|Any CPU.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.AppStore|Any CPU.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.AppStore|ARM.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.AppStore|ARM.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.AppStore|iPhone.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.AppStore|iPhone.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.AppStore|x64.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.AppStore|x64.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.AppStore|x86.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.AppStore|x86.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Debug|ARM.ActiveCfg = Debug|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Debug|ARM.Build.0 = Debug|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Debug|iPhone.Build.0 = Debug|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Debug|x64.ActiveCfg = Debug|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Debug|x64.Build.0 = Debug|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Debug|x86.ActiveCfg = Debug|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Debug|x86.Build.0 = Debug|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Release|Any CPU.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Release|ARM.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Release|ARM.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Release|iPhone.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Release|iPhone.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Release|x64.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Release|x64.Build.0 = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Release|x86.ActiveCfg = Release|Any CPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -337,6 +387,7 @@ Global {096CE273-B696-42E5-8770-E06FBE982235} = {5124C265-C6EF-4415-9497-0EF227E43095} {EBD6A824-A56E-4F33-B352-B4E72D711B00} = {5124C265-C6EF-4415-9497-0EF227E43095} {6D4D9135-F225-4626-A9CE-32BDF97AEA89} = {5124C265-C6EF-4415-9497-0EF227E43095} + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1} = {5124C265-C6EF-4415-9497-0EF227E43095} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {42D18242-8BA9-4238-9D59-10850E1C2C24} diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/AppDelegate.cs b/src/InAppBillingTests/InAppBillingTests.Mac/AppDelegate.cs new file mode 100644 index 0000000..f81ff1d --- /dev/null +++ b/src/InAppBillingTests/InAppBillingTests.Mac/AppDelegate.cs @@ -0,0 +1,34 @@ +using AppKit; +using Foundation; +using Xamarin.Forms; +using Xamarin.Forms.Platform.MacOS; + +namespace InAppBillingTests.Mac +{ + [Register("AppDelegate")] + public class AppDelegate : FormsApplicationDelegate + { + NSWindow window; + public AppDelegate() + { + var style = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled; + + var rect = new CoreGraphics.CGRect(200, 1000, 1024, 768); + window = new NSWindow(rect, style, NSBackingStore.Buffered, false); + window.Title = "Xamarin.Forms on Mac!"; // choose your own Title here + window.TitleVisibility = NSWindowTitleVisibility.Hidden; + } + + public override NSWindow MainWindow + { + get { return window; } + } + + public override void DidFinishLaunching(NSNotification notification) + { + Forms.Init(); + LoadApplication(new App()); + base.DidFinishLaunching(notification); + } + } +} diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png new file mode 100644 index 0000000..d0b5a80 Binary files /dev/null and b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png differ diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png new file mode 100644 index 0000000..f4c8d29 Binary files /dev/null and b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png differ diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png new file mode 100644 index 0000000..ebb5a0f Binary files /dev/null and b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png differ diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png new file mode 100644 index 0000000..0986d31 Binary files /dev/null and b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png differ diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png new file mode 100644 index 0000000..f4c8d29 Binary files /dev/null and b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png differ diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png new file mode 100644 index 0000000..a142c83 Binary files /dev/null and b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png differ diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png new file mode 100644 index 0000000..0986d31 Binary files /dev/null and b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png differ diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png new file mode 100644 index 0000000..412d6ca Binary files /dev/null and b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png differ diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png new file mode 100644 index 0000000..a142c83 Binary files /dev/null and b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png differ diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png new file mode 100644 index 0000000..e99022a Binary files /dev/null and b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png differ diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..6b28545 --- /dev/null +++ b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images": [ + { + "filename": "AppIcon-16.png", + "size": "16x16", + "scale": "1x", + "idiom": "mac" + }, + { + "filename": "AppIcon-16@2x.png", + "size": "16x16", + "scale": "2x", + "idiom": "mac" + }, + { + "filename": "AppIcon-32.png", + "size": "32x32", + "scale": "1x", + "idiom": "mac" + }, + { + "filename": "AppIcon-32@2x.png", + "size": "32x32", + "scale": "2x", + "idiom": "mac" + }, + { + "filename": "AppIcon-128.png", + "size": "128x128", + "scale": "1x", + "idiom": "mac" + }, + { + "filename": "AppIcon-128@2x.png", + "size": "128x128", + "scale": "2x", + "idiom": "mac" + }, + { + "filename": "AppIcon-256.png", + "size": "256x256", + "scale": "1x", + "idiom": "mac" + }, + { + "filename": "AppIcon-256@2x.png", + "size": "256x256", + "scale": "2x", + "idiom": "mac" + }, + { + "filename": "AppIcon-512.png", + "size": "512x512", + "scale": "1x", + "idiom": "mac" + }, + { + "filename": "AppIcon-512@2x.png", + "size": "512x512", + "scale": "2x", + "idiom": "mac" + } + ], + "info": { + "version": 1, + "author": "xcode" + } +} \ No newline at end of file diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/Contents.json b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/Contents.json new file mode 100644 index 0000000..4caf392 --- /dev/null +++ b/src/InAppBillingTests/InAppBillingTests.Mac/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Entitlements.plist b/src/InAppBillingTests/InAppBillingTests.Mac/Entitlements.plist new file mode 100644 index 0000000..9ae5993 --- /dev/null +++ b/src/InAppBillingTests/InAppBillingTests.Mac/Entitlements.plist @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/InAppBillingTests.Mac.csproj b/src/InAppBillingTests/InAppBillingTests.Mac/InAppBillingTests.Mac.csproj new file mode 100644 index 0000000..b6f2fea --- /dev/null +++ b/src/InAppBillingTests/InAppBillingTests.Mac/InAppBillingTests.Mac.csproj @@ -0,0 +1,102 @@ + + + + Debug + AnyCPU + {04BF1C8C-EACA-466D-80D8-C2B9012A37F1} + {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Exe + InAppBillingTests.Mac + iaptestmac + v2.0 + Xamarin.Mac + Resources + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + Mac Developer + false + false + false + true + true + true + + + + pdbonly + true + bin\Release + + prompt + 4 + false + true + false + true + true + true + Entitlements.plist + SdkOnly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ViewController.cs + + + + + + + + + + + + {6D4D9135-F225-4626-A9CE-32BDF97AEA89} + InAppBillingTests + + + {C570E25E-259F-4D4C-88F0-B2982815192D} + Plugin.InAppBilling + + + + \ No newline at end of file diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Info.plist b/src/InAppBillingTests/InAppBillingTests.Mac/Info.plist new file mode 100644 index 0000000..488a7e4 --- /dev/null +++ b/src/InAppBillingTests/InAppBillingTests.Mac/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleName + iaptestmac + CFBundleIdentifier + com.refractored.iaptest + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + 10.14 + CFBundleDevelopmentRegion + en + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + NSHumanReadableCopyright + + NSPrincipalClass + NSApplication + NSMainStoryboardFile + Main + XSAppIconAssets + Assets.xcassets/AppIcon.appiconset + + diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Main.cs b/src/InAppBillingTests/InAppBillingTests.Mac/Main.cs new file mode 100644 index 0000000..a2bca16 --- /dev/null +++ b/src/InAppBillingTests/InAppBillingTests.Mac/Main.cs @@ -0,0 +1,14 @@ +using AppKit; + +namespace InAppBillingTests.Mac +{ + static class MainClass + { + static void Main(string[] args) + { + NSApplication.Init(); + NSApplication.SharedApplication.Delegate = new AppDelegate(); + NSApplication.Main(args); + } + } +} diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/Main.storyboard b/src/InAppBillingTests/InAppBillingTests.Mac/Main.storyboard new file mode 100644 index 0000000..9d27dc9 --- /dev/null +++ b/src/InAppBillingTests/InAppBillingTests.Mac/Main.storyboard @@ -0,0 +1,713 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/ViewController.cs b/src/InAppBillingTests/InAppBillingTests.Mac/ViewController.cs new file mode 100644 index 0000000..60e2854 --- /dev/null +++ b/src/InAppBillingTests/InAppBillingTests.Mac/ViewController.cs @@ -0,0 +1,34 @@ +using System; + +using AppKit; +using Foundation; + +namespace InAppBillingTests.Mac +{ + public partial class ViewController : NSViewController + { + public ViewController(IntPtr handle) : base(handle) + { + } + + public override void ViewDidLoad() + { + base.ViewDidLoad(); + + // Do any additional setup after loading the view. + } + + public override NSObject RepresentedObject + { + get + { + return base.RepresentedObject; + } + set + { + base.RepresentedObject = value; + // Update the view, if already loaded. + } + } + } +} diff --git a/src/InAppBillingTests/InAppBillingTests.Mac/ViewController.designer.cs b/src/InAppBillingTests/InAppBillingTests.Mac/ViewController.designer.cs new file mode 100644 index 0000000..d71b1ae --- /dev/null +++ b/src/InAppBillingTests/InAppBillingTests.Mac/ViewController.designer.cs @@ -0,0 +1,18 @@ +// WARNING +// +// This file has been generated automatically by Xamarin Studio to store outlets and +// actions made in the UI designer. If it is removed, they will be lost. +// Manual changes to this file may not be handled correctly. +// +using Foundation; + +namespace InAppBillingTests.Mac +{ + [Register("ViewController")] + partial class ViewController + { + void ReleaseDesignerOutlets() + { + } + } +} diff --git a/src/Plugin.InAppBilling/InAppBilling.apple.cs b/src/Plugin.InAppBilling/InAppBilling.apple.cs index d4b36eb..24318db 100644 --- a/src/Plugin.InAppBilling/InAppBilling.apple.cs +++ b/src/Plugin.InAppBilling/InAppBilling.apple.cs @@ -5,7 +5,6 @@ using System.Diagnostics; using System.Linq; using System.Threading.Tasks; -using UIKit; namespace Plugin.InAppBilling { @@ -15,7 +14,27 @@ namespace Plugin.InAppBilling [Preserve(AllMembers = true)] public class InAppBillingImplementation : BaseInAppBilling { - static bool IsiOS112 => UIDevice.CurrentDevice.CheckSystemVersion(11, 2); +#if __IOS__ || __TVOS__ + static bool HasIntroductoryPrice => UIKit.UIDevice.CurrentDevice.CheckSystemVersion(11, 2); +#else + static bool initIntro, hasIntro; + static bool HasIntroductoryPrice + { + get + { + if (initIntro) + return hasIntro; + + initIntro = true; + + + using var info = new NSProcessInfo(); + hasIntro = info.IsOperatingSystemAtLeastVersion(new NSOperatingSystemVersion(10,13,2)); + return hasIntro; + + } + } +#endif /// /// Gets or sets a callback for out of band purchases to complete. @@ -38,13 +57,15 @@ public InAppBillingImplementation() /// public override bool InTestingMode { get; set; } - /// - /// Get product information of a specific product - /// - /// Sku or Id of the product(s) - /// Type of product offering - /// - public async override Task> GetProductInfoAsync(ItemType itemType, params string[] productIds) + public IntPtr Handle => throw new NotImplementedException(); + + /// + /// Get product information of a specific product + /// + /// Sku or Id of the product(s) + /// Type of product offering + /// + public async override Task> GetProductInfoAsync(ItemType itemType, params string[] productIds) { var products = await GetProductAsync(productIds); @@ -56,8 +77,8 @@ public async override Task> GetProductInfoAsync ProductId = p.ProductIdentifier, Description = p.LocalizedDescription, CurrencyCode = p.PriceLocale?.CurrencyCode ?? string.Empty, - LocalizedIntroductoryPrice = IsiOS112 ? (p.IntroductoryPrice?.LocalizedPrice() ?? string.Empty) : string.Empty, - MicrosIntroductoryPrice = IsiOS112 ? (long)((p.IntroductoryPrice?.Price?.DoubleValue ?? 0) * 1000000d) : 0 + LocalizedIntroductoryPrice = HasIntroductoryPrice ? (p.IntroductoryPrice?.LocalizedPrice() ?? string.Empty) : string.Empty, + MicrosIntroductoryPrice = HasIntroductoryPrice ? (long)((p.IntroductoryPrice?.Price?.DoubleValue ?? 0) * 1000000d) : 0 }); } @@ -175,7 +196,9 @@ public async override Task PurchaseAsync(string productId, Id = p.TransactionIdentifier, ProductId = p.Payment?.ProductIdentifier ?? string.Empty, State = p.GetPurchaseState(), +#if __IOS__ || __TVOS__ PurchaseToken = p.TransactionReceipt?.GetBase64EncodedString(NSDataBase64EncodingOptions.None) ?? string.Empty +#endif }; if (verifyPurchase == null) @@ -203,7 +226,9 @@ Task ValidateReceipt(IInAppBillingVerifyPurchase verifyPurchase, string pr } - Task PurchaseAsync(string productId) + TaskCompletionSource productTCS; + + async Task PurchaseAsync(string productId) { var tcsTransaction = new TaskCompletionSource(); @@ -257,13 +282,27 @@ Task PurchaseAsync(string productId) paymentObserver.TransactionCompleted += handler; +#if __IOS__ || __TVOS__ + var payment = SKPayment.CreateFrom(productId); +#else + + var products = await GetProductAsync(new[] { productId }); + var product = products?.FirstOrDefault(); + if (product == null) + throw new InAppBillingPurchaseException(PurchaseError.InvalidProduct); + + var payment = SKPayment.CreateFrom(product); + //var payment = SKPayment.CreateFrom((SKProduct)SKProduct.FromObject(new NSString(productId))); +#endif SKPaymentQueue.DefaultQueue.AddPayment(payment); - return tcsTransaction.Task; + return await tcsTransaction.Task; } + + /// /// Consume a purchase with a purchase token. /// @@ -341,6 +380,7 @@ public override void Dispose(bool disposing) base.Dispose(disposing); } + } @@ -471,11 +511,15 @@ public static InAppBillingPurchase ToIABPurchase(this SKPaymentTransaction trans if (p == null) return null; +#if __IOS__ || __TVOS__ var finalToken = p.TransactionReceipt?.GetBase64EncodedString(NSDataBase64EncodingOptions.None); if (string.IsNullOrEmpty(finalToken)) finalToken = transaction.TransactionReceipt?.GetBase64EncodedString(NSDataBase64EncodingOptions.None); - return new InAppBillingPurchase +#else + var finalToken = string.Empty; +#endif + return new InAppBillingPurchase { TransactionDateUtc = NSDateToDateTimeUtc(transaction.TransactionDate), Id = p.TransactionIdentifier, diff --git a/src/Plugin.InAppBilling/Plugin.InAppBilling.csproj b/src/Plugin.InAppBilling/Plugin.InAppBilling.csproj index b9471e2..cd4c861 100644 --- a/src/Plugin.InAppBilling/Plugin.InAppBilling.csproj +++ b/src/Plugin.InAppBilling/Plugin.InAppBilling.csproj @@ -1,6 +1,6 @@  - netstandard2.0;MonoAndroid10.0;Xamarin.iOS10;Xamarin.TVOS10 + netstandard2.0;MonoAndroid10.0;Xamarin.iOS10;Xamarin.TVOS10;Xamarin.Mac20 $(TargetFrameworks);uap10.0.16299; Plugin.InAppBilling Plugin.InAppBilling @@ -61,6 +61,7 @@ + @@ -77,7 +78,7 @@ - + @@ -90,4 +91,8 @@ + + + + \ No newline at end of file diff --git a/src/Plugin.InAppBilling/Shared/BaseInAppBilling.shared.cs b/src/Plugin.InAppBilling/Shared/BaseInAppBilling.shared.cs index 2d03e80..7f2dbde 100644 --- a/src/Plugin.InAppBilling/Shared/BaseInAppBilling.shared.cs +++ b/src/Plugin.InAppBilling/Shared/BaseInAppBilling.shared.cs @@ -9,7 +9,6 @@ namespace Plugin.InAppBilling /// Base implementation for In App Billing, handling disposables /// - public abstract class BaseInAppBilling : IInAppBilling, IDisposable { ///