From d361ae23815cd7355be1ddb17d9e035772f18ab7 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Mon, 8 May 2017 14:58:46 -0400 Subject: [PATCH] Assist the user with store setup and allow continuing anyway. --- platform-darwin/External/Pearl | 2 +- .../project.pbxproj | 8 ++++++++ platform-darwin/Source/MPAppDelegate_InApp.m | 19 ++++++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/platform-darwin/External/Pearl b/platform-darwin/External/Pearl index af1cf4cb..c74e9635 160000 --- a/platform-darwin/External/Pearl +++ b/platform-darwin/External/Pearl @@ -1 +1 @@ -Subproject commit af1cf4cba3d6dc475b5095f29cedee4d9467b2b5 +Subproject commit c74e9635377568b4c8a4bd63f7b081288c8e4f49 diff --git a/platform-darwin/MasterPassword-iOS.xcodeproj/project.pbxproj b/platform-darwin/MasterPassword-iOS.xcodeproj/project.pbxproj index 78833d79..cbf2673a 100644 --- a/platform-darwin/MasterPassword-iOS.xcodeproj/project.pbxproj +++ b/platform-darwin/MasterPassword-iOS.xcodeproj/project.pbxproj @@ -38,7 +38,9 @@ 93D396BA1C74C4A06FD86437 /* PearlOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D3942A356B639724157982 /* PearlOverlay.h */; }; 93D396D8B67DA6522CDBA142 /* MPCoachmarkViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D3995B1D4DCE5A30D882BA /* MPCoachmarkViewController.m */; }; 93D397952F5635C793C24DF1 /* NSError+PearlFullDescription.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D39F9106F2CCFB94283188 /* NSError+PearlFullDescription.m */; }; + 93D397FCAAC6FA885247A4F9 /* PearlLinks.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D39FEFC296AF6E7DF8E468 /* PearlLinks.m */; }; 93D3980046016EFD05B35BC5 /* PearlUICollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D39B1D8177A86C5B9EDDE3 /* PearlUICollectionView.h */; }; + 93D39861AEE621B287EA93E9 /* PearlLinks.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D399C408B705172FA0FA02 /* PearlLinks.h */; }; 93D398ECD7D1A0DEDDADF516 /* MPEmergencyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D39ACBA9F4878B6A1CC33B /* MPEmergencyViewController.m */; }; 93D399246DC90F50913A1287 /* UIResponder+PearlFirstResponder.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D39A1DDFA09AE2E14D26DC /* UIResponder+PearlFirstResponder.m */; }; 93D3992FA1546E01F498F665 /* PearlNavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D398567FD02DB2647B8CF3 /* PearlNavigationController.h */; }; @@ -522,6 +524,7 @@ 93D399A8E3181B442D347CD7 /* MPAlgorithmV2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPAlgorithmV2.m; sourceTree = ""; }; 93D399B36CDB2004D7C51391 /* MPMessageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPMessageViewController.m; sourceTree = ""; }; 93D399C2F3D48E57C4803BDC /* NSPersistentStore+PearlMigration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSPersistentStore+PearlMigration.m"; sourceTree = ""; }; + 93D399C408B705172FA0FA02 /* PearlLinks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PearlLinks.h; sourceTree = ""; }; 93D399E571F61E50A9BF8FAF /* MPUsersViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPUsersViewController.m; sourceTree = ""; }; 93D399F244BB522A317811BB /* MPFixable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPFixable.h; sourceTree = ""; }; 93D39A1DDFA09AE2E14D26DC /* UIResponder+PearlFirstResponder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIResponder+PearlFirstResponder.m"; sourceTree = ""; }; @@ -561,6 +564,7 @@ 93D39F9106F2CCFB94283188 /* NSError+PearlFullDescription.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSError+PearlFullDescription.m"; sourceTree = ""; }; 93D39FBF8FCEB4C106272334 /* NSOrderedSetOrArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSOrderedSetOrArray.h; sourceTree = ""; }; 93D39FD9623E8D5571C0AEB3 /* MPAlgorithmV3.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPAlgorithmV3.m; sourceTree = ""; }; + 93D39FEFC296AF6E7DF8E468 /* PearlLinks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PearlLinks.m; sourceTree = ""; }; DA04E33D14B1E70400ECA4F3 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; DA071BF1190187FE00179766 /* empty@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "empty@2x.png"; sourceTree = ""; }; DA071BF2190187FE00179766 /* empty.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = empty.png; sourceTree = ""; }; @@ -3170,6 +3174,8 @@ 93D392D76C091DEA3319F11D /* UIView+AlphaScale.h */, 93D3952910EDB8E0EBC94BA9 /* UIView+Visible.m */, 93D39B7B765546B1F1900CB7 /* UIView+Visible.h */, + 93D39FEFC296AF6E7DF8E468 /* PearlLinks.m */, + 93D399C408B705172FA0FA02 /* PearlLinks.h */, ); path = "Pearl-UIKit"; sourceTree = ""; @@ -3280,6 +3286,7 @@ 93D399E4BC1E092A8C8B12AE /* NSOrderedSetOrArray.h in Headers */, 93D3959696396A91961C6148 /* UIView+AlphaScale.h in Headers */, 93D39BFB5F5F9337F6565DE3 /* UIView+Visible.h in Headers */, + 93D39861AEE621B287EA93E9 /* PearlLinks.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3995,6 +4002,7 @@ 93D392A33CCE85431E910C7B /* NSOrderedSetOrArray.m in Sources */, 93D393AA69A1193401160418 /* UIView+AlphaScale.m in Sources */, 93D3942C1B117EE4851AA7B6 /* UIView+Visible.m in Sources */, + 93D397FCAAC6FA885247A4F9 /* PearlLinks.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/platform-darwin/Source/MPAppDelegate_InApp.m b/platform-darwin/Source/MPAppDelegate_InApp.m index ed799f11..c5b10aa8 100644 --- a/platform-darwin/Source/MPAppDelegate_InApp.m +++ b/platform-darwin/Source/MPAppDelegate_InApp.m @@ -109,11 +109,28 @@ PearlAssociatedObjectProperty( NSMutableArray*, ProductObservers, productObserve @"you have a payment method added to the account and purchases are" @"not disabled under General -> Restrictions." viewStyle:UIAlertViewStyleDefault initAlert:nil - tappedButtonBlock:nil cancelTitle:@"Thanks" otherTitles:nil]; + tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) { + if (buttonIndex == alert.cancelButtonIndex) + // Cancel + return; + if (buttonIndex == alert.firstOtherButtonIndex) { + // Settings + [PearlLinks openSettingsStore]; + return; + } + + // Try Anyway + [self performPurchaseProductWithIdentifier:productIdentifier quantity:quantity]; + } cancelTitle:@"Cancel" otherTitles:@"Settings", @"Try Anyway", nil]; return; } #endif + [self performPurchaseProductWithIdentifier:productIdentifier quantity:quantity]; +} + +- (void)performPurchaseProductWithIdentifier:(NSString *)productIdentifier quantity:(NSInteger)quantity { + for (SKProduct *product in [self.products allValues]) if ([product.productIdentifier isEqualToString:productIdentifier]) { SKMutablePayment *payment = [SKMutablePayment paymentWithProduct:product];