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