// // RDSSystemSetVC.m // Temperature // // Created by RD on 2023/1/16. // #import "RDSSystemSetVC.h" #import "RDSSystemSetCell.h" #import "RDSUserProtocolViewController.h" #import "RDCheckAppVersion.h" #import "RDSResetPwdVC.h" #import static NSString * const RDSSystemSetCellID = @"RDSSystemSetCell"; @interface RDSSystemSetVC () @property (nonatomic, weak) UITableView *tableView; @end @implementation RDSSystemSetVC - (void)viewDidLoad { [super viewDidLoad]; self.title = @"系统设置"; self.view.backgroundColor = [UIColor colorWithHexString:@"#F9F9F9"]; [self p_setupTableView]; } - (void)p_setupTableView { UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT-20-60)]; [self.view addSubview:tableView]; tableView.dataSource = self; tableView.delegate = self; tableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0); self.tableView = tableView; self.tableView.backgroundColor = [UIColor clearColor]; [self.tableView registerNib:[UINib nibWithNibName:@"RDSSystemSetCell" bundle:nil] forCellReuseIdentifier:RDSSystemSetCellID]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.tableView.showsVerticalScrollIndicator = NO; tableView.rowHeight = 60*kSCALE_WIDTH_X; } #pragma mark - Table view data source - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 2; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { RDSSystemSetCell *cell = [tableView dequeueReusableCellWithIdentifier:RDSSystemSetCellID]; cell.selectionStyle = UITableViewCellSelectionStyleNone; if(indexPath.row == 0){ cell.titleLab.text = @"检查更新"; NSString *currentVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; cell.versionLabel.text = [NSString stringWithFormat:@"v %@",currentVersion]; } if(indexPath.row == 1){ cell.titleLab.text = @"清除缓存"; cell.versionLabel.text = @""; } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ if(indexPath.row == 0){ [TheCheckAppVersion checkUpdateAlert]; } if(indexPath.row == 1){ NSSet *websiteDataTypes = [WKWebsiteDataStore allWebsiteDataTypes]; NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0]; [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes modifiedSince:dateFrom completionHandler:^{ [RDSHudShower showBottomToast:@"已清除缓存"]; }]; } } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 75; } @end