|
@@ -26,7 +26,7 @@
|
|
|
- (void)viewDidLoad {
|
|
|
[super viewDidLoad];
|
|
|
// Do any additional setup after loading the view from its nib.
|
|
|
- self.title = @"个人中心";
|
|
|
+ self.title = self.isSetting ? @"通用设置" : @"个人中心";
|
|
|
if (@available(iOS 11.0, *)) {
|
|
|
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
} else {
|
|
@@ -99,14 +99,33 @@
|
|
|
vc.title = detail.title;
|
|
|
[self navPushViewController:vc animated:YES];
|
|
|
}
|
|
|
+ if ([detail.title isEqualToString:@"清空聊天记录"]) {
|
|
|
+ [SLCustomizeAlert showAletrWithTitle:@"温馨提示" message:@"是否清空聊天记录?" sureBtnTitle:@"确定" cancelBtnTitle:@"取消" sureBtnAction:^{
|
|
|
+ NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
|
|
+ NSDictionary *dic = [userDefaults dictionaryRepresentation];
|
|
|
+ for (id key in dic) {
|
|
|
+ if ([key isKindOfClass:NSString.class] && [key containsString:[NSString stringWithFormat:@"%@--to--",[SLGlobalInfo SharedInstance].loginInfo.user.userId]]) {
|
|
|
+ [userDefaults removeObjectForKey:key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ [userDefaults synchronize];
|
|
|
+ //语音文件
|
|
|
+ NSString *voicePath = [YMPath_DOCUMENT stringByAppendingFormat:@"/%@", @"voices"];
|
|
|
+ [[NSFileManager defaultManager] removeItemAtPath:voicePath error:nil];
|
|
|
+ [ZFToast ShowWithMessage:@"清空成功"];
|
|
|
+ } cancelBtnAction:^{
|
|
|
+
|
|
|
+ }];
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
- if (indexPath.section == 0 && indexPath.row == 0) {
|
|
|
- return 68.f;
|
|
|
+ SLPageModelDetail *detail = [[self.dataModels objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
|
|
+ if ([detail.title isEqualToString:@"头像"]) {
|
|
|
+ return 68.0f;
|
|
|
}
|
|
|
- return 50.f;
|
|
|
+ return 50.0f;
|
|
|
}
|
|
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
|
@@ -137,6 +156,12 @@
|
|
|
@[[SLPageModelDetail initWithTitle:@"用户服务协议" subTitle:@"" bgImage:@""],
|
|
|
[SLPageModelDetail initWithTitle:@"免责声明" subTitle:@"" bgImage:@""]],
|
|
|
@[[SLPageModelDetail initWithTitle:@"退出登录" subTitle:@"" bgImage:@""],]];
|
|
|
+ if (self.isSetting) {
|
|
|
+ arr = @[
|
|
|
+ @[[SLPageModelDetail initWithTitle:@"语言设置" subTitle:@"" bgImage:@""],
|
|
|
+ [SLPageModelDetail initWithTitle:@"聊天背景" subTitle:@"" bgImage:@""]],
|
|
|
+ @[[SLPageModelDetail initWithTitle:@"清空聊天记录" subTitle:@"" bgImage:@""],]];
|
|
|
+ }
|
|
|
_dataModels = [NSMutableArray arrayWithArray:arr];
|
|
|
}
|
|
|
return _dataModels;
|