2023-07-14 18:50:55 +08:00
|
|
|
//
|
|
|
|
// YMMineSettingPresent.m
|
|
|
|
// YUMI
|
|
|
|
//
|
|
|
|
// Created by YUMI on 2021/9/17.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "XPMineSettingPresent.h"
|
|
|
|
#import "Api+Mine.h"
|
|
|
|
#import "Api+Room.h"
|
|
|
|
///P
|
|
|
|
#import "XPMineSettingProtocol.h"
|
|
|
|
///Model
|
|
|
|
#import "UserInfoModel.h"
|
|
|
|
#import "AccountModel.h"
|
|
|
|
#import "XPMineSettingItemModel.h"
|
|
|
|
#import "YYUtility.h"
|
|
|
|
#import "XPVersionUpdateModel.h"
|
|
|
|
#import "Api+Main.h"
|
2023-10-17 18:30:14 +08:00
|
|
|
#import "XPMaskManagerModel.h"
|
2023-07-14 18:50:55 +08:00
|
|
|
///Tool
|
|
|
|
#import "AccountInfoStorage.h"
|
|
|
|
#import "XPRoomMiniManager.h"
|
|
|
|
#import "RtcManager.h"
|
|
|
|
#import "ClientConfig.h"
|
|
|
|
///Third
|
|
|
|
#import <NIMSDK/NIMSDK.h>
|
|
|
|
|
|
|
|
@interface XPMineSettingPresent ()
|
|
|
|
///手机号
|
|
|
|
@property (nonatomic,strong) XPMineSettingItemModel *phoneItem;
|
2025-03-14 19:43:04 +08:00
|
|
|
@property (nonatomic,strong) XPMineSettingItemModel *emailItem;
|
2023-07-14 18:50:55 +08:00
|
|
|
///支付密码
|
|
|
|
@property (nonatomic,strong) XPMineSettingItemModel *payItem;
|
|
|
|
///登录密码
|
|
|
|
@property (nonatomic,strong) XPMineSettingItemModel *loginItem;
|
|
|
|
///数据源
|
|
|
|
@property (nonatomic,strong) NSArray *datasouce;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation XPMineSettingPresent
|
|
|
|
- (id<XPMineSettingProtocol>)getView {
|
|
|
|
return (id<XPMineSettingProtocol>) [super getView];
|
|
|
|
}
|
|
|
|
|
2024-04-08 18:55:15 +08:00
|
|
|
-(void)clearList{
|
|
|
|
self.datasouce = nil;
|
|
|
|
}
|
2023-07-14 18:50:55 +08:00
|
|
|
/// 获取数据源
|
|
|
|
/// @param userinfo 当前的用户信息
|
|
|
|
- (void)getMineSettingDataSourceWith:(UserInfoModel *)userinfo {
|
|
|
|
if (self.datasouce.count > 0) {
|
|
|
|
self.phoneItem.subTitle = userinfo.isBindPhone ? userinfo.phone : YMLocalizedString(@"XPMineSettingPresent0");
|
2023-08-04 11:47:43 +08:00
|
|
|
self.payItem.subTitle = userinfo.isBindPaymentPwd ? YMLocalizedString(@"XPMineSettingPresent26") : YMLocalizedString(@"XPMineSettingPresent2");
|
2023-07-14 18:50:55 +08:00
|
|
|
} else {
|
2025-03-14 19:43:04 +08:00
|
|
|
XPMineSettingItemModel *emailItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
emailItem.title = YMLocalizedString(@"20.20.51_text_13");
|
|
|
|
emailItem.subTitle = ![NSString isEmpty:userinfo.email] ? userinfo.email : YMLocalizedString(@"XPMineSettingPresent4");
|
|
|
|
emailItem.type = XPMineSettingItemType_Email;
|
|
|
|
self.emailItem = emailItem;
|
|
|
|
|
2024-05-22 19:23:54 +08:00
|
|
|
XPMineSettingItemModel * phoneItem = [[XPMineSettingItemModel alloc] init];
|
2025-03-14 19:43:04 +08:00
|
|
|
phoneItem.title = YMLocalizedString(@"20.20.51_text_14");
|
2024-05-22 19:23:54 +08:00
|
|
|
phoneItem.subTitle = userinfo.isBindPhone ? userinfo.phone : YMLocalizedString(@"XPMineSettingPresent4");
|
|
|
|
phoneItem.type = XPMineSettingItemType_Phone;
|
|
|
|
self.phoneItem = phoneItem;
|
2023-10-17 18:30:14 +08:00
|
|
|
|
2024-05-22 19:23:54 +08:00
|
|
|
XPMineSettingItemModel * loginItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
loginItem.title = userinfo.isBindPasswd ? YMLocalizedString(@"XPMineLoginPasswordViewController6") : YMLocalizedString(@"XPMineSettingPresent6");
|
|
|
|
loginItem.subTitle = YMLocalizedString(@"XPMineSettingPresent7");
|
|
|
|
loginItem.type = XPMineSettingItemType_Login_Password;
|
|
|
|
self.loginItem = loginItem;
|
|
|
|
|
|
|
|
XPMineSettingItemModel * shieldItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
shieldItem.title = YMLocalizedString(@"XPMineSettingPresent27");
|
|
|
|
|
|
|
|
shieldItem.type = XPMineSettingItemType_Shield_management;
|
|
|
|
|
|
|
|
XPMineSettingItemModel * blackListItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
blackListItem.title = YMLocalizedString(@"XPMineSettingPresent8");
|
|
|
|
blackListItem.subTitle = @"";
|
|
|
|
blackListItem.type = XPMineSettingItemType_Black_Manager;
|
|
|
|
|
|
|
|
XPMineSettingItemModel * languageItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
languageItem.title = YMLocalizedString(@"XPMineSettingPresent28");
|
|
|
|
languageItem.subTitle = @"";
|
|
|
|
languageItem.type = XPMineSettingItemType_Language;
|
2023-07-14 18:50:55 +08:00
|
|
|
|
2024-05-22 19:23:54 +08:00
|
|
|
XPMineSettingItemModel * payItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
payItem.title = YMLocalizedString(@"XPMineSettingPresent9");
|
|
|
|
payItem.subTitle = userinfo.isBindPaymentPwd ? YMLocalizedString(@"XPMineSettingPresent26") : YMLocalizedString(@"XPMineSettingPresent11");
|
|
|
|
payItem.type = XPMineSettingItemType_Pay_Password;
|
|
|
|
self.payItem = payItem;
|
|
|
|
|
|
|
|
XPMineSettingItemModel * notificaItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
notificaItem.title = YMLocalizedString(@"XPMineSettingPresent12");
|
|
|
|
notificaItem.subTitle = YMLocalizedString(@"XPMineSettingPresent13");
|
|
|
|
notificaItem.type = XPMineSettingItemType_Notification_Remind;
|
|
|
|
|
|
|
|
XPMineSettingItemModel * privacyItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
privacyItem.title = YMLocalizedString(@"XPMineSettingPresent14");
|
|
|
|
privacyItem.subTitle = @"";
|
|
|
|
privacyItem.type = XPMineSettingItemType_Permission;
|
|
|
|
|
|
|
|
XPMineSettingItemModel * helperItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
helperItem.title = YMLocalizedString(@"XPMineSettingPresent15");
|
|
|
|
helperItem.subTitle = @"";
|
|
|
|
helperItem.type = XPMineSettingItemType_Helper;
|
|
|
|
|
|
|
|
XPMineSettingItemModel * feedbackItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
feedbackItem.title = YMLocalizedString(@"XPMineSettingPresent16");
|
|
|
|
feedbackItem.subTitle = @"";
|
|
|
|
feedbackItem.type = XPMineSettingItemType_Feedback;
|
|
|
|
|
|
|
|
XPMineSettingItemModel * clearMemoryItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
clearMemoryItem.title = YMLocalizedString(@"XPMineSettingPresent17");
|
|
|
|
clearMemoryItem.subTitle = @"";
|
|
|
|
clearMemoryItem.type = XPMineSettingItemType_Clear_Memory;
|
|
|
|
|
|
|
|
XPMineSettingItemModel *updateItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
updateItem.title = YMLocalizedString(@"XPMineSettingPresent18");
|
|
|
|
updateItem.subTitle = @"";
|
|
|
|
updateItem.type = XPMineSettingItemType_CheckUpdate;
|
|
|
|
|
|
|
|
XPMineSettingItemModel * aboutusItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
aboutusItem.title = [NSString stringWithFormat:YMLocalizedString(@"XPMineAboutUsViewController0"), AppName];
|
|
|
|
aboutusItem.subTitle = @"";
|
|
|
|
aboutusItem.type = XPMineSettingItemType_About_Us;
|
2024-10-23 19:08:51 +08:00
|
|
|
|
|
|
|
XPMineSettingItemModel * vipItem = [[XPMineSettingItemModel alloc] init];
|
|
|
|
vipItem.title = YMLocalizedString(@"VipSettin_1.0.17_0");
|
|
|
|
vipItem.subTitle = @"";
|
|
|
|
vipItem.type = XPMineSettingItemType_VIP;
|
|
|
|
|
2025-03-21 16:19:07 +08:00
|
|
|
NSArray * oneSection = @[emailItem, phoneItem, loginItem, payItem];
|
|
|
|
NSArray * twoSection = @[vipItem, notificaItem, languageItem];
|
|
|
|
NSArray * threeSection = @[shieldItem, blackListItem];
|
|
|
|
NSArray * fourthSection = @[privacyItem, helperItem, clearMemoryItem, updateItem, aboutusItem];
|
2024-05-22 19:23:54 +08:00
|
|
|
|
|
|
|
self.datasouce = @[oneSection, twoSection, threeSection, fourthSection];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[[self getView] getMineSettingDatasourceSuccess:self.datasouce];
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取用户信息
|
|
|
|
- (void)getUserInfo {
|
|
|
|
NSString * uid = [[AccountInfoStorage instance] getUid];
|
2024-07-25 20:16:51 +08:00
|
|
|
@kWeakify(self);
|
2023-07-14 18:50:55 +08:00
|
|
|
[Api getUserInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
2024-07-25 20:16:51 +08:00
|
|
|
@kStrongify(self);
|
2023-07-14 18:50:55 +08:00
|
|
|
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
|
|
|
|
[[self getView] onGetUserInfoSuccess:infoModel];
|
2025-03-21 16:19:07 +08:00
|
|
|
} showLoading:YES] uid:uid];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// 退出当前账号
|
|
|
|
- (void)logoutCurrentAccount {
|
|
|
|
if([XPRoomMiniManager shareManager].getRoomInfo) {
|
|
|
|
NSString *roomUid = [NSString stringWithFormat:@"%ld", [XPRoomMiniManager shareManager].getRoomInfo.uid];
|
|
|
|
///上报退房
|
|
|
|
[Api requestReportUserOutRoom:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
} uid:[[AccountInfoStorage instance] getUid] roomUid:roomUid ticket:[[AccountInfoStorage instance] getTicket]];
|
|
|
|
///退出房间
|
|
|
|
NSString * roomId = [NSString stringWithFormat:@"%ld", [XPRoomMiniManager shareManager].getRoomInfo.roomId];
|
|
|
|
[[NIMSDK sharedSDK].chatroomManager exitChatroom:roomId completion:nil];
|
|
|
|
[[RtcManager instance] exitRoom];
|
|
|
|
[[XPRoomMiniManager shareManager] configRoomInfo:nil];
|
|
|
|
[[XPRoomMiniManager shareManager] configUserInfo:nil];
|
|
|
|
[[XPRoomMiniManager shareManager] configCurrentMusic:nil isPlaying:NO];
|
|
|
|
[[XPRoomMiniManager shareManager] resetLocalMessage];
|
|
|
|
}
|
|
|
|
AccountModel * account = [[AccountInfoStorage instance] accountModel];
|
|
|
|
[Api logoutCurrentAccount:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
[[self getView] logoutCurrentAccountSuccess];
|
|
|
|
}] access_token:account.access_token];
|
|
|
|
[self logout];
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - 版本更新
|
|
|
|
-(void)getVersionUpdate{
|
|
|
|
NSString *appVersion = [YYUtility appVersion];
|
|
|
|
NSString *os = @"ios";
|
|
|
|
NSString *channel = [YYUtility getAppSource];
|
|
|
|
[Api requestVersionUpdate:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
XPVersionUpdateModel *model = [XPVersionUpdateModel modelWithDictionary:data.data];
|
|
|
|
[[self getView] getVersionUpdate:model];
|
|
|
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
|
|
|
[[self getView] getVersionUpdateFail];
|
|
|
|
} errorToast:NO] appVersion:appVersion os:os channel:channel];
|
|
|
|
}
|
2023-10-17 18:30:14 +08:00
|
|
|
-(void)getBlackRoomListWithPageNum:(NSString *)pageNum pageSize:(NSString *)pageSize{
|
|
|
|
[Api getBlackRoomList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
NSArray *list = [XPMaskManagerModel modelsWithArray:data.data];
|
|
|
|
[[self getView]getBlackRoomList:list];
|
|
|
|
}showLoading:NO] pageNum:pageNum pageSize:pageSize];
|
|
|
|
}
|
|
|
|
///解除屏蔽
|
|
|
|
-(void)requestUnmaskingFromBlackRoomListWithRoomUid:(NSString *)roomUid type:(NSString *)type{
|
|
|
|
[Api requestUnmaskingFromBlackRoomList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
[[self getView]requestUnmaskingFromBlackRoomListSuccess];
|
|
|
|
}showLoading:YES] objId:roomUid type:type ];
|
|
|
|
}
|
2023-07-14 18:50:55 +08:00
|
|
|
@end
|