|
@@ -102,18 +102,22 @@
|
|
|
}
|
|
|
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];
|
|
|
+ [[SLHttpCenter SharedInstance] getWithUrl:@"/api/Chat/ResetChatRecord" parameter:@{} success:^(id responseObject) {
|
|
|
+ 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:@"清空成功"];
|
|
|
+ [userDefaults synchronize];
|
|
|
+ //语音文件
|
|
|
+ NSString *voicePath = [YMPath_DOCUMENT stringByAppendingFormat:@"/%@", @"voices"];
|
|
|
+ [[NSFileManager defaultManager] removeItemAtPath:voicePath error:nil];
|
|
|
+ [ZFToast ShowWithMessage:@"清空成功"];
|
|
|
+ } failure:^(SPRequestError *error) {
|
|
|
+
|
|
|
+ }];
|
|
|
} cancelBtnAction:^{
|
|
|
|
|
|
}];
|