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.

359 lines
13 KiB

  1. // 49126048c3d19dd5b676b8d39844cf133833b67a
  2. // Generated by the value-object.rb DO NOT EDIT!!
  3. #import "SCManagedCapturerState.h"
  4. #import <SCFoundation/SCValueObjectHelpers.h>
  5. #import <FastCoding/FastCoder.h>
  6. @implementation SCManagedCapturerState
  7. static ptrdiff_t sSCManagedCapturerStateOffsets[0];
  8. static BOOL sSCManagedCapturerStateHasOffsets;
  9. - (instancetype)initWithIsRunning:(BOOL)isRunning
  10. isNightModeActive:(BOOL)isNightModeActive
  11. isPortraitModeActive:(BOOL)isPortraitModeActive
  12. lowLightCondition:(BOOL)lowLightCondition
  13. adjustingExposure:(BOOL)adjustingExposure
  14. devicePosition:(SCManagedCaptureDevicePosition)devicePosition
  15. zoomFactor:(CGFloat)zoomFactor
  16. flashSupported:(BOOL)flashSupported
  17. torchSupported:(BOOL)torchSupported
  18. flashActive:(BOOL)flashActive
  19. torchActive:(BOOL)torchActive
  20. lensesActive:(BOOL)lensesActive
  21. arSessionActive:(BOOL)arSessionActive
  22. liveVideoStreaming:(BOOL)liveVideoStreaming
  23. lensProcessorReady:(BOOL)lensProcessorReady
  24. {
  25. self = [super init];
  26. if (self) {
  27. _isRunning = isRunning;
  28. _isNightModeActive = isNightModeActive;
  29. _isPortraitModeActive = isPortraitModeActive;
  30. _lowLightCondition = lowLightCondition;
  31. _adjustingExposure = adjustingExposure;
  32. _devicePosition = devicePosition;
  33. _zoomFactor = zoomFactor;
  34. _flashSupported = flashSupported;
  35. _torchSupported = torchSupported;
  36. _flashActive = flashActive;
  37. _torchActive = torchActive;
  38. _lensesActive = lensesActive;
  39. _arSessionActive = arSessionActive;
  40. _liveVideoStreaming = liveVideoStreaming;
  41. _lensProcessorReady = lensProcessorReady;
  42. }
  43. return self;
  44. }
  45. #pragma mark - NSCopying
  46. - (instancetype)copyWithZone:(NSZone *)zone
  47. {
  48. // Immutable object, bypass copy
  49. return self;
  50. }
  51. #pragma mark - NSCoding
  52. - (instancetype)initWithCoder:(NSCoder *)aDecoder
  53. {
  54. self = [super init];
  55. if (self) {
  56. _isRunning = [aDecoder decodeBoolForKey:@"isRunning"];
  57. _isNightModeActive = [aDecoder decodeBoolForKey:@"isNightModeActive"];
  58. _isPortraitModeActive = [aDecoder decodeBoolForKey:@"isPortraitModeActive"];
  59. _lowLightCondition = [aDecoder decodeBoolForKey:@"lowLightCondition"];
  60. _adjustingExposure = [aDecoder decodeBoolForKey:@"adjustingExposure"];
  61. _devicePosition = (SCManagedCaptureDevicePosition)[aDecoder decodeIntegerForKey:@"devicePosition"];
  62. _zoomFactor = [aDecoder decodeFloatForKey:@"zoomFactor"];
  63. _flashSupported = [aDecoder decodeBoolForKey:@"flashSupported"];
  64. _torchSupported = [aDecoder decodeBoolForKey:@"torchSupported"];
  65. _flashActive = [aDecoder decodeBoolForKey:@"flashActive"];
  66. _torchActive = [aDecoder decodeBoolForKey:@"torchActive"];
  67. _lensesActive = [aDecoder decodeBoolForKey:@"lensesActive"];
  68. _arSessionActive = [aDecoder decodeBoolForKey:@"arSessionActive"];
  69. _liveVideoStreaming = [aDecoder decodeBoolForKey:@"liveVideoStreaming"];
  70. _lensProcessorReady = [aDecoder decodeBoolForKey:@"lensProcessorReady"];
  71. }
  72. return self;
  73. }
  74. - (void)encodeWithCoder:(NSCoder *)aCoder
  75. {
  76. [aCoder encodeBool:_isRunning forKey:@"isRunning"];
  77. [aCoder encodeBool:_isNightModeActive forKey:@"isNightModeActive"];
  78. [aCoder encodeBool:_isPortraitModeActive forKey:@"isPortraitModeActive"];
  79. [aCoder encodeBool:_lowLightCondition forKey:@"lowLightCondition"];
  80. [aCoder encodeBool:_adjustingExposure forKey:@"adjustingExposure"];
  81. [aCoder encodeInteger:(NSInteger)_devicePosition forKey:@"devicePosition"];
  82. [aCoder encodeFloat:_zoomFactor forKey:@"zoomFactor"];
  83. [aCoder encodeBool:_flashSupported forKey:@"flashSupported"];
  84. [aCoder encodeBool:_torchSupported forKey:@"torchSupported"];
  85. [aCoder encodeBool:_flashActive forKey:@"flashActive"];
  86. [aCoder encodeBool:_torchActive forKey:@"torchActive"];
  87. [aCoder encodeBool:_lensesActive forKey:@"lensesActive"];
  88. [aCoder encodeBool:_arSessionActive forKey:@"arSessionActive"];
  89. [aCoder encodeBool:_liveVideoStreaming forKey:@"liveVideoStreaming"];
  90. [aCoder encodeBool:_lensProcessorReady forKey:@"lensProcessorReady"];
  91. }
  92. #pragma mark - FasterCoding
  93. - (BOOL)preferFasterCoding
  94. {
  95. return YES;
  96. }
  97. - (void)encodeWithFasterCoder:(id<FCFasterCoder>)fasterCoder
  98. {
  99. [fasterCoder encodeBool:_adjustingExposure];
  100. [fasterCoder encodeBool:_arSessionActive];
  101. [fasterCoder encodeSInt32:_devicePosition];
  102. [fasterCoder encodeBool:_flashActive];
  103. [fasterCoder encodeBool:_flashSupported];
  104. [fasterCoder encodeBool:_isNightModeActive];
  105. [fasterCoder encodeBool:_isPortraitModeActive];
  106. [fasterCoder encodeBool:_isRunning];
  107. [fasterCoder encodeBool:_lensProcessorReady];
  108. [fasterCoder encodeBool:_lensesActive];
  109. [fasterCoder encodeBool:_liveVideoStreaming];
  110. [fasterCoder encodeBool:_lowLightCondition];
  111. [fasterCoder encodeBool:_torchActive];
  112. [fasterCoder encodeBool:_torchSupported];
  113. [fasterCoder encodeFloat64:_zoomFactor];
  114. }
  115. - (void)decodeWithFasterDecoder:(id<FCFasterDecoder>)fasterDecoder
  116. {
  117. _adjustingExposure = (BOOL)[fasterDecoder decodeBool];
  118. _arSessionActive = (BOOL)[fasterDecoder decodeBool];
  119. _devicePosition = (SCManagedCaptureDevicePosition)[fasterDecoder decodeSInt32];
  120. _flashActive = (BOOL)[fasterDecoder decodeBool];
  121. _flashSupported = (BOOL)[fasterDecoder decodeBool];
  122. _isNightModeActive = (BOOL)[fasterDecoder decodeBool];
  123. _isPortraitModeActive = (BOOL)[fasterDecoder decodeBool];
  124. _isRunning = (BOOL)[fasterDecoder decodeBool];
  125. _lensProcessorReady = (BOOL)[fasterDecoder decodeBool];
  126. _lensesActive = (BOOL)[fasterDecoder decodeBool];
  127. _liveVideoStreaming = (BOOL)[fasterDecoder decodeBool];
  128. _lowLightCondition = (BOOL)[fasterDecoder decodeBool];
  129. _torchActive = (BOOL)[fasterDecoder decodeBool];
  130. _torchSupported = (BOOL)[fasterDecoder decodeBool];
  131. _zoomFactor = (CGFloat)[fasterDecoder decodeFloat64];
  132. }
  133. - (void)setBool:(BOOL)val forUInt64Key:(uint64_t)key
  134. {
  135. switch (key) {
  136. case 15633755733674300ULL:
  137. _adjustingExposure = (BOOL)val;
  138. break;
  139. case 11461798188076803ULL:
  140. _arSessionActive = (BOOL)val;
  141. break;
  142. case 12833337784991002ULL:
  143. _flashActive = (BOOL)val;
  144. break;
  145. case 51252237764061994ULL:
  146. _flashSupported = (BOOL)val;
  147. break;
  148. case 1498048848502287ULL:
  149. _isNightModeActive = (BOOL)val;
  150. break;
  151. case 56151582267629469ULL:
  152. _isPortraitModeActive = (BOOL)val;
  153. break;
  154. case 12346172623874083ULL:
  155. _isRunning = (BOOL)val;
  156. break;
  157. case 67168377441917657ULL:
  158. _lensProcessorReady = (BOOL)val;
  159. break;
  160. case 5791542045168142ULL:
  161. _lensesActive = (BOOL)val;
  162. break;
  163. case 28486888710545224ULL:
  164. _liveVideoStreaming = (BOOL)val;
  165. break;
  166. case 24071673583499455ULL:
  167. _lowLightCondition = (BOOL)val;
  168. break;
  169. case 40774429934225315ULL:
  170. _torchActive = (BOOL)val;
  171. break;
  172. case 41333098301057670ULL:
  173. _torchSupported = (BOOL)val;
  174. break;
  175. }
  176. }
  177. - (void)setSInt32:(int32_t)val forUInt64Key:(uint64_t)key
  178. {
  179. switch (key) {
  180. case 66264093189780655ULL:
  181. _devicePosition = (SCManagedCaptureDevicePosition)val;
  182. break;
  183. }
  184. }
  185. - (void)setFloat64:(double)val forUInt64Key:(uint64_t)key
  186. {
  187. switch (key) {
  188. case 61340640993537628ULL:
  189. _zoomFactor = (CGFloat)val;
  190. break;
  191. }
  192. }
  193. + (uint64_t)fasterCodingVersion
  194. {
  195. return 10319810232046341562ULL;
  196. }
  197. + (uint64_t *)fasterCodingKeys
  198. {
  199. static uint64_t keys[] = {
  200. 15 /* Total */,
  201. FC_ENCODE_KEY_TYPE(15633755733674300, FCEncodeTypeBool),
  202. FC_ENCODE_KEY_TYPE(11461798188076803, FCEncodeTypeBool),
  203. FC_ENCODE_KEY_TYPE(66264093189780655, FCEncodeTypeSInt32),
  204. FC_ENCODE_KEY_TYPE(12833337784991002, FCEncodeTypeBool),
  205. FC_ENCODE_KEY_TYPE(51252237764061994, FCEncodeTypeBool),
  206. FC_ENCODE_KEY_TYPE(1498048848502287, FCEncodeTypeBool),
  207. FC_ENCODE_KEY_TYPE(56151582267629469, FCEncodeTypeBool),
  208. FC_ENCODE_KEY_TYPE(12346172623874083, FCEncodeTypeBool),
  209. FC_ENCODE_KEY_TYPE(67168377441917657, FCEncodeTypeBool),
  210. FC_ENCODE_KEY_TYPE(5791542045168142, FCEncodeTypeBool),
  211. FC_ENCODE_KEY_TYPE(28486888710545224, FCEncodeTypeBool),
  212. FC_ENCODE_KEY_TYPE(24071673583499455, FCEncodeTypeBool),
  213. FC_ENCODE_KEY_TYPE(40774429934225315, FCEncodeTypeBool),
  214. FC_ENCODE_KEY_TYPE(41333098301057670, FCEncodeTypeBool),
  215. FC_ENCODE_KEY_TYPE(61340640993537628, FCEncodeTypeFloat64),
  216. };
  217. return keys;
  218. }
  219. #pragma mark - isEqual
  220. - (BOOL)isEqual:(id)object
  221. {
  222. if (!SCObjectsIsEqual(self, object, &sSCManagedCapturerStateHasOffsets, sSCManagedCapturerStateOffsets, 15, 0)) {
  223. return NO;
  224. }
  225. SCManagedCapturerState *other = (SCManagedCapturerState *)object;
  226. if (other->_isRunning != _isRunning) {
  227. return NO;
  228. }
  229. if (other->_isNightModeActive != _isNightModeActive) {
  230. return NO;
  231. }
  232. if (other->_isPortraitModeActive != _isPortraitModeActive) {
  233. return NO;
  234. }
  235. if (other->_lowLightCondition != _lowLightCondition) {
  236. return NO;
  237. }
  238. if (other->_adjustingExposure != _adjustingExposure) {
  239. return NO;
  240. }
  241. if (other->_devicePosition != _devicePosition) {
  242. return NO;
  243. }
  244. if (other->_zoomFactor != _zoomFactor) {
  245. return NO;
  246. }
  247. if (other->_flashSupported != _flashSupported) {
  248. return NO;
  249. }
  250. if (other->_torchSupported != _torchSupported) {
  251. return NO;
  252. }
  253. if (other->_flashActive != _flashActive) {
  254. return NO;
  255. }
  256. if (other->_torchActive != _torchActive) {
  257. return NO;
  258. }
  259. if (other->_lensesActive != _lensesActive) {
  260. return NO;
  261. }
  262. if (other->_arSessionActive != _arSessionActive) {
  263. return NO;
  264. }
  265. if (other->_liveVideoStreaming != _liveVideoStreaming) {
  266. return NO;
  267. }
  268. if (other->_lensProcessorReady != _lensProcessorReady) {
  269. return NO;
  270. }
  271. return YES;
  272. }
  273. - (NSUInteger)hash
  274. {
  275. NSUInteger subhashes[] = {
  276. (NSUInteger)_isRunning, (NSUInteger)_isNightModeActive, (NSUInteger)_isPortraitModeActive,
  277. (NSUInteger)_lowLightCondition, (NSUInteger)_adjustingExposure, (NSUInteger)_devicePosition,
  278. (NSUInteger)_zoomFactor, (NSUInteger)_flashSupported, (NSUInteger)_torchSupported,
  279. (NSUInteger)_flashActive, (NSUInteger)_torchActive, (NSUInteger)_lensesActive,
  280. (NSUInteger)_arSessionActive, (NSUInteger)_liveVideoStreaming, (NSUInteger)_lensProcessorReady};
  281. NSUInteger result = subhashes[0];
  282. for (int i = 1; i < 15; i++) {
  283. unsigned long long base = (((unsigned long long)result) << 32 | subhashes[i]);
  284. base = (~base) + (base << 18);
  285. base ^= (base >> 31);
  286. base *= 21;
  287. base ^= (base >> 11);
  288. base += (base << 6);
  289. base ^= (base >> 22);
  290. result = (NSUInteger)base;
  291. }
  292. return result;
  293. }
  294. #pragma mark - Print description in console: lldb> po #{variable name}
  295. - (NSString *)description
  296. {
  297. NSMutableString *desc = [NSMutableString string];
  298. [desc appendString:@"{\n"];
  299. [desc appendFormat:@"\tisRunning:%@\n", [@(_isRunning) description]];
  300. [desc appendFormat:@"\tisNightModeActive:%@\n", [@(_isNightModeActive) description]];
  301. [desc appendFormat:@"\tisPortraitModeActive:%@\n", [@(_isPortraitModeActive) description]];
  302. [desc appendFormat:@"\tlowLightCondition:%@\n", [@(_lowLightCondition) description]];
  303. [desc appendFormat:@"\tadjustingExposure:%@\n", [@(_adjustingExposure) description]];
  304. [desc appendFormat:@"\tdevicePosition:%@\n", [@(_devicePosition) description]];
  305. [desc appendFormat:@"\tzoomFactor:%@\n", [@(_zoomFactor) description]];
  306. [desc appendFormat:@"\tflashSupported:%@\n", [@(_flashSupported) description]];
  307. [desc appendFormat:@"\ttorchSupported:%@\n", [@(_torchSupported) description]];
  308. [desc appendFormat:@"\tflashActive:%@\n", [@(_flashActive) description]];
  309. [desc appendFormat:@"\ttorchActive:%@\n", [@(_torchActive) description]];
  310. [desc appendFormat:@"\tlensesActive:%@\n", [@(_lensesActive) description]];
  311. [desc appendFormat:@"\tarSessionActive:%@\n", [@(_arSessionActive) description]];
  312. [desc appendFormat:@"\tliveVideoStreaming:%@\n", [@(_liveVideoStreaming) description]];
  313. [desc appendFormat:@"\tlensProcessorReady:%@\n", [@(_lensProcessorReady) description]];
  314. [desc appendString:@"}\n"];
  315. return [desc copy];
  316. }
  317. @end