Skip to content

Commit

Permalink
Fixed issues with template collections
Browse files Browse the repository at this point in the history
  • Loading branch information
Kostas Karayannis committed Dec 6, 2016
1 parent c4f04dc commit c122629
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion 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 = '6.1.5'
spec.version = '6.1.6'
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 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 = @"6.1.5";
NSString *const kOLKiteSDKVersion = @"6.1.6";
NSString *const kOLKiteSDKErrorDomain = @"co.oceanlabs.kOLKiteSDKErrorDomain";
NSString *const kNotificationTemplateSyncComplete = @"co.oceanlabs.pssdk.notification.kNotificationSyncComplete";
NSString *const kNotificationKeyTemplateSyncError = @"co.oceanlabs.pssdk.notification.kNotificationKeyTemplateSyncError";
Expand Down
1 change: 1 addition & 0 deletions Kite-SDK/PSPrintSDK/OLImageEditViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa

OLProduct *product = [OLProduct productWithTemplateId:templateId];
product.uuid = self.product.uuid;
[product.selectedOptions removeObjectForKey:self.selectedOption.code];

if (self.navigationController.viewControllers.count > 1){
OLProductOverviewViewController *vc = self.navigationController.viewControllers[self.navigationController.viewControllers.count - 2];
Expand Down
3 changes: 2 additions & 1 deletion Kite-SDK/PSPrintSDK/OLProductTemplateCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@

@property (strong, nonatomic) NSString *_Nonnull name;
@property (strong, nonatomic) NSURL *_Nullable icon;
@property (strong, nonatomic) NSString *_Nonnull code;
@property (strong, nonatomic) NSArray<NSDictionary<NSString *, NSString *> *> *_Nonnull templates;
- (_Nonnull instancetype)initWithName:(NSString *_Nonnull)name templates:(NSArray<NSDictionary<NSString *, NSString *> *> *_Nonnull )templates;
- (_Nonnull instancetype)initWithName:(NSString *_Nonnull)name code:(NSString *_Nonnull)code templates:(NSArray<NSDictionary<NSString *, NSString *> *> *_Nonnull )templates;
- (BOOL)containsTemplateIdentifier:(NSString *_Nonnull)identifier;

@end
3 changes: 2 additions & 1 deletion Kite-SDK/PSPrintSDK/OLProductTemplateCollection.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@

@implementation OLProductTemplateCollection

- (_Nonnull instancetype)initWithName:(NSString *_Nonnull)name templates:(NSArray<NSDictionary<NSString *, NSString *> *> *_Nonnull )templates{
- (_Nonnull instancetype)initWithName:(NSString *_Nonnull)name code:(NSString *)code templates:(NSArray<NSDictionary<NSString *, NSString *> *> *_Nonnull )templates{
if (self = [super init]){
self.name = name;
self.templates = templates;
self.code = code;
}

return self;
Expand Down
3 changes: 2 additions & 1 deletion Kite-SDK/PSPrintSDK/OLProductTemplateOption.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ - (instancetype)initWithTemplateCollection:(OLProductTemplateCollection *)collec
self.name = collection.name;
self.iconURL = collection.icon;
self.type = OLProductTemplateOptionTypeTemplateCollection;
self.code = collection.code;
NSMutableArray *choices = [[NSMutableArray alloc] init];
for (NSDictionary *template in collection.templates){
OLProductTemplateOptionChoice *choice = [[OLProductTemplateOptionChoice alloc] init];
Expand Down Expand Up @@ -122,7 +123,7 @@ - (UIImage *)fallbackIcon{
return [UIImage imageNamedInKiteBundle:self.iconImageName];
}
else{ //Match known options with embedded assets
if ([self.code isEqualToString:@"case_style"]){
if ([self.code isEqualToString:@"case_style"] || [self.code isEqualToString:@"Phone Cases"]){
return [UIImage imageNamedInKiteBundle:@"case-options"];
}
}
Expand Down
3 changes: 2 additions & 1 deletion Kite-SDK/PSPrintSDK/OLProductTemplateSyncRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ - (void)fetchTemplatesWithURL:(NSURL *)url templateAccumulator:(NSMutableArray *
for (NSDictionary *collection in collections){
if ([collection isKindOfClass:[NSDictionary class]]){
NSString *name = collection[@"option_label"];
NSString *code = collection[@"name"];
NSArray *templates = collection[@"templates"];
OLProductTemplateCollection *templateCollection = [[OLProductTemplateCollection alloc] initWithName:name templates:templates];
OLProductTemplateCollection *templateCollection = [[OLProductTemplateCollection alloc] initWithName:name code:code templates:templates];
[templateCollections addObject:templateCollection];
}
}
Expand Down

0 comments on commit c122629

Please sign in to comment.