添加隐私,注销功能

This commit is contained in:
2026-02-27 14:49:46 +08:00
parent a711be4c4d
commit c3e037e070
13 changed files with 247 additions and 846 deletions

View File

@@ -14,6 +14,7 @@
#import "KBChangeNicknamePopView.h"
#import "KBGenderPickerPopView.h"
#import "KBMyVM.h"
#import "KBAlert.h"
@interface KBPersonInfoVC () <UITableViewDelegate, UITableViewDataSource, PHPickerViewControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate>
//
@@ -25,8 +26,10 @@
@property (nonatomic, strong) UIButton *editBadge; //
@property (nonatomic, strong) UILabel *modifyLabel; // Modify
// 退
// 退
@property (nonatomic, strong) UIButton *logoutBtn;
//
@property (nonatomic, strong) UIButton *cancelBtn;
//
@property (nonatomic, copy) NSArray<NSDictionary *> *items; // {title,value,arrow,copy}
@@ -64,9 +67,18 @@
//
self.tableView.tableHeaderView = self.headerView;
// 退
// 退
[self.view addSubview:self.logoutBtn];
[self.logoutBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view).offset(16);
make.right.equalTo(self.view).offset(-16);
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-(12 + 56 + 10));
make.height.mas_equalTo(56);
}];
//
[self.view addSubview:self.cancelBtn];
[self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view).offset(16);
make.right.equalTo(self.view).offset(-16);
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-12);
@@ -75,7 +87,7 @@
//
UIEdgeInsets inset = self.tableView.contentInset;
inset.bottom = 56 + 24; // +
inset.bottom = 56 + 10 + 56 + 24; // + +
self.tableView.contentInset = inset;
self.viewModel = [[KBMyVM alloc] init];
__weak typeof(self) weakSelf = self;
@@ -275,6 +287,25 @@
[self.myVM logout];
}
- (void)onTapCancelAccount {
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_person_cancel_account_btn"
pageId:@"person_info"
elementId:@"cancel_account_btn"
extra:nil
completion:nil];
KBWeakSelf;
[KBAlert confirmTitle:KBLocalized(@"Cancel Account")
message:KBLocalized(@"After cancellation, your account will be deactivated and local login data will be cleared. Continue?")
ok:KBLocalized(@"Confirm")
cancel:KBLocalized(@"Cancel")
okColor:[UIColor colorWithHex:0xFF0000]
cancelColor:nil
completion:^(BOOL ok) {
if (!ok) { return; }
[weakSelf.myVM cancelAccountWithCompletion:nil];
}];
}
#pragma mark - Lazy UI
- (UITableView *)tableView {
@@ -378,6 +409,19 @@
return _logoutBtn;
}
- (UIButton *)cancelBtn {
if (!_cancelBtn) {
_cancelBtn = [UIButton buttonWithType:UIButtonTypeSystem];
[_cancelBtn setTitle:KBLocalized(@"Cancel Account") forState:UIControlStateNormal];
[_cancelBtn setTitleColor:[UIColor colorWithHex:0xFF0000] forState:UIControlStateNormal];
_cancelBtn.titleLabel.font = [KBFont medium:16];
_cancelBtn.backgroundColor = UIColor.whiteColor;
_cancelBtn.layer.cornerRadius = 12; _cancelBtn.layer.masksToBounds = YES;
[_cancelBtn addTarget:self action:@selector(onTapCancelAccount) forControlEvents:UIControlEventTouchUpInside];
}
return _cancelBtn;
}
#pragma mark - Image Picker
- (void)presentImagePicker {