admin
2023-04-21 57e30bc2584b92ce3da3821bd0f6e040f2ad28df
BuWanVideo2.0/SettingController.m
@@ -9,10 +9,13 @@
#import "SettingController.h"
#import "StorageSpaceTableViewCell.h"
#import "SettingWebView.h"
#import "UIView+Toast.h"
#define indentfly @"cell"
#define indentfly1 @"Mcell"
#define indentfly2 @"WIFIcell"
#define indentfly_logout @"LogoutCell"
#define indentfly_unregister @"UnregisterCell"
@interface SettingController()<UITableViewDelegate,UITableViewDataSource>{
    BOOL _userOnLine;
@@ -26,6 +29,10 @@
@implementation SettingController
- (void)viewWillAppear:(BOOL)animated {
    _userOnLine=[[NSUserDefaults standardUserDefaults] boolForKey:@"userOnLine"];
    if(_mytableview){
        [_mytableview reloadData];
    }
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:animated];
}
@@ -89,9 +96,24 @@
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"buUserInfo"];
    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"userOnLine"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"RELOAD_DATA" object:nil];
    [self.navigationController popViewControllerAnimated:YES];
}
// 注销
-(void)unRegister{
    NSString *link= [[NSUserDefaults standardUserDefaults] stringForKey:UNREGISTER_LINK];
    if(link&&![link isEqual:@""])
    {
        NSLog(@"注销");
        SettingWebView *settingWebViewController = [[SettingWebView alloc] init];
        settingWebViewController.webTitle=@"账号注销";
        settingWebViewController.requestURL=link;
        [self.navigationController pushViewController:settingWebViewController animated:YES];
    }else{
        [self.view makeToast:@"尚未获取到注销链接"];
    }
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
@@ -102,7 +124,7 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if(_userOnLine){
        if (section==3) {
        if (section==3||section==4) {
            return 1;
        }
    }
@@ -111,7 +133,7 @@
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    if (_userOnLine) {
        return _dataAry.count+1;
        return _dataAry.count+2;
    }
    return _dataAry.count;
}
@@ -119,7 +141,7 @@
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if(section==0){
        return 30;
    }else if(section==3){
    }else if(section==3||section==4){
        return 0;
    }
    return 22;
@@ -150,9 +172,9 @@
        return cell;
        
    }else if(indexPath.section==3){
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentfly];
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentfly_logout];
        if (cell==nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:indentfly];
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:indentfly_logout];
            [cell setAccessoryType:UITableViewCellAccessoryNone];
        }
        
@@ -161,6 +183,23 @@
        [outButton setTitle:@"退出登录" forState:UIControlStateNormal];
        [outButton setTintColor:[UIColor whiteColor]];
        [outButton addTarget:self action:@selector(OutOfLogin) forControlEvents:UIControlEventTouchUpInside];
        [cell.viewForLastBaselineLayout addSubview:outButton];
        return cell;
    }else if(indexPath.section==4){
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentfly_unregister];
        if (cell==nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:indentfly_unregister];
            [cell setAccessoryType:UITableViewCellAccessoryNone];
        }
        UIButton *outButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, KScreenW, 44)];
        [outButton setBackgroundColor:[UIColor whiteColor]];
//        [outButton setBackgroundColor:kGlobalBlueColor];
        [outButton setTitle:@"注销账号" forState:UIControlStateNormal];
        [outButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        [outButton setTintColor:[UIColor grayColor]];
        [outButton addTarget:self action:@selector(unRegister) forControlEvents:UIControlEventTouchUpInside];
        [cell.viewForLastBaselineLayout addSubview:outButton];
        
        return cell;
@@ -234,6 +273,9 @@
    if(indexPath.section == 3 && indexPath.row == 0) {
        [self OutOfLogin];
    }
    if(indexPath.section == 4 && indexPath.row == 0) {
        [self unRegister];
    }
}
- (void)popTips {