48 lines
1.3 KiB
Objective-C
48 lines
1.3 KiB
Objective-C
//
|
|
// MewLoginPresenter.m
|
|
// mew-ios
|
|
//
|
|
// Created by 触海 on 2023/11/6.
|
|
//
|
|
|
|
#import "MewLoginPresenter.h"
|
|
///Tool
|
|
#import "MewAccountInfoStorage.h"
|
|
///APi
|
|
#import "Api+Login.h"
|
|
///P
|
|
#import "MewLoginProtocol.h"
|
|
#import "MewAccountModel.h"
|
|
#import "NSObject+MEWExtension.h"
|
|
@implementation MewLoginPresenter
|
|
|
|
#pragma mark - Super
|
|
- (id<MewLoginProtocol>)mew_getView {
|
|
return (id<MewLoginProtocol>)[super mew_getView];
|
|
}
|
|
|
|
#pragma mark - Public Method
|
|
/// 一键登录
|
|
- (void)mew_phoneQuickLogin:(NSString *)accessToken token:(NSString *)token {
|
|
[Api Mew_PhoneQuickLogin:[self mew_createHttpCompletion:^(MewBaseModel * _Nonnull data) {
|
|
|
|
}] accessToken:accessToken token:token];
|
|
}
|
|
|
|
|
|
- (void)mew_thirdLoginWithApple:(NSString *)token unionId:(NSString *)unionId {
|
|
[Api Mew_LoginWithThirdPart:[self mew_createHttpCompletion:^(MewBaseModel * _Nonnull data) {
|
|
MewAccountModel *model = [MewAccountModel mewModelWithDictionary:data.data];
|
|
if (model != nil) {
|
|
[[MewAccountInfoStorage instance] mew_saveAccountInfo:model];
|
|
[[self mew_getView] mew_loginSuccess];
|
|
}
|
|
|
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
|
|
|
} mew_showLoading:YES] openid:token unionid:unionId access_token:token type:@"5"];
|
|
}
|
|
|
|
|
|
@end
|