bug
This commit is contained in:
@@ -71,10 +71,10 @@
|
||||
if (!self) return;
|
||||
|
||||
KBLocalizationManager *mgr = [KBLocalizationManager shared];
|
||||
// 在中英文间切换:当前是中文就切到英文,否则切到简体中文
|
||||
// 在英文与繁体中文间切换
|
||||
NSString *next = [mgr.currentLanguageCode.lowercaseString hasPrefix:@"zh"]
|
||||
? KBLanguageCodeEnglish
|
||||
: KBLanguageCodeSimplifiedChinese;
|
||||
: KBLanguageCodeTraditionalChinese;
|
||||
[mgr setCurrentLanguageCode:next persist:YES];
|
||||
|
||||
// 语言切换后重新进入根控制器
|
||||
|
||||
@@ -348,6 +348,8 @@ typedef void(^KBInputProfileSelectHandler)(NSString *languageCode, NSString *lay
|
||||
@property (nonatomic, strong) UIImageView *avatarView; // 头像
|
||||
@property (nonatomic, strong) UIButton *editBadge; // 头像右下角的小铅笔
|
||||
@property (nonatomic, strong) UILabel *modifyLabel; // “Modify” 文案
|
||||
@property (nonatomic, strong) UILabel *userIdLabel; // 用户 ID
|
||||
@property (nonatomic, strong) UIButton *userIdCopyButton; // 复制用户 ID
|
||||
|
||||
// 底部退出登录按钮
|
||||
@property (nonatomic, strong) UIButton *logoutBtn;
|
||||
@@ -421,6 +423,7 @@ typedef void(^KBInputProfileSelectHandler)(NSString *languageCode, NSString *lay
|
||||
weakSelf.userModel = user;
|
||||
[weakSelf.avatarView kb_setAvatarURL:weakSelf.userModel.avatarUrl placeholder:KBAvatarPlaceholderImage];
|
||||
weakSelf.modifyLabel.text = weakSelf.userModel.nickName;
|
||||
weakSelf.userIdLabel.text = weakSelf.userModel.userId ?: @"";
|
||||
}
|
||||
[weakSelf rebuildItems];
|
||||
}];
|
||||
@@ -443,12 +446,10 @@ typedef void(^KBInputProfileSelectHandler)(NSString *languageCode, NSString *lay
|
||||
NSString *nickname = self.userModel.nickName ?: @"";
|
||||
NSString *genderText = [self kb_genderDisplayText];
|
||||
NSString *languageText = [self currentInputProfileDisplayText];
|
||||
NSString *userId = self.userModel.userId ?: @"";
|
||||
self.items = @[
|
||||
@{ @"title": KBLocalized(@"Nickname"), @"value": nickname, @"arrow": @YES, @"copy": @NO },
|
||||
@{ @"title": KBLocalized(@"Gender"), @"value": genderText, @"arrow": @YES, @"copy": @NO },
|
||||
@{ @"title": KBLocalized(@"Input Language"), @"value": languageText, @"arrow": @YES, @"copy": @NO },
|
||||
@{ @"title": KBLocalized(@"User ID"), @"value": userId, @"arrow": @NO, @"copy": @YES },
|
||||
];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
@@ -838,6 +839,13 @@ typedef void(^KBInputProfileSelectHandler)(NSString *languageCode, NSString *lay
|
||||
[self.myVM logout];
|
||||
}
|
||||
|
||||
- (void)onTapUserIdCopy {
|
||||
NSString *userId = self.userModel.userId ?: @"";
|
||||
if (userId.length == 0) { return; }
|
||||
UIPasteboard.generalPasteboard.string = userId;
|
||||
[KBHUD showInfo:KBLocalized(@"Copied")];
|
||||
}
|
||||
|
||||
#pragma mark - Lazy UI(懒加载)
|
||||
|
||||
- (UITableView *)tableView {
|
||||
@@ -856,12 +864,14 @@ typedef void(^KBInputProfileSelectHandler)(NSString *languageCode, NSString *lay
|
||||
- (UIView *)headerView {
|
||||
if (!_headerView) {
|
||||
CGFloat w = UIScreen.mainScreen.bounds.size.width;
|
||||
UIView *hv = [[UIView alloc] initWithFrame:CGRectMake(0, 0, w, 180)];
|
||||
UIView *hv = [[UIView alloc] initWithFrame:CGRectMake(0, 0, w, 200)];
|
||||
hv.backgroundColor = UIColor.clearColor;
|
||||
|
||||
[hv addSubview:self.avatarView];
|
||||
[hv addSubview:self.editBadge];
|
||||
[hv addSubview:self.modifyLabel];
|
||||
[hv addSubview:self.userIdLabel];
|
||||
[hv addSubview:self.userIdCopyButton];
|
||||
|
||||
[self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(hv);
|
||||
@@ -877,6 +887,15 @@ typedef void(^KBInputProfileSelectHandler)(NSString *languageCode, NSString *lay
|
||||
make.top.equalTo(self.avatarView.mas_bottom).offset(10);
|
||||
make.centerX.equalTo(hv);
|
||||
}];
|
||||
[self.userIdLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.modifyLabel.mas_bottom).offset(10);
|
||||
make.centerX.equalTo(hv).offset(-KBFit(12.0));
|
||||
}];
|
||||
[self.userIdCopyButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.userIdLabel);
|
||||
make.left.equalTo(self.userIdLabel.mas_right).offset(6);
|
||||
make.width.height.mas_equalTo(18);
|
||||
}];
|
||||
|
||||
// 头像可点击:弹系统相册
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTapAvatarEdit)];
|
||||
@@ -928,6 +947,31 @@ typedef void(^KBInputProfileSelectHandler)(NSString *languageCode, NSString *lay
|
||||
return _modifyLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)userIdLabel {
|
||||
if (!_userIdLabel) {
|
||||
_userIdLabel = [UILabel new];
|
||||
_userIdLabel.textColor = [UIColor colorWithHex:0x9B9B9B];
|
||||
_userIdLabel.font = [KBFont regular:12];
|
||||
}
|
||||
return _userIdLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)userIdCopyButton {
|
||||
if (!_userIdCopyButton) {
|
||||
_userIdCopyButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
UIImage *image = [UIImage imageNamed:@"copy_icon"];
|
||||
if (image) {
|
||||
[_userIdCopyButton setImage:image forState:UIControlStateNormal];
|
||||
} else {
|
||||
[_userIdCopyButton setTitle:KBLocalized(@"Copy") forState:UIControlStateNormal];
|
||||
[_userIdCopyButton setTitleColor:[UIColor colorWithHex:KBBlackValue] forState:UIControlStateNormal];
|
||||
_userIdCopyButton.titleLabel.font = [KBFont regular:12];
|
||||
}
|
||||
[_userIdCopyButton addTarget:self action:@selector(onTapUserIdCopy) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _userIdCopyButton;
|
||||
}
|
||||
|
||||
- (UIButton *)logoutBtn {
|
||||
if (!_logoutBtn) {
|
||||
_logoutBtn = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
|
||||
@@ -491,11 +491,15 @@ NSString * const KBUserCharacterDeletedNotification = @"KBUserCharacterDeletedNo
|
||||
|
||||
- (void)fetchCancelAccountWarningWithCompletion:(KBCancelAccountAgreementCompletion)completion {
|
||||
KBLanguageCode langCode = [KBLocalizationManager shared].currentLanguageCode;
|
||||
NSString *locale;
|
||||
if ([langCode isEqualToString:KBLanguageCodeSimplifiedChinese]) {
|
||||
locale = @"zh-CN";
|
||||
} else {
|
||||
locale = @"en-US";
|
||||
NSString *locale = @"en-US";
|
||||
if ([langCode isEqualToString:KBLanguageCodeTraditionalChinese]) {
|
||||
locale = @"zh-TW";
|
||||
} else if ([langCode isEqualToString:KBLanguageCodeSpanish]) {
|
||||
locale = @"es-ES";
|
||||
} else if ([langCode isEqualToString:KBLanguageCodeIndonesian]) {
|
||||
locale = @"id-ID";
|
||||
} else if ([langCode isEqualToString:KBLanguageCodePortuguese]) {
|
||||
locale = @"pt-PT";
|
||||
}
|
||||
|
||||
[[KBNetworkManager shared] GET:API_CANCEL_ACCOUNT_WARNING
|
||||
|
||||
Reference in New Issue
Block a user