MHBeautiesModel.m 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. //
  2. // MHBeautiesModel.m
  3. #import "MHBeautiesModel.h"
  4. @interface MHBeautiesModel()<NSSecureCoding>
  5. @end
  6. @implementation MHBeautiesModel
  7. - (void)encodeWithCoder:(NSCoder *)aCoder {
  8. [aCoder encodeObject:self.imgName forKey:@"beautyImage"];
  9. [aCoder encodeObject:self.beautyTitle forKey:@"beautyTitle"];
  10. [aCoder encodeObject:self.originalValue forKey:@"value"];
  11. [aCoder encodeObject:@(self.isSelected) forKey:@"isSelected"];
  12. [aCoder encodeObject:@(self.type) forKey:@"beautyType"];
  13. [aCoder encodeObject:@(self.aliment) forKey:@"watermarkAliment"];
  14. [aCoder encodeObject:@(self.menuType) forKey:@"menuType"];
  15. [aCoder encodeObject:self.defaultValue forKey:@"oneclickDefaultValue"];
  16. [aCoder encodeObject:self.nose_defaultValue forKey:@"nose_defaultValue"];
  17. [aCoder encodeObject:self.mouth_maxValue forKey:@"mouth_maxValue"];
  18. [aCoder encodeObject:self.mouth_minValue forKey:@"mouth_minValue"];
  19. [aCoder encodeObject:self.mouth_defaultValue forKey:@"mouth_defaultValue"];
  20. [aCoder encodeObject:self.face_maxValue forKey:@"face_maxValue"];
  21. [aCoder encodeObject:self.face_minValue forKey:@"face_minValue"];
  22. [aCoder encodeObject:self.face_defaultValue forKey:@"face_defaultValue"];
  23. [aCoder encodeObject:self.eyeAngle_maxValue forKey:@"eyeAngle_maxValue"];
  24. [aCoder encodeObject:self.eyeAngle_minValue forKey:@"eyeAngle_minValue"];
  25. [aCoder encodeObject:self.eyeAngle_defaultValue forKey:@"eyeAngle_defaultValue"];
  26. [aCoder encodeObject:self.eyeDistance_maxValue forKey:@"eyeDistance_maxValue"];
  27. [aCoder encodeObject:self.eyeDistance_minValue forKey:@"eyeDistance_minValue"];
  28. [aCoder encodeObject:self.eyeDistance_defaultValue forKey:@"eyeDistance_defaultValue"];
  29. [aCoder encodeObject:self.eyeBrown_maxValue forKey:@"eyeBrown_maxValue"];
  30. [aCoder encodeObject:self.eyeBrown_minValue forKey:@"eyeBrown_minValue"];
  31. [aCoder encodeObject:self.eyeBrown_defaultValue forKey:@"eyeBrown_defaultValue"];
  32. [aCoder encodeObject:self.bigEye_maxValue forKey:@"bigEye_maxValue"];
  33. [aCoder encodeObject:self.bigEye_minValue forKey:@"bigEye_minValue"];
  34. [aCoder encodeObject:self.bigEye_defaultValue forKey:@"bigEye_defaultValue"];
  35. [aCoder encodeObject:self.whiteValue forKey:@"whiteValue"];
  36. [aCoder encodeObject:self.ruddinessValue forKey:@"ruddinessValue"];
  37. [aCoder encodeObject:self.buffingValue forKey:@"buffingValue"];
  38. [aCoder encodeObject:self.nose_minValue forKey:@"nose_minValue"];
  39. [aCoder encodeObject:self.nose_maxValue forKey:@"nose_maxValue"];
  40. [aCoder encodeObject:self.chin_defaultValue forKey:@"chin_defaultValue"];
  41. [aCoder encodeObject:self.chin_minValue forKey:@"chin_minValue"];
  42. [aCoder encodeObject:self.chin_maxValue forKey:@"chin_maxValue"];
  43. [aCoder encodeObject:self.eyeAlae_maxValue forKey:@"eyeAlae_maxValue"];
  44. [aCoder encodeObject:self.eyeAlae_minValue forKey:@"eyeAlae_minValue"];
  45. [aCoder encodeObject:self.eyeAlae_defaultValue forKey:@"eyeAlae_defaultValue"];
  46. [aCoder encodeObject:self.shaveFace_maxValue forKey:@"shaveFace_maxValue"];
  47. [aCoder encodeObject:self.shaveFace_minValue forKey:@"shaveFace_minValue"];
  48. [aCoder encodeObject:self.shaveFace_defaultValue forKey:@"shaveFace_defaultValue"];
  49. [aCoder encodeObject:self.longnose_maxValue forKey:@"longnose_maxValue"];
  50. [aCoder encodeObject:self.longnose_minValue forKey:@"longnose_minValue"];
  51. [aCoder encodeObject:self.longnose_defaultValue forKey:@"longnose_defaultValue"];
  52. [aCoder encodeObject:self.forehead_maxValue forKey:@"forehead_maxValue"];
  53. [aCoder encodeObject:self.forehead_minValue forKey:@"forehead_minValue"];
  54. [aCoder encodeObject:self.forehead_defaultValue forKey:@"forehead_defaultValue"];
  55. }
  56. - (instancetype)initWithCoder:(NSCoder *)aDecoder {
  57. if (self = [super init]) {
  58. self.imgName = [aDecoder decodeObjectForKey:@"beautyImage"];
  59. self.beautyTitle = [aDecoder decodeObjectForKey:@"beautyTitle"];
  60. self.originalValue = [aDecoder decodeObjectForKey:@"value"];
  61. self.type = (NSInteger)[aDecoder decodeObjectForKey:@"beautyType"];
  62. self.menuType = (NSInteger)[aDecoder decodeObjectForKey:@"menuType"];
  63. self.aliment = (NSInteger)[aDecoder decodeObjectForKey:@"watermarkAliment"];
  64. self.isSelected = [[aDecoder decodeObjectForKey:@"isSelected"] boolValue];
  65. self.defaultValue = [aDecoder decodeObjectForKey:@"oneclickDefaultValue"];
  66. self.whiteValue = [aDecoder decodeObjectForKey:@"whiteValue"];
  67. self.buffingValue = [aDecoder decodeObjectForKey:@"buffingValue"];
  68. self.ruddinessValue = [aDecoder decodeObjectForKey:@"ruddinessValue"];
  69. self.bigEye_defaultValue = [aDecoder decodeObjectForKey:@"bigEye_defaultValue"];
  70. self.bigEye_minValue = [aDecoder decodeObjectForKey:@"bigEye_minValue"];
  71. self.bigEye_maxValue = [aDecoder decodeObjectForKey:@"bigEye_maxValue"];
  72. self.eyeBrown_defaultValue = [aDecoder decodeObjectForKey:@"eyeBrown_defaultValue"];
  73. self.eyeBrown_minValue = [aDecoder decodeObjectForKey:@"eyeBrown_minValue"];
  74. self.eyeBrown_maxValue = [aDecoder decodeObjectForKey:@"eyeBrown_maxValue"];
  75. self.eyeDistance_defaultValue = [aDecoder decodeObjectForKey:@"eyeDistance_defaultValue"];
  76. self.eyeDistance_minValue = [aDecoder decodeObjectForKey:@"eyeDistance_minValue"];
  77. self.eyeDistance_maxValue = [aDecoder decodeObjectForKey:@"eyeDistance_maxValue"];
  78. self.eyeAngle_defaultValue = [aDecoder decodeObjectForKey:@"eyeAngle_defaultValue"];
  79. self.eyeAngle_minValue = [aDecoder decodeObjectForKey:@"eyeAngle_minValue"];
  80. self.eyeAngle_maxValue = [aDecoder decodeObjectForKey:@"eyeAngle_maxValue"];
  81. self.face_defaultValue = [aDecoder decodeObjectForKey:@"face_defaultValue"];
  82. self.face_minValue = [aDecoder decodeObjectForKey:@"face_minValue"];
  83. self.face_maxValue = [aDecoder decodeObjectForKey:@"face_maxValue"];
  84. self.mouth_defaultValue = [aDecoder decodeObjectForKey:@"mouth_defaultValue"];
  85. self.mouth_minValue = [aDecoder decodeObjectForKey:@"mouth_minValue"];
  86. self.mouth_maxValue = [aDecoder decodeObjectForKey:@"mouth_maxValue"];
  87. self.nose_defaultValue = [aDecoder decodeObjectForKey:@"nose_defaultValue"];
  88. self.nose_minValue = [aDecoder decodeObjectForKey:@"nose_minValue"];
  89. self.nose_maxValue = [aDecoder decodeObjectForKey:@"nose_maxValue"];
  90. self.chin_defaultValue = [aDecoder decodeObjectForKey:@"chin_defaultValue"];
  91. self.chin_minValue = [aDecoder decodeObjectForKey:@"chin_minValue"];
  92. self.chin_maxValue = [aDecoder decodeObjectForKey:@"chin_maxValue"];
  93. self.forehead_defaultValue = [aDecoder decodeObjectForKey:@"forehead_defaultValue"];
  94. self.forehead_minValue = [aDecoder decodeObjectForKey:@"forehead_minValue"];
  95. self.forehead_maxValue = [aDecoder decodeObjectForKey:@"forehead_maxValue"];
  96. self.longnose_defaultValue = [aDecoder decodeObjectForKey:@"longnose_defaultValue"];
  97. self.longnose_minValue = [aDecoder decodeObjectForKey:@"longnose_minValue"];
  98. self.longnose_maxValue = [aDecoder decodeObjectForKey:@"longnose_maxValue"];
  99. self.shaveFace_defaultValue = [aDecoder decodeObjectForKey:@"shaveFace_defaultValue"];
  100. self.shaveFace_minValue = [aDecoder decodeObjectForKey:@"shaveFace_minValue"];
  101. self.shaveFace_maxValue = [aDecoder decodeObjectForKey:@"shaveFace_maxValue"];
  102. self.eyeAlae_defaultValue = [aDecoder decodeObjectForKey:@"eyeAlae_defaultValue"];
  103. self.eyeAlae_minValue = [aDecoder decodeObjectForKey:@"eyeAlae_minValue"];
  104. self.eyeAlae_maxValue = [aDecoder decodeObjectForKey:@"eyeAlae_maxValue"];
  105. }
  106. return self;
  107. }
  108. //iOS11
  109. +(BOOL)supportsSecureCoding{
  110. return YES;
  111. }
  112. + (instancetype)mh_quickBeautyModelWithDictionary:(NSDictionary *)dic {
  113. MHBeautiesModel *model = [MHBeautiesModel new];
  114. model.imgName = [dic objectForKey:@"imageName"];
  115. model.beautyTitle = [dic objectForKey:@"title"];
  116. model.type = [dic[@"type"] integerValue];
  117. model.defaultValue = [dic objectForKey:@"defaultValue"];
  118. model.whiteValue = [dic objectForKey:@"whiteValue"];
  119. model.buffingValue = [dic objectForKey:@"buffingValue"];
  120. model.ruddinessValue = [dic objectForKey:@"ruddinessValue"];
  121. model.bigEye_defaultValue = [dic objectForKey:@"bigEye_defaultValue"];
  122. model.bigEye_minValue = [dic objectForKey:@"bigEye_minValue"];
  123. model.bigEye_maxValue = [dic objectForKey:@"bigEye_maxValue"];
  124. model.eyeBrown_defaultValue = [dic objectForKey:@"eyeBrown_defaultValue"];
  125. model.eyeBrown_minValue = [dic objectForKey:@"eyeBrown_minValue"];
  126. model.eyeBrown_maxValue = [dic objectForKey:@"eyeBrown_maxValue"];
  127. model.eyeDistance_defaultValue = [dic objectForKey:@"eyeDistance_defaultValue"];
  128. model.eyeDistance_minValue = [dic objectForKey:@"eyeDistance_minValue"];
  129. model.eyeDistance_maxValue = [dic objectForKey:@"eyeDistance_maxValue"];
  130. model.eyeAngle_defaultValue = [dic objectForKey:@"eyeAngle_defaultValue"];
  131. model.eyeAngle_minValue = [dic objectForKey:@"eyeAngle_minValue"];
  132. model.eyeAngle_maxValue = [dic objectForKey:@"eyeAngle_maxValue"];
  133. model.face_defaultValue = [dic objectForKey:@"face_defaultValue"];
  134. model.face_minValue = [dic objectForKey:@"face_minValue"];
  135. model.face_maxValue = [dic objectForKey:@"face_maxValue"];
  136. model.mouth_defaultValue = [dic objectForKey:@"mouth_defaultValue"];
  137. model.mouth_minValue = [dic objectForKey:@"mouth_minValue"];
  138. model.mouth_maxValue = [dic objectForKey:@"mouth_maxValue"];
  139. model.nose_defaultValue = [dic objectForKey:@"nose_defaultValue"];
  140. model.nose_minValue = [dic objectForKey:@"nose_minValue"];
  141. model.nose_maxValue = [dic objectForKey:@"nose_maxValue"];
  142. model.chin_defaultValue = [dic objectForKey:@"chin_defaultValue"];
  143. model.chin_minValue = [dic objectForKey:@"chin_minValue"];
  144. model.chin_maxValue = [dic objectForKey:@"chin_maxValue"];
  145. model.forehead_defaultValue = [dic objectForKey:@"forehead_defaultValue"];
  146. model.forehead_minValue = [dic objectForKey:@"forehead_minValue"];
  147. model.forehead_maxValue = [dic objectForKey:@"forehead_maxValue"];
  148. model.longnose_defaultValue = [dic objectForKey:@"longnose_defaultValue"];
  149. model.longnose_minValue = [dic objectForKey:@"longnose_minValue"];
  150. model.longnose_maxValue = [dic objectForKey:@"longnose_maxValue"];
  151. model.shaveFace_defaultValue = [dic objectForKey:@"shaveFace_defaultValue"];
  152. model.shaveFace_minValue = [dic objectForKey:@"shaveFace_minValue"];
  153. model.shaveFace_maxValue = [dic objectForKey:@"shaveFace_maxValue"];
  154. model.eyeAlae_defaultValue = [dic objectForKey:@"eyeAlae_defaultValue"];
  155. model.eyeAlae_minValue = [dic objectForKey:@"eyeAlae_minValue"];
  156. model.eyeAlae_maxValue = [dic objectForKey:@"eyeAlae_maxValue"];
  157. return model;
  158. }
  159. @end