2014 snapchat source code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

180 lines
5.1 KiB

  1. // ed265cb0c346ae35dce70d3fc12a0bd8deae0802
  2. // Generated by the value-object.rb DO NOT EDIT!!
  3. #import "SCManagedRecordedVideo.h"
  4. #import <FastCoding/FastCoder.h>
  5. @implementation SCManagedRecordedVideo
  6. - (instancetype)initWithVideoURL:(NSURL *)videoURL
  7. rawVideoDataFileURL:(NSURL *)rawVideoDataFileURL
  8. placeholderImage:(UIImage *)placeholderImage
  9. isFrontFacingCamera:(BOOL)isFrontFacingCamera
  10. {
  11. self = [super init];
  12. if (self) {
  13. _videoURL = [(NSObject *)videoURL copy];
  14. _rawVideoDataFileURL = [(NSObject *)rawVideoDataFileURL copy];
  15. _placeholderImage = [(NSObject *)placeholderImage copy];
  16. _isFrontFacingCamera = isFrontFacingCamera;
  17. }
  18. return self;
  19. }
  20. #pragma mark - NSCopying
  21. - (instancetype)copyWithZone:(NSZone *)zone
  22. {
  23. // Immutable object, bypass copy
  24. return self;
  25. }
  26. #pragma mark - NSCoding
  27. - (instancetype)initWithCoder:(NSCoder *)aDecoder
  28. {
  29. self = [super init];
  30. if (self) {
  31. _videoURL = [aDecoder decodeObjectForKey:@"videoURL"];
  32. _rawVideoDataFileURL = [aDecoder decodeObjectForKey:@"rawVideoDataFileURL"];
  33. _placeholderImage = [aDecoder decodeObjectForKey:@"placeholderImage"];
  34. _isFrontFacingCamera = [aDecoder decodeBoolForKey:@"isFrontFacingCamera"];
  35. }
  36. return self;
  37. }
  38. - (void)encodeWithCoder:(NSCoder *)aCoder
  39. {
  40. [aCoder encodeObject:_videoURL forKey:@"videoURL"];
  41. [aCoder encodeObject:_rawVideoDataFileURL forKey:@"rawVideoDataFileURL"];
  42. [aCoder encodeObject:_placeholderImage forKey:@"placeholderImage"];
  43. [aCoder encodeBool:_isFrontFacingCamera forKey:@"isFrontFacingCamera"];
  44. }
  45. #pragma mark - FasterCoding
  46. - (BOOL)preferFasterCoding
  47. {
  48. return YES;
  49. }
  50. - (void)encodeWithFasterCoder:(id<FCFasterCoder>)fasterCoder
  51. {
  52. [fasterCoder encodeBool:_isFrontFacingCamera];
  53. [fasterCoder encodeObject:_placeholderImage];
  54. [fasterCoder encodeObject:_rawVideoDataFileURL];
  55. [fasterCoder encodeObject:_videoURL];
  56. }
  57. - (void)decodeWithFasterDecoder:(id<FCFasterDecoder>)fasterDecoder
  58. {
  59. _isFrontFacingCamera = (BOOL)[fasterDecoder decodeBool];
  60. _placeholderImage = (UIImage *)[fasterDecoder decodeObject];
  61. _rawVideoDataFileURL = (NSURL *)[fasterDecoder decodeObject];
  62. _videoURL = (NSURL *)[fasterDecoder decodeObject];
  63. }
  64. - (void)setObject:(id)val forUInt64Key:(uint64_t)key
  65. {
  66. switch (key) {
  67. case 50783861721184594ULL:
  68. _placeholderImage = (UIImage *)val;
  69. break;
  70. case 13152167848358790ULL:
  71. _rawVideoDataFileURL = (NSURL *)val;
  72. break;
  73. case 48945309622713334ULL:
  74. _videoURL = (NSURL *)val;
  75. break;
  76. }
  77. }
  78. - (void)setBool:(BOOL)val forUInt64Key:(uint64_t)key
  79. {
  80. switch (key) {
  81. case 11924284868025312ULL:
  82. _isFrontFacingCamera = (BOOL)val;
  83. break;
  84. }
  85. }
  86. + (uint64_t)fasterCodingVersion
  87. {
  88. return 17435789727352013688ULL;
  89. }
  90. + (uint64_t *)fasterCodingKeys
  91. {
  92. static uint64_t keys[] = {
  93. 4 /* Total */,
  94. FC_ENCODE_KEY_TYPE(11924284868025312, FCEncodeTypeBool),
  95. FC_ENCODE_KEY_TYPE(50783861721184594, FCEncodeTypeObject),
  96. FC_ENCODE_KEY_TYPE(13152167848358790, FCEncodeTypeObject),
  97. FC_ENCODE_KEY_TYPE(48945309622713334, FCEncodeTypeObject),
  98. };
  99. return keys;
  100. }
  101. #pragma mark - isEqual
  102. - (BOOL)isEqual:(id)object
  103. {
  104. if (self == object) {
  105. return YES;
  106. }
  107. if (![object isMemberOfClass:[self class]]) {
  108. return NO;
  109. }
  110. SCManagedRecordedVideo *other = (SCManagedRecordedVideo *)object;
  111. if (other.videoURL != _videoURL && ![(NSObject *)other.videoURL isEqual:_videoURL]) {
  112. return NO;
  113. }
  114. if (other.rawVideoDataFileURL != _rawVideoDataFileURL &&
  115. ![(NSObject *)other.rawVideoDataFileURL isEqual:_rawVideoDataFileURL]) {
  116. return NO;
  117. }
  118. if (other.placeholderImage != _placeholderImage &&
  119. ![(NSObject *)other.placeholderImage isEqual:_placeholderImage]) {
  120. return NO;
  121. }
  122. if (other.isFrontFacingCamera != _isFrontFacingCamera) {
  123. return NO;
  124. }
  125. return YES;
  126. }
  127. - (NSUInteger)hash
  128. {
  129. NSUInteger subhashes[] = {[_videoURL hash], [_rawVideoDataFileURL hash], [_placeholderImage hash],
  130. (NSUInteger)_isFrontFacingCamera};
  131. NSUInteger result = subhashes[0];
  132. for (int i = 1; i < 4; i++) {
  133. unsigned long long base = (((unsigned long long)result) << 32 | subhashes[i]);
  134. base = (~base) + (base << 18);
  135. base ^= (base >> 31);
  136. base *= 21;
  137. base ^= (base >> 11);
  138. base += (base << 6);
  139. base ^= (base >> 22);
  140. result = (NSUInteger)base;
  141. }
  142. return result;
  143. }
  144. #pragma mark - Print description in console: lldb> po #{variable name}
  145. - (NSString *)description
  146. {
  147. NSMutableString *desc = [NSMutableString string];
  148. [desc appendString:@"{\n"];
  149. [desc appendFormat:@"\tvideoURL:%@\n", [_videoURL description]];
  150. [desc appendFormat:@"\trawVideoDataFileURL:%@\n", [_rawVideoDataFileURL description]];
  151. [desc appendFormat:@"\tplaceholderImage:%@\n", [_placeholderImage description]];
  152. [desc appendFormat:@"\tisFrontFacingCamera:%@\n", [@(_isFrontFacingCamera) description]];
  153. [desc appendString:@"}\n"];
  154. return [desc copy];
  155. }
  156. @end