cdts/xdts-ios 3/TreeHole/Code/Features/Settings/ViewController/PrivacySettingsViewController.m

70 lines
3.5 KiB
Mathematica
Raw Normal View History

2023-07-27 09:20:00 +08:00
//
// PrivacySettingsViewController.m
// Youth
//
// Created by mambaxie on 2022/1/2.
//
#import "PrivacySettingsViewController.h"
#import "SystemSettingsViewController.h"
@interface PrivacySettingsViewController ()
@end
@implementation PrivacySettingsViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (MTCommonListTableConfig *)tableConfigForTableViewContorller
{
MTCommonListTableConfig *config = [MTCommonListTableConfig defaultConfigWithCellStyle:MTCommonListTableCellStyleDisclosureIndicator rowsCountForSections:@[@(2)]];
config.cellTitles = @[@"系统权限", @"账户注销"];
[config resetCellConfigForSection:0 row:0 config:^(MTCommonListTableCellConfig *cellConfig) {
cellConfig.cellAction = ^(MTCommonListTableViewController *tableViewController, NSIndexPath *indexPath, MTCommonListTableCellConfig *cellConfig) {
[PYAppService pushViewControllerAnimated:[SystemSettingsViewController new]];
};
}];
[config resetCellConfigForSection:0 row:1 config:^(MTCommonListTableCellConfig *cellConfig) {
cellConfig.cellAction = ^(MTCommonListTableViewController *tableViewController, NSIndexPath *indexPath, MTCommonListTableCellConfig *cellConfig) {
[MTAlertView showWithSetupBlcok:^(MTAlertViewConfig *config) {
config.title = @"账户注销";
config.message = @"此操作会移除该账户以及分身账户所有信息\n该手机号7天内无法再注册\n请确认";
config.cancelTitle = @"不注销";
config.otherDestructiveTitle = @"确认注销";
config.otherHandler = ^(MTAlertButton *button) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[MTAlertView showWithSetupBlcok:^(MTAlertViewConfig *config) {
config.title = @"账户注销二次确认";
config.message = @"此操作会移除该账户所有信息\n该手机号7天内无法再注册\n请确认";
config.cancelTitle = @"不注销";
config.otherDestructiveTitle = @"确认注销";
config.otherHandler = ^(MTAlertButton *button) {
[PYHTTPManager getWithPath:@"deleteaccount" params:nil callback:^(id _Nullable rsp, NSError * _Nullable error) {
if (!error) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[SVProgressHUD showSuccessWithStatus:@"注销成功"];
[PYAppService logout];
});
}else{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[SVProgressHUD showErrorWithStatus:[error.userInfo objectForKey:@"message"]];
});
}
}];
};
}];
});
};
}];
};
}];
config.tableTitle = @"隐私设置";
return config;
}
@end