Skip to content

Commit

Permalink
Merge branch 'release-0.4.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
odrobnik committed Sep 21, 2015
2 parents 1a78596 + 4ca1153 commit 01f595e
Show file tree
Hide file tree
Showing 25 changed files with 637 additions and 172 deletions.
9 changes: 9 additions & 0 deletions Core/Source/PLYConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ extern NSString * const PLYErrorDomain;
*/
extern NSString * const PLYServerLoginErrorNotification;

/**
Notification for when an entity has been deleted
*/
extern NSString * const PLYServerDidCreateEntityNotification;

/**
Key in the info dictionary for PLYServerDidCreateEntityNotification
*/
extern NSString * const PLYServerDidCreateEntityKey;

/**
Notification for when an entity has been deleted
Expand Down
2 changes: 2 additions & 0 deletions Core/Source/PLYConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
NSString * const PLYErrorDomain = @"Product Layer API";
NSString * const PLYServerLoginErrorNotification = @"PLYServerLoginErrorNotification";
NSString * const PLYUserDefaultOpineComposerIncludeLocation = @"PLYUserDefaultOpineComposerIncludeLocation";
NSString * const PLYServerDidCreateEntityNotification = @"PLYServerDidCreateEntityNotification";
NSString * const PLYServerDidDeleteEntityNotification = @"PLYServerDidDeleteEntityNotification";
NSString * const PLYServerDidModifyListNotification = @"PLYServerDidModifyListNotification";
NSString * const PLYServerDidDeleteEntityKey = @"PLYServerDidDeleteEntityKey";
NSString * const PLYServerDidModifyListKey = @"PLYServerDidModifyListKey";
NSString * const PLYServerDidUpdateEntityNotification = @"PLYServerDidUpdateEntityNotification";
NSString * const PLYServerDidUpdateEntityKey = @"PLYServerDidUpdateEntityKey";
NSString * const PLYServerDidCreateEntityKey = @"PLYServerDidCreateEntityKey";

/**
Timeline Options
Expand Down
5 changes: 5 additions & 0 deletions Core/Source/PLYEntities/PLYUser.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@
@property (nonatomic, copy, readonly) NSDictionary *socialConnections;


/**
The roles of the user
*/
@property (nonatomic, copy, readonly) NSArray *roles;

/**
An PLYUserAvatar object for the receiver
*/
Expand Down
13 changes: 12 additions & 1 deletion Core/Source/PLYEntities/PLYUser.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ @interface PLYUser ()
@property (nonatomic, assign, readwrite) BOOL following;
@property (nonatomic, assign, readwrite) BOOL followed;
@property (nonatomic, copy, readwrite) NSDictionary *socialConnections;
@property (nonatomic, copy, readwrite) NSArray *roles;
@property (nonatomic, copy, readwrite) PLYUserAvatar *avatar;

@end
Expand All @@ -34,10 +35,14 @@ + (NSString *)entityTypeIdentifier

- (void)setValue:(id)value forKey:(NSString *)key
{
if ([key isEqualToString:@"pl-app"] || [key isEqualToString:@"pl-usr-roles"])
if ([key isEqualToString:@"pl-app"])
{
// Do nothing
}
else if ([key isEqualToString:@"pl-usr-roles"])
{
self.roles = value;
}
else if ([key isEqualToString:@"pl-usr-nickname"])
{
self.nickname = value;
Expand Down Expand Up @@ -182,6 +187,11 @@ - (NSDictionary *)dictionaryRepresentation
dict[@"pl-usr-avatar"] = [_avatar dictionaryRepresentation];
}

if (_roles)
{
dict[@"pl-usr-roles"] = _roles;
}

// return immutable
return [dict copy];
}
Expand All @@ -203,6 +213,7 @@ - (void)updateFromEntity:(PLYUser *)entity
self.following = entity.following;
self.followed = entity.followed;
self.socialConnections = entity.socialConnections;
self.roles = entity.roles;

if (entity.avatar)
{
Expand Down
21 changes: 10 additions & 11 deletions Core/Source/PLYFunctions.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,17 @@ BOOL PLYIsValidGTIN(NSString *GTIN)
dispatch_once(&onceToken, ^{
// get the same bundle where one of the core entities classes are located in
NSBundle *bundle = [NSBundle bundleForClass:[PLYImage class]];
NSString *extension = [[bundle bundlePath] pathExtension];

// inside a framework, the framework IS the resource bundle
_resourceBundle = bundle;
// in apps and unit tests we need to get the bundle
if ([extension isEqualToString:@"app"] ||
[extension isEqualToString:@"xctest"])
{
NSString *resourceBundlePath = [bundle pathForResource:@"ProductLayerSDK" ofType:@"bundle"];
_resourceBundle = [NSBundle bundleWithPath:resourceBundlePath];
}
NSString *resourceBundlePath = [bundle pathForResource:@"ProductLayerSDK" ofType:@"bundle"];
if (resourceBundlePath)
{
_resourceBundle = [NSBundle bundleWithPath:resourceBundlePath];
}
else
{
// inside a framework, but no bundle found, so that framework IS the resource bundle
_resourceBundle = bundle;
}
});

return _resourceBundle;
Expand Down
30 changes: 29 additions & 1 deletion Core/Source/PLYServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,19 @@ typedef void (^PLYCompletion)(id result, NSError *error);
forGTIN:(NSString *)gtin
completion:(PLYCompletion)completion;

/**
@param image The image to delete
@param completion The completion handler for the request
*/
- (void)deleteImage:(PLYImage *)image completion:(PLYCompletion)completion;

/**
@param image The image to rotate
@param degrees The amount to rotate by, allowed values are: 90, 180, 270
@param completion The completion handler for the request
*/
- (void)rotateImage:(PLYImage *)image degrees:(NSUInteger)degrees completion:(PLYCompletion)completion;

/**
Determins the image URL for the given image with a maximum size and optional crop
@param image The image to retrieve the URL for
Expand All @@ -325,7 +338,6 @@ typedef void (^PLYCompletion)(id result, NSError *error);
*/
- (NSURL *)URLForImage:(PLYImage *)image maxWidth:(CGFloat)maxWidth maxHeight:(CGFloat)maxHeight crop:(BOOL)crop;


/**
Determins the image URL for the given default image for a given GTIN
@param GTIN The GTIN to produce the URL for
Expand Down Expand Up @@ -369,6 +381,15 @@ typedef void (^PLYCompletion)(id result, NSError *error);
*/
- (void)createOpine:(PLYOpine *)opine completion:(PLYCompletion)completion;

/**
Refreshes an opine from the server.
@param opine The opine
@param completion The completion handler for the request
*/
- (void)refreshOpine:(PLYOpine *)opine completion:(PLYCompletion)completion;


/**
Destroy an opine.
@param opine The opine
Expand Down Expand Up @@ -598,4 +619,11 @@ typedef void (^PLYCompletion)(id result, NSError *error);
*/
- (void)categoriesWithLanguage:(NSString *)language completion:(PLYCompletion)completion;

/**
Returns a path string that concatenates the localized category names separated by slashes for a given category key
@param categoryKey The key of the category
@returns The category path string
*/
- (NSString *)localizedCategoryPathForKey:(NSString *)categoryKey;

@end

0 comments on commit 01f595e

Please sign in to comment.