| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- //
- // RASettingActionModel.m
- // Apex And Drivers
- //
- // Created by Jack on 2018/9/12.
- // Copyright © 2018年 USAI. All rights reserved.
- //
- #import "RASettingActionModel.h"
- @implementation RASettingActionModel
- - (CGFloat)height {
- return 60.0f;
- }
- - (void)setActive:(BOOL)active{
- _active = active;
-
- if (self.actionType == RASettingActionTypeCleanCache) {
-
- [self updateCacheSize];
- }
-
- if (self.delegate && [self.delegate respondsToSelector:@selector(refreshUI)]) {
- [self.delegate refreshUI];
- }
- }
- - (void)setActionType:(RASettingActionType)actionType {
-
- if (actionType == RASettingActionTypeCleanCache) {
-
- [self updateCacheSize];
- }
- }
- - (void)updateCacheSize {
-
- NSString *cacheDir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
- NSString *imageCacheDir = [cacheDir stringByAppendingPathComponent:@"ImageCache"];
- float cacheSize = [RAUtils fileSizeForDir:imageCacheDir];
-
- self.detail = ({
-
- NSString *detail = [NSString stringWithFormat:@"%.1fM",cacheSize];
-
- detail;
- });
- }
- @end
|