NIMKitRobotTemplateLayout.m 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // NIMKitRobotTemplateLayout.m
  3. // NIMKit
  4. //
  5. // Created by chris on 2017/6/25.
  6. // Copyright © 2017年 NetEase. All rights reserved.
  7. //
  8. #import "NIMKitRobotTemplateLayout.h"
  9. #import "NIMKitResourceResizer.h"
  10. @implementation NIMKitRobotTemplateLayout
  11. - (instancetype)init
  12. {
  13. self = [super init];
  14. if (self)
  15. {
  16. _items = [[NSMutableArray alloc] init];
  17. }
  18. return self;
  19. }
  20. @end
  21. @implementation NIMKitRobotTemplateItem
  22. - (NSString *)thumbUrl
  23. {
  24. return [[NIMKitResourceResizer sharedResizer] imageThumbnailURL:self.url];
  25. }
  26. -(void)setValue:(id)value forUndefinedKey:(nonnull NSString *)key{
  27. if ([key isEqualToString:@"type"])
  28. {
  29. if ([value isEqualToString:@"block"])
  30. {
  31. self.itemType = NIMKitRobotTemplateItemTypeLinkBlock;
  32. }
  33. if ([value isEqualToString:@"url"])
  34. {
  35. self.itemType = NIMKitRobotTemplateItemTypeLinkURL;
  36. }
  37. }
  38. }
  39. - (nullable id)valueForUndefinedKey:(NSString *)key{
  40. return nil;
  41. }
  42. @end
  43. @implementation NIMKitRobotTemplateLinkItem
  44. - (instancetype)init
  45. {
  46. self = [super init];
  47. if (self)
  48. {
  49. _items = [[NSMutableArray alloc] init];
  50. }
  51. return self;
  52. }
  53. @end