登录页面,注册页面的UI和逻辑修改,充值页面的UI修改
@@ -184,6 +184,8 @@
|
||||
8C9C84AA2B0D930B00A601BC /* MicroNobleWaveView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84A92B0D930B00A601BC /* MicroNobleWaveView.m */; };
|
||||
8C9C84AD2B0D9AB900A601BC /* XPRoomMessageHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84AC2B0D9AB900A601BC /* XPRoomMessageHeaderView.m */; };
|
||||
8C9C84B12B0DEAE100A601BC /* YMIButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84B02B0DEAE100A601BC /* YMIButton.m */; };
|
||||
8C9C84B42B0E951200A601BC /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C9C84B32B0E951200A601BC /* StoreKit.framework */; };
|
||||
8C9C84BA2B0ECD2100A601BC /* MineRechargePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84B92B0ECD2100A601BC /* MineRechargePresenter.m */; };
|
||||
FFDAAB800AD6BB4653B4427F /* Pods_yinmeng_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1797344FB85F47F60D0CC2A0 /* Pods_yinmeng_ios.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@@ -567,6 +569,11 @@
|
||||
8C9C84AC2B0D9AB900A601BC /* XPRoomMessageHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMessageHeaderView.m; sourceTree = "<group>"; };
|
||||
8C9C84AF2B0DEAE100A601BC /* YMIButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YMIButton.h; sourceTree = "<group>"; };
|
||||
8C9C84B02B0DEAE100A601BC /* YMIButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YMIButton.m; sourceTree = "<group>"; };
|
||||
8C9C84B22B0E94FA00A601BC /* yinmeng-ios.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "yinmeng-ios.entitlements"; sourceTree = "<group>"; };
|
||||
8C9C84B32B0E951200A601BC /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
|
||||
8C9C84B82B0ECD2100A601BC /* MineRechargePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MineRechargePresenter.h; sourceTree = "<group>"; };
|
||||
8C9C84B92B0ECD2100A601BC /* MineRechargePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MineRechargePresenter.m; sourceTree = "<group>"; };
|
||||
8C9C84BE2B0ED1D000A601BC /* MineRechargeProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MineRechargeProtocol.h; sourceTree = "<group>"; };
|
||||
A22C3BCB2715A2E8FDECEA30 /* Pods-yinmeng-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-yinmeng-ios.release.xcconfig"; path = "Target Support Files/Pods-yinmeng-ios/Pods-yinmeng-ios.release.xcconfig"; sourceTree = "<group>"; };
|
||||
E9E8A33E3FDD457C53D1E6D7 /* Pods-yinmeng-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-yinmeng-ios.debug.xcconfig"; path = "Target Support Files/Pods-yinmeng-ios/Pods-yinmeng-ios.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
@@ -579,6 +586,7 @@
|
||||
8C9C847F2B0C6A6A00A601BC /* TXSoundTouch.xcframework in Frameworks */,
|
||||
8C9C847D2B0C6A6400A601BC /* TXFFmpeg.xcframework in Frameworks */,
|
||||
FFDAAB800AD6BB4653B4427F /* Pods_yinmeng_ios.framework in Frameworks */,
|
||||
8C9C84B42B0E951200A601BC /* StoreKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -734,6 +742,7 @@
|
||||
8C4D534E2AFD4CF600238AE6 /* yinmeng-ios */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8C9C84B22B0E94FA00A601BC /* yinmeng-ios.entitlements */,
|
||||
8C9C847B2B0C697F00A601BC /* Sources */,
|
||||
8C9C82DE2B0C697A00A601BC /* Main */,
|
||||
8C9C82DD2B0C697000A601BC /* Library */,
|
||||
@@ -1421,6 +1430,8 @@
|
||||
8C9C835B2B0C697A00A601BC /* YMMineSettingPresenter.m */,
|
||||
8C9C835C2B0C697A00A601BC /* YMMineSettingPresenter.h */,
|
||||
8C9C835D2B0C697A00A601BC /* YMMineCollectRoomPresenter.h */,
|
||||
8C9C84B82B0ECD2100A601BC /* MineRechargePresenter.h */,
|
||||
8C9C84B92B0ECD2100A601BC /* MineRechargePresenter.m */,
|
||||
);
|
||||
path = Presenter;
|
||||
sourceTree = "<group>";
|
||||
@@ -1430,6 +1441,7 @@
|
||||
children = (
|
||||
8C9C835F2B0C697A00A601BC /* YMMineSettingProtocol.h */,
|
||||
8C9C83602B0C697A00A601BC /* YMMineCollectRoomProtocol.h */,
|
||||
8C9C84BE2B0ED1D000A601BC /* MineRechargeProtocol.h */,
|
||||
);
|
||||
path = Protocol;
|
||||
sourceTree = "<group>";
|
||||
@@ -2093,6 +2105,7 @@
|
||||
B603F71B608343F0E1A79C4B /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8C9C84B32B0E951200A601BC /* StoreKit.framework */,
|
||||
8C9C847E2B0C6A6A00A601BC /* TXSoundTouch.xcframework */,
|
||||
8C9C847C2B0C6A6400A601BC /* TXFFmpeg.xcframework */,
|
||||
1797344FB85F47F60D0CC2A0 /* Pods_yinmeng_ios.framework */,
|
||||
@@ -2319,6 +2332,7 @@
|
||||
8C9C84A32B0D894100A601BC /* RoomFaceSendInfoModel.m in Sources */,
|
||||
8C9C84222B0C697A00A601BC /* MicroExtModel.m in Sources */,
|
||||
8C9C843C2B0C697A00A601BC /* RtcManager.m in Sources */,
|
||||
8C9C84BA2B0ECD2100A601BC /* MineRechargePresenter.m in Sources */,
|
||||
8C9C84182B0C697A00A601BC /* YMHomePresenter.m in Sources */,
|
||||
8C9C841E2B0C697A00A601BC /* YMRoomSendTextView.m in Sources */,
|
||||
8C9C843E2B0C697A00A601BC /* YMMineSettingPresenter.m in Sources */,
|
||||
@@ -2545,6 +2559,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = "yinmeng-ios/yinmeng-ios.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 48UCG35Q9W;
|
||||
@@ -2580,6 +2595,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = "yinmeng-ios/yinmeng-ios.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 48UCG35Q9W;
|
||||
|
@@ -7,6 +7,7 @@
|
||||
|
||||
#import "AppDelegate+ThirdConfig.h"
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import <QYSDK_NIM/QYSDK.h>
|
||||
#import "YMConstant.h"
|
||||
#import "CustomAttachmentDecoder.h"
|
||||
|
||||
@@ -37,4 +38,11 @@
|
||||
// }
|
||||
[[UIApplication sharedApplication] registerForRemoteNotifications];
|
||||
}
|
||||
|
||||
- (void)configQIYUSDK {
|
||||
[[QYSDK sharedSDK] registerAppId:@"b6b7ca22f8ce319dea3a7456dc211fec" appName:@"音萌"];
|
||||
[QYSDK sharedSDK].customUIConfig.showAudioEntry = NO;
|
||||
[QYSDK sharedSDK].customUIConfig.autoShowKeyboard = NO;
|
||||
[QYSDK sharedSDK].customUIConfig.serviceHeadImage = [UIImage imageNamed:@"ming_setting_about_us"];
|
||||
}
|
||||
@end
|
||||
|
22
yinmeng-ios/yinmeng-ios/Assets.xcassets/Mew/Login/mew_login_apple.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_apple@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_apple@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
yinmeng-ios/yinmeng-ios/Assets.xcassets/Mew/Login/mew_login_apple.imageset/mew_login_apple@2x.png
vendored
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
yinmeng-ios/yinmeng-ios/Assets.xcassets/Mew/Login/mew_login_apple.imageset/mew_login_apple@3x.png
vendored
Normal file
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_full_man_normal@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_full_man_normal@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_full_man_select@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_full_man_select@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_full_waman_normal@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_full_waman_normal@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_full_waman_select@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_full_waman_select@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 12 KiB |
22
yinmeng-ios/yinmeng-ios/Assets.xcassets/Mew/Login/mew_login_line_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_line_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_line_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.2 KiB |
22
yinmeng-ios/yinmeng-ios/Assets.xcassets/Mew/Login/mew_login_next.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_next@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mew_login_next@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
yinmeng-ios/yinmeng-ios/Assets.xcassets/Mew/Login/mew_login_next.imageset/mew_login_next@2x.png
vendored
Normal file
After Width: | Height: | Size: 482 B |
BIN
yinmeng-ios/yinmeng-ios/Assets.xcassets/Mew/Login/mew_login_next.imageset/mew_login_next@3x.png
vendored
Normal file
After Width: | Height: | Size: 679 B |
@@ -44,6 +44,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+ (void)completeUserInfo:(HttpRequestHelperCompletion)complection
|
||||
userInfo:(NSDictionary *)userInfo;
|
||||
|
||||
/// 获取用户钱包余额信息
|
||||
/// @param complection 完成
|
||||
/// @param uid 用户uid
|
||||
/// @param ticket ticketg
|
||||
+ (void)getUserWalletInfo:(HttpRequestHelperCompletion)complection
|
||||
uid:(NSString *)uid
|
||||
ticket:(NSString *)ticket;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -69,7 +69,17 @@
|
||||
/// @param userInfo 需要更新的用户信息
|
||||
+ (void)completeUserInfo:(HttpRequestHelperCompletion)complection
|
||||
userInfo:(NSDictionary *)userInfo {
|
||||
[self makeRequest:@"user/v2/update" method:HttpRequestHelperMethodPOST completion:complection];
|
||||
[HttpRequestHelper request:@"user/v2/update" method:HttpRequestHelperMethodPOST params:userInfo completion:complection];
|
||||
}
|
||||
|
||||
|
||||
/// 获取用户钱包余额信息
|
||||
/// @param complection 完成
|
||||
/// @param uid 用户uid
|
||||
/// @param ticket ticketg
|
||||
+ (void)getUserWalletInfo:(HttpRequestHelperCompletion)complection
|
||||
uid:(NSString *)uid
|
||||
ticket:(NSString *)ticket {
|
||||
[self makeRequest:@"purse/query" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, uid, ticket,nil];
|
||||
}
|
||||
@end
|
||||
|
@@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic , copy) NSString * phone;
|
||||
@property (nonatomic , copy) NSString * nick;
|
||||
@property (nonatomic , copy) NSString * avatar;
|
||||
/// mew avatar
|
||||
//@property (nonatomic , copy) NSString * newAvatar;
|
||||
@property (nonatomic , assign) GenderType gender;
|
||||
@property (nonatomic , assign) NSInteger uid;
|
||||
@property (nonatomic , assign) NSInteger platformRole;
|
||||
|
@@ -9,8 +9,30 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface YMIAPHelper : NSObject
|
||||
typedef NS_ENUM(NSInteger ,PaymentStatus) {
|
||||
PaymentStatus_Purchasing = 1,//付款中
|
||||
PaymentStatus_Purchased, //付款操作已经完成
|
||||
PaymentStatus_Failed, //付款操作失败
|
||||
PaymentStatus_Deferred, //未知状态
|
||||
};
|
||||
|
||||
@protocol YMIAPHelperDelegate <NSObject>
|
||||
|
||||
///当前充值的状态
|
||||
- (void)rechargeProcessStatus:(PaymentStatus)status;
|
||||
|
||||
///充值成功回调id
|
||||
- (void)rechargeSuccess:(NSString *)transactionIdentifier;
|
||||
@end
|
||||
|
||||
@interface YMIAPHelper : NSObject
|
||||
|
||||
+ (instancetype)shareHelper;
|
||||
///代理
|
||||
@property (nonatomic,weak) id<YMIAPHelperDelegate> delegate;
|
||||
///购买商品
|
||||
- (void)buyAppProductWithAppProductId:(NSString *)appProductId;
|
||||
@end
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -6,7 +6,91 @@
|
||||
//
|
||||
|
||||
#import "YMIAPHelper.h"
|
||||
#import <IAPHelper/IAPHelper.h>
|
||||
#import <IAPShare.h>
|
||||
|
||||
@implementation YMIAPHelper
|
||||
+ (instancetype)shareHelper {
|
||||
static dispatch_once_t onceToken;
|
||||
static YMIAPHelper * helper;
|
||||
dispatch_once(&onceToken, ^{
|
||||
helper = [[YMIAPHelper alloc] init];
|
||||
});
|
||||
return helper;
|
||||
}
|
||||
|
||||
|
||||
- (void)buyAppProductWithAppProductId:(NSString *)appProductId {
|
||||
NSSet* dataSet = [[NSSet alloc] initWithObjects:appProductId, nil];
|
||||
[IAPShare sharedHelper].iap = [[IAPHelper alloc] initWithProductIdentifiers:dataSet];
|
||||
[[IAPShare sharedHelper].iap requestProductsWithCompletion:^(SKProductsRequest *request, SKProductsResponse *response) {
|
||||
if (response != nil && response.products.count) {
|
||||
///有这个内购的产品
|
||||
} else if (!response.products.count) {
|
||||
///请求内购产品失败,无产品数量
|
||||
#warning to do 此处埋点一个 没有内购产品
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(rechargeProcessStatus:)]) {
|
||||
[self.delegate rechargeProcessStatus:PaymentStatus_Failed];
|
||||
}
|
||||
return;
|
||||
} else if (!response) {
|
||||
#warning to do 此处埋点一个 请求内购没有响应
|
||||
///请求内购产品失败,内购无响应
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(rechargeProcessStatus:)]) {
|
||||
[self.delegate rechargeProcessStatus:PaymentStatus_Failed];
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
#warning to do 此处埋点一个 异常 发起付款失败
|
||||
///异常 发起付款失败
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(rechargeProcessStatus:)]) {
|
||||
[self.delegate rechargeProcessStatus:PaymentStatus_Failed];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (response.products.firstObject) {
|
||||
[[IAPShare sharedHelper].iap buyProduct:response.products.firstObject onCompletion:^(SKPaymentTransaction *transcation) {
|
||||
NSLog(@"%@",transcation.error.description);
|
||||
switch(transcation.transactionState) {
|
||||
case SKPaymentTransactionStatePurchased: {
|
||||
NSLog(@"付款完成状态, 要做出相关的处理");
|
||||
[[SKPaymentQueue defaultQueue] finishTransaction:transcation];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(rechargeProcessStatus:)]) {
|
||||
[self.delegate rechargeProcessStatus:PaymentStatus_Purchased];
|
||||
}
|
||||
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(rechargeSuccess:)]) {
|
||||
[self.delegate rechargeSuccess:transcation.transactionIdentifier];
|
||||
}
|
||||
//同步返回购买成功后,需要请求服务器二次校验
|
||||
}
|
||||
break;
|
||||
case SKPaymentTransactionStateFailed: {
|
||||
[[SKPaymentQueue defaultQueue] finishTransaction:transcation];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(rechargeProcessStatus:)]) {
|
||||
[self.delegate rechargeProcessStatus:PaymentStatus_Failed];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SKPaymentTransactionStatePurchasing: {
|
||||
NSLog(@"正在购买中");
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(rechargeProcessStatus:)]) {
|
||||
[self.delegate rechargeProcessStatus:PaymentStatus_Purchasing];
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
[[SKPaymentQueue defaultQueue] finishTransaction:transcation];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(rechargeProcessStatus:)]) {
|
||||
[self.delegate rechargeProcessStatus:PaymentStatus_Deferred];
|
||||
}
|
||||
NSLog(@"其它");
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -11,9 +11,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MewLoginNumberViewController : BaseViewController
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#import "YMMacro.h"
|
||||
|
||||
@interface MewLoginNumberViewController ()<MewLoginPhoneViewDelegate, MewLoginPasswordViewDelegate>
|
||||
@property (nonatomic, strong) UIImageView *bgImageView;
|
||||
/// 返回按钮
|
||||
@property (nonatomic, strong) UIButton *backButton;
|
||||
/// 手机号登录
|
||||
@@ -22,7 +23,7 @@
|
||||
/// 账号登录
|
||||
@property (nonatomic, strong) UIButton *passwordButton;
|
||||
/// 下划线
|
||||
@property (nonatomic, strong) UIView *lineView;
|
||||
@property (nonatomic, strong) UIImageView *lineView;
|
||||
/// 是否选中了手机号登录
|
||||
@property (nonatomic, assign, getter=isPhoneSelect) BOOL phoneSelect;
|
||||
/// 手机登录View
|
||||
@@ -98,6 +99,7 @@
|
||||
|
||||
#pragma mark - Init View
|
||||
- (void)initSubView {
|
||||
[self.view addSubview:self.bgImageView];
|
||||
[self.view addSubview:self.backButton];
|
||||
[self.view addSubview:self.phoneButton];
|
||||
[self.view addSubview:self.passwordButton];
|
||||
@@ -108,6 +110,9 @@
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.view);
|
||||
}];
|
||||
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.view).mas_offset(10);
|
||||
make.top.mas_equalTo(statusbarHeight);
|
||||
@@ -151,8 +156,8 @@
|
||||
- (void)setPhoneSelect:(BOOL)phoneSelect {
|
||||
_phoneSelect = phoneSelect;
|
||||
/// 更新样式
|
||||
self.phoneButton.titleLabel.font = _phoneSelect ? kFontBold(20) : kFontRegular(14);
|
||||
self.passwordButton.titleLabel.font = _phoneSelect ? kFontRegular(14) : kFontBold(20);
|
||||
self.phoneButton.titleLabel.font = _phoneSelect ? kFontSemibold(18) : kFontSemibold(16);
|
||||
self.passwordButton.titleLabel.font = _phoneSelect ? kFontSemibold(16) : kFontSemibold(18);
|
||||
self.phoneLoginView.hidden = !_phoneSelect;
|
||||
self.passwordLoginView.hidden = _phoneSelect;
|
||||
|
||||
@@ -163,11 +168,16 @@
|
||||
}
|
||||
|
||||
#pragma mark - Get
|
||||
- (UIImageView *)bgImageView {
|
||||
if (!_bgImageView) {
|
||||
_bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mew_home_bg"]];
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
- (UIButton *)backButton {
|
||||
if (!_backButton) {
|
||||
_backButton = [[UIButton alloc] init];
|
||||
[_backButton setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
|
||||
_backButton.backgroundColor = UIColor.blueColor;
|
||||
[_backButton setImage:[UIImage imageNamed:@"common_back_white_left"] forState:UIControlStateNormal];
|
||||
[_backButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _backButton;
|
||||
@@ -177,7 +187,8 @@
|
||||
if (!_phoneButton) {
|
||||
_phoneButton = [[UIButton alloc] init];
|
||||
[_phoneButton setTitle:@"手机号登录" forState:UIControlStateNormal];
|
||||
[_phoneButton setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
|
||||
[_phoneButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
||||
_phoneButton.titleLabel.font = kFontSemibold(16);
|
||||
[_phoneButton addTarget:self action:@selector(phoneButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _phoneButton;
|
||||
@@ -187,16 +198,17 @@
|
||||
if (!_passwordButton) {
|
||||
_passwordButton = [[UIButton alloc] init];
|
||||
[_passwordButton setTitle:@"账号登录" forState:UIControlStateNormal];
|
||||
[_passwordButton setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
|
||||
[_passwordButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
||||
_phoneButton.titleLabel.font = kFontSemibold(16);
|
||||
[_passwordButton addTarget:self action:@selector(passwordButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _passwordButton;
|
||||
}
|
||||
|
||||
- (UIView *)lineView {
|
||||
- (UIImageView *)lineView {
|
||||
if (!_lineView) {
|
||||
_lineView = [[UIView alloc] init];
|
||||
_lineView.backgroundColor = UIColor.blackColor;
|
||||
_lineView = [[UIImageView alloc] init];
|
||||
_lineView.image = [UIImage imageNamed:@"mew_login_line_bg"];
|
||||
}
|
||||
return _lineView;
|
||||
}
|
||||
|
@@ -10,6 +10,8 @@
|
||||
#import "YMIButton.h"
|
||||
//apple
|
||||
#import <AuthenticationServices/ASAuthorizationAppleIDButton.h>
|
||||
#import <AuthenticationServices/AuthenticationServices.h>
|
||||
#import <NTESQuickPass/NTESQuickPass.h>
|
||||
///Third
|
||||
#import <YYText.h>
|
||||
#import <Masonry/Masonry.h>
|
||||
@@ -18,9 +20,16 @@
|
||||
#import "ThemeColor.h"
|
||||
#import "YMHUDTool.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "YMConstant.h"
|
||||
#import "GCDHelper.h"
|
||||
#import "Base.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "Api+Login.h"
|
||||
///Present
|
||||
#import "LoginPresenter.h"
|
||||
#import "LoginProtocol.h"
|
||||
#import "ThirdUserInfo.h"
|
||||
|
||||
|
||||
|
||||
UIKIT_EXTERN NSString * const kYinyouPrivateKey;
|
||||
@@ -35,17 +44,14 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
|
||||
};
|
||||
|
||||
|
||||
@interface MewLoginViewController ()
|
||||
@interface MewLoginViewController ()<ASAuthorizationControllerDelegate,ASAuthorizationControllerPresentationContextProviding>
|
||||
@property (nonatomic, strong) UIView *contentView;
|
||||
/** 登录按钮*/
|
||||
@property (nonatomic, strong) UIButton *loginButton;
|
||||
|
||||
@property (nonatomic, strong) UIStackView *stackView;
|
||||
/// 手机
|
||||
@property (nonatomic, strong) YMIButton *phoneButtonView;
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
|
||||
@property (nonatomic, strong) ASAuthorizationAppleIDButton *appleButton;
|
||||
#endif
|
||||
//@property (nonatomic, strong) UIStackView *stackView;
|
||||
/// 苹果
|
||||
@property (nonatomic, strong) YMIButton *appleButtonView;
|
||||
|
||||
/** 同意勾选按钮*/
|
||||
@property (nonatomic, strong) UIButton *agreeButton;
|
||||
@@ -77,7 +83,7 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
|
||||
[super viewDidLoad];
|
||||
[self initView];
|
||||
[self setUpConstraints];
|
||||
[self setEvents];
|
||||
// [self setEvents];
|
||||
// [self loginAnimation];
|
||||
}
|
||||
|
||||
@@ -99,7 +105,7 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
|
||||
// [self.view addSubview:self.logoImageView];
|
||||
[self.view addSubview:self.contentView];
|
||||
[self.contentView addSubview:self.loginButton];
|
||||
[self.contentView addSubview:self.stackView];
|
||||
// [self.contentView addSubview:self.stackView];
|
||||
[self.view addSubview:self.agreeButton];
|
||||
[self.view addSubview:self.agreeLabel];
|
||||
[self.view addSubview:self.authBubbleView];
|
||||
@@ -107,23 +113,19 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
|
||||
[self.view addSubview:self.leftLineView];
|
||||
[self.view addSubview:self.rightLineView];
|
||||
[self.view addSubview:self.otherLoginTitleLabel];
|
||||
[self.view addSubview:self.appleButtonView];
|
||||
|
||||
// [self.stackView addArrangedSubview:self.qqButtonView];
|
||||
[self.stackView addArrangedSubview:self.phoneButtonView];
|
||||
// [self.stackView addArrangedSubview:self.wxButtonView];
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
|
||||
[self.stackView addArrangedSubview:self.appleButton];
|
||||
#endif
|
||||
// [self.stackView addArrangedSubview:self.phoneButtonView];
|
||||
//// [self.stackView addArrangedSubview:self.wxButtonView];
|
||||
//#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
|
||||
// [self.stackView addArrangedSubview:self.appleButton];
|
||||
//#endif
|
||||
|
||||
}
|
||||
|
||||
- (void)setUpConstraints {
|
||||
CGFloat kscale = 363.0 / 375.0;
|
||||
// [self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.right.top.mas_equalTo(self.view);
|
||||
// make.height.mas_equalTo(KScreenWidth * kscale);
|
||||
// }];
|
||||
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.view);
|
||||
}];
|
||||
@@ -157,15 +159,20 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
|
||||
|
||||
|
||||
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.bottom.mas_equalTo(self.view).offset(-kSafeAreaBottomHeight - 60);
|
||||
// make.centerX.mas_equalTo(self.view);
|
||||
// make.height.mas_equalTo(75);
|
||||
// }];
|
||||
|
||||
[self.appleButtonView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self.view).offset(-kSafeAreaBottomHeight - 60);
|
||||
make.centerX.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(75);
|
||||
}];
|
||||
|
||||
|
||||
[self.agreeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.appleButton.mas_bottom).offset(20);
|
||||
make.top.mas_equalTo(self.appleButtonView.mas_bottom).offset(20);
|
||||
make.height.mas_equalTo(40);
|
||||
make.width.mas_equalTo(220);
|
||||
make.centerX.mas_equalTo(self.view).mas_offset(15 - 6);
|
||||
@@ -190,7 +197,7 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
|
||||
}];
|
||||
|
||||
[self.otherLoginTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.stackView.mas_top).offset(-32);
|
||||
make.bottom.equalTo(self.appleButtonView.mas_top).offset(-32);
|
||||
make.centerX.equalTo(self.view);
|
||||
}];
|
||||
[self.leftLineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -208,16 +215,31 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
|
||||
|
||||
}
|
||||
|
||||
- (void)setEvents {
|
||||
// 手机登陆按钮点击
|
||||
UITapGestureRecognizer *phoneTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickRecognizer:)];
|
||||
[self.phoneButtonView addGestureRecognizer:phoneTap];
|
||||
UITapGestureRecognizer * appleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickRecognizer:)];
|
||||
[self.appleButton addGestureRecognizer:appleTap];
|
||||
- (void)setViewHidden {
|
||||
|
||||
if (@available(iOS 13.0, *)) {
|
||||
self.leftLineView.hidden = NO;
|
||||
self.rightLineView.hidden = NO;
|
||||
self.otherLoginTitleLabel.hidden = NO;
|
||||
self.appleButtonView.hidden = NO;
|
||||
} else {
|
||||
self.leftLineView.hidden = YES;
|
||||
self.rightLineView.hidden = YES;
|
||||
self.otherLoginTitleLabel.hidden = YES;
|
||||
self.appleButtonView.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
//- (void)setEvents {
|
||||
// 手机登陆按钮点击
|
||||
// UITapGestureRecognizer *phoneTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickRecognizer:)];
|
||||
// [self.appleButtonView addGestureRecognizer:phoneTap];
|
||||
// UITapGestureRecognizer * appleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickRecognizer:)];
|
||||
// [self.appleButton addGestureRecognizer:appleTap];
|
||||
//}
|
||||
|
||||
- (void)setConfigPrivacyAlertView {
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
// NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
// NSString *isShow = [defaults objectForKey:kYinyouPrivateKey];
|
||||
// 隐私协议弹出
|
||||
// if (!isShow && isShow.length <= 0) {
|
||||
@@ -231,150 +253,23 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)phoneQuickLogin {
|
||||
// [self showLoading];
|
||||
// 在使用一键登录之前,请先调用shouldQuickLogin方法,判断当前上网卡的网络环境和运营商是否可以一键登录
|
||||
// @weakify(self)
|
||||
// NTESQuickLoginManager *qlManager = [NTESQuickLoginManager sharedInstance];
|
||||
// BOOL shouldQL = [qlManager shouldQuickLogin];
|
||||
// if (!shouldQL) {
|
||||
// [self phoneQuickLoginFail];
|
||||
// return;
|
||||
// }
|
||||
// [qlManager registerWithBusinessID:KeyWithType(KeyType_NTESQuickLoginBusinessId) configURL:nil extData:nil];
|
||||
// [qlManager getPhoneNumberCompletion:^(NSDictionary * _Nonnull resultDic) {
|
||||
// @strongify(self)
|
||||
// NSNumber *boolNum = [resultDic objectForKey:@"success"];
|
||||
// NSString * token = [resultDic objectForKey:@"token"];
|
||||
// BOOL getPhoneNumberSuccess = [boolNum boolValue];
|
||||
// if (!getPhoneNumberSuccess || token.length <= 0) {
|
||||
// dispatch_main_sync_safe(^{
|
||||
// [self phoneQuickLoginFail];
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// [self configQuickLogin];
|
||||
// [qlManager CUCMCTAuthorizeLoginCompletion:^(NSDictionary * _Nonnull resultDic) {
|
||||
// @strongify(self)
|
||||
// NSNumber *boolNum = [resultDic objectForKey:@"success"];
|
||||
// BOOL authSuccess = [boolNum boolValue];
|
||||
// if (!authSuccess) {
|
||||
// dispatch_main_sync_safe(^{
|
||||
// NSString *resultCode = [resultDic objectForKey:@"resultCode"];
|
||||
// //取消一键登录
|
||||
// if ([resultCode isEqualToString:@"200020"] ||
|
||||
// [resultCode isEqualToString:@"10104"]) {
|
||||
// [self hideHUD];
|
||||
// } else {
|
||||
// [self phoneQuickLoginFail];
|
||||
// }
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
// dispatch_main_sync_safe(^{
|
||||
// @strongify(self)
|
||||
// [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventOneClickLoginSuccess];
|
||||
// // // 取号成功,获取acessToken
|
||||
// [self hideHUD];
|
||||
// [self dismissViewControllerAnimated:YES completion:nil];
|
||||
// [self.presenter phoneQuickLogin:resultDic[@"accessToken"] token:token];
|
||||
// });
|
||||
// }];
|
||||
// }];
|
||||
}
|
||||
|
||||
- (void)phoneQuickLoginFail {
|
||||
[self showErrorToast:@"一键登录失败,请检查手机网络状态。"];
|
||||
// LoginPhoneViewController *inputPhoneVC = [[LoginPhoneViewController alloc] init];
|
||||
// [self.navigationController pushViewController:inputPhoneVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)configQuickLogin {
|
||||
// 获取当前上网卡的运营商,0:未知 1:电信 2.移动 3.联通
|
||||
// NSInteger currentCarrier = [[NTESQuickLoginManager sharedInstance] getCarrier];
|
||||
// NTESQuickLoginModel *CMModel = [[NTESQuickLoginModel alloc] init];
|
||||
// CMModel.currentVC = self;
|
||||
// CMModel.presentDirectionType = NTESPresentDirectionPresent;
|
||||
// if (currentCarrier == XYLoginTypeUnicom) { // 联通
|
||||
// CMModel.logoImg = [UIImage imageNamed:@"login_unicom_mobile"];
|
||||
// }else if (currentCarrier == XYLoginTypeChinaMobile) { //移动
|
||||
// CMModel.logoImg = [UIImage imageNamed:@"login_china_mobile"];
|
||||
// }else { //电信
|
||||
// CMModel.logoImg = [UIImage imageNamed:@"login_ct_mobile"];
|
||||
// }
|
||||
// CMModel.backgroundColor = [ThemeColor appBackgroundColor];
|
||||
//
|
||||
// CMModel.logoWidth = 95;
|
||||
// CMModel.logoHeight = 95;
|
||||
// CMModel.logoOffsetTopY = 30;
|
||||
// CMModel.navText = @"一键登录";
|
||||
// CMModel.navTextColor = [ThemeColor mainTextColor];
|
||||
// CMModel.navTextFont = [UIFont boldSystemFontOfSize:18];
|
||||
//
|
||||
// CMModel.navReturnImg = [UIImage imageNamed:@"common_nav_back"];
|
||||
// CMModel.navBgColor = [ThemeColor appBackgroundColor];
|
||||
//
|
||||
// CMModel.logBtnHeight = 45;
|
||||
// CMModel.logBtnRadius = 45.f / 2;
|
||||
// CMModel.logBtnOffsetTopY= 260;
|
||||
// CMModel.logBtnOriginLeft = 52;
|
||||
// CMModel.logBtnOriginRight = 52;
|
||||
// CMModel.logBtnUsableBGColor = [ThemeColor appMainColor];
|
||||
// CMModel.logBtnText = @"本机号码一键登录";
|
||||
// CMModel.logBtnTextColor = [ThemeColor mainTextColor];
|
||||
// CMModel.logBtnTextFont = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
|
||||
//
|
||||
// CMModel.numberOffsetTopY = 170;
|
||||
// CMModel.numberColor = [ThemeColor mainTextColor];
|
||||
// CMModel.numberFont = [UIFont boldSystemFontOfSize:20];
|
||||
// CMModel.brandColor = [ThemeColor mainTextColor];
|
||||
//
|
||||
// CMModel.uncheckedImg = [UIImage imageNamed:@"common_checkbox_uncheck"];
|
||||
// CMModel.checkedImg = [UIImage imageNamed:@"common_checkbox_checked"];
|
||||
// CMModel.checkboxWH = 20;
|
||||
// NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
// NSString * hadAgree = [defaults stringForKey:kPhoneQuickPrivacyKey];
|
||||
// if (hadAgree.length > 0) {
|
||||
// CMModel.privacyState = YES;
|
||||
// }
|
||||
//
|
||||
// CMModel.privacyColor = [ThemeColor secondTextColor];
|
||||
// CMModel.appPrivacyText = [NSString stringWithFormat:@"同意《默认》,并授权%@获取本机号码。",AppName];
|
||||
// CMModel.privacyFont = [UIFont systemFontOfSize:12];
|
||||
// CMModel.protocolColor = [ThemeColor mainTextColor];
|
||||
// CMModel.appPrivacyOriginBottomMargin = 30;
|
||||
//
|
||||
// CMModel.backActionBlock = ^{ //点击了返回按钮
|
||||
// [self hideHUD];
|
||||
// };
|
||||
//
|
||||
// CMModel.checkActionBlock = ^(BOOL isChecked) {
|
||||
// NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
// if (isChecked) {
|
||||
// [defaults setObject:@"phonequickhadAgree" forKey:kPhoneQuickPrivacyKey];
|
||||
// [defaults synchronize];
|
||||
// } else {
|
||||
// NSString * hadAgree = [defaults stringForKey:kPhoneQuickPrivacyKey];
|
||||
// if (hadAgree.length > 0) {
|
||||
// [defaults removeObjectForKey:kPhoneQuickPrivacyKey];
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// dispatch_main_sync_safe(^{
|
||||
// [[NTESQuickLoginManager sharedInstance] setupModel:CMModel];
|
||||
// });
|
||||
}
|
||||
#pragma mark - LoginProtocol
|
||||
- (void)loginSuccess {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
[self showSuccessToast:@"登录成功"];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Event Response
|
||||
/// 手机号码一键登录
|
||||
- (void)loginButtonAction:(UIButton *)sender {
|
||||
if (!self.agreeButton.isSelected) {
|
||||
[YMHUDTool showErrorWithMessage:@"请勾选协议"];
|
||||
return;
|
||||
}
|
||||
|
||||
MewLoginNumberViewController *controller = [[MewLoginNumberViewController alloc] init];
|
||||
[self.navigationController pushViewController:controller animated:NO];
|
||||
}
|
||||
/// 同意隐私政策
|
||||
- (void)agreeButtonAction:(UIButton *)sender {
|
||||
@@ -394,36 +289,153 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
|
||||
}
|
||||
}
|
||||
}
|
||||
/// 一键登录
|
||||
- (void)loginQuickButtonAction:(UIButton *)sender {
|
||||
if (self.agreeButton.isSelected) {
|
||||
[self phoneQuickLogin];
|
||||
} else {
|
||||
[UIView animateWithDuration:0.5 animations:^{
|
||||
self.authBubbleView.alpha = 1.0;
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
/// 手机 || 密码登录 || Apple
|
||||
- (void)didClickRecognizer:(UITapGestureRecognizer *)tap {
|
||||
UIView * view = tap.view;
|
||||
/// 苹果登录
|
||||
- (void)loginWithApple {
|
||||
if (!self.agreeButton.isSelected) {
|
||||
[YMHUDTool showErrorWithMessage:@"请勾选协议"];
|
||||
return;
|
||||
}
|
||||
|
||||
MewLoginNumberViewController *controller = [[MewLoginNumberViewController alloc] init];
|
||||
[self.navigationController pushViewController:controller animated:NO];
|
||||
|
||||
if (@available(iOS 13.0, *)) {
|
||||
// 基于用户的Apple ID授权用户,生成用户授权请求的一种机制
|
||||
ASAuthorizationAppleIDProvider * appleIDProvider = [[ASAuthorizationAppleIDProvider alloc] init];
|
||||
// 创建新的AppleID 授权请求
|
||||
ASAuthorizationAppleIDRequest * authAppleIDRequest = [appleIDProvider createRequest];
|
||||
// 在用户授权期间请求的联系信息
|
||||
// authAppleIDRequest.requestedScopes = @[ASAuthorizationScopeFullName, ASAuthorizationScopeEmail];
|
||||
//如果 KeyChain 里面也有登录信息的话,可以直接使用里面保存的用户名和密码进行登录。
|
||||
// ASAuthorizationPasswordRequest * passwordRequest = [[[ASAuthorizationPasswordProvider alloc] init] createRequest];
|
||||
|
||||
NSMutableArray <ASAuthorizationRequest *> * array = [NSMutableArray arrayWithCapacity:2];
|
||||
if (authAppleIDRequest) {
|
||||
[array addObject:authAppleIDRequest];
|
||||
}
|
||||
// if (passwordRequest) {
|
||||
// [array addObject:passwordRequest];
|
||||
// }
|
||||
NSArray <ASAuthorizationRequest *> * requests = [array copy];
|
||||
// 由ASAuthorizationAppleIDProvider创建的授权请求 管理授权请求的控制器
|
||||
ASAuthorizationController * authorizationController = [[ASAuthorizationController alloc] initWithAuthorizationRequests:requests];
|
||||
// 设置授权控制器通知授权请求的成功与失败的代理
|
||||
authorizationController.delegate = self;
|
||||
// 设置提供 展示上下文的代理,在这个上下文中 系统可以展示授权界面给用户
|
||||
authorizationController.presentationContextProvider = self;
|
||||
// 在控制器初始化期间启动授权流
|
||||
[authorizationController performRequests];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// 手机 || 密码登录 || Apple
|
||||
//- (void)didClickRecognizer:(UITapGestureRecognizer *)tap {
|
||||
// if (!self.agreeButton.isSelected) {
|
||||
// [YMHUDTool showErrorWithMessage:@"请勾选协议"];
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// MewLoginNumberViewController *controller = [[MewLoginNumberViewController alloc] init];
|
||||
// [self.navigationController pushViewController:controller animated:NO];
|
||||
//}
|
||||
|
||||
#pragma mark - ASAuthorizationControllerDelegate
|
||||
// 授权成功
|
||||
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(ASAuthorization *)authorization API_AVAILABLE(ios(13.0)) {
|
||||
|
||||
if ([authorization.credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]) {
|
||||
ThirdUserInfo *userInfo = [[ThirdUserInfo alloc] init];
|
||||
|
||||
ASAuthorizationAppleIDCredential * credential = (ASAuthorizationAppleIDCredential *)authorization.credential;
|
||||
|
||||
// 苹果用户唯一标识符,该值在同一个开发者账号下的所有 App 下是一样的,开发者可以用该唯一标识符与自己后台系统的账号体系绑定起来。
|
||||
NSString * userID = credential.user;
|
||||
//把用户的唯一标识 传给后台 判断该用户是否绑定手机号,如果绑定了直接登录,如果没绑定跳绑定手机号页面
|
||||
// // 苹果用户信息 如果授权过,可能无法再次获取该信息
|
||||
NSPersonNameComponents * fullName = credential.fullName;
|
||||
NSString * email = credential.email;
|
||||
//
|
||||
// // 服务器验证需要使用的参数
|
||||
NSString * authorizationCode = [[NSString alloc] initWithData:credential.authorizationCode encoding:NSUTF8StringEncoding];
|
||||
NSString * identityToken = [[NSString alloc] initWithData:credential.identityToken encoding:NSUTF8StringEncoding];
|
||||
//
|
||||
NSString *tokenStr = [@"ios" stringByAppendingString:userID];
|
||||
// // 用于判断当前登录的苹果账号是否是一个真实用户,取值有:unsupported、unknown、likelyReal
|
||||
ASUserDetectionStatus realUserStatus = credential.realUserStatus;
|
||||
|
||||
if (fullName.familyName.length > 0 && fullName.givenName.length > 0) {
|
||||
userInfo.userName = [NSString stringWithFormat:@"%@%@",fullName.familyName, fullName.givenName];
|
||||
}
|
||||
|
||||
[AccountInfoStorage instance].thirdUserInfo = userInfo;
|
||||
[YMHUDTool showLoadingWithMessage:@"正在登录中"];
|
||||
[self.presenter thirdLoginWithApple:identityToken unionId:userID];
|
||||
// [Api loginWithThirdPart:^(BaseModel * _Nonnull data, NSInteger code, NSString * _Nonnull msg) {
|
||||
//
|
||||
//
|
||||
// } openid:identityToken unionid:userID access_token:identityToken type:@"5"];
|
||||
|
||||
// NSLog(@"userID: %@", userID);
|
||||
// NSLog(@"fullName: %@", fullName);
|
||||
// NSLog(@"email: %@", email);
|
||||
// NSLog(@"authorizationCode: %@", authorizationCode);
|
||||
// NSLog(@"identityToken: %@", identityToken);
|
||||
// NSLog(@"realUserStatus: %@", @(realUserStatus));
|
||||
}else if ([authorization.credential isKindOfClass:[ASPasswordCredential class]]) {
|
||||
// 这个获取的是iCloud记录的账号密码,需要输入框支持iOS 12 记录账号密码的新特性,如果不支持,可以忽略
|
||||
// 用户登录使用现有的密码凭证
|
||||
ASPasswordCredential * passwordCredential = (ASPasswordCredential *)authorization.credential;
|
||||
// 密码凭证对象的用户标识 用户的唯一标识
|
||||
NSString * user = passwordCredential.user;
|
||||
|
||||
//把用户的唯一标识 传给后台 判断该用户是否绑定手机号,如果绑定了直接登录,如果没绑定跳绑定手机号页面
|
||||
|
||||
// // 密码凭证对象的密码
|
||||
// NSString * password = passwordCredential.password;
|
||||
// NSLog(@"userID: %@", user);
|
||||
// NSLog(@"password: %@", password);
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
// 授权失败
|
||||
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithError:(NSError *)error API_AVAILABLE(ios(13.0)) {
|
||||
NSString *errorMsg = nil;
|
||||
switch (error.code) {
|
||||
case ASAuthorizationErrorCanceled:
|
||||
errorMsg = @"用户取消了授权请求";
|
||||
break;
|
||||
case ASAuthorizationErrorFailed:
|
||||
errorMsg = @"授权请求失败";
|
||||
break;
|
||||
case ASAuthorizationErrorInvalidResponse:
|
||||
errorMsg = @"授权请求响应无效";
|
||||
break;
|
||||
case ASAuthorizationErrorNotHandled:
|
||||
errorMsg = @"未能处理授权请求";
|
||||
break;
|
||||
case ASAuthorizationErrorUnknown:
|
||||
errorMsg = @"授权请求失败未知原因";
|
||||
break;
|
||||
}
|
||||
NSLog(@"%@", errorMsg);
|
||||
}
|
||||
|
||||
#pragma mark- ASAuthorizationControllerPresentationContextProviding
|
||||
- (ASPresentationAnchor)presentationAnchorForAuthorizationController:(ASAuthorizationController *)controller API_AVAILABLE(ios(13.0)){
|
||||
return self.view.window;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIButton *)loginButton{ //手机号码一键登录
|
||||
if (!_loginButton) {
|
||||
_loginButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_loginButton.layer.masksToBounds = YES;
|
||||
_loginButton.layer.cornerRadius = 45/2.f;
|
||||
[_loginButton setTitle:@"手机号码一键登录" forState:UIControlStateNormal];
|
||||
[_loginButton setTitle:@"账号登录" forState:UIControlStateNormal];
|
||||
[_loginButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
||||
_loginButton.titleLabel.font = kFontMedium(16);
|
||||
_loginButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
|
||||
@@ -524,45 +536,45 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
|
||||
return _contentView;
|
||||
}
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
_stackView.distribution = UIStackViewDistributionEqualSpacing;
|
||||
_stackView.spacing = 32;
|
||||
_stackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_stackView.alignment = UIStackViewAlignmentFill;
|
||||
//- (UIStackView *)stackView {
|
||||
// if (!_stackView) {
|
||||
// _stackView = [[UIStackView alloc] init];
|
||||
// _stackView.distribution = UIStackViewDistributionEqualSpacing;
|
||||
// _stackView.spacing = 32;
|
||||
// _stackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
// _stackView.alignment = UIStackViewAlignmentFill;
|
||||
// }
|
||||
// return _stackView;
|
||||
//}
|
||||
|
||||
- (YMIButton *)appleButtonView { //手机号登录
|
||||
if (!_appleButtonView) {
|
||||
_appleButtonView = [[YMIButton alloc] initWithImagePosition:XPButtonImagePositionTop];
|
||||
[_appleButtonView setImage: [UIImage imageNamed:@"mew_login_apple"] forState:UIControlStateNormal];
|
||||
[_appleButtonView setTitle:@"苹果登录" forState:UIControlStateNormal];
|
||||
[_appleButtonView setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
||||
_appleButtonView.titleLabel.font = kFontRegular(12);
|
||||
_appleButtonView.imageTitleSpace = 5.0;
|
||||
[_appleButtonView addTarget:self action:@selector(loginWithApple) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _stackView;
|
||||
return _appleButtonView;
|
||||
}
|
||||
|
||||
- (YMIButton *)phoneButtonView { //手机号登录
|
||||
if (!_phoneButtonView) {
|
||||
_phoneButtonView = [[YMIButton alloc] initWithImagePosition:XPButtonImagePositionTop];
|
||||
[_phoneButtonView setImage: [UIImage imageNamed:@"mew_login_account"] forState:UIControlStateNormal];
|
||||
[_phoneButtonView setTitle:@"账号登录" forState:UIControlStateNormal];
|
||||
[_phoneButtonView setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
||||
_phoneButtonView.titleLabel.font = kFontRegular(12);
|
||||
_phoneButtonView.imageTitleSpace = 5.0;
|
||||
// [_phoneButtonView addTarget:self action:@selector(loginWithNumberButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _phoneButtonView;
|
||||
}
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
|
||||
- (ASAuthorizationAppleIDButton *)appleButton API_AVAILABLE(ios(13.0)){ //苹果登录
|
||||
if (!_appleButton) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
_appleButton = [[ASAuthorizationAppleIDButton alloc] initWithAuthorizationButtonType:ASAuthorizationAppleIDButtonTypeSignIn authorizationButtonStyle:ASAuthorizationAppleIDButtonStyleWhite];
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
_appleButton.cornerRadius = 25;
|
||||
_appleButton.tag = 1000 + ThirdLoginType_Apple;
|
||||
// _appleButton.hidden = NO;
|
||||
}
|
||||
return _appleButton;
|
||||
}
|
||||
#endif
|
||||
//#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
|
||||
//- (ASAuthorizationAppleIDButton *)appleButton API_AVAILABLE(ios(13.0)){ //苹果登录
|
||||
// if (!_appleButton) {
|
||||
// if (@available(iOS 13.0, *)) {
|
||||
// _appleButton = [[ASAuthorizationAppleIDButton alloc] initWithAuthorizationButtonType:ASAuthorizationAppleIDButtonTypeSignIn authorizationButtonStyle:ASAuthorizationAppleIDButtonStyleWhite];
|
||||
// } else {
|
||||
// // Fallback on earlier versions
|
||||
// }
|
||||
// _appleButton.cornerRadius = 25;
|
||||
// _appleButton.tag = 1000 + ThirdLoginType_Apple;
|
||||
//// _appleButton.hidden = NO;
|
||||
// }
|
||||
// return _appleButton;
|
||||
//}
|
||||
//#endif
|
||||
|
||||
- (UIImageView *)bgImageView {
|
||||
if (!_bgImageView) {
|
||||
|
@@ -12,6 +12,9 @@
|
||||
/// Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "YMHUDTool.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "YMConstant.h"
|
||||
#import "YMMacro.h"
|
||||
///View
|
||||
#import "LoginInputView.h"
|
||||
///present
|
||||
@@ -57,11 +60,24 @@
|
||||
|
||||
}
|
||||
|
||||
- (void)phoneAndPasswordLoginFail:(NSString *)error {
|
||||
[YMHUDTool showErrorWithMessage:error];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Action Event
|
||||
/// 登录
|
||||
- (void)nextButtonAction {
|
||||
if (self.phoneView.textField.text.length == 0 || [self.phoneView.textField.text isEqualToString:@""]) {
|
||||
[YMHUDTool showErrorWithMessage:@"请输入账号"];
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.codeView.textField.text.length == 0 || [self.codeView.textField.text isEqualToString:@""]) {
|
||||
[YMHUDTool showErrorWithMessage:@"请输入密码"];
|
||||
return;
|
||||
}
|
||||
|
||||
[self.present loginWithPhone:self.phoneView.textField.text password:self.codeView.textField.text];
|
||||
|
||||
}
|
||||
@@ -106,8 +122,9 @@
|
||||
}];
|
||||
|
||||
[self.forgetPasswordButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.codeView.mas_bottom).offset(8);
|
||||
// make.centerY.mas_equalTo(self.codeView.mas_bottom).offset(8);
|
||||
make.right.mas_equalTo(self.codeView);
|
||||
make.top.equalTo(self.codeView.mas_bottom).offset(10);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -124,16 +141,11 @@
|
||||
_nextButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_nextButton.layer.masksToBounds = YES;
|
||||
_nextButton.layer.cornerRadius = 45/2.f;
|
||||
[_nextButton setTitle:@"下一步" forState:UIControlStateNormal];
|
||||
[_nextButton setImage:[UIImage imageNamed:@"mew_login_next"] forState:UIControlStateNormal];
|
||||
_nextButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
|
||||
_nextButton.enabled = NO;
|
||||
[_nextButton setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
|
||||
// UIImage *disableImage = [UIImage gradientColorImageFromColors:@[[ThemeColor disableButtonColor],[ThemeColor disableButtonColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
// [_nextButton setBackgroundImage:disableImage forState:UIControlStateDisabled];
|
||||
// [_nextButton setTitleColor:[ThemeColor disableButtonTextColor] forState:UIControlStateDisabled];
|
||||
// UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor],[ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
// [_nextButton setBackgroundImage:image forState:UIControlStateNormal];
|
||||
// [_nextButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FF60FD"], [ThemeColor colorWithHexString:@"#8974FF"],[ThemeColor colorWithHexString:@"#69EBFF"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(KScreenWidth - 2*36, 52)];
|
||||
_nextButton.backgroundColor = [UIColor colorWithPatternImage:image];
|
||||
[_nextButton addTarget:self action:@selector(nextButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _nextButton;
|
||||
@@ -145,8 +157,8 @@
|
||||
if (!_forgetPasswordButton) {
|
||||
_forgetPasswordButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_forgetPasswordButton setTitle:@"忘记密码?" forState:UIControlStateNormal];
|
||||
[_forgetPasswordButton setTitleColor:[ThemeColor secondTextColor] forState:UIControlStateNormal];
|
||||
_forgetPasswordButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:11];
|
||||
[_forgetPasswordButton setTitleColor:UIColorRGBAlpha(0xFFFFFF, 0.8) forState:UIControlStateNormal];
|
||||
_forgetPasswordButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:14];
|
||||
// _forgetPasswordButton.hidden = NO;
|
||||
[_forgetPasswordButton addTarget:self action:@selector(forgetPasswordButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
@@ -156,7 +168,7 @@
|
||||
- (LoginInputView *)phoneView {
|
||||
if (!_phoneView) {
|
||||
_phoneView = [[LoginInputView alloc] init];
|
||||
_phoneView.backgroundColor = [ThemeColor colorWithHexString:@"#F8F8FB"];
|
||||
_phoneView.backgroundColor = UIColor.whiteColor;
|
||||
_phoneView.layer.masksToBounds = YES;
|
||||
_phoneView.layer.cornerRadius = 45/2;
|
||||
_phoneView.titleLabel.hidden = YES;
|
||||
@@ -176,7 +188,7 @@
|
||||
- (LoginInputView *)codeView {
|
||||
if (!_codeView) {
|
||||
_codeView = [[LoginInputView alloc] init];
|
||||
_codeView.backgroundColor = [ThemeColor colorWithHexString:@"#F8F8FB"];
|
||||
_codeView.backgroundColor = UIColor.whiteColor;
|
||||
_codeView.layer.masksToBounds = YES;
|
||||
_codeView.layer.cornerRadius = 51.0/2;
|
||||
_codeView.placeHolder = @"请输入密码";
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#import "ThemeColor.h"
|
||||
#import "YMMacro.h"
|
||||
#import "YMHUDTool.h"
|
||||
#import "UIImage+Utils.h"
|
||||
/// View
|
||||
#import "LoginInputView.h"
|
||||
|
||||
@@ -30,7 +31,7 @@
|
||||
///验证码View
|
||||
@property (nonatomic,strong) UIView *codeView;
|
||||
///重新获取验证码 和 倒计时
|
||||
@property (nonatomic,strong) UIStackView *codeStackView;
|
||||
//@property (nonatomic,strong) UIStackView *codeStackView;
|
||||
///显示倒计时
|
||||
@property (nonatomic,strong) UILabel *cutdownLabel;
|
||||
///重新获得验证码
|
||||
@@ -169,18 +170,20 @@
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.phoneInputView];
|
||||
[self addSubview:self.codeView];
|
||||
[self.codeView addSubview:self.codeStackView];
|
||||
[self.codeStackView addArrangedSubview:self.codeTextField];
|
||||
[self.codeStackView addArrangedSubview:self.cutdownLabel];
|
||||
[self.codeStackView addArrangedSubview:self.retryCodeButton];
|
||||
// [self.codeView addSubview:self.codeStackView];
|
||||
[self.codeView addSubview:self.codeTextField];
|
||||
[self.codeView addSubview:self.cutdownLabel];
|
||||
[self.codeView addSubview:self.retryCodeButton];
|
||||
[self addSubview:self.confirmButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
CGFloat kscale = 363.0 / 375.0;
|
||||
[self.phoneInputView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.left.right.equalTo(self);
|
||||
make.height.mas_equalTo(51);
|
||||
make.top.equalTo(self);
|
||||
make.left.mas_equalTo(36);
|
||||
make.right.mas_equalTo(-36);
|
||||
make.height.mas_equalTo(52);
|
||||
}];
|
||||
|
||||
[self.codeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -188,14 +191,26 @@
|
||||
make.left.right.height.equalTo(self.phoneInputView);
|
||||
}];
|
||||
|
||||
[self.codeStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.codeView).inset(15);
|
||||
make.top.bottom.mas_equalTo(self.codeView);
|
||||
[self.retryCodeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.codeView).offset(-15);
|
||||
make.centerY.equalTo(self.codeView);
|
||||
}];
|
||||
[self.cutdownLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.retryCodeButton);
|
||||
}];
|
||||
[self.codeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.codeView).offset(15);
|
||||
make.centerY.equalTo(self.codeView);
|
||||
}];
|
||||
|
||||
// [self.codeStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.right.mas_equalTo(self.codeView).inset(15);
|
||||
// make.top.bottom.mas_equalTo(self.codeView);
|
||||
// }];
|
||||
|
||||
[self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.codeView.mas_bottom).offset(15);
|
||||
make.left.right.height.mas_equalTo(self.codeStackView);
|
||||
make.left.right.height.mas_equalTo(self.codeView);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -244,8 +259,7 @@
|
||||
- (UIView *)codeView {
|
||||
if (!_codeView) {
|
||||
_codeView = [[UIView alloc] init];
|
||||
// _codeView.backgroundColor = UIColor.redColor;
|
||||
//[ThemeColor colorWithHexString:@"#F8F8FB"];
|
||||
_codeView.backgroundColor = UIColor.whiteColor;
|
||||
_codeView.layer.masksToBounds = YES;
|
||||
_codeView.layer.cornerRadius = 51.0/2;
|
||||
|
||||
@@ -283,7 +297,7 @@
|
||||
if (!_retryCodeButton) {
|
||||
_retryCodeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_retryCodeButton setTitle:@"获取验证码" forState:UIControlStateNormal];
|
||||
[_retryCodeButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||||
[_retryCodeButton setTitleColor:[ThemeColor colorWithHexString:@"#9552FF"] forState:UIControlStateNormal];
|
||||
_retryCodeButton.titleLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium];
|
||||
[_retryCodeButton addTarget:self action:@selector(getSmsCodeButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
_retryCodeButton.hidden = NO;
|
||||
@@ -291,31 +305,18 @@
|
||||
return _retryCodeButton;
|
||||
}
|
||||
|
||||
- (UIStackView *)codeStackView {
|
||||
if (!_codeStackView) {
|
||||
_codeStackView = [[UIStackView alloc] init];
|
||||
_codeStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_codeStackView.distribution = UIStackViewDistributionFill;
|
||||
_codeStackView.alignment = UIStackViewAlignmentCenter;
|
||||
_codeStackView.spacing = 0;
|
||||
}
|
||||
return _codeStackView;
|
||||
}
|
||||
|
||||
|
||||
- (UIButton *)confirmButton{
|
||||
if (!_confirmButton) {
|
||||
_confirmButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_confirmButton.layer.masksToBounds = YES;
|
||||
_confirmButton.layer.cornerRadius = 51/2.f;
|
||||
[_confirmButton setTitle:@"验证" forState:UIControlStateNormal];
|
||||
_confirmButton.layer.cornerRadius = 52/2.f;
|
||||
[_confirmButton setImage:[UIImage imageNamed:@"mew_login_next"] forState:UIControlStateNormal];
|
||||
_confirmButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
|
||||
// [_confirmButton setTitleColor:[ThemeColor disableButtonTextColor] forState:UIControlStateDisabled];
|
||||
// [_confirmButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
|
||||
_confirmButton.enabled = NO;
|
||||
// UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
// [_confirmButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor disableButtonColor], [ThemeColor disableButtonColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateDisabled];
|
||||
// [_confirmButton setBackgroundImage:image forState:UIControlStateNormal];
|
||||
[_confirmButton setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FF60FD"], [ThemeColor colorWithHexString:@"#8974FF"],[ThemeColor colorWithHexString:@"#69EBFF"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(KScreenWidth - 2*36, 52)];
|
||||
_confirmButton.backgroundColor = [UIColor colorWithPatternImage:image];
|
||||
[_confirmButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
||||
[_confirmButton addTarget:self action:@selector(confirmButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _confirmButton;
|
||||
|
@@ -10,11 +10,18 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol MewRechargeSubViewDelegate <NSObject>
|
||||
|
||||
- (void)didSelectMewRechargeChargeProdId:(NSString *)chargeProdId;
|
||||
|
||||
@end
|
||||
|
||||
@interface MewRechargeSubView : UIView
|
||||
// 充值模型
|
||||
@property (nonatomic, copy) NSArray<RechargeListModel *> *rechargeModels;
|
||||
// 钱包
|
||||
@property (nonatomic, strong) WalletInfoModel *walletModel;
|
||||
@property (nonatomic, weak) id<MewRechargeSubViewDelegate> delegate;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#import "ThemeColor.h"
|
||||
#import "YMMacro.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "YMHUDTool.h"
|
||||
|
||||
@interface MewRechargeSubView()
|
||||
//余额
|
||||
@@ -32,6 +33,7 @@
|
||||
@property (nonatomic,strong) YYLabel *rechargePrivacyLabel;
|
||||
//@property (nonatomic, strong) UIStackView *rechargeStackView;
|
||||
@property (nonatomic, strong) UIButton *rechargeButton;
|
||||
@property (nonatomic, strong) RechargeListModel *selectModel;
|
||||
|
||||
@end
|
||||
|
||||
@@ -50,6 +52,30 @@
|
||||
#pragma mark - Action Event
|
||||
- (void)rechargeButtonAction {
|
||||
//立即充值
|
||||
if (self.selectModel == nil) {
|
||||
[YMHUDTool showErrorWithMessage:@"请选择充值的钻石"];
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.delegate) {
|
||||
[self.delegate didSelectMewRechargeChargeProdId:self.selectModel.chargeProdId];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didRechargeButtonAction:(UITapGestureRecognizer *)tap {
|
||||
for (UIView *rechargeView in self.rechargeBgViewArrays) {
|
||||
rechargeView.layer.borderColor = UIColor.clearColor.CGColor;
|
||||
rechargeView.layer.borderWidth = 0.0;
|
||||
}
|
||||
|
||||
UIView *currentRechargeView = tap.view;
|
||||
currentRechargeView.layer.borderColor = [ThemeColor colorWithHexString:@"#9552FF"].CGColor;
|
||||
currentRechargeView.layer.borderWidth = 1.0;
|
||||
|
||||
NSInteger selectIndex = tap.view.tag;
|
||||
self.selectModel = self.rechargeModels[selectIndex];
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Set
|
||||
@@ -67,8 +93,8 @@
|
||||
- (void)initView {
|
||||
[self addSubview:self.balanceBgImageView];
|
||||
[self addSubview:self.balanceStackView];
|
||||
[self.balanceStackView addSubview:self.balanceImageView];
|
||||
[self.balanceStackView addSubview:self.balanceTitleLabel];
|
||||
[self.balanceStackView addArrangedSubview:self.balanceImageView];
|
||||
[self.balanceStackView addArrangedSubview:self.balanceTitleLabel];
|
||||
[self addSubview:self.balanceMoneyLabel];
|
||||
[self addSubview:self.rechargeView];
|
||||
[self addSubview:self.rechargePrivacyLabel];
|
||||
@@ -90,29 +116,39 @@
|
||||
rechargeBgView.backgroundColor = UIColorRGBAlpha(0x525566, 0.8);
|
||||
rechargeBgView.layer.cornerRadius = 8.0;
|
||||
rechargeBgView.layer.masksToBounds = YES;
|
||||
rechargeBgView.tag = i;
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didRechargeButtonAction:)];
|
||||
[rechargeBgView addGestureRecognizer:tap];
|
||||
[self.rechargeBgViewArrays addObject:rechargeBgView];
|
||||
[self.rechargeView addSubview:rechargeBgView];
|
||||
|
||||
UIStackView *rechargeStackView = [[UIStackView alloc] initWithFrame:CGRectMake(0, 0, viewWidth, 25)];
|
||||
rechargeStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
rechargeStackView.distribution = UIStackViewDistributionFill;
|
||||
rechargeStackView.alignment = UIStackViewAlignmentFill;
|
||||
rechargeStackView.spacing = 2;
|
||||
UIView *rechargeStackView = [[UIView alloc] initWithFrame:CGRectMake(5, 14, viewWidth, 25)];
|
||||
[rechargeBgView addSubview:rechargeStackView];
|
||||
|
||||
UIImageView *rechargeImageView = [[UIImageView alloc] init];
|
||||
// rechargeImageView.frame.size = CGSizeMake(20, 20);
|
||||
rechargeImageView.image = [UIImage imageNamed:@"mew_recharge_diamond_small"];
|
||||
[rechargeStackView addSubview:rechargeImageView];
|
||||
UILabel *rechargeDiamondLabel = [[UILabel alloc] init];
|
||||
rechargeDiamondLabel.text = [NSString stringWithFormat:@"%@钻石",model.giftGoldNum];
|
||||
rechargeDiamondLabel.text = [NSString stringWithFormat:@"%@",model.prodName];
|
||||
// [rechargeDiamondLabel sizeToFit];
|
||||
rechargeDiamondLabel.textColor = UIColor.whiteColor;
|
||||
rechargeDiamondLabel.font = kFontMedium(18);
|
||||
rechargeDiamondLabel.font = kFontMedium(16);
|
||||
[rechargeStackView addSubview:rechargeDiamondLabel];
|
||||
[rechargeDiamondLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.top.height.equalTo(rechargeStackView);
|
||||
}];
|
||||
[rechargeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(20);
|
||||
make.centerY.equalTo(rechargeDiamondLabel);
|
||||
make.right.equalTo(rechargeDiamondLabel.mas_left).offset(-5);
|
||||
}];
|
||||
|
||||
UILabel *rechargeMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(rechargeStackView.frame) + 10.0, viewWidth, 20)];
|
||||
UILabel *rechargeMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(rechargeStackView.frame) + 13.0, viewWidth, 20)];
|
||||
rechargeMoneyLabel.text = [NSString stringWithFormat:@"%@元",model.money];
|
||||
rechargeMoneyLabel.textColor = UIColorRGBAlpha(0xFFFFFF, 0.8);
|
||||
rechargeMoneyLabel.font = kFontRegular(14);
|
||||
rechargeMoneyLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[rechargeBgView addSubview:rechargeMoneyLabel];
|
||||
}
|
||||
|
||||
@@ -127,12 +163,13 @@
|
||||
[self.balanceBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(KScreenWidth - 2*19);
|
||||
make.height.mas_equalTo(124*kScreenScale);
|
||||
make.top.mas_equalTo(41);
|
||||
make.top.mas_equalTo(self);
|
||||
make.left.mas_equalTo(19);
|
||||
}];
|
||||
[self.balanceStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.balanceBgImageView).offset(27);
|
||||
make.left.right.equalTo(self.balanceImageView);
|
||||
// make.width.mas_equalTo(self);
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.height.mas_equalTo(25);
|
||||
}];
|
||||
[self.balanceMoneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
|
@@ -11,11 +11,18 @@
|
||||
/// Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import "YMMacro.h"
|
||||
#import "YMIAPHelper.h"
|
||||
/// P
|
||||
#import "MineRechargeProtocol.h"
|
||||
#import "MineRechargePresenter.h"
|
||||
|
||||
@interface MewRechargeViewController ()
|
||||
@interface MewRechargeViewController ()<MineRechargeProtocol, MewRechargeSubViewDelegate, YMIAPHelperDelegate>
|
||||
@property (nonatomic, strong) UIImageView *rechargeBgImageView;
|
||||
@property (nonatomic, strong) UIButton *backButton;
|
||||
@property (nonatomic, strong) MewRechargeSubView *rechageView;
|
||||
|
||||
///订单编号
|
||||
@property (nonatomic,copy) NSString *orderId;
|
||||
@end
|
||||
|
||||
@implementation MewRechargeViewController
|
||||
@@ -24,13 +31,57 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (MineRechargePresenter *)createPresenter {
|
||||
return [[MineRechargePresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[YMIAPHelper shareHelper].delegate = nil;
|
||||
}
|
||||
|
||||
#pragma mark - Life Cycle
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initView];
|
||||
|
||||
[self loadData];
|
||||
[YMIAPHelper shareHelper].delegate = self;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - Load Data
|
||||
- (void)loadData {
|
||||
[self.presenter requestRechargeListWithChannel:@"1"];
|
||||
[self.presenter getUserWalletInfo];
|
||||
}
|
||||
|
||||
#pragma mark - MineRechargeProtocol
|
||||
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo {
|
||||
self.rechageView.walletModel = balanceInfo;
|
||||
}
|
||||
|
||||
- (void)requestRechargeListSucccess:(NSArray *)list {
|
||||
self.rechageView.rechargeModels = list;
|
||||
}
|
||||
|
||||
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId {
|
||||
if (orderId.length > 0) {
|
||||
self.orderId = orderId;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - MewRechargeSubViewDelegate
|
||||
- (void)didSelectMewRechargeChargeProdId:(NSString *)chargeProdId {
|
||||
[self.presenter requestIAPRechargeOrderWithChargeProdId:chargeProdId];
|
||||
}
|
||||
|
||||
#pragma mark - YMIAPHelperDelegate
|
||||
|
||||
|
||||
|
||||
#pragma mark - Action Event
|
||||
- (void)backButtonAction {
|
||||
[self.navigationController popViewControllerAnimated:NO];
|
||||
@@ -81,6 +132,7 @@
|
||||
- (MewRechargeSubView *)rechageView {
|
||||
if (!_rechageView) {
|
||||
_rechageView = [[MewRechargeSubView alloc] init];
|
||||
_rechageView.delegate = self;
|
||||
}
|
||||
return _rechageView;
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
/// Third
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import <QYSDK_NIM/QYSDK.h>
|
||||
#import <AFNetworkReachabilityManager.h>
|
||||
///VC
|
||||
#import "TabbarViewController.h"
|
||||
#import "BaseNavigationController.h"
|
||||
@@ -33,12 +34,16 @@
|
||||
/// Model
|
||||
//#import "UserInfoModel.h"
|
||||
|
||||
NSString * const kNetworkReachabilityKey = @"kNetworkReachabilityKey";
|
||||
|
||||
@interface TabbarViewController () <
|
||||
BaseMvpProtocol, MainProtocol,
|
||||
NIMLoginManagerDelegate, NIMSystemNotificationManagerDelegate,
|
||||
NIMChatManagerDelegate,NIMBroadcastManagerDelegate>
|
||||
|
||||
@property (nonatomic, strong) MainPresenter *presenter;
|
||||
///是否是的第一次链接网络
|
||||
@property (nonatomic,assign) BOOL isFirstReachability;
|
||||
|
||||
@end
|
||||
|
||||
@@ -150,10 +155,10 @@
|
||||
[self pushBindPhoneController];
|
||||
}
|
||||
|
||||
if (userInfo.nick == nil || userInfo.avatar == nil) {
|
||||
[self completeUserInfo];
|
||||
return;
|
||||
}
|
||||
// if (userInfo.nick == nil || userInfo.avatar == nil) {
|
||||
// [self completeUserInfo];
|
||||
// return;
|
||||
// }
|
||||
|
||||
[self initTabs:YES];
|
||||
// [self setUserInfoToQYWithUserInfo:userInfo];
|
||||
@@ -196,6 +201,35 @@
|
||||
[YMHUDTool hideHUD];
|
||||
}
|
||||
|
||||
#pragma mark - 网络状态监听
|
||||
- (void)networkReachability{
|
||||
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
|
||||
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
|
||||
switch (status) {
|
||||
case AFNetworkReachabilityStatusUnknown:
|
||||
self.isFirstReachability = YES;
|
||||
break;
|
||||
case AFNetworkReachabilityStatusNotReachable:
|
||||
self.isFirstReachability = YES;
|
||||
break;
|
||||
case AFNetworkReachabilityStatusReachableViaWWAN:
|
||||
case AFNetworkReachabilityStatusReachableViaWiFi:
|
||||
{
|
||||
if (self.isFirstReachability) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kNetworkReachabilityKey object:nil userInfo:nil];
|
||||
[self.presenter autoLogin];
|
||||
[[ClientConfig shareConfig] clientInit];
|
||||
}
|
||||
self.isFirstReachability = YES;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Pirvate Method
|
||||
// 去到绑定手机号码页面
|
||||
- (void)pushBindPhoneController {
|
||||
|
@@ -31,6 +31,8 @@
|
||||
[[AccountInfoStorage instance] saveAccountInfo:model];
|
||||
}
|
||||
[[self getView] phoneAndPasswordLoginSuccess];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
[[self getView] phoneAndPasswordLoginFail:msg];
|
||||
} showLoading:YES] phone:desPhone password:desPassword client_secret:@"uyzjdhds" version:@"1" client_id:@"erban-client" grant_type:@"password"];
|
||||
}
|
||||
@end
|
||||
|
@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param type 登录的类型
|
||||
- (void)thirdLoginWithType:(ThirdLoginType)type;
|
||||
|
||||
- (void)thirdLoginWithApple:(NSString *)token unionId:(NSString *)unionId;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#import "Api+Login.h"
|
||||
///P
|
||||
#import "LoginProtocol.h"
|
||||
#import "AccountModel.h"
|
||||
|
||||
@implementation LoginPresenter
|
||||
|
||||
@@ -33,5 +34,18 @@
|
||||
|
||||
}
|
||||
|
||||
- (void)thirdLoginWithApple:(NSString *)token unionId:(NSString *)unionId {
|
||||
[Api loginWithThirdPart:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
AccountModel *model = [AccountModel modelWithDictionary:data.data];
|
||||
if (model != nil) {
|
||||
[[AccountInfoStorage instance] saveAccountInfo:model];
|
||||
[[self getView] loginSuccess];
|
||||
}
|
||||
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
|
||||
} showLoading:YES] openid:token unionid:unionId access_token:token type:@"5"];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -12,6 +12,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol LoginPasswordProtocol <NSObject>
|
||||
///手机号密码登录成功
|
||||
- (void)phoneAndPasswordLoginSuccess;
|
||||
///手机号密码登录失败
|
||||
- (void)phoneAndPasswordLoginFail:(NSString *)error;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -17,9 +17,12 @@
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "CountDownHelper.h"
|
||||
#import "YMMacro.h"
|
||||
#import "UIImage+Utils.h"
|
||||
|
||||
|
||||
@interface LoginForgetPasswordViewController ()<LoginForgetPasswordProtocol, CountDownHelperDelegate>
|
||||
@property (nonatomic, strong) UIImageView *bgImageView;
|
||||
///容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///手机号
|
||||
@@ -30,6 +33,7 @@
|
||||
@property (nonatomic,strong) LoginForgetEditView *passwordView;
|
||||
///完成
|
||||
@property (nonatomic,strong) UIButton *finishButton;
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
/// 返回按钮
|
||||
@property (nonatomic, strong) UIButton *backButton;
|
||||
|
||||
@@ -45,9 +49,9 @@
|
||||
[[CountDownHelper shareHelper] stopCountDown];
|
||||
}
|
||||
|
||||
//- (BOOL)isHiddenNavBar {
|
||||
// return YES;
|
||||
//}
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Life Cycle
|
||||
- (void)viewDidLoad {
|
||||
@@ -108,29 +112,66 @@
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.title = @"忘记密码";
|
||||
// self.titleLabel.text = @"忘记密码";
|
||||
[CountDownHelper shareHelper].delegate = self;
|
||||
[self.view addSubview:self.bgImageView];
|
||||
[self.view addSubview:self.backButton];
|
||||
[self.view addSubview:self.titleLabel];
|
||||
|
||||
[self.view addSubview:self.stackView];
|
||||
[self.view addSubview:self.finishButton];
|
||||
|
||||
[self.stackView addArrangedSubview:self.phoneView];
|
||||
[self.stackView addArrangedSubview:self.codeView];
|
||||
[self.stackView addArrangedSubview:self.passwordView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.view);
|
||||
}];
|
||||
|
||||
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.view).mas_offset(10);
|
||||
make.top.mas_equalTo(statusbarHeight);
|
||||
make.height.width.mas_equalTo(44);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.backButton);
|
||||
make.centerX.equalTo(self.view);
|
||||
}];
|
||||
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self.view);
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(60);
|
||||
make.width.mas_equalTo(KScreenWidth - 2 *36);
|
||||
make.centerX.equalTo(self.view);
|
||||
}];
|
||||
|
||||
[self.finishButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view).inset(52);
|
||||
make.height.mas_equalTo(45);
|
||||
make.left.right.mas_equalTo(self.view).inset(36);
|
||||
make.height.mas_equalTo(52);
|
||||
make.top.mas_equalTo(self.stackView.mas_bottom).offset(20);
|
||||
}];
|
||||
|
||||
// [self.phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.height.mas_equalTo(52);
|
||||
// make.width.mas_equalTo(KScreenWidth - 2 * 36);
|
||||
// make.centerX.equalTo(self.view);
|
||||
// make.top.mas_equalTo(60);
|
||||
// }];
|
||||
//
|
||||
// [self.codeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.height.width.centerX.mas_equalTo(self.phoneView);
|
||||
// make.top.equalTo(self.phoneView.mas_bottom).offset(20);
|
||||
// }];
|
||||
//
|
||||
// [self.passwordView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.height.width.centerX.mas_equalTo(self.phoneView);
|
||||
// make.top.equalTo(self.codeView.mas_bottom).offset(20);
|
||||
// }];
|
||||
|
||||
[self.phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(45);
|
||||
make.height.mas_equalTo(52);
|
||||
}];
|
||||
|
||||
[self.codeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -144,35 +185,49 @@
|
||||
|
||||
- (void)initEvents {
|
||||
// @weakify(self);
|
||||
RAC(self.finishButton, enabled) = [RACSignal combineLatest:@[self.phoneView.textField.rac_textSignal, self.codeView.textField.rac_textSignal, self.passwordView.textField.rac_textSignal] reduce:^id _Nonnull(NSString *phone, NSString *code, NSString *password){
|
||||
return @(phone.length == 11 && code.length > 0 && password.length >= 6 && password.length <= 16);
|
||||
}];
|
||||
// RAC(self.finishButton, enabled) = [RACSignal combineLatest:@[self.phoneView.textField.rac_textSignal, self.codeView.textField.rac_textSignal, self.passwordView.textField.rac_textSignal] reduce:^id _Nonnull(NSString *phone, NSString *code, NSString *password){
|
||||
// return @(phone.length == 11 && code.length > 0 && password.length >= 6 && password.length <= 16);
|
||||
// }];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIImageView *)bgImageView {
|
||||
if (!_bgImageView) {
|
||||
_bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mew_home_bg"]];
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
|
||||
- (UIButton *)backButton {
|
||||
if (!_backButton) {
|
||||
_backButton = [[UIButton alloc] init];
|
||||
[_backButton setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
|
||||
_backButton.backgroundColor = UIColor.blueColor;
|
||||
[_backButton setImage:[UIImage imageNamed:@"common_back_white_left"] forState:UIControlStateNormal];
|
||||
[_backButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _backButton;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.text = @"忘记密码";
|
||||
_titleLabel.font = kFontMedium(18);
|
||||
_titleLabel.textColor = UIColor.whiteColor;
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)finishButton{
|
||||
if (!_finishButton) {
|
||||
_finishButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_finishButton.layer.masksToBounds = YES;
|
||||
_finishButton.layer.cornerRadius = 45/2.f;
|
||||
[_finishButton setTitle:@"提交" forState:UIControlStateNormal];
|
||||
_finishButton.layer.cornerRadius = 52/2.f;
|
||||
[_finishButton setImage:[UIImage imageNamed:@"mew_login_next"] forState:UIControlStateNormal];
|
||||
_finishButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
|
||||
[_finishButton setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
|
||||
_finishButton.enabled = NO;
|
||||
// UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
// [_finishButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor disableButtonColor], [ThemeColor disableButtonColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateDisabled];
|
||||
// [_finishButton setBackgroundImage:image forState:UIControlStateNormal];
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FF60FD"], [ThemeColor colorWithHexString:@"#8974FF"],[ThemeColor colorWithHexString:@"#69EBFF"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(KScreenWidth - 2*36, 52)];
|
||||
_finishButton.backgroundColor = [UIColor colorWithPatternImage:image];
|
||||
[_finishButton addTarget:self action:@selector(finishButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _finishButton;
|
||||
@@ -185,7 +240,7 @@
|
||||
_stackView.axis = UILayoutConstraintAxisVertical;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentFill;
|
||||
_stackView.spacing = 0;
|
||||
_stackView.spacing = 20;
|
||||
}
|
||||
return _stackView;
|
||||
}
|
||||
@@ -195,6 +250,9 @@
|
||||
_phoneView = [[LoginForgetEditView alloc] init];
|
||||
_phoneView.placeholder = @"请输入手机号";
|
||||
_phoneView.type = LoginForgetEditViewTypeNormal;
|
||||
_phoneView.backgroundColor = UIColor.whiteColor;
|
||||
_phoneView.layer.cornerRadius = 52/2.f;
|
||||
_phoneView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _phoneView;
|
||||
}
|
||||
@@ -204,7 +262,12 @@
|
||||
_codeView = [[LoginForgetEditView alloc] init];
|
||||
_codeView.placeholder = @"请输入验证码";
|
||||
_codeView.type = LoginForgetEditViewTypeSms;
|
||||
_codeView.backgroundColor = UIColor.whiteColor;
|
||||
[_codeView.authCodeButton setTitleColor:[ThemeColor colorWithHexString:@"#9552FF"] forState:UIControlStateNormal];
|
||||
_codeView.layer.cornerRadius = 52/2.f;
|
||||
_codeView.layer.masksToBounds = YES;
|
||||
[_codeView.authCodeButton addTarget:self action:@selector(authCodeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
}
|
||||
return _codeView;
|
||||
}
|
||||
@@ -217,6 +280,9 @@
|
||||
_passwordView.textField.keyboardType = UIKeyboardTypeASCIICapable;
|
||||
_passwordView.textField.secureTextEntry = YES;
|
||||
_passwordView.textField.clearButtonMode = UITextFieldViewModeAlways;
|
||||
_passwordView.backgroundColor = UIColor.whiteColor;
|
||||
_passwordView.layer.cornerRadius = 52/2.f;
|
||||
_passwordView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _passwordView;
|
||||
}
|
||||
|
@@ -13,6 +13,8 @@
|
||||
#import "ThemeColor.h"
|
||||
#import "YMMacro.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "YMHUDTool.h"
|
||||
///Model
|
||||
#import "ThirdUserInfo.h"
|
||||
/// presenter
|
||||
@@ -20,6 +22,11 @@
|
||||
#import "LoginFullInfoProtocol.h"
|
||||
|
||||
@interface LoginFullInfoViewController ()<LoginFullInfoProtocol>
|
||||
@property (nonatomic, strong) UIImageView *bgImageView;
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
/// 返回按钮
|
||||
@property (nonatomic, strong) UIButton *backButton;
|
||||
@property (nonatomic, strong) UIView *textFileBgView;
|
||||
///输入框
|
||||
@property (nonatomic,strong) UITextField *textField;
|
||||
///性别的容器
|
||||
@@ -37,9 +44,9 @@
|
||||
|
||||
@implementation LoginFullInfoViewController
|
||||
|
||||
//- (BOOL)isHiddenNavBar {
|
||||
// return YES;
|
||||
//}
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (LoginFullInfoPresenter *)createPresenter {
|
||||
return [[LoginFullInfoPresenter alloc] init];
|
||||
@@ -48,10 +55,11 @@
|
||||
#pragma mark - Life Cycle
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.title = @"填写资料";
|
||||
// self.title = @"填写资料";
|
||||
self.sexString = @"";
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self initEvents];
|
||||
// [self initEvents];
|
||||
}
|
||||
|
||||
#pragma mark - LoginFullInfoProtocol
|
||||
@@ -60,6 +68,10 @@
|
||||
[self dissMissVC];
|
||||
}
|
||||
|
||||
- (void)requestRandomNickSuccess:(NSString *)nick {
|
||||
self.textField.text = nick;
|
||||
}
|
||||
|
||||
#pragma mark - Action Event
|
||||
/// 男
|
||||
- (void)maleButtonAction {
|
||||
@@ -77,6 +89,17 @@
|
||||
|
||||
/// 下一步
|
||||
- (void)nextButtonAction {
|
||||
if (self.sexString.length == 0 || [self.sexString isEqualToString:@""]) {
|
||||
[YMHUDTool showErrorWithMessage:@"请选择性别"];
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.textField.text.length == 0 || [self.textField.text isEqualToString:@""]) {
|
||||
[YMHUDTool showErrorWithMessage:@"请输入昵称"];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
[self updateUserInfo];
|
||||
}
|
||||
|
||||
@@ -105,6 +128,7 @@
|
||||
if (self.textField.text.length > 0 && self.sexString.length > 0) {
|
||||
self.nextButton.enabled = YES;
|
||||
} else {
|
||||
// [YMHUDTool showErrorWithMessage:@"请填写资料"];
|
||||
self.nextButton.enabled = NO;
|
||||
}
|
||||
}
|
||||
@@ -117,38 +141,70 @@
|
||||
while (vc.presentingViewController) {
|
||||
vc = vc.presentingViewController;
|
||||
}
|
||||
[vc dismissViewControllerAnimated:YES completion:^{
|
||||
}];
|
||||
[vc dismissViewControllerAnimated:YES completion:nil];
|
||||
// NSString * inviteCode = @"";
|
||||
// [[NSNotificationCenter defaultCenter] postNotificationName:kUserCompleteInfoFinishKey object:inviteCode];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Init View
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.textField];
|
||||
[self.view addSubview:self.bgImageView];
|
||||
[self.view addSubview:self.backButton];
|
||||
[self.view addSubview:self.titleLabel];
|
||||
[self.view addSubview:self.textFileBgView];
|
||||
[self.textFileBgView addSubview:self.textField];
|
||||
[self.view addSubview:self.sexStackView];
|
||||
[self.sexStackView addArrangedSubview:self.maleButton];
|
||||
[self.sexStackView addArrangedSubview:self.femaleButton];
|
||||
[self.view addSubview:self.nextButton];
|
||||
[self initSubViewConstraints];
|
||||
if ([self.presenter getThirdUserInfo] && [self.presenter getThirdUserInfo].userName.length > 0) {
|
||||
self.textField.text = [self.presenter getThirdUserInfo].userName;
|
||||
} else {
|
||||
[self.presenter randomRequestNick];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kStatusBarHeight + 100);
|
||||
make.left.mas_equalTo(24);
|
||||
make.right.mas_equalTo(24);
|
||||
make.height.mas_equalTo(25);
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.view);
|
||||
}];
|
||||
|
||||
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.view).mas_offset(10);
|
||||
make.top.mas_equalTo(statusbarHeight);
|
||||
make.height.width.mas_equalTo(44);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.backButton);
|
||||
make.centerX.equalTo(self.view);
|
||||
}];
|
||||
|
||||
|
||||
[self.sexStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.textField);
|
||||
make.top.mas_equalTo(self.textField.mas_bottom).offset(15);
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(60);
|
||||
}];
|
||||
|
||||
[self.textFileBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.sexStackView.mas_bottom).offset(32);
|
||||
make.left.mas_equalTo(36);
|
||||
make.right.mas_equalTo(-36);
|
||||
make.height.mas_equalTo(52);
|
||||
}];
|
||||
|
||||
[self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.textFileBgView).inset(20);
|
||||
make.height.mas_equalTo(self.textFileBgView);
|
||||
}];
|
||||
|
||||
|
||||
[self.nextButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view).inset(52);
|
||||
make.height.mas_equalTo(45);
|
||||
make.top.mas_equalTo(self.sexStackView.mas_bottom).offset(75);
|
||||
make.left.right.mas_equalTo(self.view).inset(36);
|
||||
make.height.mas_equalTo(52);
|
||||
make.top.mas_equalTo(self.textField.mas_bottom).offset(40);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -167,25 +223,65 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - Set
|
||||
- (void)setSexString:(NSString *)sexString {
|
||||
_sexString = sexString;
|
||||
[self updateNextButton];
|
||||
// 返回
|
||||
- (void)backButtonAction {
|
||||
[self dismissViewControllerAnimated:NO completion:nil];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma mark - Set
|
||||
//- (void)setSexString:(NSString *)sexString {
|
||||
// _sexString = sexString;
|
||||
// [self updateNextButton];
|
||||
//}
|
||||
|
||||
|
||||
#pragma mark - Get
|
||||
- (UIImageView *)bgImageView {
|
||||
if (!_bgImageView) {
|
||||
_bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mew_home_bg"]];
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
|
||||
- (UIButton *)backButton {
|
||||
if (!_backButton) {
|
||||
_backButton = [[UIButton alloc] init];
|
||||
[_backButton setImage:[UIImage imageNamed:@"common_back_white_left"] forState:UIControlStateNormal];
|
||||
[_backButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _backButton;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.text = @"填写资料";
|
||||
_titleLabel.font = kFontMedium(18);
|
||||
_titleLabel.textColor = UIColor.whiteColor;
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIView *)textFileBgView {
|
||||
if (!_textFileBgView) {
|
||||
_textFileBgView = [[UIView alloc] init];
|
||||
_textFileBgView.layer.cornerRadius = 52/2.f;
|
||||
_textFileBgView.layer.masksToBounds = YES;
|
||||
_textFileBgView.backgroundColor = UIColor.whiteColor;
|
||||
}
|
||||
return _textFileBgView;
|
||||
}
|
||||
|
||||
- (UITextField *)textField {
|
||||
if (!_textField) {
|
||||
_textField = [[UITextField alloc] init];
|
||||
_textField.textColor = [ThemeColor mainTextColor];
|
||||
_textField.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:15.f];
|
||||
_textField.borderStyle = UITextBorderStyleNone;
|
||||
// _textField.tintColor = [ThemeColor appMainColor];
|
||||
_textField.textAlignment = NSTextAlignmentRight;
|
||||
_textField.backgroundColor = [UIColor clearColor];
|
||||
_textField.textAlignment = NSTextAlignmentLeft;
|
||||
_textField.placeholder = @"请输入昵称";
|
||||
}
|
||||
return _textField;
|
||||
}
|
||||
@@ -204,8 +300,8 @@
|
||||
- (UIButton *)maleButton {
|
||||
if (!_maleButton) {
|
||||
_maleButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_maleButton setImage:[UIImage imageNamed:@"login_full_info_male_normal"] forState:UIControlStateNormal];
|
||||
[_maleButton setImage:[UIImage imageNamed:@"login_full_info_male_select"] forState:UIControlStateSelected];
|
||||
[_maleButton setImage:[UIImage imageNamed:@"mew_login_full_man_normal"] forState:UIControlStateNormal];
|
||||
[_maleButton setImage:[UIImage imageNamed:@"mew_login_full_man_select"] forState:UIControlStateSelected];
|
||||
[_maleButton addTarget:self action:@selector(maleButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _maleButton;
|
||||
@@ -214,8 +310,8 @@
|
||||
- (UIButton *)femaleButton {
|
||||
if (!_femaleButton) {
|
||||
_femaleButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_femaleButton setImage:[UIImage imageNamed:@"login_full_info_female_normal"] forState:UIControlStateNormal];
|
||||
[_femaleButton setImage:[UIImage imageNamed:@"login_full_info_female_select"] forState:UIControlStateSelected];
|
||||
[_femaleButton setImage:[UIImage imageNamed:@"mew_login_full_waman_normal"] forState:UIControlStateNormal];
|
||||
[_femaleButton setImage:[UIImage imageNamed:@"mew_login_full_waman_select"] forState:UIControlStateSelected];
|
||||
[_femaleButton addTarget:self action:@selector(femaleButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _femaleButton;
|
||||
@@ -225,14 +321,11 @@
|
||||
if (!_nextButton) {
|
||||
_nextButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_nextButton.layer.masksToBounds = YES;
|
||||
_nextButton.layer.cornerRadius = 45/2.f;
|
||||
[_nextButton setTitle:@"下一步" forState:UIControlStateNormal];
|
||||
_nextButton.layer.cornerRadius = 52/2.f;
|
||||
[_nextButton setImage:[UIImage imageNamed:@"mew_login_next"] forState:UIControlStateNormal];
|
||||
_nextButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
|
||||
// [_nextButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
|
||||
_nextButton.enabled = NO;
|
||||
// UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
// [_nextButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor disableButtonColor], [ThemeColor disableButtonColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateDisabled];
|
||||
// [_nextButton setBackgroundImage:image forState:UIControlStateNormal];
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FF60FD"], [ThemeColor colorWithHexString:@"#8974FF"],[ThemeColor colorWithHexString:@"#69EBFF"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(KScreenWidth - 2*36, 52)];
|
||||
_nextButton.backgroundColor = [UIColor colorWithPatternImage:image];
|
||||
[_nextButton addTarget:self action:@selector(nextButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _nextButton;
|
||||
|
@@ -51,6 +51,43 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param pageNo 当前页数
|
||||
/// @param pageSize 一页多少个
|
||||
+ (void)getattentionListCompletion:(HttpRequestHelperCompletion)completion uid:(NSString *)uid pageNo:(NSString *)pageNo pageSize:(NSString *)pageSize;
|
||||
|
||||
|
||||
/// 请求充值列表
|
||||
/// @param complection 完成
|
||||
/// @param channelType channel
|
||||
+ (void)getRechargeList:(HttpRequestHelperCompletion)complection
|
||||
channelType:(NSString *)channelType;
|
||||
|
||||
/// 苹果下单
|
||||
/// @param complection 完成
|
||||
/// @param chargeProdId 充值id
|
||||
/// @param uid 用户的uid
|
||||
/// @param ticket ticket
|
||||
/// @param deviceInfo uuid
|
||||
/// @param clientIp ip地址
|
||||
+ (void)requestIAPRecharge:(HttpRequestHelperCompletion)complection
|
||||
chargeProdId:(NSString *)chargeProdId
|
||||
uid:(NSString *)uid
|
||||
ticket:(NSString *)ticket
|
||||
deviceInfo:(NSString *)deviceInfo
|
||||
clientIp:(NSString *)clientIp;
|
||||
|
||||
/// 验证凭据
|
||||
/// @param complection 完成
|
||||
/// @param receipt base 64 recepit
|
||||
/// @param chooseEnv @"true"
|
||||
/// @param chargeRecordId 服务端生成的订单编号
|
||||
/// @param transcationId 内购的唯一标识符
|
||||
/// @param uid 用户uid
|
||||
/// @param ticket ticket
|
||||
+ (void)checkReceipt:(HttpRequestHelperCompletion)complection
|
||||
receipt:(NSString *)receipt
|
||||
chooseEnv:(NSString *)chooseEnv
|
||||
chargeRecordId:(NSString *)chargeRecordId
|
||||
transcationId:(NSString *)transcationId
|
||||
uid:(NSString *)uid
|
||||
ticket:(NSString *)ticket;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -63,4 +63,38 @@
|
||||
+ (void)getattentionListCompletion:(HttpRequestHelperCompletion)completion uid:(NSString *)uid pageNo:(NSString *)pageNo pageSize:(NSString *)pageSize {
|
||||
[self makeRequest:@"fans/following" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, uid, pageNo, pageSize, nil];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// 请求充值列表
|
||||
/// @param completion 完成
|
||||
/// @param channelType channel
|
||||
+ (void)getRechargeList:(HttpRequestHelperCompletion)completion channelType:(NSString *)channelType {
|
||||
[self makeRequest:@"chargeprod/list" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,channelType, nil];
|
||||
}
|
||||
|
||||
/// 苹果下单
|
||||
/// @param completion 完成
|
||||
/// @param chargeProdId 充值id
|
||||
/// @param uid 用户的uid
|
||||
/// @param ticket ticket
|
||||
/// @param deviceInfo uuid
|
||||
/// @param clientIp ip地址
|
||||
+ (void)requestIAPRecharge:(HttpRequestHelperCompletion)completion chargeProdId:(NSString *)chargeProdId uid:(NSString *)uid ticket:(NSString *)ticket deviceInfo:(NSString *)deviceInfo clientIp:(NSString *)clientIp {
|
||||
[self makeRequest:@"order/placeV2" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,chargeProdId, uid, ticket, deviceInfo, clientIp, nil];
|
||||
}
|
||||
|
||||
|
||||
/// 验证凭据
|
||||
/// @param completion 完成
|
||||
/// @param receipt base 64 recepit
|
||||
/// @param chooseEnv @"true"
|
||||
/// @param chargeRecordId 服务端生成的订单编号
|
||||
/// @param transcationId 内购的唯一标识符
|
||||
/// @param uid 用户uid
|
||||
/// @param ticket ticket
|
||||
+ (void)checkReceipt:(HttpRequestHelperCompletion)completion receipt:(NSString *)receipt chooseEnv:(NSString *)chooseEnv chargeRecordId:(NSString *)chargeRecordId transcationId:(NSString *)transcationId uid:(NSString *)uid ticket:(NSString *)ticket {
|
||||
[self makeRequest:@"verify/setiap" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,receipt, chooseEnv, chargeRecordId, transcationId, uid, ticket, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// MineRechargePresenter.h
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by 触海 on 2023/11/22.
|
||||
//
|
||||
|
||||
#import "BaseMvpPresenter.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MineRechargePresenter : BaseMvpPresenter
|
||||
|
||||
/// 获取钱包信息
|
||||
- (void)getUserWalletInfo;
|
||||
/// 请求内购列表
|
||||
/// @param channel 目前是8
|
||||
- (void)requestRechargeListWithChannel:(NSString *)channel;
|
||||
|
||||
/// 获取充值的订单编号
|
||||
/// @param chargeProdId 苹果服务器的充值 的id
|
||||
- (void)requestIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId;
|
||||
|
||||
/// 充值成功二次验证
|
||||
/// @param receipt 凭据
|
||||
/// @param orderId 订单编号
|
||||
/// @param transcationId 商品id
|
||||
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId;
|
||||
|
||||
/// 批量验证内购掉单
|
||||
/// @param transcations 凭据的数组
|
||||
- (void)checkTranscationIds:(NSArray *)transcations;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// MineRechargePresenter.m
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by 触海 on 2023/11/22.
|
||||
//
|
||||
|
||||
#import "MineRechargePresenter.h"
|
||||
/// Tool
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "YYUtility.h"
|
||||
#import "NSObject+MJExtension.h"
|
||||
///Api
|
||||
#import "Api+Mine.h"
|
||||
#import "RechargeListModel.h"
|
||||
#import "WalletInfoModel.h"
|
||||
#import "MineRechargeProtocol.h"
|
||||
|
||||
@implementation MineRechargePresenter
|
||||
|
||||
|
||||
/// 获取钱包信息
|
||||
- (void)getUserWalletInfo {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
[Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data];
|
||||
[[self getView] getUserWalletInfo:model];
|
||||
}] uid:uid ticket:ticket];
|
||||
}
|
||||
|
||||
|
||||
/// 请求内购列表
|
||||
/// @param channel 目前是8
|
||||
- (void)requestRechargeListWithChannel:(NSString *)channel {
|
||||
[Api getRechargeList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
NSArray * array = [RechargeListModel modelsWithArray:data.data];
|
||||
[[self getView] requestRechargeListSucccess:array];
|
||||
}] channelType:channel];
|
||||
}
|
||||
|
||||
/// 获取充值的订单编号
|
||||
/// @param chargeProdId 苹果服务器的充值 的id
|
||||
- (void)requestIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
NSString * deviceInfo = [YYUtility deviceID];
|
||||
NSString * clientIp= [YYUtility ipAddress];
|
||||
[Api requestIAPRecharge:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
NSString *orderId = (NSString *)data.data[@"recordId"];
|
||||
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
[[self getView] requestIAPRechargeOrderFail];
|
||||
}] chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
||||
}
|
||||
|
||||
|
||||
/// 充值成功二次验证
|
||||
/// @param receipt 凭据
|
||||
/// @param orderId 订单编号
|
||||
/// @param transcationId 商品id
|
||||
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
[Api checkReceipt:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] checkReceiptSuccess:transcationId];
|
||||
} showLoading:YES] receipt:receipt chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
||||
}
|
||||
|
||||
|
||||
/// 批量验证内购掉单
|
||||
/// @param transcations 凭据的数组
|
||||
- (void)checkTranscationIds:(NSArray *)transcations {
|
||||
NSString * transcationIdStr = [transcations toJSONString];
|
||||
[Api requestCheckTranscationIds:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] checkTranscationIdsSuccess];
|
||||
}] transcationIdStr:transcationIdStr];
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// MineRechargeProtocol.h
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by 触海 on 2023/11/22.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol MineRechargeProtocol <NSObject>
|
||||
///请求钱包余额信息
|
||||
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo;
|
||||
///请求充值列表成功
|
||||
- (void)requestRechargeListSucccess:(NSArray *)list;
|
||||
///请求充值id的状态成功
|
||||
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId;
|
||||
///请求充值账单失败
|
||||
- (void)requestIAPRechargeOrderFail;
|
||||
///二次校验成功
|
||||
- (void)checkReceiptSuccess:(NSString *)transcationId;
|
||||
///批量验证凭据成功
|
||||
- (void)checkTranscationIdsSuccess;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
10
yinmeng-ios/yinmeng-ios/yinmeng-ios.entitlements
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.developer.applesignin</key>
|
||||
<array>
|
||||
<string>Default</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|