Commit 6223bea7c63053db59fa9b9c26b71f5eec5a064d
1 parent
6767d57f
存取方式修改,优化图片加载速度减少卡顿
Showing
2 changed files
with
13 additions
and
10 deletions
CNLiveBaseTools.podspec
CNLiveBaseTools/Classes/TabBarEditIcon/CNLiveEditAppIconManager.m
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 11 | #import "CNLiveWebZipManager.h" | 11 | #import "CNLiveWebZipManager.h" |
| 12 | #import <MJExtension/MJExtension.h> | 12 | #import <MJExtension/MJExtension.h> |
| 13 | #import <QMUIKit/QMUIKit.h> | 13 | #import <QMUIKit/QMUIKit.h> |
| 14 | +#import <CNLiveBeeHive/BHConfig.h> | ||
| 14 | 15 | ||
| 15 | 16 | ||
| 16 | @implementation CNLiveEditAppIconManager | 17 | @implementation CNLiveEditAppIconManager |
| @@ -47,6 +48,7 @@ | @@ -47,6 +48,7 @@ | ||
| 47 | /*** 将新数据存入新key中 ***/ | 48 | /*** 将新数据存入新key中 ***/ |
| 48 | [userDefaults setObject:holidayDic forKey:kHolidayKey_New]; | 49 | [userDefaults setObject:holidayDic forKey:kHolidayKey_New]; |
| 49 | [[NSUserDefaults standardUserDefaults] synchronize]; | 50 | [[NSUserDefaults standardUserDefaults] synchronize]; |
| 51 | + [BHConfig set:kHolidayKey_New value:holidayDic]; | ||
| 50 | } | 52 | } |
| 51 | 53 | ||
| 52 | 54 | ||
| @@ -92,11 +94,12 @@ | @@ -92,11 +94,12 @@ | ||
| 92 | [userDefaults setObject:newHolidyDic forKey:kHolidayKey]; | 94 | [userDefaults setObject:newHolidyDic forKey:kHolidayKey]; |
| 93 | [[NSUserDefaults standardUserDefaults] synchronize]; | 95 | [[NSUserDefaults standardUserDefaults] synchronize]; |
| 94 | } | 96 | } |
| 97 | + [BHConfig set:kHolidayKey value:[userDefaults objectForKey:kHolidayKey]]; | ||
| 95 | }else { | 98 | }else { |
| 96 | [userDefaults removeObjectForKey:kHolidayKey]; | 99 | [userDefaults removeObjectForKey:kHolidayKey]; |
| 97 | [[NSUserDefaults standardUserDefaults] synchronize]; | 100 | [[NSUserDefaults standardUserDefaults] synchronize]; |
| 101 | + [BHConfig set:kHolidayKey value:@{}]; | ||
| 98 | } | 102 | } |
| 99 | - | ||
| 100 | } | 103 | } |
| 101 | //获取当前时间戳 | 104 | //获取当前时间戳 |
| 102 | + (CGFloat)currentTimeStr{ | 105 | + (CGFloat)currentTimeStr{ |
| @@ -119,7 +122,7 @@ | @@ -119,7 +122,7 @@ | ||
| 119 | DownLoadAppIconStatus downLoadStatus = [CNLiveEditAppIconManager editNetAppIconDownloadWithKey:kHolidayKey_New]; | 122 | DownLoadAppIconStatus downLoadStatus = [CNLiveEditAppIconManager editNetAppIconDownloadWithKey:kHolidayKey_New]; |
| 120 | if (downLoadStatus == DownLoadAppIconStatusNormal) {//没下载没解压 | 123 | if (downLoadStatus == DownLoadAppIconStatusNormal) {//没下载没解压 |
| 121 | 124 | ||
| 122 | - NSDictionary *dic = [[NSUserDefaults standardUserDefaults] objectForKey:kHolidayKey_New]; | 125 | + NSDictionary *dic = [BHConfig get:kHolidayKey_New]; |
| 123 | if (dic && dic.count > 0) { | 126 | if (dic && dic.count > 0) { |
| 124 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; | 127 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; |
| 125 | if (iconModel.holidayTheme) { | 128 | if (iconModel.holidayTheme) { |
| @@ -154,7 +157,7 @@ | @@ -154,7 +157,7 @@ | ||
| 154 | 157 | ||
| 155 | }else if (downLoadStatus == DownLoadAppIconStatusZipAndUnZip) {//下载并解压 | 158 | }else if (downLoadStatus == DownLoadAppIconStatusZipAndUnZip) {//下载并解压 |
| 156 | 159 | ||
| 157 | - NSDictionary *dic = [[NSUserDefaults standardUserDefaults] objectForKey:kHolidayKey_New]; | 160 | + NSDictionary *dic = [BHConfig get:kHolidayKey_New]; |
| 158 | if (dic && dic.count > 0) { | 161 | if (dic && dic.count > 0) { |
| 159 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; | 162 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; |
| 160 | if (iconModel.holidayTheme) { | 163 | if (iconModel.holidayTheme) { |
| @@ -194,7 +197,7 @@ | @@ -194,7 +197,7 @@ | ||
| 194 | EditAppIconStatus iconStatus = [CNLiveEditAppIconManager getEditAppIconStatusWithKey:key]; | 197 | EditAppIconStatus iconStatus = [CNLiveEditAppIconManager getEditAppIconStatusWithKey:key]; |
| 195 | if (iconStatus == EditAppIconStatusNet) { | 198 | if (iconStatus == EditAppIconStatusNet) { |
| 196 | 199 | ||
| 197 | - NSDictionary *dic = [[NSUserDefaults standardUserDefaults] objectForKey:key]; | 200 | + NSDictionary *dic = [BHConfig get:key]; |
| 198 | if (dic && dic.count > 0) { | 201 | if (dic && dic.count > 0) { |
| 199 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; | 202 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; |
| 200 | if (iconModel.holidayTheme) { | 203 | if (iconModel.holidayTheme) { |
| @@ -227,7 +230,7 @@ | @@ -227,7 +230,7 @@ | ||
| 227 | 230 | ||
| 228 | NSString *imagePath = @""; | 231 | NSString *imagePath = @""; |
| 229 | 232 | ||
| 230 | - NSDictionary *dic = [[NSUserDefaults standardUserDefaults] objectForKey:kHolidayKey]; | 233 | + NSDictionary *dic = [BHConfig get:kHolidayKey]; |
| 231 | if (dic && dic.count > 0) { | 234 | if (dic && dic.count > 0) { |
| 232 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; | 235 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; |
| 233 | if (iconModel.holidayTheme) { | 236 | if (iconModel.holidayTheme) { |
| @@ -251,7 +254,7 @@ | @@ -251,7 +254,7 @@ | ||
| 251 | 254 | ||
| 252 | NSString *imagePath = @""; | 255 | NSString *imagePath = @""; |
| 253 | 256 | ||
| 254 | - NSDictionary *dic = [[NSUserDefaults standardUserDefaults] objectForKey:kHolidayKey]; | 257 | + NSDictionary *dic = [BHConfig get:kHolidayKey]; |
| 255 | if (dic && dic.count > 0) { | 258 | if (dic && dic.count > 0) { |
| 256 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; | 259 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; |
| 257 | if (iconModel.holidayTheme) { | 260 | if (iconModel.holidayTheme) { |
| @@ -279,7 +282,7 @@ | @@ -279,7 +282,7 @@ | ||
| 279 | /*** 默认 ***/ | 282 | /*** 默认 ***/ |
| 280 | EditAppIconStatus status = EditAppIconStatusNormal; | 283 | EditAppIconStatus status = EditAppIconStatusNormal; |
| 281 | 284 | ||
| 282 | - NSDictionary *dic = [[NSUserDefaults standardUserDefaults] objectForKey:key]; | 285 | + NSDictionary *dic = [BHConfig get:key]; |
| 283 | if (dic && dic.count > 0) { | 286 | if (dic && dic.count > 0) { |
| 284 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; | 287 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; |
| 285 | if ([iconModel.isShow isEqualToString:@"1"]) {//不显示 1为不显示 0为显示 | 288 | if ([iconModel.isShow isEqualToString:@"1"]) {//不显示 1为不显示 0为显示 |
| @@ -340,7 +343,7 @@ | @@ -340,7 +343,7 @@ | ||
| 340 | UIColor *normalColor = UIColorMake(147, 155, 164); | 343 | UIColor *normalColor = UIColorMake(147, 155, 164); |
| 341 | UIColor *selectedColor = UIColorMake(26, 173, 25); | 344 | UIColor *selectedColor = UIColorMake(26, 173, 25); |
| 342 | /*** 根据信息更变 ***/ | 345 | /*** 根据信息更变 ***/ |
| 343 | - NSDictionary *dic = [[NSUserDefaults standardUserDefaults] objectForKey:kHolidayKey]; | 346 | + NSDictionary *dic = [BHConfig get:kHolidayKey]; |
| 344 | if (dic && dic.count > 0) { | 347 | if (dic && dic.count > 0) { |
| 345 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; | 348 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; |
| 346 | CNEditAppIconDetailModel *detailModel = iconModel.holidayTheme; | 349 | CNEditAppIconDetailModel *detailModel = iconModel.holidayTheme; |
| @@ -369,7 +372,7 @@ | @@ -369,7 +372,7 @@ | ||
| 369 | UIColor *normalColor = UIColorMake(147, 155, 164); | 372 | UIColor *normalColor = UIColorMake(147, 155, 164); |
| 370 | UIColor *selectedColor = UIColorMake(26, 173, 25); | 373 | UIColor *selectedColor = UIColorMake(26, 173, 25); |
| 371 | /*** 根据信息更变 ***/ | 374 | /*** 根据信息更变 ***/ |
| 372 | - NSDictionary *dic = [[NSUserDefaults standardUserDefaults] objectForKey:kHolidayKey]; | 375 | + NSDictionary *dic = [BHConfig get:kHolidayKey]; |
| 373 | if (dic && dic.count > 0) { | 376 | if (dic && dic.count > 0) { |
| 374 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; | 377 | CNEditAppIconModel *iconModel = [CNEditAppIconModel mj_objectWithKeyValues:dic]; |
| 375 | CNEditAppIconDetailModel *detailModel = iconModel.holidayTheme; | 378 | CNEditAppIconDetailModel *detailModel = iconModel.holidayTheme; |