补全了退出当前账号的逻辑
This commit is contained in:
@@ -15,8 +15,13 @@ NSString * const kWeChatNumber = @"yinyoucc";
|
||||
|
||||
///在里面进行判断当前环境是什么
|
||||
NSString * const KeyWithType(KeyType type) {
|
||||
#warning to do 需要根据当前环境进行判断
|
||||
BOOL isRelease = NO;
|
||||
BOOL isRelase = NO;
|
||||
#ifdef DEBUG
|
||||
isRelase = NO;
|
||||
#else
|
||||
isRelase = YES;
|
||||
#endif
|
||||
|
||||
NSDictionary * dic = @{
|
||||
///正式环境
|
||||
@(YES):@{
|
||||
@@ -43,7 +48,7 @@ NSString * const KeyWithType(KeyType type) {
|
||||
@(KeyType_APNSCer) : @"yinyouApnsDebug",
|
||||
}
|
||||
};
|
||||
NSDictionary * enviroDic = [dic objectForKey:@(isRelease)];
|
||||
NSDictionary * enviroDic = [dic objectForKey:@(isRelase)];
|
||||
return [enviroDic objectForKey:@(type)];
|
||||
}
|
||||
|
||||
|
@@ -130,6 +130,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
uid:(NSString *)uid
|
||||
ticket:(NSString *)ticket;
|
||||
|
||||
/// 退出当前账号
|
||||
/// @param complection 完成
|
||||
/// @param access_token token
|
||||
+ (void)logoutCurrentAccount:(HttpRequestHelperCompletion)complection
|
||||
access_token:(NSString *)access_token;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -131,4 +131,12 @@
|
||||
}
|
||||
|
||||
|
||||
/// 退出当前账号
|
||||
/// @param complection 完成
|
||||
/// @param access_token token
|
||||
+ (void)logoutCurrentAccount:(HttpRequestHelperCompletion)complection access_token:(NSString *)access_token {
|
||||
[self makeRequest:@"acc/logout" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, access_token, nil];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -18,6 +18,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param userinfo 当前的用户信息
|
||||
- (void)getMineSettingDataSourceWith:(UserInfoModel *)userinfo;
|
||||
|
||||
/// 退出当前账号
|
||||
- (void)logoutCurrentAccount;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#import "XPMineSettingProtocol.h"
|
||||
///Model
|
||||
#import "UserInfoModel.h"
|
||||
#import "AccountModel.h"
|
||||
#import "XPMineSettingItemModel.h"
|
||||
///Tool
|
||||
#import "AccountInfoStorage.h"
|
||||
@@ -94,5 +95,14 @@
|
||||
}
|
||||
|
||||
|
||||
/// 退出当前账号
|
||||
- (void)logoutCurrentAccount {
|
||||
AccountModel * account = [[AccountInfoStorage instance] accountModel];
|
||||
[Api logoutCurrentAccount:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[self logout];
|
||||
[[self getView] logoutCurrentAccountSuccess];
|
||||
}] access_token:account.access_token];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)getMineSettingDatasourceSuccess:(NSArray *)array;
|
||||
///获取用户信息成功
|
||||
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo;
|
||||
///退出当前账号成功
|
||||
- (void)logoutCurrentAccountSuccess;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -54,6 +54,7 @@
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initEvents];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self.presenter getMineSettingDataSourceWith:self.userInfo];
|
||||
@@ -66,6 +67,12 @@
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initEvents {
|
||||
[[self.logoutButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
|
||||
[self.presenter logoutCurrentAccount];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
self.title = @"设置";
|
||||
[self.view addSubview:self.tableView];
|
||||
@@ -228,6 +235,10 @@
|
||||
[self.presenter getMineSettingDataSourceWith:userInfo];
|
||||
}
|
||||
|
||||
- (void)logoutCurrentAccountSuccess {
|
||||
[self.navigationController popToRootViewControllerAnimated:NO];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
|
@@ -143,9 +143,12 @@
|
||||
} else {
|
||||
if ([self.roomUid isEqualToString:uid]) {
|
||||
// TODO: 进入自己房间,需要重新开房。
|
||||
[self.presenter openUserRoomWithTitle:roomInfo.title.length > 0 ? roomInfo.title : @"" type:roomInfo.type roomPwd:roomInfo.roomPwd roomDesc:roomInfo.roomDesc backPic:nil];
|
||||
[self showSuccessToast:@"请选择进入其他人的房间"];
|
||||
[self enterRoomFail];
|
||||
} else {
|
||||
// TODO: 房主已经下线。
|
||||
[self showSuccessToast:@"房主已下线"];
|
||||
[self enterRoomFail];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user