From e88a533d3213c8a09e54e86630e304f2c114508e Mon Sep 17 00:00:00 2001 From: Pascal Harris Date: Thu, 11 May 2017 19:18:55 +0100 Subject: [PATCH 01/10] Working registration system for off-store MailRaider Pro --- FsprgEmbeddedStore/FsprgStoreParameters.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/FsprgEmbeddedStore/FsprgStoreParameters.m b/FsprgEmbeddedStore/FsprgStoreParameters.m index caede0a..0e5a361 100755 --- a/FsprgEmbeddedStore/FsprgStoreParameters.m +++ b/FsprgEmbeddedStore/FsprgStoreParameters.m @@ -124,13 +124,14 @@ - (NSURL *)toURL productIdEncoded = @""; } + NSString *urlAsStr; if([kFsprgOrderProcessDetail isEqualTo:[self orderProcessType]]) { - NSString *protocol = @"http"; - if([self hasContactDefaults]) { - protocol = @"https"; - } - urlAsStr = [NSString stringWithFormat:@"%@://sites.fastspring.com/%@/product/%@", protocol, storeIdEncoded, productIdEncoded]; +// NSString *protocol = @"http"; +// if([self hasContactDefaults]) { +// protocol = @"https"; +// } + urlAsStr = [NSString stringWithFormat:@"https://sites.fastspring.com/%@/product/%@", storeIdEncoded, productIdEncoded]; } else if([kFsprgOrderProcessInstant isEqualTo:[self orderProcessType]]) { urlAsStr = [NSString stringWithFormat:@"https://sites.fastspring.com/%@/instant/%@", storeIdEncoded, productIdEncoded]; } else if ([kFsprgOrderProcessCheckout isEqualTo:[self orderProcessType]]) { From 38756b3c7ba4cd52c15def8bdfb08bcf96b83779 Mon Sep 17 00:00:00 2001 From: Pascal Harris Date: Thu, 8 Jun 2017 11:37:16 +0100 Subject: [PATCH 02/10] Update to add automatic opening of attachment drawer in pro version, if required. --- FsprgEmbeddedStore/Model/FsprgOrder.m | 1 + 1 file changed, 1 insertion(+) diff --git a/FsprgEmbeddedStore/Model/FsprgOrder.m b/FsprgEmbeddedStore/Model/FsprgOrder.m index 2164f8e..2d34d13 100644 --- a/FsprgEmbeddedStore/Model/FsprgOrder.m +++ b/FsprgEmbeddedStore/Model/FsprgOrder.m @@ -105,6 +105,7 @@ - (NSString *)customerEmail - (FsprgOrderItem *)firstOrderItem { NSArray *items = [[self raw] valueForKey:@"OrderItems"]; +// NSLog(@"%@",items); return [FsprgOrderItem itemWithDictionary:[items objectAtIndex:0]]; } From 737841031d065443627e9cbcd200e453025f0206 Mon Sep 17 00:00:00 2001 From: Pascal Harris Date: Thu, 15 Jun 2017 16:34:34 +0100 Subject: [PATCH 03/10] Updated to enable saving metadata to eml as an option --- FsprgEmbeddedStore/FsprgStoreParameters.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FsprgEmbeddedStore/FsprgStoreParameters.m b/FsprgEmbeddedStore/FsprgStoreParameters.m index 0e5a361..c27debd 100755 --- a/FsprgEmbeddedStore/FsprgStoreParameters.m +++ b/FsprgEmbeddedStore/FsprgStoreParameters.m @@ -140,7 +140,7 @@ - (NSURL *)toURL NSAssert1(FALSE, @"OrderProcessType '%@' unknown.", [self orderProcessType]); return nil; } - + NSMutableArray *keys = [NSMutableArray arrayWithArray:[[self raw] allKeys]]; [keys removeObject:kOrderProcessType]; [keys removeObject:kStoreId]; From 91f165b897328b8601867e1fb4b5feb6cd1091eb Mon Sep 17 00:00:00 2001 From: Pascal Harris Date: Thu, 26 Apr 2018 14:59:01 +0100 Subject: [PATCH 04/10] Version 3.22 This version of MailRaider includes: * New functionality to extract to a PDF archive, consisting of a folder containing the email message in PDF format and all attachments. * Bug fix to correctly extract msg file attachments which contain 'RE:' in the message name. * Bug fix to better extract msg files containing malformed RTF data. * Other miscellaneous bug Fixes* Code cleanup --- FsprgEmbeddedStore/FsprgEmbeddedStoreController.m | 2 +- FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m | 2 +- FsprgEmbeddedStore/FsprgStoreParameters.m | 2 +- FsprgEmbeddedStore/Model/FsprgFileDownload.m | 2 +- FsprgEmbeddedStore/Model/FsprgFulfillment.m | 2 +- FsprgEmbeddedStore/Model/FsprgLicense.m | 2 +- FsprgEmbeddedStore/Model/FsprgOrder.m | 2 +- FsprgEmbeddedStore/Model/FsprgOrderItem.m | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m index b2c40fe..335b756 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m @@ -43,7 +43,7 @@ + (void)initialize - (id) init { - self = [super init]; + self = super.init; if (self != nil) { [self setWebView:nil]; [self setDelegate:nil]; diff --git a/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m b/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m index f8e88ff..8b4e0b4 100644 --- a/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m +++ b/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m @@ -14,7 +14,7 @@ @implementation FsprgOrderDocumentRepresentation - (id) init { - self = [super init]; + self = super.init; if (self != nil) { [self setOrder:nil]; } diff --git a/FsprgEmbeddedStore/FsprgStoreParameters.m b/FsprgEmbeddedStore/FsprgStoreParameters.m index c27debd..c8000ff 100755 --- a/FsprgEmbeddedStore/FsprgStoreParameters.m +++ b/FsprgEmbeddedStore/FsprgStoreParameters.m @@ -83,7 +83,7 @@ + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key - (id)initWithRaw:(NSMutableDictionary *)aRaw { - self = [super init]; + self = super.init; if (self != nil) { [self setRaw:aRaw]; } diff --git a/FsprgEmbeddedStore/Model/FsprgFileDownload.m b/FsprgEmbeddedStore/Model/FsprgFileDownload.m index f36825f..77aad6d 100644 --- a/FsprgEmbeddedStore/Model/FsprgFileDownload.m +++ b/FsprgEmbeddedStore/Model/FsprgFileDownload.m @@ -18,7 +18,7 @@ + (FsprgFileDownload *)fileDownloadWithDictionary:(NSDictionary *)aDictionary - (FsprgFileDownload *)initWithDictionary:(NSDictionary *)aDictionary { - self = [super init]; + self = super.init; if (self != nil) { [self setRaw:aDictionary]; } diff --git a/FsprgEmbeddedStore/Model/FsprgFulfillment.m b/FsprgEmbeddedStore/Model/FsprgFulfillment.m index 1745458..a4737ef 100644 --- a/FsprgEmbeddedStore/Model/FsprgFulfillment.m +++ b/FsprgEmbeddedStore/Model/FsprgFulfillment.m @@ -20,7 +20,7 @@ + (FsprgFulfillment *)fulfillmentWithDictionary:(NSDictionary *)aDictionary - (FsprgFulfillment *)initWithDictionary:(NSDictionary *)aDictionary { - self = [super init]; + self = super.init; if (self != nil) { [self setRaw:aDictionary]; } diff --git a/FsprgEmbeddedStore/Model/FsprgLicense.m b/FsprgEmbeddedStore/Model/FsprgLicense.m index 0bd919c..5c54f8f 100644 --- a/FsprgEmbeddedStore/Model/FsprgLicense.m +++ b/FsprgEmbeddedStore/Model/FsprgLicense.m @@ -18,7 +18,7 @@ + (FsprgLicense *)licenseWithDictionary:(NSDictionary *)aDictionary - (FsprgLicense *)initWithDictionary:(NSDictionary *)aDictionary { - self = [super init]; + self = super.init; if (self != nil) { [self setRaw:aDictionary]; } diff --git a/FsprgEmbeddedStore/Model/FsprgOrder.m b/FsprgEmbeddedStore/Model/FsprgOrder.m index 2d34d13..5f25e6d 100644 --- a/FsprgEmbeddedStore/Model/FsprgOrder.m +++ b/FsprgEmbeddedStore/Model/FsprgOrder.m @@ -34,7 +34,7 @@ + (FsprgOrder *)orderFromData:(NSData *)aData - (FsprgOrder *)initWithDictionary:(NSDictionary *)aDictionary { - self = [super init]; + self = super.init; if (self != nil) { [self setRaw:aDictionary]; } diff --git a/FsprgEmbeddedStore/Model/FsprgOrderItem.m b/FsprgEmbeddedStore/Model/FsprgOrderItem.m index 9a13cf2..beebcb1 100644 --- a/FsprgEmbeddedStore/Model/FsprgOrderItem.m +++ b/FsprgEmbeddedStore/Model/FsprgOrderItem.m @@ -18,7 +18,7 @@ + (FsprgOrderItem *)itemWithDictionary:(NSDictionary *)aDictionary - (FsprgOrderItem *)initWithDictionary:(NSDictionary *)aDictionary { - self = [super init]; + self = super.init; if (self != nil) { [self setRaw:aDictionary]; } From 38895d782a63337707456997f7cc224511008cc4 Mon Sep 17 00:00:00 2001 From: Pascal Harris Date: Fri, 5 Feb 2021 16:41:47 +0000 Subject: [PATCH 05/10] Removal of the majority of deprecations --- .../FsprgEmbeddedStoreController.m | 20 +++++++++---------- FsprgEmbeddedStore/FsprgOrderView.m | 4 ++-- FsprgEmbeddedStore/FsprgStoreParameters.m | 18 ++++++++--------- FsprgEmbeddedStore/Model/FsprgFulfillment.m | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m index 335b756..b293419 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m @@ -66,7 +66,7 @@ - (void)setWebView:(WebView *)aWebView [webView setUIDelegate:nil]; [webView setResourceLoadDelegate:nil]; [webView setApplicationNameForUserAgent:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self]; + [NSNotificationCenter.defaultCenter removeObserver:self]; [webView release]; webView = [aWebView retain]; @@ -77,15 +77,15 @@ - (void)setWebView:(WebView *)aWebView [webView setUIDelegate:self]; [webView setResourceLoadDelegate:self]; [webView setApplicationNameForUserAgent:@"FSEmbeddedStore/2.0"]; - [[NSNotificationCenter defaultCenter] addObserver:self + [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(webViewFrameChanged:) name:NSViewFrameDidChangeNotification object:webView]; - [[NSNotificationCenter defaultCenter] addObserver:self + [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(estimatedLoadingProgressChanged:) name:WebViewProgressStartedNotification object:webView]; - [[NSNotificationCenter defaultCenter] addObserver:self + [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(estimatedLoadingProgressChanged:) name:WebViewProgressEstimateChangedNotification object:webView]; @@ -95,7 +95,7 @@ - (void)setWebView:(WebView *)aWebView - (id )delegate { - if(delegate == nil) { + if (delegate == nil) { NSLog(@"No delegate has been assigned to FsprgEmbeddedStoreController!"); } return delegate; @@ -131,7 +131,7 @@ - (void)loadWithContentsOfFile:(NSString *)aPath [self setStoreHost:nil]; NSData *data = [NSData dataWithContentsOfFile:aPath]; - if(data == nil) { + if (data == nil) { NSLog(@"File %@ not found.", aPath); } else { [[webView mainFrame] loadData:data MIMEType:@"application/x-fsprgorder+xml" textEncodingName:@"UTF-8" baseURL:nil]; @@ -202,7 +202,7 @@ - (void)resizeContentDivE } DOMElement *resizableContentE = [[[[self webView] mainFrame] DOMDocument] getElementById:@"FsprgResizableContent"]; - if(resizableContentE == nil) { + if (resizableContentE == nil) { return; } @@ -263,14 +263,14 @@ - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame newStoreHost = [newURL host]; } - if([self storeHost] == nil) { + if ([self storeHost] == nil) { [self setStoreHost:newStoreHost]; [[self delegate] didLoadStore:newURL]; } else { FsprgPageType newPageType; - if([newStoreHost isEqualTo:[self storeHost]]) { + if ([newStoreHost isEqualTo:[self storeHost]]) { newPageType = FsprgPageFS; - } else if([newStoreHost hasSuffix:@"paypal.com"]) { + } else if ([newStoreHost hasSuffix:@"paypal.com"]) { newPageType = FsprgPagePayPal; } else { newPageType = FsprgPageUnknown; diff --git a/FsprgEmbeddedStore/FsprgOrderView.m b/FsprgEmbeddedStore/FsprgOrderView.m index 53bda55..2898593 100644 --- a/FsprgEmbeddedStore/FsprgOrderView.m +++ b/FsprgEmbeddedStore/FsprgOrderView.m @@ -53,7 +53,7 @@ - (void)setNeedsLayout:(BOOL)flag - (void)drawRect:(NSRect)aRect { - if([self needsLayout]) { + if ([self needsLayout]) { [self setNeedsLayout:FALSE]; [self layout]; } @@ -62,7 +62,7 @@ - (void)drawRect:(NSRect)aRect - (void)layout { - if([[self subviews] count] == 0) { + if ([[self subviews] count] == 0) { [self setFrame:[[self superview] frame]]; FsprgOrderDocumentRepresentation *representation = (FsprgOrderDocumentRepresentation *)[[self dataSource] representation]; diff --git a/FsprgEmbeddedStore/FsprgStoreParameters.m b/FsprgEmbeddedStore/FsprgStoreParameters.m index c8000ff..464a0f7 100755 --- a/FsprgEmbeddedStore/FsprgStoreParameters.m +++ b/FsprgEmbeddedStore/FsprgStoreParameters.m @@ -74,7 +74,7 @@ + (FsprgStoreParameters *)parametersWithRaw:(NSMutableDictionary *)aRaw + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { NSSet *keyPaths = [keyPathsForValuesAffecting valueForKey:key]; - if(keyPaths == nil) { + if (keyPaths == nil) { return [NSSet set]; } else { return keyPaths; @@ -116,23 +116,23 @@ - (NSURLRequest *)toURLRequest - (NSURL *)toURL { NSString *storeIdEncoded = [[self storeId] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - if(storeIdEncoded == nil) { + if (storeIdEncoded == nil) { storeIdEncoded = @""; } NSString *productIdEncoded = [[self productId] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - if(productIdEncoded == nil) { + if (productIdEncoded == nil) { productIdEncoded = @""; } NSString *urlAsStr; - if([kFsprgOrderProcessDetail isEqualTo:[self orderProcessType]]) { + if ([kFsprgOrderProcessDetail isEqualTo:[self orderProcessType]]) { // NSString *protocol = @"http"; -// if([self hasContactDefaults]) { +// if ([self hasContactDefaults]) { // protocol = @"https"; // } urlAsStr = [NSString stringWithFormat:@"https://sites.fastspring.com/%@/product/%@", storeIdEncoded, productIdEncoded]; - } else if([kFsprgOrderProcessInstant isEqualTo:[self orderProcessType]]) { + } else if ([kFsprgOrderProcessInstant isEqualTo:[self orderProcessType]]) { urlAsStr = [NSString stringWithFormat:@"https://sites.fastspring.com/%@/instant/%@", storeIdEncoded, productIdEncoded]; } else if ([kFsprgOrderProcessCheckout isEqualTo:[self orderProcessType]]) { urlAsStr = [NSString stringWithFormat:@"https://sites.fastspring.com/%@/checkout/%@", storeIdEncoded, productIdEncoded]; @@ -152,14 +152,14 @@ - (NSURL *)toURL for (i = 0; i < count; i++) { NSString *key = [keys objectAtIndex:i]; NSString *value = [[self raw] valueForKey:key]; - if(value != nil) { + if (value != nil) { queryStr = [queryStr stringByAppendingFormat:@"&%@=%@", key, [value stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; } } - if([queryStr length] > 0) { + if ([queryStr length] > 0) { urlAsStr = [NSString stringWithFormat:@"%@?%@", urlAsStr, [queryStr substringFromIndex:1]]; } @@ -168,7 +168,7 @@ - (NSURL *)toURL - (void)setObject:(NSString *)anObject forKey:(NSString *)aKey { - if(anObject == nil) { + if (anObject == nil) { [[self raw] removeObjectForKey:aKey]; } else { [[self raw] setObject:anObject forKey:aKey]; diff --git a/FsprgEmbeddedStore/Model/FsprgFulfillment.m b/FsprgEmbeddedStore/Model/FsprgFulfillment.m index a4737ef..07f3dbe 100644 --- a/FsprgEmbeddedStore/Model/FsprgFulfillment.m +++ b/FsprgEmbeddedStore/Model/FsprgFulfillment.m @@ -43,10 +43,10 @@ - (id)valueForKey:(NSString *)aKey { NSDictionary *anItem = [[self raw] valueForKey:aKey]; - if([[anItem valueForKey:@"FulfillmentType"] isEqual:@"License"]) { + if ([[anItem valueForKey:@"FulfillmentType"] isEqual:@"License"]) { return [FsprgLicense licenseWithDictionary:anItem]; } - if([[anItem valueForKey:@"FulfillmentType"] isEqual:@"File"]) { + if ([[anItem valueForKey:@"FulfillmentType"] isEqual:@"File"]) { return [FsprgFileDownload fileDownloadWithDictionary:anItem]; } From 2c0d23b281f3f926839e1790d8829f9516a291c3 Mon Sep 17 00:00:00 2001 From: 45RPM Software Date: Tue, 15 Feb 2022 11:45:27 +0000 Subject: [PATCH 06/10] Updated - working version for distribution. --- FsprgEmbeddedStore/FsprgEmbeddedStore.h | 14 +- .../FsprgEmbeddedStoreController.h | 16 +- .../FsprgEmbeddedStoreController.m | 140 +++++++++--------- .../FsprgEmbeddedStoreDelegate.h | 4 +- .../FsprgOrderDocumentRepresentation.h | 3 +- .../FsprgOrderDocumentRepresentation.m | 16 +- FsprgEmbeddedStore/FsprgOrderView.h | 6 +- FsprgEmbeddedStore/FsprgOrderView.m | 26 ++-- FsprgEmbeddedStore/FsprgStoreParameters.h | 61 +++----- FsprgEmbeddedStore/FsprgStoreParameters.m | 112 +++++++------- FsprgEmbeddedStore/Model/FsprgFileDownload.h | 7 +- FsprgEmbeddedStore/Model/FsprgFileDownload.m | 23 +-- FsprgEmbeddedStore/Model/FsprgFulfillment.h | 5 +- FsprgEmbeddedStore/Model/FsprgFulfillment.m | 26 ++-- FsprgEmbeddedStore/Model/FsprgLicense.h | 19 ++- FsprgEmbeddedStore/Model/FsprgLicense.m | 33 +++-- FsprgEmbeddedStore/Model/FsprgOrder.h | 31 ++-- FsprgEmbeddedStore/Model/FsprgOrder.m | 76 +++++----- FsprgEmbeddedStore/Model/FsprgOrderItem.h | 25 ++-- FsprgEmbeddedStore/Model/FsprgOrderItem.m | 40 ++--- 20 files changed, 337 insertions(+), 346 deletions(-) diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStore.h b/FsprgEmbeddedStore/FsprgEmbeddedStore.h index 900e197..143f80d 100644 --- a/FsprgEmbeddedStore/FsprgEmbeddedStore.h +++ b/FsprgEmbeddedStore/FsprgEmbeddedStore.h @@ -2,15 +2,21 @@ // FsprgEmbeddedStore.h // FsprgEmbeddedStore // -// Created by Lars Steiger on 2/28/10. -// Copyright 2010 FastSpring. All rights reserved. +// Created by Luc Vandal on 2016-07-19. +// Copyright © 2016 Edovia Inc. All rights reserved. // +#import + +//! Project version number for FsprgEmbeddedStore. +FOUNDATION_EXPORT double FsprgEmbeddedStoreVersionNumber; + +//! Project version string for FsprgEmbeddedStore. +FOUNDATION_EXPORT const unsigned char FsprgEmbeddedStoreVersionString[]; #import "FsprgEmbeddedStoreController.h" #import "FsprgEmbeddedStoreDelegate.h" #import "FsprgStoreParameters.h" - -// Model +// Mode" #import "FsprgOrder.h" #import "FsprgOrderItem.h" #import "FsprgFulfillment.h" diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.h b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.h index 983685b..ae2f1ea 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.h +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.h @@ -21,19 +21,17 @@ NSMutableDictionary *hostCertificates; } -- (WebView *)webView; +@property (NS_NONATOMIC_IOSONLY, strong) WebView *webView; /*! * Connects this controller to a web view. * @param aWebView Web view to connect. */ -- (void)setWebView:(WebView *)aWebView; -- (id )delegate; +@property (NS_NONATOMIC_IOSONLY, assign) id delegate; /*! * Sets a delegate to which it has a weak reference. * @param aDelegate Delegate to set. */ -- (void)setDelegate:(id )aDelegate; /*! * Loads the store using the given parameters. @@ -51,30 +49,30 @@ * Useful to trigger e.g. the hidden flag of a progress bar. * @result TRUE if loading a page. */ -- (BOOL)isLoading; +@property (NS_NONATOMIC_IOSONLY, getter=isLoading, readonly) BOOL loading; /*! * Useful to provide the value for a progress bar. * @result The loading progress in percent of a page (0 - 100) */ -- (double)estimatedLoadingProgress; +@property (NS_NONATOMIC_IOSONLY, readonly) double estimatedLoadingProgress; /** * Useful to show a secure icon. * @result TRUE if connection is secure (SSL) */ -- (BOOL)isSecure; +@property (NS_NONATOMIC_IOSONLY, getter=isSecure, readonly) BOOL secure; /** * * @result NSArray containing SecCertificateRef objects for the host of the main frame, if it was loaded via https. */ -- (NSArray *)securityCertificates; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *securityCertificates; /*! * Host that delivers the store (e.g. sites.fastspring.com). * @result nil until the store has been loaded. */ -- (NSString *)storeHost; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *storeHost; @end diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m index b293419..9b46de1 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m @@ -11,7 +11,7 @@ #import "FsprgOrderDocumentRepresentation.h" // We don't retrieve SSL certificates below OSX 10.6 -#define RETRIEVE_SSL_CERTIFICATES defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 +//#define RETRIEVE_SSL_CERTIFICATES defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 @interface FsprgEmbeddedStoreController () @@ -21,15 +21,14 @@ - (void)setIsSecure:(BOOL)aFlag; - (void)setStoreHost:(NSString *)aHost; - (void)resizeContentDivE; - (void)webViewFrameChanged:(NSNotification *)aNotification; -- (NSMutableDictionary *)hostCertificates; -- (void)setHostCertificates:(NSMutableDictionary *)aHostCertificates; +@property (nonatomic, copy) NSMutableDictionary *hostCertificates; @end -#if defined(MAC_OS_X_VERSION_10_11) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11 +//#if defined(MAC_OS_X_VERSION_10_11) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11 @interface FsprgEmbeddedStoreController () @end -#endif +//#endif @implementation FsprgEmbeddedStoreController @@ -41,21 +40,21 @@ + (void)initialize forMIMEType:@"application/x-fsprgorder+xml"]; } -- (id) init +- (instancetype) init { - self = super.init; + self = [super init]; if (self != nil) { [self setWebView:nil]; [self setDelegate:nil]; [self setStoreHost:nil]; - [self setHostCertificates:[NSMutableDictionary dictionary]]; + self.hostCertificates = [NSMutableDictionary dictionary]; } return self; } - (WebView *)webView { - return [[webView retain] autorelease]; + return webView; } - (void)setWebView:(WebView *)aWebView @@ -66,26 +65,25 @@ - (void)setWebView:(WebView *)aWebView [webView setUIDelegate:nil]; [webView setResourceLoadDelegate:nil]; [webView setApplicationNameForUserAgent:nil]; - [NSNotificationCenter.defaultCenter removeObserver:self]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; - [webView release]; - webView = [aWebView retain]; + webView = aWebView; if (webView) { [webView setPostsFrameChangedNotifications:TRUE]; - [webView setFrameLoadDelegate:self]; - [webView setUIDelegate:self]; - [webView setResourceLoadDelegate:self]; - [webView setApplicationNameForUserAgent:@"FSEmbeddedStore/2.0"]; - [NSNotificationCenter.defaultCenter addObserver:self + webView.frameLoadDelegate = self; + webView.UIDelegate = self; + webView.resourceLoadDelegate = self; + webView.applicationNameForUserAgent = @"FSEmbeddedStore/2.0"; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webViewFrameChanged:) name:NSViewFrameDidChangeNotification object:webView]; - [NSNotificationCenter.defaultCenter addObserver:self + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(estimatedLoadingProgressChanged:) name:WebViewProgressStartedNotification object:webView]; - [NSNotificationCenter.defaultCenter addObserver:self + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(estimatedLoadingProgressChanged:) name:WebViewProgressEstimateChangedNotification object:webView]; @@ -95,7 +93,7 @@ - (void)setWebView:(WebView *)aWebView - (id )delegate { - if (delegate == nil) { + if(delegate == nil) { NSLog(@"No delegate has been assigned to FsprgEmbeddedStoreController!"); } return delegate; @@ -115,15 +113,15 @@ - (void)loadWithParameters:(FsprgStoreParameters *)parameters return; } - NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[urlRequest URL]]; - NSUInteger i, count = [cookies count]; + NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:urlRequest.URL]; + NSUInteger i, count = cookies.count; for (i = 0; i < count; i++) { - NSHTTPCookie *cookie = [cookies objectAtIndex:i]; + NSHTTPCookie *cookie = cookies[i]; [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie]; } [self setStoreHost:nil]; - [[webView mainFrame] loadRequest:urlRequest]; + [webView.mainFrame loadRequest:urlRequest]; } - (void)loadWithContentsOfFile:(NSString *)aPath @@ -131,16 +129,16 @@ - (void)loadWithContentsOfFile:(NSString *)aPath [self setStoreHost:nil]; NSData *data = [NSData dataWithContentsOfFile:aPath]; - if (data == nil) { + if(data == nil) { NSLog(@"File %@ not found.", aPath); } else { - [[webView mainFrame] loadData:data MIMEType:@"application/x-fsprgorder+xml" textEncodingName:@"UTF-8" baseURL:nil]; + [webView.mainFrame loadData:data MIMEType:@"application/x-fsprgorder+xml" textEncodingName:@"UTF-8" baseURL:nil]; } } - (BOOL)isLoading { - return [self estimatedLoadingProgress] < 100; + return self.estimatedLoadingProgress < 100; } - (void)setIsLoading:(BOOL)aFlag { @@ -148,7 +146,7 @@ - (void)setIsLoading:(BOOL)aFlag } - (double)estimatedLoadingProgress { - return [webView estimatedProgress] * 100; + return webView.estimatedProgress * 100; } - (void)setEstimatedLoadingProgress:(double)aProgress { @@ -161,8 +159,8 @@ - (void)estimatedLoadingProgressChanged:(NSNotification *)aNotification } - (BOOL)isSecure { - WebDataSource *mainFrameDs = [[[self webView] mainFrame] dataSource]; - return [@"https" isEqualTo:[[[mainFrameDs request] URL] scheme]]; + WebDataSource *mainFrameDs = self.webView.mainFrame.dataSource; + return [@"https" isEqualTo:mainFrameDs.request.URL.scheme]; } - (void)setIsSecure:(BOOL)aFlag { @@ -171,54 +169,53 @@ - (void)setIsSecure:(BOOL)aFlag - (NSArray *)securityCertificates { - if ([self isSecure] == NO) { + if (self.secure == NO) { return nil; } - NSString *mainFrameURL = [[self webView] mainFrameURL]; - NSString *host = [[NSURL URLWithString:mainFrameURL] host]; - return [[self hostCertificates] objectForKey:host]; + NSString *mainFrameURL = self.webView.mainFrameURL; + NSString *host = [NSURL URLWithString:mainFrameURL].host; + return self.hostCertificates[host]; } - (NSString *)storeHost { - return [[storeHost retain] autorelease]; + return storeHost; } - (void)setStoreHost:(NSString *)aHost { if (storeHost != aHost) { - [storeHost release]; - storeHost = [aHost retain]; + storeHost = aHost; } } - (void)resizeContentDivE { - if ([[self delegate] respondsToSelector:@selector(shouldStoreControllerFixContentDivHeight:)]) { - if ([[self delegate] shouldStoreControllerFixContentDivHeight:self] == NO) { + if ([self.delegate respondsToSelector:@selector(shouldStoreControllerFixContentDivHeight:)]) { + if ([self.delegate shouldStoreControllerFixContentDivHeight:self] == NO) { return; } } - DOMElement *resizableContentE = [[[[self webView] mainFrame] DOMDocument] getElementById:@"FsprgResizableContent"]; - if (resizableContentE == nil) { + DOMElement *resizableContentE = [self.webView.mainFrame.DOMDocument getElementById:@"FsprgResizableContent"]; + if(resizableContentE == nil) { return; } - CGFloat windowHeight = [[self webView] frame].size.height; - id result = [[[self webView] windowScriptObject] evaluateWebScript:@"document.getElementsByClassName('store-page-navigation')[0].clientHeight"]; + CGFloat windowHeight = self.webView.frame.size.height; + id result = [self.webView.windowScriptObject evaluateWebScript:@"document.getElementsByClassName('store-page-navigation')[0].clientHeight"]; if (result == [WebUndefined undefined]) { return; } - float pageNavigationHeight = [(NSString *)result floatValue]; + float pageNavigationHeight = ((NSString *)result).floatValue; - DOMCSSStyleDeclaration *cssStyle = [[self webView] computedStyleForElement:resizableContentE pseudoElement:nil]; - float paddingTop = [[[cssStyle paddingBottom] substringToIndex:[[cssStyle paddingTop] length]-2] floatValue]; - float paddingBottom = [[[cssStyle paddingBottom] substringToIndex:[[cssStyle paddingBottom] length]-2] floatValue]; + DOMCSSStyleDeclaration *cssStyle = [self.webView computedStyleForElement:resizableContentE pseudoElement:nil]; + float paddingTop = [[cssStyle paddingBottom] substringToIndex:[cssStyle paddingTop].length-2].floatValue; + float paddingBottom = [[cssStyle paddingBottom] substringToIndex:[cssStyle paddingBottom].length-2].floatValue; CGFloat newHeight = windowHeight - paddingTop - paddingBottom - pageNavigationHeight; - [[resizableContentE style] setHeight:[NSString stringWithFormat:@"%fpx", newHeight]]; + [resizableContentE.style setHeight:[NSString stringWithFormat:@"%fpx", newHeight]]; } - (void)webViewFrameChanged:(NSNotification *)aNotification @@ -228,13 +225,12 @@ - (void)webViewFrameChanged:(NSNotification *)aNotification - (NSMutableDictionary *)hostCertificates { - return [[hostCertificates retain] autorelease]; + return hostCertificates; } + - (void)setHostCertificates:(NSMutableDictionary *)anHostCertificates { if (hostCertificates != anHostCertificates) { - [anHostCertificates retain]; - [hostCertificates release]; hostCertificates = anHostCertificates; } } @@ -244,8 +240,8 @@ - (void)setHostCertificates:(NSMutableDictionary *)anHostCertificates - (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame { - if ([[self delegate] respondsToSelector:@selector(webView:didStartProvisionalLoadForFrame:)]) { - [[self delegate] webView:sender didStartProvisionalLoadForFrame:frame]; + if ([self.delegate respondsToSelector:@selector(webView:didStartProvisionalLoadForFrame:)]) { + [self.delegate webView:sender didStartProvisionalLoadForFrame:frame]; } } @@ -255,45 +251,45 @@ - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame [self resizeContentDivE]; - NSURL *newURL = [[[frame dataSource] request] URL]; + NSURL *newURL = frame.dataSource.request.URL; NSString *newStoreHost; - if ([@"file" isEqualTo:[newURL scheme]]) { + if ([@"file" isEqualTo:newURL.scheme]) { newStoreHost = @"file"; } else { - newStoreHost = [newURL host]; + newStoreHost = newURL.host; } - if ([self storeHost] == nil) { + if(self.storeHost == nil) { [self setStoreHost:newStoreHost]; - [[self delegate] didLoadStore:newURL]; + [self.delegate didLoadStore:newURL]; } else { FsprgPageType newPageType; - if ([newStoreHost isEqualTo:[self storeHost]]) { + if([newStoreHost isEqualTo:self.storeHost]) { newPageType = FsprgPageFS; - } else if ([newStoreHost hasSuffix:@"paypal.com"]) { + } else if([newStoreHost hasSuffix:@"paypal.com"]) { newPageType = FsprgPagePayPal; } else { newPageType = FsprgPageUnknown; } - [[self delegate] didLoadPage:newURL ofType:newPageType]; + [self.delegate didLoadPage:newURL ofType:newPageType]; } } - (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { - [[self delegate] webView:sender didFailProvisionalLoadWithError:error forFrame:frame]; + [self.delegate webView:sender didFailProvisionalLoadWithError:error forFrame:frame]; } - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { - [[self delegate] webView:sender didFailLoadWithError:error forFrame:frame]; + [self.delegate webView:sender didFailLoadWithError:error forFrame:frame]; } #pragma mark - WebUIDelegate - (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame { - NSString *title = [sender mainFrameTitle]; + NSString *title = sender.mainFrameTitle; NSAlert *alertPanel = [[NSAlert alloc] init]; [alertPanel setMessageText:title]; [alertPanel setInformativeText:message]; @@ -312,10 +308,10 @@ - (NSUInteger)webView:(WebView *)sender dragDestinationActionMaskForDraggingInfo - (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request { NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0) - styleMask:(NSClosableWindowMask|NSResizableWindowMask) + styleMask:(NSWindowStyleMaskClosable|NSWindowStyleMaskResizable) backing:NSBackingStoreBuffered defer:NO]; - WebView *subWebView = [[[WebView alloc] initWithFrame:NSMakeRect(0,0,0,0)] autorelease]; + WebView *subWebView = [[WebView alloc] initWithFrame:NSMakeRect(0,0,0,0)]; [window setReleasedWhenClosed:TRUE]; [window setContentView:subWebView]; [window makeKeyAndOrderFront:sender]; @@ -333,7 +329,7 @@ - (BOOL)webView:(WebView *)sender resource:(id)identifier canAuthenticateAgainst - (void)webView:(WebView *)sender resource:(id)identifier didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource { - SecTrustRef trustRef = [[challenge protectionSpace] serverTrust]; + SecTrustRef trustRef = challenge.protectionSpace.serverTrust; SecTrustResultType resultType; SecTrustEvaluate(trustRef, &resultType); NSUInteger count = (NSUInteger)SecTrustGetCertificateCount(trustRef); @@ -342,13 +338,13 @@ - (void)webView:(WebView *)sender resource:(id)identifier didReceiveAuthenticati CFIndex idx; for (idx = 0; idx < (CFIndex)count; idx++) { SecCertificateRef certificateRef = SecTrustGetCertificateAtIndex(trustRef, idx); - [certificates addObject:(id)certificateRef]; + [certificates addObject:(__bridge id)certificateRef]; } - NSString *host = [[challenge protectionSpace] host]; - [[self hostCertificates] setObject:certificates forKey:host]; + NSString *host = challenge.protectionSpace.host; + self.hostCertificates[host] = certificates; - [[challenge sender] useCredential:[NSURLCredential credentialForTrust:trustRef] forAuthenticationChallenge:challenge]; + [challenge.sender useCredential:[NSURLCredential credentialForTrust:trustRef] forAuthenticationChallenge:challenge]; } #endif @@ -359,8 +355,6 @@ - (void)dealloc [self setDelegate:nil]; [self setStoreHost:nil]; [self setHostCertificates:nil]; - - [super dealloc]; } @end diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreDelegate.h b/FsprgEmbeddedStore/FsprgEmbeddedStoreDelegate.h index 9f0aa6a..771ca10 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreDelegate.h +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreDelegate.h @@ -12,11 +12,11 @@ #import "FsprgOrder.h" /*! Type for didLoadPage:ofType: */ -typedef enum { +typedef NS_ENUM(unsigned int, FsprgPageType) { FsprgPageFS, FsprgPagePayPal, FsprgPageUnknown -} FsprgPageType; +}; @class FsprgEmbeddedStoreController; diff --git a/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.h b/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.h index 2e90831..b8bbc95 100644 --- a/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.h +++ b/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.h @@ -18,7 +18,6 @@ FsprgOrder *order; } -- (FsprgOrder *)order; -- (void)setOrder:(FsprgOrder *)anOrder; +@property (NS_NONATOMIC_IOSONLY, strong) FsprgOrder *order; @end diff --git a/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m b/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m index 8b4e0b4..cec22aa 100644 --- a/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m +++ b/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m @@ -12,9 +12,9 @@ @implementation FsprgOrderDocumentRepresentation -- (id) init +- (instancetype) init { - self = super.init; + self = [super init]; if (self != nil) { [self setOrder:nil]; } @@ -23,14 +23,13 @@ - (id) init - (FsprgOrder *)order { - return [[order retain] autorelease]; + return order; } - (void)setOrder:(FsprgOrder *)anOrder { if (order != anOrder) { - [order release]; - order = [anOrder retain]; + order = anOrder; } } @@ -53,9 +52,9 @@ - (void)setDataSource:(WebDataSource *)aDataSource - (void)receivedData:(NSData *)aData withDataSource:(WebDataSource *)aDataSource { - [self setOrder:[FsprgOrder orderFromData:aData]]; - FsprgEmbeddedStoreController *delegate = [[[aDataSource webFrame] webView] frameLoadDelegate]; - [[delegate delegate] didReceiveOrder:[self order]]; + self.order = [FsprgOrder orderFromData:aData]; + FsprgEmbeddedStoreController *delegate = aDataSource.webFrame.webView.frameLoadDelegate; + [delegate.delegate didReceiveOrder:self.order]; } - (void)receivedError:(NSError *)anError withDataSource:(WebDataSource *)aDataSource @@ -70,7 +69,6 @@ - (void)dealloc { [self setOrder:nil]; - [super dealloc]; } @end diff --git a/FsprgEmbeddedStore/FsprgOrderView.h b/FsprgEmbeddedStore/FsprgOrderView.h index ff6b63b..c30b8d8 100644 --- a/FsprgEmbeddedStore/FsprgOrderView.h +++ b/FsprgEmbeddedStore/FsprgOrderView.h @@ -19,9 +19,7 @@ BOOL needsLayout; } -- (WebDataSource *)dataSource; -- (void)setDataSource:(WebDataSource *)aDataSource; -- (BOOL)needsLayout; -- (void)setNeedsLayout:(BOOL)flag; +@property (NS_NONATOMIC_IOSONLY, assign) WebDataSource *dataSource; +@property (NS_NONATOMIC_IOSONLY) BOOL needsLayout; @end diff --git a/FsprgEmbeddedStore/FsprgOrderView.m b/FsprgEmbeddedStore/FsprgOrderView.m index 2898593..d10e559 100644 --- a/FsprgEmbeddedStore/FsprgOrderView.m +++ b/FsprgEmbeddedStore/FsprgOrderView.m @@ -13,32 +13,31 @@ @implementation FsprgOrderView -- (id)initWithFrame:(NSRect)frame +- (instancetype)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { [self setDataSource:nil]; [self setNeedsLayout:FALSE]; [self setAutoresizesSubviews:TRUE]; - [self setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; + self.autoresizingMask = (NSViewWidthSizable | NSViewHeightSizable); } return self; } - (WebDataSource *)dataSource { - return [[dataSource retain] autorelease]; + return dataSource; } - (void)setDataSource:(WebDataSource *)aDataSource { if (dataSource != aDataSource) { - [dataSource release]; - dataSource = [aDataSource retain]; + dataSource = aDataSource; } } - (void)dataSourceUpdated:(WebDataSource *)aDataSource { - [self setDataSource:aDataSource]; + self.dataSource = aDataSource; } - (BOOL)needsLayout @@ -53,7 +52,7 @@ - (void)setNeedsLayout:(BOOL)flag - (void)drawRect:(NSRect)aRect { - if ([self needsLayout]) { + if(self.needsLayout) { [self setNeedsLayout:FALSE]; [self layout]; } @@ -62,14 +61,14 @@ - (void)drawRect:(NSRect)aRect - (void)layout { - if ([[self subviews] count] == 0) { - [self setFrame:[[self superview] frame]]; + if(self.subviews.count == 0) { + self.frame = self.superview.frame; - FsprgOrderDocumentRepresentation *representation = (FsprgOrderDocumentRepresentation *)[[self dataSource] representation]; - FsprgOrder *order = [representation order]; + FsprgOrderDocumentRepresentation *representation = (FsprgOrderDocumentRepresentation *)self.dataSource.representation; + FsprgOrder *order = representation.order; - FsprgEmbeddedStoreController *delegate = [[[[self dataSource] webFrame] webView] UIDelegate]; - NSView *newSubview = [[delegate delegate] viewWithFrame:[self frame] forOrder:order]; + FsprgEmbeddedStoreController *delegate = self.dataSource.webFrame.webView.UIDelegate; + NSView *newSubview = [delegate.delegate viewWithFrame:self.frame forOrder:order]; [self addSubview:newSubview]; } @@ -89,7 +88,6 @@ - (void)dealloc { [self setDataSource:nil]; - [super dealloc]; } @end diff --git a/FsprgEmbeddedStore/FsprgStoreParameters.h b/FsprgEmbeddedStore/FsprgStoreParameters.h index a5f4184..e27661e 100755 --- a/FsprgEmbeddedStore/FsprgStoreParameters.h +++ b/FsprgEmbeddedStore/FsprgStoreParameters.h @@ -31,54 +31,46 @@ extern NSString * const kFsprgModeTest; + (FsprgStoreParameters *)parameters; + (FsprgStoreParameters *)parametersWithRaw:(NSMutableDictionary *)aRaw; -- (NSURLRequest *)toURLRequest; -- (NSURL *)toURL; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSURLRequest *toURLRequest; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSURL *toURL; -- (id)initWithRaw:(NSMutableDictionary *)aRaw; -- (NSMutableDictionary *)raw; -- (void)setRaw:(NSMutableDictionary *)aRaw; +- (instancetype)initWithRaw:(NSMutableDictionary *)aRaw NS_DESIGNATED_INITIALIZER; +@property (NS_NONATOMIC_IOSONLY, copy) NSMutableDictionary *raw; /*! * Pass a language code via the URL to bypass automatic language detection. * Example: de */ -- (NSString *)language; -- (void)setLanguage:(NSString *)aLanguage; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *language; /*! * Use kFsprgOrderProcessDetail or kFsprgOrderProcessInstant. */ -- (NSString *)orderProcessType; -- (void)setOrderProcessType:(NSString *)anOrderProcessType; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *orderProcessType; /*! * Store path name and product path name. * These are found in a full product URL such as sites.fastspring.com//product/ */ - (void)setStoreId:(NSString *)aStoreId withProductId:(NSString *)aProductId; -- (NSString *)storeId; -- (void)setStoreId:(NSString *)aStoreId; -- (NSString *)productId; -- (void)setProductId:(NSString *)aProductId; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *storeId; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *productId; /*! * Use kFsprgModeActive, kFsprgModeActiveTest or kFsprgModeTest. */ -- (NSString *)mode; -- (void)setMode:(NSString *)aMode; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *mode; /*! * Used for "External Tracking". Go to "Link Sources" inside SpringBoard. * Example: november_sale_post */ -- (NSString *)campaign; -- (void)setCampaign:(NSString *)aCampaign; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *campaign; /*! * Used for advanced and atypical store configuration options. */ -- (NSString *)option; -- (void)setOption:(NSString *)anOption; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *option; /*! * Pass a custom referrer via the URL to override the automatically detected referring URL (HTTP_REFERER). @@ -86,23 +78,20 @@ extern NSString * const kFsprgModeTest; * passed in this parameter then no data will be stored from the HTTP_REFERER header. * Example: xyz123 */ -- (NSString *)referrer; -- (void)setReferrer:(NSString *)aReferrer; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *referrer; /*! * Used for "External Tracking". Go to "Link Sources" inside SpringBoard. * Example: my_blog */ -- (NSString *)source; -- (void)setSource:(NSString *)aSource; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *source; /*! * Pass a coupon code via the URL to automatically apply a coupon to the order so that the customer * does not need to enter it. A corresponding coupon code must be setup and associated with a promotion. * Example: DECSPECIAL987 */ -- (NSString *)coupon; -- (void)setCoupon:(NSString *)aCoupon; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *coupon; /*! * This parameter has many uses within SpringBoard. A tag is a variable that can hold any positive integer value. @@ -111,19 +100,13 @@ extern NSString * const kFsprgModeTest; * * mytaga,mytagb,mytagc=2,anothertag=8 */ -- (NSString *)tags; -- (void)setTags:(NSString *)aTags; - -- (BOOL)hasContactDefaults; -- (NSString *)contactFname; -- (void)setContactFname:(NSString *)aContactFname; -- (NSString *)contactLname; -- (void)setContactLname:(NSString *)aContactLname; -- (NSString *)contactEmail; -- (void)setContactEmail:(NSString *)aContactEmail; -- (NSString *)contactCompany; -- (void)setContactCompany:(NSString *)aContactCompany; -- (NSString *)contactPhone; -- (void)setContactPhone:(NSString *)aContactPhone; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *tags; + +@property (NS_NONATOMIC_IOSONLY, readonly) BOOL hasContactDefaults; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *contactFname; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *contactLname; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *contactEmail; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *contactCompany; +@property (NS_NONATOMIC_IOSONLY, copy) NSString *contactPhone; @end diff --git a/FsprgEmbeddedStore/FsprgStoreParameters.m b/FsprgEmbeddedStore/FsprgStoreParameters.m index 464a0f7..f56305c 100755 --- a/FsprgEmbeddedStore/FsprgStoreParameters.m +++ b/FsprgEmbeddedStore/FsprgStoreParameters.m @@ -39,7 +39,7 @@ @implementation FsprgStoreParameters + (void)initialize { - keyPathsForValuesAffecting = [[NSMutableDictionary dictionaryWithCapacity:1] retain]; + keyPathsForValuesAffecting = [NSMutableDictionary dictionaryWithCapacity:1]; NSSet *toURLSet = [NSSet setWithObjects:NSStringFromSelector(@selector(language)), NSStringFromSelector(@selector(orderProcessType)), @@ -57,55 +57,59 @@ + (void)initialize NSStringFromSelector(@selector(contactCompany)), NSStringFromSelector(@selector(contactPhone)), nil]; - [keyPathsForValuesAffecting setObject:toURLSet forKey:NSStringFromSelector(@selector(toURL))]; + keyPathsForValuesAffecting[NSStringFromSelector(@selector(toURL))] = toURLSet; } + (FsprgStoreParameters *)parameters { NSMutableDictionary *raw = [NSMutableDictionary dictionaryWithCapacity:15]; - return [[[FsprgStoreParameters alloc] initWithRaw:raw] autorelease]; + return [[FsprgStoreParameters alloc] initWithRaw:raw]; } + (FsprgStoreParameters *)parametersWithRaw:(NSMutableDictionary *)aRaw { - return [[[FsprgStoreParameters alloc] initWithRaw:aRaw] autorelease]; + return [[FsprgStoreParameters alloc] initWithRaw:aRaw]; } + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { NSSet *keyPaths = [keyPathsForValuesAffecting valueForKey:key]; - if (keyPaths == nil) { + if(keyPaths == nil) { return [NSSet set]; } else { return keyPaths; } } -- (id)initWithRaw:(NSMutableDictionary *)aRaw +- (instancetype)init { - self = super.init; + return [self initWithRaw:[NSMutableDictionary dictionary]]; +} + +- (instancetype)initWithRaw:(NSMutableDictionary *)aRaw +{ + self = [super init]; if (self != nil) { - [self setRaw:aRaw]; + self.raw = aRaw; } return self; } - (NSMutableDictionary *)raw { - return [[raw retain] autorelease]; + return raw; } - (void)setRaw:(NSMutableDictionary *)aRaw { if (raw != aRaw) { - [raw release]; - raw = [aRaw retain]; + raw = aRaw; } } - (NSURLRequest *)toURLRequest { - NSURL *toURL = [self toURL]; + NSURL *toURL = self.toURL; if (toURL) { return [NSMutableURLRequest requestWithURL:toURL]; } else { @@ -115,51 +119,50 @@ - (NSURLRequest *)toURLRequest - (NSURL *)toURL { - NSString *storeIdEncoded = [[self storeId] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - if (storeIdEncoded == nil) { + NSString *storeIdEncoded = [self.storeId stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + if(storeIdEncoded == nil) { storeIdEncoded = @""; } - NSString *productIdEncoded = [[self productId] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - if (productIdEncoded == nil) { + NSString *productIdEncoded = [self.productId stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + if(productIdEncoded == nil) { productIdEncoded = @""; } - NSString *urlAsStr; - if ([kFsprgOrderProcessDetail isEqualTo:[self orderProcessType]]) { -// NSString *protocol = @"http"; -// if ([self hasContactDefaults]) { -// protocol = @"https"; -// } - urlAsStr = [NSString stringWithFormat:@"https://sites.fastspring.com/%@/product/%@", storeIdEncoded, productIdEncoded]; - } else if ([kFsprgOrderProcessInstant isEqualTo:[self orderProcessType]]) { + if([kFsprgOrderProcessDetail isEqualTo:self.orderProcessType]) { + NSString *protocol = @"http"; + if(self.hasContactDefaults) { + protocol = @"https"; + } + urlAsStr = [NSString stringWithFormat:@"%@://sites.fastspring.com/%@/product/%@", protocol, storeIdEncoded, productIdEncoded]; + } else if([kFsprgOrderProcessInstant isEqualTo:self.orderProcessType]) { urlAsStr = [NSString stringWithFormat:@"https://sites.fastspring.com/%@/instant/%@", storeIdEncoded, productIdEncoded]; - } else if ([kFsprgOrderProcessCheckout isEqualTo:[self orderProcessType]]) { + } else if ([kFsprgOrderProcessCheckout isEqualTo:self.orderProcessType]) { urlAsStr = [NSString stringWithFormat:@"https://sites.fastspring.com/%@/checkout/%@", storeIdEncoded, productIdEncoded]; } else { NSAssert1(FALSE, @"OrderProcessType '%@' unknown.", [self orderProcessType]); return nil; } - - NSMutableArray *keys = [NSMutableArray arrayWithArray:[[self raw] allKeys]]; + + NSMutableArray *keys = [NSMutableArray arrayWithArray:self.raw.allKeys]; [keys removeObject:kOrderProcessType]; [keys removeObject:kStoreId]; [keys removeObject:kProductId]; [keys sortUsingSelector:@selector(compare:)]; NSString *queryStr = @""; - NSUInteger i, count = [keys count]; + NSUInteger i, count = keys.count; for (i = 0; i < count; i++) { - NSString *key = [keys objectAtIndex:i]; - NSString *value = [[self raw] valueForKey:key]; - if (value != nil) { + NSString *key = keys[i]; + NSString *value = [self.raw valueForKey:key]; + if(value != nil) { queryStr = [queryStr stringByAppendingFormat:@"&%@=%@", key, [value stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; } } - if ([queryStr length] > 0) { + if(queryStr.length > 0) { urlAsStr = [NSString stringWithFormat:@"%@?%@", urlAsStr, [queryStr substringFromIndex:1]]; } @@ -168,16 +171,16 @@ - (NSURL *)toURL - (void)setObject:(NSString *)anObject forKey:(NSString *)aKey { - if (anObject == nil) { - [[self raw] removeObjectForKey:aKey]; + if(anObject == nil) { + [self.raw removeObjectForKey:aKey]; } else { - [[self raw] setObject:anObject forKey:aKey]; + self.raw[aKey] = anObject; } } - (NSString *)language { - return [[self raw] objectForKey:kLanguage]; + return self.raw[kLanguage]; } - (void)setLanguage:(NSString *)aLanguage @@ -187,7 +190,7 @@ - (void)setLanguage:(NSString *)aLanguage - (NSString *)orderProcessType { - return [[self raw] objectForKey:kOrderProcessType]; + return self.raw[kOrderProcessType]; } - (void)setOrderProcessType:(NSString *)anOrderProcessType { @@ -196,13 +199,13 @@ - (void)setOrderProcessType:(NSString *)anOrderProcessType - (void)setStoreId:(NSString *)aStoreId withProductId:(NSString *)aProductId { - [self setStoreId:aStoreId]; - [self setProductId:aProductId]; + self.storeId = aStoreId; + self.productId = aProductId; } - (NSString *)storeId { - return [[self raw] objectForKey:kStoreId]; + return self.raw[kStoreId]; } - (void)setStoreId:(NSString *)aStoreId { @@ -211,7 +214,7 @@ - (void)setStoreId:(NSString *)aStoreId - (NSString *)productId { - return [[self raw] objectForKey:kProductId]; + return self.raw[kProductId]; } - (void)setProductId:(NSString *)aProductId { @@ -220,7 +223,7 @@ - (void)setProductId:(NSString *)aProductId - (NSString *)mode { - return [[self raw] objectForKey:kMode]; + return self.raw[kMode]; } - (void)setMode:(NSString *)aMode { @@ -229,7 +232,7 @@ - (void)setMode:(NSString *)aMode - (NSString *)campaign { - return [[self raw] objectForKey:kCampaign]; + return self.raw[kCampaign]; } - (void)setCampaign:(NSString *)aCampaign { @@ -238,7 +241,7 @@ - (void)setCampaign:(NSString *)aCampaign - (NSString *)option { - return [[self raw] objectForKey:kOption]; + return self.raw[kOption]; } - (void)setOption:(NSString *)anOption { @@ -247,7 +250,7 @@ - (void)setOption:(NSString *)anOption - (NSString *)referrer { - return [[self raw] objectForKey:kReferrer]; + return self.raw[kReferrer]; } - (void)setReferrer:(NSString *)aReferrer { @@ -256,7 +259,7 @@ - (void)setReferrer:(NSString *)aReferrer - (NSString *)source { - return [[self raw] objectForKey:kSource]; + return self.raw[kSource]; } - (void)setSource:(NSString *)aSource { @@ -265,7 +268,7 @@ - (void)setSource:(NSString *)aSource - (NSString *)coupon { - return [[self raw] objectForKey:kCoupon]; + return self.raw[kCoupon]; } - (void)setCoupon:(NSString *)aCoupon { @@ -274,7 +277,7 @@ - (void)setCoupon:(NSString *)aCoupon - (NSString *)tags { - return [[self raw] objectForKey:kTags]; + return self.raw[kTags]; } - (void)setTags:(NSString *)aTags { @@ -283,7 +286,7 @@ - (void)setTags:(NSString *)aTags - (BOOL)hasContactDefaults { - NSArray *allKeys = [[self raw] allKeys]; + NSArray *allKeys = self.raw.allKeys; return [allKeys containsObject:kContactFname] || [allKeys containsObject:kContactLname] || @@ -294,7 +297,7 @@ - (BOOL)hasContactDefaults - (NSString *)contactFname { - return [[self raw] objectForKey:kContactFname]; + return self.raw[kContactFname]; } - (void)setContactFname:(NSString *)aContactFname { @@ -303,7 +306,7 @@ - (void)setContactFname:(NSString *)aContactFname - (NSString *)contactLname { - return [[self raw] objectForKey:kContactLname]; + return self.raw[kContactLname]; } - (void)setContactLname:(NSString *)aContactLname { @@ -312,7 +315,7 @@ - (void)setContactLname:(NSString *)aContactLname - (NSString *)contactEmail { - return [[self raw] objectForKey:kContactEmail]; + return self.raw[kContactEmail]; } - (void)setContactEmail:(NSString *)aContactEmail { @@ -321,7 +324,7 @@ - (void)setContactEmail:(NSString *)aContactEmail - (NSString *)contactCompany { - return [[self raw] objectForKey:kContactCompany]; + return self.raw[kContactCompany]; } - (void)setContactCompany:(NSString *)aContactCompany { @@ -330,7 +333,7 @@ - (void)setContactCompany:(NSString *)aContactCompany - (NSString *)contactPhone { - return [[self raw] objectForKey:kContactPhone]; + return self.raw[kContactPhone]; } - (void)setContactPhone:(NSString *)aContactPhone { @@ -341,7 +344,6 @@ - (void)dealloc { [self setRaw:nil]; - [super dealloc]; } @end diff --git a/FsprgEmbeddedStore/Model/FsprgFileDownload.h b/FsprgEmbeddedStore/Model/FsprgFileDownload.h index 793baac..c7241d0 100644 --- a/FsprgEmbeddedStore/Model/FsprgFileDownload.h +++ b/FsprgEmbeddedStore/Model/FsprgFileDownload.h @@ -19,10 +19,9 @@ + (FsprgFileDownload *)fileDownloadWithDictionary:(NSDictionary *)aDictionary; -- (FsprgFileDownload *)initWithDictionary:(NSDictionary *)aDictionary; -- (NSDictionary *)raw; -- (void)setRaw:(NSDictionary *)aDictionary; +- (instancetype)initWithDictionary:(NSDictionary *)aDictionary NS_DESIGNATED_INITIALIZER; +@property (NS_NONATOMIC_IOSONLY, copy) NSDictionary *raw; -- (NSURL *)fileURL; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSURL *fileURL; @end diff --git a/FsprgEmbeddedStore/Model/FsprgFileDownload.m b/FsprgEmbeddedStore/Model/FsprgFileDownload.m index 77aad6d..edd32ed 100644 --- a/FsprgEmbeddedStore/Model/FsprgFileDownload.m +++ b/FsprgEmbeddedStore/Model/FsprgFileDownload.m @@ -13,32 +13,38 @@ @implementation FsprgFileDownload + (FsprgFileDownload *)fileDownloadWithDictionary:(NSDictionary *)aDictionary { - return [[[FsprgFileDownload alloc] initWithDictionary:aDictionary] autorelease]; + return [[FsprgFileDownload alloc] initWithDictionary:aDictionary]; } -- (FsprgFileDownload *)initWithDictionary:(NSDictionary *)aDictionary +- (instancetype)init { - self = super.init; + return [self initWithDictionary:@{}]; +} + +- (instancetype)initWithDictionary:(NSDictionary *)aDictionary +{ + self = [super init]; if (self != nil) { - [self setRaw:aDictionary]; + self.raw = aDictionary; } return self; } + - (NSDictionary *)raw { - return [[raw retain] autorelease]; + return raw; } + - (void)setRaw:(NSDictionary *)aDictionary { if (raw != aDictionary) { - [raw release]; - raw = [aDictionary retain]; + raw = aDictionary; } } - (NSURL *)fileURL { - return [NSURL URLWithString:[[self raw] valueForKey:@"FileURL"]]; + return [NSURL URLWithString:[self.raw valueForKey:@"FileURL"]]; } + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key @@ -51,7 +57,6 @@ - (void)dealloc { [self setRaw:nil]; - [super dealloc]; } @end diff --git a/FsprgEmbeddedStore/Model/FsprgFulfillment.h b/FsprgEmbeddedStore/Model/FsprgFulfillment.h index de932b2..0a89667 100644 --- a/FsprgEmbeddedStore/Model/FsprgFulfillment.h +++ b/FsprgEmbeddedStore/Model/FsprgFulfillment.h @@ -19,9 +19,8 @@ + (FsprgFulfillment *)fulfillmentWithDictionary:(NSDictionary *)aDictionary; -- (FsprgFulfillment *)initWithDictionary:(NSDictionary *)aDictionary; -- (NSDictionary *)raw; -- (void)setRaw:(NSDictionary *)aDictionary; +- (instancetype)initWithDictionary:(NSDictionary *)aDictionary NS_DESIGNATED_INITIALIZER; +@property (NS_NONATOMIC_IOSONLY, copy) NSDictionary *raw; /*! * @param aKey type of fulfillment (e.g. license, download) diff --git a/FsprgEmbeddedStore/Model/FsprgFulfillment.m b/FsprgEmbeddedStore/Model/FsprgFulfillment.m index 07f3dbe..eed6039 100644 --- a/FsprgEmbeddedStore/Model/FsprgFulfillment.m +++ b/FsprgEmbeddedStore/Model/FsprgFulfillment.m @@ -15,38 +15,43 @@ @implementation FsprgFulfillment + (FsprgFulfillment *)fulfillmentWithDictionary:(NSDictionary *)aDictionary { - return [[[FsprgFulfillment alloc] initWithDictionary:aDictionary] autorelease]; + return [[FsprgFulfillment alloc] initWithDictionary:aDictionary]; } -- (FsprgFulfillment *)initWithDictionary:(NSDictionary *)aDictionary +- (instancetype)init { - self = super.init; + return [self initWithDictionary:@{}]; +} + +- (instancetype)initWithDictionary:(NSDictionary *)aDictionary +{ + self = [super init]; if (self != nil) { - [self setRaw:aDictionary]; + self.raw = aDictionary; } return self; } + - (NSDictionary *)raw { - return [[raw retain] autorelease]; + return raw; } - (void)setRaw:(NSDictionary *)aDictionary { if (raw != aDictionary) { - [raw release]; - raw = [aDictionary retain]; + raw = aDictionary; } } - (id)valueForKey:(NSString *)aKey { - NSDictionary *anItem = [[self raw] valueForKey:aKey]; + NSDictionary *anItem = [self.raw valueForKey:aKey]; - if ([[anItem valueForKey:@"FulfillmentType"] isEqual:@"License"]) { + if([[anItem valueForKey:@"FulfillmentType"] isEqual:@"License"]) { return [FsprgLicense licenseWithDictionary:anItem]; } - if ([[anItem valueForKey:@"FulfillmentType"] isEqual:@"File"]) { + if([[anItem valueForKey:@"FulfillmentType"] isEqual:@"File"]) { return [FsprgFileDownload fileDownloadWithDictionary:anItem]; } @@ -63,7 +68,6 @@ - (void)dealloc { [self setRaw:nil]; - [super dealloc]; } @end diff --git a/FsprgEmbeddedStore/Model/FsprgLicense.h b/FsprgEmbeddedStore/Model/FsprgLicense.h index 27a1e7d..ac83133 100644 --- a/FsprgEmbeddedStore/Model/FsprgLicense.h +++ b/FsprgEmbeddedStore/Model/FsprgLicense.h @@ -19,16 +19,15 @@ + (FsprgLicense *)licenseWithDictionary:(NSDictionary *)aDictionary; -- (FsprgLicense *)initWithDictionary:(NSDictionary *)aDictionary; -- (NSDictionary *)raw; -- (void)setRaw:(NSDictionary *)aDictionary; +- (instancetype)initWithDictionary:(NSDictionary *)aDictionary NS_DESIGNATED_INITIALIZER; +@property (NS_NONATOMIC_IOSONLY, copy) NSDictionary *raw; -- (NSString *)licenseName; -- (NSString *)licenseEmail; -- (NSString *)licenseCompany; -- (NSString *)firstLicenseCode; -- (NSArray *)licenseCodes; -- (NSDictionary *)licensePropertyList; -- (NSURL *)licenseURL; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *licenseName; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *licenseEmail; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *licenseCompany; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *firstLicenseCode; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *licenseCodes; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSDictionary *licensePropertyList; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSURL *licenseURL; @end diff --git a/FsprgEmbeddedStore/Model/FsprgLicense.m b/FsprgEmbeddedStore/Model/FsprgLicense.m index 5c54f8f..32a7e3c 100644 --- a/FsprgEmbeddedStore/Model/FsprgLicense.m +++ b/FsprgEmbeddedStore/Model/FsprgLicense.m @@ -13,63 +13,67 @@ @implementation FsprgLicense + (FsprgLicense *)licenseWithDictionary:(NSDictionary *)aDictionary { - return [[[FsprgLicense alloc] initWithDictionary:aDictionary] autorelease]; + return [[FsprgLicense alloc] initWithDictionary:aDictionary]; } -- (FsprgLicense *)initWithDictionary:(NSDictionary *)aDictionary +- (instancetype)init { - self = super.init; + return [self initWithDictionary:@{}]; +} + +- (instancetype)initWithDictionary:(NSDictionary *)aDictionary +{ + self = [super init]; if (self != nil) { - [self setRaw:aDictionary]; + self.raw = aDictionary; } return self; } - (NSDictionary *)raw { - return [[raw retain] autorelease]; + return raw; } - (void)setRaw:(NSDictionary *)aDictionary { if (raw != aDictionary) { - [raw release]; - raw = [aDictionary retain]; + raw = aDictionary; } } - (NSString *)licenseName { - return [[self raw] valueForKey:@"LicenseName"]; + return [self.raw valueForKey:@"LicenseName"]; } - (NSString *)licenseEmail { - return [[self raw] valueForKey:@"LicenseEmail"]; + return [self.raw valueForKey:@"LicenseEmail"]; } - (NSString *)licenseCompany { - return [[self raw] valueForKey:@"LicenseCompany"]; + return [self.raw valueForKey:@"LicenseCompany"]; } - (NSString *)firstLicenseCode { - return [[self licenseCodes] objectAtIndex:0]; + return self.licenseCodes[0]; } - (NSArray *)licenseCodes { - return [[self raw] valueForKey:@"LicenseCodes"]; + return [self.raw valueForKey:@"LicenseCodes"]; } - (NSDictionary *)licensePropertyList { - return [[self raw] valueForKey:@"LicensePropertyList"]; + return [self.raw valueForKey:@"LicensePropertyList"]; } - (NSURL *)licenseURL { - return [NSURL URLWithString:[[self raw] valueForKey:@"LicenseURL"]]; + return [NSURL URLWithString:[self.raw valueForKey:@"LicenseURL"]]; } + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key @@ -82,7 +86,6 @@ - (void)dealloc { [self setRaw:nil]; - [super dealloc]; } @end diff --git a/FsprgEmbeddedStore/Model/FsprgOrder.h b/FsprgEmbeddedStore/Model/FsprgOrder.h index 23f0ab5..64ddc76 100644 --- a/FsprgEmbeddedStore/Model/FsprgOrder.h +++ b/FsprgEmbeddedStore/Model/FsprgOrder.h @@ -20,26 +20,25 @@ + (FsprgOrder *)orderFromData:(NSData *)aData; -- (FsprgOrder *)initWithDictionary:(NSDictionary *)aDictionary; -- (NSDictionary *)raw; -- (void)setRaw:(NSDictionary *)aDictionary; - -- (BOOL)orderIsTest; -- (NSString *)orderReference; -- (NSString *)orderLanguage; -- (NSString *)orderCurrency; -- (NSNumber *)orderTotal; -- (NSNumber *)orderTotalUSD; -- (NSString *)customerFirstName; -- (NSString *)customerLastName; -- (NSString *)customerCompany; -- (NSString *)customerEmail; +- (instancetype)initWithDictionary:(NSDictionary *)aDictionary NS_DESIGNATED_INITIALIZER; +@property (NS_NONATOMIC_IOSONLY, copy) NSDictionary *raw; + +@property (NS_NONATOMIC_IOSONLY, readonly) BOOL orderIsTest; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *orderReference; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *orderLanguage; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *orderCurrency; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSNumber *orderTotal; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSNumber *orderTotalUSD; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *customerFirstName; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *customerLastName; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *customerCompany; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *customerEmail; /*! * Shortcut for [[self orderItems] objectAtIndex:0]. * @result First item. */ -- (FsprgOrderItem *)firstOrderItem; -- (NSArray *)orderItems; +@property (NS_NONATOMIC_IOSONLY, readonly, strong) FsprgOrderItem *firstOrderItem; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *orderItems; @end diff --git a/FsprgEmbeddedStore/Model/FsprgOrder.m b/FsprgEmbeddedStore/Model/FsprgOrder.m index 5f25e6d..379885e 100644 --- a/FsprgEmbeddedStore/Model/FsprgOrder.m +++ b/FsprgEmbeddedStore/Model/FsprgOrder.m @@ -14,109 +14,114 @@ @implementation FsprgOrder + (FsprgOrder *)orderFromData:(NSData *)aData { NSPropertyListFormat *format = nil; - NSString *errorDesc = nil; - -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 - NSDictionary *aDict = [NSPropertyListSerialization propertyListFromData:aData - mutabilityOption:NSPropertyListImmutable - format:format - errorDescription:&errorDesc]; - -#else + +//#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 +// NSString *errorDesc = nil; +// NSDictionary *aDict = [NSPropertyListSerialization propertyListFromData:aData +// mutabilityOption:NSPropertyListImmutable +// format:format +// errorDescription:&errorDesc]; +// +//#else NSDictionary *aDict = [NSPropertyListSerialization propertyListWithData:aData options:NSPropertyListImmutable format:format error:nil]; -#endif +//#endif - return [[[FsprgOrder alloc] initWithDictionary:aDict] autorelease]; + return [[FsprgOrder alloc] initWithDictionary:aDict]; +} + +- (instancetype)init +{ + return [self initWithDictionary:@{}]; } -- (FsprgOrder *)initWithDictionary:(NSDictionary *)aDictionary +- (instancetype)initWithDictionary:(NSDictionary *)aDictionary { - self = super.init; + self = [super init]; if (self != nil) { - [self setRaw:aDictionary]; + self.raw = aDictionary; } return self; -} +} + - (NSDictionary *)raw { - return [[raw retain] autorelease]; + return raw; } + - (void)setRaw:(NSDictionary *)aDictionary { if (raw != aDictionary) { - [raw release]; - raw = [aDictionary retain]; + raw = aDictionary; } } - (BOOL)orderIsTest { - return [[[self raw] valueForKey:@"OrderIsTest"] boolValue]; + return [[self.raw valueForKey:@"OrderIsTest"] boolValue]; } - (NSString *)orderReference { - return [[self raw] valueForKey:@"OrderReference"]; + return [self.raw valueForKey:@"OrderReference"]; } - (NSString *)orderLanguage { - return [[self raw] valueForKey:@"OrderLanguage"]; + return [self.raw valueForKey:@"OrderLanguage"]; } - (NSString *)orderCurrency { - return [[self raw] valueForKey:@"OrderCurrency"]; + return [self.raw valueForKey:@"OrderCurrency"]; } - (NSNumber *)orderTotal { - return [[self raw] valueForKey:@"OrderTotal"]; + return [self.raw valueForKey:@"OrderTotal"]; } - (NSNumber *)orderTotalUSD { - return [[self raw] valueForKey:@"OrderTotalUSD"]; + return [self.raw valueForKey:@"OrderTotalUSD"]; } - (NSString *)customerFirstName { - return [[self raw] valueForKey:@"CustomerFirstName"]; + return [self.raw valueForKey:@"CustomerFirstName"]; } - (NSString *)customerLastName { - return [[self raw] valueForKey:@"CustomerLastName"]; + return [self.raw valueForKey:@"CustomerLastName"]; } - (NSString *)customerCompany { - return [[self raw] valueForKey:@"CustomerCompany"]; + return [self.raw valueForKey:@"CustomerCompany"]; } - (NSString *)customerEmail { - return [[self raw] valueForKey:@"CustomerEmail"]; + return [self.raw valueForKey:@"CustomerEmail"]; } - (FsprgOrderItem *)firstOrderItem { - NSArray *items = [[self raw] valueForKey:@"OrderItems"]; -// NSLog(@"%@",items); - return [FsprgOrderItem itemWithDictionary:[items objectAtIndex:0]]; + NSArray *items = [self.raw valueForKey:@"OrderItems"]; + return [FsprgOrderItem itemWithDictionary:items[0]]; } - (NSArray *)orderItems { - NSArray *items = [[self raw] valueForKey:@"OrderItems"]; - NSMutableArray *orderItems = [NSMutableArray arrayWithCapacity:[items count]]; + NSArray *items = [self.raw valueForKey:@"OrderItems"]; + NSMutableArray *orderItems = [NSMutableArray arrayWithCapacity:items.count]; - NSUInteger i, count = [items count]; + NSUInteger i, count = items.count; for (i = 0; i < count; i++) { - NSDictionary *anItem = [items objectAtIndex:i]; + NSDictionary *anItem = items[i]; [orderItems addObject:[FsprgOrderItem itemWithDictionary:anItem]]; } @@ -133,7 +138,6 @@ - (void)dealloc { [self setRaw:nil]; - [super dealloc]; } @end diff --git a/FsprgEmbeddedStore/Model/FsprgOrderItem.h b/FsprgEmbeddedStore/Model/FsprgOrderItem.h index f71ee07..c7d5526 100644 --- a/FsprgEmbeddedStore/Model/FsprgOrderItem.h +++ b/FsprgEmbeddedStore/Model/FsprgOrderItem.h @@ -22,39 +22,38 @@ + (FsprgOrderItem *)itemWithDictionary:(NSDictionary *)aDictionary; -- (FsprgOrderItem *)initWithDictionary:(NSDictionary *)aDictionary; -- (NSDictionary *)raw; -- (void)setRaw:(NSDictionary *)aDictionary; +- (instancetype)initWithDictionary:(NSDictionary *)aDictionary NS_DESIGNATED_INITIALIZER; +@property (NS_NONATOMIC_IOSONLY, copy) NSDictionary *raw; -- (NSString *)productName; -- (NSString *)productDisplay; -- (NSNumber *)quantity; -- (NSNumber *)itemTotal; -- (NSNumber *)itemTotalUSD; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *productName; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *productDisplay; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSNumber *quantity; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSNumber *itemTotal; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSNumber *itemTotalUSD; /*! * This reference can be used to make calls to FastSpring's Subscription API. * See https://support.fastspring.com/entries/236487-api-subscriptions */ -- (NSString *)subscriptionReference; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *subscriptionReference; /*! * This URL can be presented to the customer to manage their subscription. */ -- (NSURL *)subscriptionCustomerURL; +@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSURL *subscriptionCustomerURL; -- (FsprgFulfillment *)fulfillment; +@property (NS_NONATOMIC_IOSONLY, readonly, strong) FsprgFulfillment *fulfillment; /*! * Shortcut for [[self fulfillment] valueForKey:@"license"]. * @result License information. */ -- (FsprgLicense *)license; +@property (NS_NONATOMIC_IOSONLY, readonly, strong) FsprgLicense *license; /*! * Shortcut for [[self fulfillment] valueForKey:@"download"]. * @result Download information. */ -- (FsprgFileDownload *)download; +@property (NS_NONATOMIC_IOSONLY, readonly, strong) FsprgFileDownload *download; @end diff --git a/FsprgEmbeddedStore/Model/FsprgOrderItem.m b/FsprgEmbeddedStore/Model/FsprgOrderItem.m index beebcb1..3087fa8 100644 --- a/FsprgEmbeddedStore/Model/FsprgOrderItem.m +++ b/FsprgEmbeddedStore/Model/FsprgOrderItem.m @@ -13,78 +13,83 @@ @implementation FsprgOrderItem + (FsprgOrderItem *)itemWithDictionary:(NSDictionary *)aDictionary { - return [[[FsprgOrderItem alloc] initWithDictionary:aDictionary] autorelease]; + return [[FsprgOrderItem alloc] initWithDictionary:aDictionary]; } -- (FsprgOrderItem *)initWithDictionary:(NSDictionary *)aDictionary +- (instancetype)init { - self = super.init; + return [self initWithDictionary:@{}]; +} + +- (instancetype)initWithDictionary:(NSDictionary *)aDictionary +{ + self = [super init]; if (self != nil) { - [self setRaw:aDictionary]; + self.raw = aDictionary; } return self; } + - (NSDictionary *)raw { - return [[raw retain] autorelease]; + return raw; } - (void)setRaw:(NSDictionary *)aDictionary { if (raw != aDictionary) { - [raw release]; - raw = [aDictionary retain]; + raw = aDictionary; } } - (NSString *)productName { - return [[self raw] valueForKey:@"ProductName"]; + return [self.raw valueForKey:@"ProductName"]; } - (NSString *)productDisplay { - return [[self raw] valueForKey:@"ProductDisplay"]; + return [self.raw valueForKey:@"ProductDisplay"]; } - (NSNumber *)quantity { - return [[self raw] valueForKey:@"Quantity"]; + return [self.raw valueForKey:@"Quantity"]; } - (NSNumber *)itemTotal { - return [[self raw] valueForKey:@"ItemTotal"]; + return [self.raw valueForKey:@"ItemTotal"]; } - (NSNumber *)itemTotalUSD { - return [[self raw] valueForKey:@"ItemTotalUSD"]; + return [self.raw valueForKey:@"ItemTotalUSD"]; } - (NSString *)subscriptionReference { - return [[self raw] valueForKey:@"SubscriptionReference"]; + return [self.raw valueForKey:@"SubscriptionReference"]; } - (NSURL *)subscriptionCustomerURL { - return [NSURL URLWithString:[[self raw] valueForKey:@"SubscriptionCustomerURL"]]; + return [NSURL URLWithString:[self.raw valueForKey:@"SubscriptionCustomerURL"]]; } - (FsprgFulfillment *)fulfillment { - return [FsprgFulfillment fulfillmentWithDictionary:[[self raw] valueForKey:@"Fulfillment"]]; + return [FsprgFulfillment fulfillmentWithDictionary:[self.raw valueForKey:@"Fulfillment"]]; } - (FsprgLicense *)license { - return [[self fulfillment] valueForKey:@"license"]; + return [self.fulfillment valueForKey:@"license"]; } - (FsprgFileDownload *)download { - return [[self fulfillment] valueForKey:@"download"]; + return [self.fulfillment valueForKey:@"download"]; } + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key @@ -97,7 +102,6 @@ - (void)dealloc { [self setRaw:nil]; - [super dealloc]; } @end From eea5bfe6e3c2d36980683099a2696b2e811047a6 Mon Sep 17 00:00:00 2001 From: 45RPM Software Date: Fri, 11 Nov 2022 20:41:22 +0000 Subject: [PATCH 07/10] Updates to RTF rendering --- FsprgEmbeddedStore/FsprgStoreParameters.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FsprgEmbeddedStore/FsprgStoreParameters.m b/FsprgEmbeddedStore/FsprgStoreParameters.m index f56305c..8b463b5 100755 --- a/FsprgEmbeddedStore/FsprgStoreParameters.m +++ b/FsprgEmbeddedStore/FsprgStoreParameters.m @@ -119,11 +119,11 @@ - (NSURLRequest *)toURLRequest - (NSURL *)toURL { - NSString *storeIdEncoded = [self.storeId stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + NSString *storeIdEncoded = [self.storeId stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet]; if(storeIdEncoded == nil) { storeIdEncoded = @""; } - NSString *productIdEncoded = [self.productId stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + NSString *productIdEncoded = [self.productId stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet]; if(productIdEncoded == nil) { productIdEncoded = @""; } @@ -158,7 +158,7 @@ - (NSURL *)toURL if(value != nil) { queryStr = [queryStr stringByAppendingFormat:@"&%@=%@", key, - [value stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; + [value stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet]]; } } From 4cb8e2a41100301e549c5838c36715933dbbba72 Mon Sep 17 00:00:00 2001 From: 45RPM Software Date: Wed, 1 Mar 2023 17:21:41 +0000 Subject: [PATCH 08/10] Bug fixes, including those necessary to MailRaider to run in the Mac App Store version --- FsprgEmbeddedStore/FsprgEmbeddedStoreController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m index 9b46de1..def1dfb 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m @@ -94,7 +94,7 @@ - (void)setWebView:(WebView *)aWebView - (id )delegate { if(delegate == nil) { - NSLog(@"No delegate has been assigned to FsprgEmbeddedStoreController!"); + // NSLog(@"No delegate has been assigned to FsprgEmbeddedStoreController!"); } return delegate; } @@ -130,7 +130,7 @@ - (void)loadWithContentsOfFile:(NSString *)aPath NSData *data = [NSData dataWithContentsOfFile:aPath]; if(data == nil) { - NSLog(@"File %@ not found.", aPath); + // NSLog(@"File %@ not found.", aPath); } else { [webView.mainFrame loadData:data MIMEType:@"application/x-fsprgorder+xml" textEncodingName:@"UTF-8" baseURL:nil]; } From 9bd8051f6ccebbfb509cf790c27ac116e237aa17 Mon Sep 17 00:00:00 2001 From: 45RPM Software Date: Sat, 27 Sep 2025 22:11:05 +0100 Subject: [PATCH 09/10] Updates to remove deprecations and ensure that HTML formatted email is displayed correctly in all versions of MailRaider. First pass at ensuring correct license key functionality in MailRaider Pro (Non app store version) --- FsprgEmbeddedStore/FsprgEmbeddedStoreController.h | 4 ++++ FsprgEmbeddedStore/FsprgEmbeddedStoreController.m | 5 +++++ FsprgEmbeddedStore/FsprgEmbeddedStoreDelegate.h | 5 +++++ FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.h | 4 ++++ FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m | 7 ++++++- FsprgEmbeddedStore/FsprgOrderView.h | 4 ++++ FsprgEmbeddedStore/FsprgOrderView.m | 4 ++++ 7 files changed, 32 insertions(+), 1 deletion(-) diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.h b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.h index ae2f1ea..03e0ec1 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.h +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.h @@ -10,6 +10,8 @@ #import #import "FsprgEmbeddedStoreDelegate.h" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" /*! * Controller for FastSpring's embedded store. @@ -75,4 +77,6 @@ */ @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *storeHost; +#pragma clang diagnostic pop + @end diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m index def1dfb..0fb62a9 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m @@ -10,6 +10,9 @@ #import "FsprgOrderView.h" #import "FsprgOrderDocumentRepresentation.h" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + // We don't retrieve SSL certificates below OSX 10.6 //#define RETRIEVE_SSL_CERTIFICATES defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 @@ -357,4 +360,6 @@ - (void)dealloc [self setHostCertificates:nil]; } +#pragma clang diagnostic pop + @end diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreDelegate.h b/FsprgEmbeddedStore/FsprgEmbeddedStoreDelegate.h index 771ca10..02a9a0f 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreDelegate.h +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreDelegate.h @@ -11,6 +11,9 @@ #import "FsprgStoreParameters.h" #import "FsprgOrder.h" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + /*! Type for didLoadPage:ofType: */ typedef NS_ENUM(unsigned int, FsprgPageType) { FsprgPageFS, @@ -86,4 +89,6 @@ typedef NS_ENUM(unsigned int, FsprgPageType) { */ - (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame; +#pragma clang diagnostic pop + @end diff --git a/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.h b/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.h index b8bbc95..9af4d4f 100644 --- a/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.h +++ b/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.h @@ -10,6 +10,8 @@ #import #import "FsprgOrder.h" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" /*! * WebDocumentRepresentation that calls FsprgEmbeddedStoreDelegate on receiving the order. @@ -20,4 +22,6 @@ @property (NS_NONATOMIC_IOSONLY, strong) FsprgOrder *order; +#pragma clang diagnostic pop + @end diff --git a/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m b/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m index cec22aa..4bf3cc6 100644 --- a/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m +++ b/FsprgEmbeddedStore/FsprgOrderDocumentRepresentation.m @@ -46,6 +46,9 @@ - (BOOL)canProvideDocumentSource return FALSE; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + - (void)setDataSource:(WebDataSource *)aDataSource { } @@ -68,7 +71,9 @@ - (void)finishedLoadingWithDataSource:(WebDataSource *)aDataSource - (void)dealloc { [self setOrder:nil]; - + [super dealloc]; //pgh fix } +#pragma clang diagnostic pop + @end diff --git a/FsprgEmbeddedStore/FsprgOrderView.h b/FsprgEmbeddedStore/FsprgOrderView.h index c30b8d8..e9af88b 100644 --- a/FsprgEmbeddedStore/FsprgOrderView.h +++ b/FsprgEmbeddedStore/FsprgOrderView.h @@ -9,6 +9,8 @@ #import #import +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" /*! * WebDocumentView implementation encapsulating the order @@ -22,4 +24,6 @@ @property (NS_NONATOMIC_IOSONLY, assign) WebDataSource *dataSource; @property (NS_NONATOMIC_IOSONLY) BOOL needsLayout; +#pragma clang diagnostic pop + @end diff --git a/FsprgEmbeddedStore/FsprgOrderView.m b/FsprgEmbeddedStore/FsprgOrderView.m index d10e559..a802a1e 100644 --- a/FsprgEmbeddedStore/FsprgOrderView.m +++ b/FsprgEmbeddedStore/FsprgOrderView.m @@ -10,6 +10,8 @@ #import "FsprgOrderDocumentRepresentation.h" #import "FsprgEmbeddedStoreController.h" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" @implementation FsprgOrderView @@ -91,3 +93,5 @@ - (void)dealloc } @end + +#pragma clang diagnostic pop From 457267658e4b9b84df1039efa5ed4d8051cb7e0c Mon Sep 17 00:00:00 2001 From: 45RPM Software Date: Sat, 11 Oct 2025 16:28:00 +0100 Subject: [PATCH 10/10] Updated to work with macOS 26 Updated to work with macOS 26 'Tahoe', removing deprecations and fixing (most) static analysis and compiler warnings. --- .../FsprgEmbeddedStoreController.m | 13 ++++++++++--- FsprgEmbeddedStore/FsprgOrderView.m | 17 +++++++++++++---- FsprgEmbeddedStore/FsprgStoreParameters.m | 10 +++++++--- FsprgEmbeddedStore/Model/FsprgFileDownload.m | 8 ++++++-- FsprgEmbeddedStore/Model/FsprgFulfillment.m | 8 ++++++-- FsprgEmbeddedStore/Model/FsprgLicense.m | 8 ++++++-- FsprgEmbeddedStore/Model/FsprgOrder.m | 19 +++++++------------ FsprgEmbeddedStore/Model/FsprgOrderItem.m | 8 ++++++-- README.mdown | 2 +- 9 files changed, 62 insertions(+), 31 deletions(-) diff --git a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m index 0fb62a9..9dd533b 100755 --- a/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m +++ b/FsprgEmbeddedStore/FsprgEmbeddedStoreController.m @@ -5,13 +5,15 @@ // Created by Lars Steiger on 2/12/10. // Copyright 2010 FastSpring. All rights reserved. // +// Updated by Pascal Harris 10/10/2026. +// Updated to work with macOS 26 'Tahoe', removing +// deprecations and fixing (most) static analysis +// and compiler warnings. #import "FsprgEmbeddedStoreController.h" #import "FsprgOrderView.h" #import "FsprgOrderDocumentRepresentation.h" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" // We don't retrieve SSL certificates below OSX 10.6 //#define RETRIEVE_SSL_CERTIFICATES defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 @@ -28,6 +30,9 @@ - (void)webViewFrameChanged:(NSNotification *)aNotification; @end +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + //#if defined(MAC_OS_X_VERSION_10_11) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11 @interface FsprgEmbeddedStoreController () @end @@ -301,6 +306,7 @@ - (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString * #else [alertPanel beginSheetModalForWindow:[sender window] completionHandler:nil]; #endif + [alertPanel release]; } - (NSUInteger)webView:(WebView *)sender dragDestinationActionMaskForDraggingInfo:(id )draggingInfo @@ -319,7 +325,7 @@ - (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *) [window setContentView:subWebView]; [window makeKeyAndOrderFront:sender]; - return subWebView; + return [subWebView autorelease]; } #pragma mark - WebResourceLoadDelegate @@ -358,6 +364,7 @@ - (void)dealloc [self setDelegate:nil]; [self setStoreHost:nil]; [self setHostCertificates:nil]; + [super dealloc]; //pgh } #pragma clang diagnostic pop diff --git a/FsprgEmbeddedStore/FsprgOrderView.m b/FsprgEmbeddedStore/FsprgOrderView.m index a802a1e..048104d 100644 --- a/FsprgEmbeddedStore/FsprgOrderView.m +++ b/FsprgEmbeddedStore/FsprgOrderView.m @@ -5,13 +5,15 @@ // Created by Lars Steiger on 2/18/10. // Copyright 2010 FastSpring. All rights reserved. // +// Updated by Pascal Harris 10/10/2026. +// Updated to work with macOS 26 'Tahoe', removing +// deprecations and fixing (most) static analysis +// and compiler warnings. #import "FsprgOrderView.h" #import "FsprgOrderDocumentRepresentation.h" #import "FsprgEmbeddedStoreController.h" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" @implementation FsprgOrderView @@ -27,21 +29,28 @@ - (instancetype)initWithFrame:(NSRect)frame return self; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + - (WebDataSource *)dataSource { return dataSource; } + - (void)setDataSource:(WebDataSource *)aDataSource { if (dataSource != aDataSource) { dataSource = aDataSource; } } + - (void)dataSourceUpdated:(WebDataSource *)aDataSource { self.dataSource = aDataSource; } +#pragma clang diagnostic pop + - (BOOL)needsLayout { return needsLayout; @@ -82,6 +91,7 @@ - (void)layout - (void)viewDidMoveToHostWindow { } + - (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow { } @@ -89,9 +99,8 @@ - (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow - (void)dealloc { [self setDataSource:nil]; - + [super dealloc]; //pgh } @end -#pragma clang diagnostic pop diff --git a/FsprgEmbeddedStore/FsprgStoreParameters.m b/FsprgEmbeddedStore/FsprgStoreParameters.m index 8b463b5..4811091 100755 --- a/FsprgEmbeddedStore/FsprgStoreParameters.m +++ b/FsprgEmbeddedStore/FsprgStoreParameters.m @@ -5,6 +5,10 @@ // Created by Lars Steiger on 2/19/10. // Copyright 2010 FastSpring. All rights reserved. // +// Updated by Pascal Harris 10/10/2026. +// Updated to work with macOS 26 'Tahoe', removing +// deprecations and fixing (most) static analysis +// and compiler warnings. #import "FsprgStoreParameters.h" @@ -63,12 +67,12 @@ + (void)initialize + (FsprgStoreParameters *)parameters { NSMutableDictionary *raw = [NSMutableDictionary dictionaryWithCapacity:15]; - return [[FsprgStoreParameters alloc] initWithRaw:raw]; + return [[[FsprgStoreParameters alloc] initWithRaw:raw] autorelease]; } + (FsprgStoreParameters *)parametersWithRaw:(NSMutableDictionary *)aRaw { - return [[FsprgStoreParameters alloc] initWithRaw:aRaw]; + return [[[FsprgStoreParameters alloc] initWithRaw:aRaw] autorelease]; } + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key @@ -343,7 +347,7 @@ - (void)setContactPhone:(NSString *)aContactPhone - (void)dealloc { [self setRaw:nil]; - + [super dealloc]; // pgh } @end diff --git a/FsprgEmbeddedStore/Model/FsprgFileDownload.m b/FsprgEmbeddedStore/Model/FsprgFileDownload.m index edd32ed..72228ae 100644 --- a/FsprgEmbeddedStore/Model/FsprgFileDownload.m +++ b/FsprgEmbeddedStore/Model/FsprgFileDownload.m @@ -5,6 +5,10 @@ // Created by Lars Steiger on 2/24/10. // Copyright 2010 FastSpring. All rights reserved. // +// Updated by Pascal Harris 10/10/2026. +// Updated to work with macOS 26 'Tahoe', removing +// deprecations and fixing (most) static analysis +// and compiler warnings. #import "FsprgFileDownload.h" @@ -13,7 +17,7 @@ @implementation FsprgFileDownload + (FsprgFileDownload *)fileDownloadWithDictionary:(NSDictionary *)aDictionary { - return [[FsprgFileDownload alloc] initWithDictionary:aDictionary]; + return [[[FsprgFileDownload alloc] initWithDictionary:aDictionary] autorelease]; } - (instancetype)init @@ -56,7 +60,7 @@ + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key - (void)dealloc { [self setRaw:nil]; - + [super dealloc]; //pgh } @end diff --git a/FsprgEmbeddedStore/Model/FsprgFulfillment.m b/FsprgEmbeddedStore/Model/FsprgFulfillment.m index eed6039..621e3a1 100644 --- a/FsprgEmbeddedStore/Model/FsprgFulfillment.m +++ b/FsprgEmbeddedStore/Model/FsprgFulfillment.m @@ -5,6 +5,10 @@ // Created by Lars Steiger on 2/24/10. // Copyright 2010 FastSpring. All rights reserved. // +// Updated by Pascal Harris 10/10/2026. +// Updated to work with macOS 26 'Tahoe', removing +// deprecations and fixing (most) static analysis +// and compiler warnings. #import "FsprgFulfillment.h" #import "FsprgLicense.h" @@ -15,7 +19,7 @@ @implementation FsprgFulfillment + (FsprgFulfillment *)fulfillmentWithDictionary:(NSDictionary *)aDictionary { - return [[FsprgFulfillment alloc] initWithDictionary:aDictionary]; + return [[[FsprgFulfillment alloc] initWithDictionary:aDictionary] autorelease]; } - (instancetype)init @@ -67,7 +71,7 @@ + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key - (void)dealloc { [self setRaw:nil]; - + [super dealloc]; //pgh } @end diff --git a/FsprgEmbeddedStore/Model/FsprgLicense.m b/FsprgEmbeddedStore/Model/FsprgLicense.m index 32a7e3c..d1bfbdd 100644 --- a/FsprgEmbeddedStore/Model/FsprgLicense.m +++ b/FsprgEmbeddedStore/Model/FsprgLicense.m @@ -5,6 +5,10 @@ // Created by Lars Steiger on 2/24/10. // Copyright 2010 FastSpring. All rights reserved. // +// Updated by Pascal Harris 10/10/2026. +// Updated to work with macOS 26 'Tahoe', removing +// deprecations and fixing (most) static analysis +// and compiler warnings. #import "FsprgLicense.h" @@ -13,7 +17,7 @@ @implementation FsprgLicense + (FsprgLicense *)licenseWithDictionary:(NSDictionary *)aDictionary { - return [[FsprgLicense alloc] initWithDictionary:aDictionary]; + return [[[FsprgLicense alloc] initWithDictionary:aDictionary] autorelease]; } - (instancetype)init @@ -85,7 +89,7 @@ + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key - (void)dealloc { [self setRaw:nil]; - + [super dealloc]; //pgh } @end diff --git a/FsprgEmbeddedStore/Model/FsprgOrder.m b/FsprgEmbeddedStore/Model/FsprgOrder.m index 379885e..b3292c0 100644 --- a/FsprgEmbeddedStore/Model/FsprgOrder.m +++ b/FsprgEmbeddedStore/Model/FsprgOrder.m @@ -5,6 +5,10 @@ // Created by Lars Steiger on 2/12/10. // Copyright 2010 FastSpring. All rights reserved. // +// Updated by Pascal Harris 10/10/2026. +// Updated to work with macOS 26 'Tahoe', removing +// deprecations and fixing (most) static analysis +// and compiler warnings. #import "FsprgOrder.h" @@ -15,21 +19,12 @@ + (FsprgOrder *)orderFromData:(NSData *)aData { NSPropertyListFormat *format = nil; -//#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 -// NSString *errorDesc = nil; -// NSDictionary *aDict = [NSPropertyListSerialization propertyListFromData:aData -// mutabilityOption:NSPropertyListImmutable -// format:format -// errorDescription:&errorDesc]; -// -//#else NSDictionary *aDict = [NSPropertyListSerialization propertyListWithData:aData options:NSPropertyListImmutable format:format error:nil]; -//#endif - - return [[FsprgOrder alloc] initWithDictionary:aDict]; + + return [[[FsprgOrder alloc] initWithDictionary:aDict] autorelease]; } - (instancetype)init @@ -137,7 +132,7 @@ + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key - (void)dealloc { [self setRaw:nil]; - + [super dealloc]; //pgh } @end diff --git a/FsprgEmbeddedStore/Model/FsprgOrderItem.m b/FsprgEmbeddedStore/Model/FsprgOrderItem.m index 3087fa8..4aa2126 100644 --- a/FsprgEmbeddedStore/Model/FsprgOrderItem.m +++ b/FsprgEmbeddedStore/Model/FsprgOrderItem.m @@ -5,6 +5,10 @@ // Created by Lars Steiger on 2/24/10. // Copyright 2010 FastSpring. All rights reserved. // +// Updated by Pascal Harris 10/10/2026. +// Updated to work with macOS 26 'Tahoe', removing +// deprecations and fixing (most) static analysis +// and compiler warnings. #import "FsprgOrderItem.h" @@ -13,7 +17,7 @@ @implementation FsprgOrderItem + (FsprgOrderItem *)itemWithDictionary:(NSDictionary *)aDictionary { - return [[FsprgOrderItem alloc] initWithDictionary:aDictionary]; + return [[[FsprgOrderItem alloc] initWithDictionary:aDictionary] autorelease]; } - (instancetype)init @@ -101,7 +105,7 @@ + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key - (void)dealloc { [self setRaw:nil]; - + [super dealloc]; //pgh } @end diff --git a/README.mdown b/README.mdown index cd6b890..539bcf9 100644 --- a/README.mdown +++ b/README.mdown @@ -6,7 +6,7 @@ FastSpring's embedded store consists of a controller with some integration point To get an idea of how it works, the SDK provides two examples and a test application. All source code is released under the MIT license. It is open to contributions and its use is unrestricted. See RELEASE_NOTES.html for the latest changes. - +Updated to work with macOS 26, removing deprecations and fixing compiler warnings by Pascal Harris, # FsprgEmbeddedStore #