Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Kite-SDK/Podfile.lock
  • Loading branch information
Kostas Karayannis committed Dec 10, 2018
2 parents 08dc45a + 353565d commit 4f3adf8
Show file tree
Hide file tree
Showing 21 changed files with 115 additions and 81 deletions.
4 changes: 2 additions & 2 deletions Kite-Print-SDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'Kite-Print-SDK'
spec.version = '7.0.0'
spec.version = '7.0.1'
spec.license = { :type => 'MIT', :file => 'Kite-SDK/LICENSE' }
spec.homepage = 'https://github.com/OceanLabs/iOS-Print-SDK'
spec.authors = {'Deon Botha' => 'deon@oceanlabs.co'}
Expand All @@ -11,7 +11,7 @@ Pod::Spec.new do |spec|
spec.social_media_url = 'https://twitter.com/dbotha'
spec.module_name = 'KiteSDK'
spec.default_subspec = 'Core'
spec.dependency "Photobook"
spec.dependency "Photobook", "~> 1.2.0"
spec.dependency "NXOAuth2Client"

spec.subspec 'Core' do |core|
Expand Down
3 changes: 3 additions & 0 deletions Kite-SDK/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 7.0.1
- Updated for the newest Photobook

# 7.0.0
- New: Photobook building experience
- New: Checkout experience
Expand Down
2 changes: 1 addition & 1 deletion Kite-SDK/KitePrintSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@
CD73BF60186215790009DE03 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1000;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = Kite.ly;
TargetAttributes = {
2E451DC71D9554B40080F1C1 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
6 changes: 3 additions & 3 deletions Kite-SDK/PSPrintSDK/AssetDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ + (AssetDataSource *)assetWithURL:(NSURL *)url {

NSString *urlStr = url.absoluteString;
if ([urlStr hasSuffix:@"jpg"] || [urlStr hasSuffix:@"jpeg"]) {
return [[AssetDataSource alloc] initWithImageURL:url mimeType:kOLMimeTypeJPEG];
return [[AssetDataSource alloc] initWithImageURL:url mimeType:kOLMimeTypeJPEG size:CGSizeZero];
} else if ([urlStr hasSuffix:@"png"]) {
return [[AssetDataSource alloc] initWithImageURL:url mimeType:kOLMimeTypePNG];
return [[AssetDataSource alloc] initWithImageURL:url mimeType:kOLMimeTypePNG size:CGSizeZero];
}
// else if ([urlStr hasSuffix:@"tiff"] || [urlStr hasSuffix:@"tif"]) {
// return [[AssetDataSource alloc] initWithImageURL:url mimeType:kOLMimeTypeTIFF];
Expand All @@ -77,7 +77,7 @@ + (AssetDataSource *)assetWithURL:(NSURL *)url {
// }
else {
// Worst case scenario just assume it's a JPEG.
return [[AssetDataSource alloc] initWithImageURL:url mimeType:kOLMimeTypeJPEG];
return [[AssetDataSource alloc] initWithImageURL:url mimeType:kOLMimeTypeJPEG size:CGSizeZero];
}

return nil;
Expand Down
11 changes: 3 additions & 8 deletions Kite-SDK/PSPrintSDK/Categories/UIViewController+OLMethods.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ @interface OLKiteViewController ()
- (void)kioskLogout;
@end

@interface UIViewController () <DismissDelegate>
@end

@implementation UIViewController (OLMethods)

- (void)addBasketIconToTopRight{
Expand Down Expand Up @@ -148,7 +145,9 @@ - (void)kioskLogoutButtonTapped{
}

- (IBAction)onButtonBasketClicked:(UIBarButtonItem *)sender {
UIViewController *checkoutVc = [[PhotobookSDK shared] checkoutViewControllerWithEmbedInNavigation:YES delegate:self];
UIViewController *checkoutVc = [[PhotobookSDK shared] checkoutViewControllerWithEmbedInNavigation:YES dismissClosure:^(UIViewController *viewController, BOOL success){
[viewController dismissViewControllerAnimated:YES completion:NULL];
}];
if (checkoutVc) {
[self presentViewController:checkoutVc animated:YES completion:NULL];
}
Expand All @@ -163,8 +162,4 @@ - (BOOL)isPushed{
return NO;
}

- (void)wantsToDismiss:(UIViewController *)viewController {
[viewController dismissViewControllerAnimated:YES completion:NULL];
}

@end
2 changes: 1 addition & 1 deletion Kite-SDK/PSPrintSDK/OLAsset+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ typedef enum {

@property (nonatomic, strong) id<OLAssetDataSource> dataSource;

- (instancetype)initWithImageURL:(NSURL *)url mimeType:(NSString *)mimeType size:(CGSize)size;
+ (void)cancelAllImageOperations;
- (BOOL)isEdited;
- (BOOL)isEqual:(id)object ignoreEdits:(BOOL)ignoreEdits;
- (instancetype)initWithImageURL:(NSURL *)url mimeType:(NSString *)mimeType;
- (void)dataLengthWithCompletionHandler:(GetDataLengthHandler)handler;
- (void)dataWithCompletionHandler:(GetDataHandler)handler;
- (void)getImageURLWithProgress:(void(^)(float progress, float total))progressHandler completionHandler:(void(^)(NSURL *url, NSError *error))handler;
Expand Down
2 changes: 1 addition & 1 deletion Kite-SDK/PSPrintSDK/OLConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#import "OLConstants.h"

NSString *const kOLKiteSDKVersion = @"7.0.0";
NSString *const kOLKiteSDKVersion = @"7.0.1";
NSString *const kOLKiteSDKErrorDomain = @"co.oceanlabs.kOLKiteSDKErrorDomain";
NSString *const kNotificationTemplateSyncComplete = @"co.oceanlabs.pssdk.notification.kNotificationSyncComplete";
NSString *const kNotificationTemplateSyncPartialComplete = @"co.oceanlabs.pssdk.notification.kNotificationTemplateSyncPartialComplete";
Expand Down
19 changes: 15 additions & 4 deletions Kite-SDK/PSPrintSDK/OLKitePrintSDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ + (void)setAPIKey:(NSString *_Nonnull)_apiKey withEnvironment:(OLKitePrintSDKEnv
environment = _environment;
[[PhotobookSDK shared] setKiteApiKey:_apiKey];
if (environment == OLKitePrintSDKEnvironmentLive) {
[[PhotobookSDK shared] setEnvironmentWithEnvironment:EnvironmentLive];
[[PhotobookSDK shared] setEnvironment:EnvironmentLive];
} else {
[[PhotobookSDK shared] setEnvironmentWithEnvironment:EnvironmentTest];
[[PhotobookSDK shared] setEnvironment:EnvironmentTest];
}
}

Expand Down Expand Up @@ -151,7 +151,9 @@ + (UIViewController *)checkoutViewControllerWithPrintJobs:(NSArray <id<OLPrintJo

+ (UIViewController *)checkoutViewControllerWithPrintJobs:(NSArray <id<OLPrintJob>>*_Nullable)printJobs info:(NSDictionary * _Nullable)info{
if ([[PhotobookSDK shared] isProcessingOrder]) {
return [[PhotobookSDK shared] receiptViewControllerWithEmbedInNavigation:YES delegate:nil];
return [[PhotobookSDK shared] receiptViewControllerWithEmbedInNavigation:YES dismissClosure:^(UIViewController *viewController, BOOL success){
[viewController dismissViewControllerAnimated:YES completion:NULL];
}];
}

[OLAnalytics setExtraInfo:info];
Expand All @@ -161,7 +163,16 @@ + (UIViewController *)checkoutViewControllerWithPrintJobs:(NSArray <id<OLPrintJo
[[Checkout shared] addProductToBasket:(id<Product>)printJob];
}

return (UINavigationController *)[[PhotobookSDK shared] checkoutViewControllerWithEmbedInNavigation:YES delegate:[OLUserSession currentSession]];
return (UINavigationController *)[[PhotobookSDK shared] checkoutViewControllerWithEmbedInNavigation:YES dismissClosure:^(UIViewController *viewController, BOOL success){
if (![OLUserSession currentSession].kiteVc){
[viewController dismissViewControllerAnimated:YES completion:NULL];
}
else if ([viewController isKindOfClass:[NSClassFromString(@"Photobook.PhotobookViewController") class]]){
[viewController.navigationController popViewControllerAnimated:YES];
} else {
[viewController.navigationController popToRootViewControllerAnimated:YES];
}
}];
}

+ (BOOL)isProcessingOrder {
Expand Down
3 changes: 0 additions & 3 deletions Kite-SDK/PSPrintSDK/OLKiteUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@
+ (BOOL)facebookEnabled;
+ (BOOL)instagramEnabled;
+ (BOOL)qrCodeUploadEnabled;
+ (NSArray<NSString *> *)supportedPKPaymentNetworks;
+ (BOOL)isApplePayAvailable;
+ (BOOL)isPayPalAvailable;
+ (BOOL)recentsAvailable;
+ (NSInteger)numberOfProvidersAvailable;

Expand Down
20 changes: 0 additions & 20 deletions Kite-SDK/PSPrintSDK/OLKiteUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -120,26 +120,6 @@ + (BOOL)cameraRollEnabled{
return YES;
}

+(BOOL)isApplePayAvailable{
if (![OLKitePrintSDK appleMerchantID] || [[OLKitePrintSDK appleMerchantID] isEqualToString:@""] || [OLKitePrintSDK isKiosk]){
return NO;
}

return [Stripe deviceSupportsApplePay];
}

+ (NSArray<NSString *> *)supportedPKPaymentNetworks {
NSArray *supportedNetworks = @[PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa];
if ((&PKPaymentNetworkDiscover) != NULL) {
supportedNetworks = [supportedNetworks arrayByAddingObject:PKPaymentNetworkDiscover];
}
return supportedNetworks;
}

+ (BOOL)isPayPalAvailable{
return [OLPayPalWrapper isPayPalAvailable];
}

+ (UIFont *)fontWithName:(NSString *)name size:(CGFloat)size{
UIFont *font = [UIFont fontWithName:name size:size];
if (!font){
Expand Down
15 changes: 13 additions & 2 deletions Kite-SDK/PSPrintSDK/OLKiteViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ - (void)viewDidAppear:(BOOL)animated{
[OLUserSession currentSession].kiteVc = self;

if ([[PhotobookSDK shared] isProcessingOrder]) {
UIViewController *receiptViewController = [[PhotobookSDK shared] receiptViewControllerWithEmbedInNavigation:YES delegate:nil];
UIViewController *receiptViewController = [[PhotobookSDK shared] receiptViewControllerWithEmbedInNavigation:YES dismissClosure:^(UIViewController *viewController, BOOL success){
[viewController dismissViewControllerAnimated:YES completion:NULL];
}];
if (receiptViewController) {
[self presentViewController:receiptViewController animated:YES completion:nil];
}
Expand Down Expand Up @@ -270,7 +272,16 @@ - (UIViewController *)reviewViewControllerForProduct:(OLProduct *)product photoS
return [[UIStoryboard storyboardWithName:@"OLKiteStoryboard" bundle:[OLKiteUtils kiteResourcesBundle]] instantiateViewControllerWithIdentifier:@"OLImagePickerViewController"];
}
else if (templateUI == OLTemplateUIPhotobook){
return [[PhotobookSDK shared] photobookViewControllerWith:[OLAsset photobookAssetsFromAssets:[OLAsset userSelectedAssets]] embedInNavigation:NO delegate:[OLUserSession currentSession]];
return [[PhotobookSDK shared] photobookViewControllerWith:[OLAsset photobookAssetsFromAssets:[OLAsset userSelectedAssets]] embedInNavigation:NO navigatesToCheckout:YES delegate:[OLUserSession currentSession] completion:^(UIViewController *viewController, BOOL success){
if (![OLUserSession currentSession].kiteVc){
[viewController dismissViewControllerAnimated:YES completion:NULL];
}
else if ([viewController isKindOfClass:[NSClassFromString(@"Photobook.PhotobookViewController") class]]){
[viewController.navigationController popViewControllerAnimated:YES];
} else {
[viewController.navigationController popToRootViewControllerAnimated:YES];
}
}];
}
else if (templateUI == OLTemplateUIPoster){
return [[UIStoryboard storyboardWithName:@"OLKiteStoryboard" bundle:[OLKiteUtils kiteResourcesBundle]] instantiateViewControllerWithIdentifier:@"OLPosterViewController"];
Expand Down
11 changes: 10 additions & 1 deletion Kite-SDK/PSPrintSDK/OLPackProductViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,16 @@ - (void)saveJobWithCompletionHandler:(void(^)(void))handler{
- (void)doCheckout {
[self saveJobWithCompletionHandler:NULL];

UIViewController *checkoutVc = [[PhotobookSDK shared] checkoutViewControllerWithEmbedInNavigation:NO delegate:[OLUserSession currentSession]];
UIViewController *checkoutVc = [[PhotobookSDK shared] checkoutViewControllerWithEmbedInNavigation:NO dismissClosure:^(UIViewController *viewController, BOOL success){
if (![OLUserSession currentSession].kiteVc){
[viewController dismissViewControllerAnimated:YES completion:NULL];
}
else if ([viewController isKindOfClass:[NSClassFromString(@"Photobook.PhotobookViewController") class]]){
[viewController.navigationController popViewControllerAnimated:YES];
} else {
[viewController.navigationController popToRootViewControllerAnimated:YES];
}
}];
UIViewController *firstController = self.navigationController.viewControllers.firstObject;
[self.navigationController setViewControllers:@[firstController, checkoutVc] animated:YES];
[[OLUserSession currentSession] resetUserSelectedPhotos];
Expand Down
11 changes: 10 additions & 1 deletion Kite-SDK/PSPrintSDK/OLProductOverviewViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,16 @@ - (void)saveJobWithCompletionHandler:(void(^)(void))handler{
- (void)doCheckout {
[self saveJobWithCompletionHandler:NULL];

UIViewController *checkoutVc = [[PhotobookSDK shared] checkoutViewControllerWithEmbedInNavigation:NO delegate:[OLUserSession currentSession]];
UIViewController *checkoutVc = [[PhotobookSDK shared] checkoutViewControllerWithEmbedInNavigation:NO dismissClosure:^(UIViewController *viewController, BOOL success){
if (![OLUserSession currentSession].kiteVc){
[viewController dismissViewControllerAnimated:YES completion:NULL];
}
else if ([viewController isKindOfClass:[NSClassFromString(@"Photobook.PhotobookViewController") class]]){
[viewController.navigationController popViewControllerAnimated:YES];
} else {
[viewController.navigationController popToRootViewControllerAnimated:YES];
}
}];
UIViewController *firstController = self.navigationController.viewControllers.firstObject;
[self.navigationController setViewControllers:@[firstController, checkoutVc] animated:YES];
[[OLUserSession currentSession] resetUserSelectedPhotos];
Expand Down
34 changes: 29 additions & 5 deletions Kite-SDK/PSPrintSDK/OLProductTemplateSyncRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
#import "OLUserSession.h"
#import "OLShippingClass.h"

@import PayPalDynamicLoader;
@import Stripe;

@interface OLProductTemplateSyncRequest ()
@property (nonatomic, strong) OLBaseRequest *req;
@property (strong, nonatomic) NSURL *nextPage;
Expand All @@ -49,10 +52,6 @@ @interface OLKitePrintSDK (Private)

+ (NSString *)apiEndpoint;
+ (NSString *)apiVersion;
+ (void)setPayPalAccountId:(NSString *)accountId;
+ (void)setPayPalPublicKey:(NSString *)publicKey;
+ (void)setStripeAccountId:(NSString *)accountId;
+ (void)setStripePublicKey:(NSString *)publicKey;

@end

Expand All @@ -64,7 +63,7 @@ - (void)sync:(OLTemplateSyncRequestCompletionHandler)handler {
if (self.templateId){
urlString = [NSString stringWithFormat:@"%@/%@/template/?template_id__in=%@&limit=1", [OLKitePrintSDK apiEndpoint], [OLKitePrintSDK apiVersion], self.templateId];
} else {
urlString = [NSString stringWithFormat:@"%@/%@/template/?limit=20", [OLKitePrintSDK apiEndpoint], [OLKitePrintSDK apiVersion]];
urlString = [NSString stringWithFormat:@"%@/%@/template/?limit=1000", [OLKitePrintSDK apiEndpoint], [OLKitePrintSDK apiVersion]];
}
NSURL *url = [NSURL URLWithString:urlString];
[self fetchTemplatesWithURL:url templateAccumulator:[[NSMutableArray alloc] init] handler:handler];
Expand Down Expand Up @@ -94,6 +93,31 @@ - (void)fetchTemplatesWithURL:(NSURL *)url templateAccumulator:(NSMutableArray *
}
}

id paymentKeys = json[@"payment_keys"];
if ([paymentKeys isKindOfClass:[NSDictionary class]]){
id paypalKeys = paymentKeys[@"paypal"];
if([paypalKeys isKindOfClass:[NSDictionary class]]){
id publicKey = paypalKeys[@"public_key"];
if ([publicKey isKindOfClass:[NSString class]]){
if ([OLKitePrintSDK environment] == OLKitePrintSDKEnvironmentSandbox){
[OLPayPalWrapper initializeWithClientIdsForEnvironments:@{@"sandbox": publicKey}];
[OLPayPalWrapper preconnectWithEnvironment:@"sandbox"];
} else {
[OLPayPalWrapper initializeWithClientIdsForEnvironments:@{@"live": publicKey}];
[OLPayPalWrapper preconnectWithEnvironment:@"live"];
}
}
}

id stripeKeys = paymentKeys[@"stripe"];
if([stripeKeys isKindOfClass:[NSDictionary class]]){
id publicKey = stripeKeys[@"public_key"];
if ([publicKey isKindOfClass:[NSString class]]){
[Stripe setDefaultPublishableKey:publicKey];
}
}
}

id userConfig = json[@"user_config"];
if ([userConfig isKindOfClass:[NSDictionary class]]){
[[OLKiteABTesting sharedInstance] setUserConfig:userConfig];
Expand Down
11 changes: 10 additions & 1 deletion Kite-SDK/PSPrintSDK/OLSingleProductReviewViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,16 @@ - (void) doCheckout{
}
self.ctaButton.enabled = NO;
[self saveJobWithCompletionHandler:^{
UIViewController *checkoutVc = [[PhotobookSDK shared] checkoutViewControllerWithEmbedInNavigation:NO delegate:[OLUserSession currentSession]];
UIViewController *checkoutVc = [[PhotobookSDK shared] checkoutViewControllerWithEmbedInNavigation:NO dismissClosure:^(UIViewController *viewController, BOOL success){
if (![OLUserSession currentSession].kiteVc){
[viewController dismissViewControllerAnimated:YES completion:NULL];
}
else if ([viewController isKindOfClass:[NSClassFromString(@"Photobook.PhotobookViewController") class]]){
[viewController.navigationController popViewControllerAnimated:YES];
} else {
[viewController.navigationController popToRootViewControllerAnimated:YES];
}
}];
UIViewController *firstController = self.navigationController.viewControllers.firstObject;
[self.navigationController setViewControllers:@[firstController, checkoutVc] animated:YES];
[[OLUserSession currentSession] resetUserSelectedPhotos];
Expand Down
11 changes: 0 additions & 11 deletions Kite-SDK/PSPrintSDK/OLUserSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,6 @@ - (NSString *) getSysInfoByName:(char *)typeSpecifier
return results;
}

- (void)wantsToDismiss:(UIViewController *)viewController {
if (!self.kiteVc){
[viewController dismissViewControllerAnimated:YES completion:NULL];
}
else if ([viewController isKindOfClass:[NSClassFromString(@"Photobook.PhotobookViewController") class]]){
[viewController.navigationController popViewControllerAnimated:YES];
} else {
[viewController.navigationController popToRootViewControllerAnimated:YES];
}
}

- (id<PhotobookAssetPicker>) assetPickerViewController {
OLImagePickerViewController *vc = [[UIStoryboard storyboardWithName:@"OLKiteStoryboard" bundle:[OLKiteUtils kiteResourcesBundle]] instantiateViewControllerWithIdentifier:@"OLImagePickerViewController"];
vc.selectedAssets = [[NSMutableArray alloc] init];
Expand Down
2 changes: 2 additions & 0 deletions Kite-SDK/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use_frameworks!
target 'KiteSDK' do
pod 'Photobook', :git => 'https://github.com/Oceanlabs/Photobook-iOS.git', :branch => 'remove-fb'
pod 'NXOAuth2Client'
pod 'FBSDKLoginKit'
pod 'FBSDKCoreKit'
end

target 'KiteSDK-Demo' do
Expand Down
Loading

0 comments on commit 4f3adf8

Please sign in to comment.