Show purchase transaction failures to the user.
This commit is contained in:
		@@ -158,13 +158,13 @@ PearlAssociatedObjectProperty( NSMutableArray*, ProductObservers, productObserve
 | 
			
		||||
 | 
			
		||||
- (void)request:(SKRequest *)request didFailWithError:(NSError *)error {
 | 
			
		||||
 | 
			
		||||
    MPError( error, @"StoreKit request (%@) failed.", request );
 | 
			
		||||
    MPError( error, @"StoreKit request failed." );
 | 
			
		||||
 | 
			
		||||
#if TARGET_OS_IPHONE
 | 
			
		||||
    PearlMainQueue( ^{
 | 
			
		||||
        UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"Purchase Failed" message:
 | 
			
		||||
                        strf( @"%@\n\n%@", error.localizedDescription,
 | 
			
		||||
                                @"Ensure you are online and try logging out and back into iTunes from your device's Settings." )
 | 
			
		||||
                                @"Could not reach Apple's iTunes Store.  Make sure you're connected to the Internet and try again." )
 | 
			
		||||
                                                                     preferredStyle:UIAlertControllerStyleAlert];
 | 
			
		||||
        [controller addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]];
 | 
			
		||||
        [self.window.rootViewController presentViewController:controller animated:YES completion:nil];
 | 
			
		||||
@@ -222,6 +222,17 @@ PearlAssociatedObjectProperty( NSMutableArray*, ProductObservers, productObserve
 | 
			
		||||
                MPError( transaction.error, @"Transaction failed: %@.", transaction.payment.productIdentifier );
 | 
			
		||||
                [queue finishTransaction:transaction];
 | 
			
		||||
 | 
			
		||||
#if TARGET_OS_IPHONE
 | 
			
		||||
                PearlMainQueue( ^{
 | 
			
		||||
                    UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"Purchase Failed" message:
 | 
			
		||||
                                    strf( @"%@\n\n%@", transaction.error.localizedDescription,
 | 
			
		||||
                                            @"Could not reach Apple's iTunes Store.  Make sure you're connected to the Internet and try again." )
 | 
			
		||||
                                                                                 preferredStyle:UIAlertControllerStyleAlert];
 | 
			
		||||
                    [controller addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]];
 | 
			
		||||
                    [self.window.rootViewController presentViewController:controller animated:YES completion:nil];
 | 
			
		||||
                } );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
                SKProduct *product = self.products[transaction.payment.productIdentifier];
 | 
			
		||||
                [Countly.sharedInstance recordEvent:@"purchase" segmentation:@{
 | 
			
		||||
                        @"id": product.productIdentifier,
 | 
			
		||||
 
 | 
			
		||||
@@ -249,7 +249,7 @@
 | 
			
		||||
                masterPassword = PearlAwait( ^(void (^setResult)(id)) {
 | 
			
		||||
                    PearlMainQueue( ^{
 | 
			
		||||
                        UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"Enter Old Master Password" message:
 | 
			
		||||
                                        strf( @"Your old master password is required to unlock the stored password for %@", site.name )
 | 
			
		||||
                                        strf( @"Your old master password is required to unlock the stored password for: <%@>", site.name )
 | 
			
		||||
                                                                                     preferredStyle:UIAlertControllerStyleAlert];
 | 
			
		||||
                        [controller addTextFieldWithConfigurationHandler:nil];
 | 
			
		||||
                        [controller addAction:[UIAlertAction actionWithTitle:@"Migrate" style:UIAlertActionStyleDefault handler:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user