diff --git a/YuMi/Appdelegate/AppDelegate.m b/YuMi/Appdelegate/AppDelegate.m index 20418274..c86e8338 100644 --- a/YuMi/Appdelegate/AppDelegate.m +++ b/YuMi/Appdelegate/AppDelegate.m @@ -10,7 +10,6 @@ #import #import #import -//#import #import "TabbarViewController.h" #import "BaseNavigationController.h" #import "AppDelegate+ThirdConfig.h" @@ -18,9 +17,8 @@ #import #import "ClientConfig.h" #import -//#import "GULAppDelegateSwizzler.h" #import -#import "XPLoginViewController.h" +#import "LoginViewController.h" #import "AccountModel.h" #import "YuMi-swift.h" #import "SessionViewController.h" @@ -110,7 +108,7 @@ void qg_VAP_Logger_handler(VAPLogLevel level, const char* file, int line, const } - (void)toLoginPage { - XPLoginViewController *lvc = [[XPLoginViewController alloc] init]; + LoginViewController *lvc = [[LoginViewController alloc] init]; BaseNavigationController * navigationController = [[BaseNavigationController alloc] initWithRootViewController:lvc]; navigationController.modalPresentationStyle = UIModalPresentationFullScreen; self.window.rootViewController = navigationController; @@ -240,15 +238,7 @@ void qg_VAP_Logger_handler(VAPLogLevel level, const char* file, int line, const } return YES; } - } - -// if([url.absoluteString containsString:@"fb1266232494209868"]){ -// return [[FBSDKApplicationDelegate sharedInstance] application:app -// openURL:url -// sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] -// annotation:options[UIApplicationOpenURLOptionsAnnotationKey]]; -// } return [GIDSignIn.sharedInstance handleURL:url]; } diff --git a/YuMi/Assets.xcassets/20.20.51/Contents.json b/YuMi/Assets.xcassets/20.20.51/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/binding_page_top.imageset/5394b7b084545ef1ec94ee1f396616d3f476c6bb8a758-r7deHF_fw480@3x.png b/YuMi/Assets.xcassets/20.20.51/binding_page_top.imageset/5394b7b084545ef1ec94ee1f396616d3f476c6bb8a758-r7deHF_fw480@3x.png new file mode 100644 index 00000000..e5681340 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/binding_page_top.imageset/5394b7b084545ef1ec94ee1f396616d3f476c6bb8a758-r7deHF_fw480@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.51/binding_page_top.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/binding_page_top.imageset/Contents.json new file mode 100644 index 00000000..4bc2ff13 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/binding_page_top.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "5394b7b084545ef1ec94ee1f396616d3f476c6bb8a758-r7deHF_fw480@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_apple.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/login_page_apple.imageset/Contents.json new file mode 100644 index 00000000..3458ed73 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/login_page_apple.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "切图 65@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_apple.imageset/切图 65@3x.png b/YuMi/Assets.xcassets/20.20.51/login_page_apple.imageset/切图 65@3x.png new file mode 100644 index 00000000..4adf1e86 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/login_page_apple.imageset/切图 65@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_area_arrow.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/login_page_area_arrow.imageset/Contents.json new file mode 100644 index 00000000..596efa38 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/login_page_area_arrow.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "路径 186@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_area_arrow.imageset/路径 186@3x.png b/YuMi/Assets.xcassets/20.20.51/login_page_area_arrow.imageset/路径 186@3x.png new file mode 100644 index 00000000..3965eb2d Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/login_page_area_arrow.imageset/路径 186@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_backage.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/login_page_backage.imageset/Contents.json new file mode 100644 index 00000000..e939dedb --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/login_page_backage.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bg@3x (1).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_backage.imageset/bg@3x (1).png b/YuMi/Assets.xcassets/20.20.51/login_page_backage.imageset/bg@3x (1).png new file mode 100644 index 00000000..052db8ec Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/login_page_backage.imageset/bg@3x (1).png differ diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_backage_ar.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/login_page_backage_ar.imageset/Contents.json new file mode 100644 index 00000000..85a447cd --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/login_page_backage_ar.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_backage_ar.imageset/bg@3x.png b/YuMi/Assets.xcassets/20.20.51/login_page_backage_ar.imageset/bg@3x.png new file mode 100644 index 00000000..83737f96 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/login_page_backage_ar.imageset/bg@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_id.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/login_page_id.imageset/Contents.json new file mode 100644 index 00000000..423aa669 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/login_page_id.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "切图 65@3x (2).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_id.imageset/切图 65@3x (2).png b/YuMi/Assets.xcassets/20.20.51/login_page_id.imageset/切图 65@3x (2).png new file mode 100644 index 00000000..3f9224ca Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/login_page_id.imageset/切图 65@3x (2).png differ diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_logo.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/login_page_logo.imageset/Contents.json new file mode 100644 index 00000000..b1d66c16 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/login_page_logo.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "logo@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_logo.imageset/logo@3x.png b/YuMi/Assets.xcassets/20.20.51/login_page_logo.imageset/logo@3x.png new file mode 100644 index 00000000..65cb563d Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/login_page_logo.imageset/logo@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_mail.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/login_page_mail.imageset/Contents.json new file mode 100644 index 00000000..bb4f25c4 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/login_page_mail.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "切图 65@3x (1).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_mail.imageset/切图 65@3x (1).png b/YuMi/Assets.xcassets/20.20.51/login_page_mail.imageset/切图 65@3x (1).png new file mode 100644 index 00000000..c01f2c8b Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/login_page_mail.imageset/切图 65@3x (1).png differ diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_mail_HI.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/login_page_mail_HI.imageset/Contents.json new file mode 100644 index 00000000..fb9616fe --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/login_page_mail_HI.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "HI@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_mail_HI.imageset/HI@3x.png b/YuMi/Assets.xcassets/20.20.51/login_page_mail_HI.imageset/HI@3x.png new file mode 100644 index 00000000..1c733f7a Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/login_page_mail_HI.imageset/HI@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_phone.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/login_page_phone.imageset/Contents.json new file mode 100644 index 00000000..1428c098 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/login_page_phone.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "手机@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_phone.imageset/手机@3x.png b/YuMi/Assets.xcassets/20.20.51/login_page_phone.imageset/手机@3x.png new file mode 100644 index 00000000..22d9c059 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/login_page_phone.imageset/手机@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_privacy_selected.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/login_page_privacy_selected.imageset/Contents.json new file mode 100644 index 00000000..44ba855a --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/login_page_privacy_selected.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "勾选@3x (1).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_privacy_selected.imageset/勾选@3x (1).png b/YuMi/Assets.xcassets/20.20.51/login_page_privacy_selected.imageset/勾选@3x (1).png new file mode 100644 index 00000000..a673afd7 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/login_page_privacy_selected.imageset/勾选@3x (1).png differ diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_privacy_unselected.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/login_page_privacy_unselected.imageset/Contents.json new file mode 100644 index 00000000..b072bb68 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/login_page_privacy_unselected.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "勾选@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_privacy_unselected.imageset/勾选@3x.png b/YuMi/Assets.xcassets/20.20.51/login_page_privacy_unselected.imageset/勾选@3x.png new file mode 100644 index 00000000..55a8f87c Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/login_page_privacy_unselected.imageset/勾选@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_top.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.51/login_page_top.imageset/Contents.json new file mode 100644 index 00000000..c5cd0547 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.51/login_page_top.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "top@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.51/login_page_top.imageset/top@3x.png b/YuMi/Assets.xcassets/20.20.51/login_page_top.imageset/top@3x.png new file mode 100644 index 00000000..2727f897 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.51/login_page_top.imageset/top@3x.png differ diff --git a/YuMi/CustomUI/UIImage/UIImage+Utils.h b/YuMi/CustomUI/UIImage/UIImage+Utils.h index 9125f282..e0db37da 100644 --- a/YuMi/CustomUI/UIImage/UIImage+Utils.h +++ b/YuMi/CustomUI/UIImage/UIImage+Utils.h @@ -60,4 +60,6 @@ typedef NS_ENUM(NSUInteger, GradientType) { - (UIImage *)resizeTo:(CGSize)size; +- (UIImage *)imageByApplyingAlpha:(CGFloat)alpha; + @end diff --git a/YuMi/CustomUI/UIImage/UIImage+Utils.m b/YuMi/CustomUI/UIImage/UIImage+Utils.m index d9fdaabc..22c3bc20 100644 --- a/YuMi/CustomUI/UIImage/UIImage+Utils.m +++ b/YuMi/CustomUI/UIImage/UIImage+Utils.m @@ -570,4 +570,23 @@ } return image; } + +- (UIImage *)imageByApplyingAlpha:(CGFloat)alpha { + UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f); + CGContextRef ctx = UIGraphicsGetCurrentContext(); + CGRect area = CGRectMake(0, 0, self.size.width, self.size.height); + + CGContextScaleCTM(ctx, 1, -1); + CGContextTranslateCTM(ctx, 0, -area.size.height); + + CGContextSetBlendMode(ctx, kCGBlendModeMultiply); + CGContextSetAlpha(ctx, alpha); + CGContextDrawImage(ctx, area, self.CGImage); + + UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + return newImage; +} + @end diff --git a/YuMi/Modules/YMLogin/Api/Api+Login.h b/YuMi/Modules/YMLogin/Api/Api+Login.h index ac46e3df..ccb691b2 100644 --- a/YuMi/Modules/YMLogin/Api/Api+Login.h +++ b/YuMi/Modules/YMLogin/Api/Api+Login.h @@ -89,6 +89,19 @@ NS_ASSUME_NONNULL_BEGIN screenUrl:(NSString *)screenUrl contact:(NSString *)contact; ++ (void)emailGetCode:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress type:(NSNumber *)type; + ++ (void)emailLogin:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress code:(NSNumber *)code; + + ++ (void)loginWithCode:(HttpRequestHelperCompletion)completion + email:(NSString *)email + code:(NSString *)code + client_secret:(NSString *)client_secret + version:(NSString *)version + client_id:(NSString *)client_id + grant_type:(NSString *)grant_type; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMLogin/Api/Api+Login.m b/YuMi/Modules/YMLogin/Api/Api+Login.m index 66bed317..2a336c15 100644 --- a/YuMi/Modules/YMLogin/Api/Api+Login.m +++ b/YuMi/Modules/YMLogin/Api/Api+Login.m @@ -100,4 +100,29 @@ completion:completion, __FUNCTION__, type, desc, screenUrl, contact, nil]; } + ++ (void)emailGetCode:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress type:(NSNumber *)type { + [self makeRequest:@"email/getCode" + method:HttpRequestHelperMethodPOST + completion:completion, __FUNCTION__, emailAddress, type, nil]; +} + + ++ (void)emailLogin:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress code:(NSNumber *)code { + [self makeRequest:@"email/verify" + method:HttpRequestHelperMethodPOST + completion:completion, __FUNCTION__, emailAddress, code, nil]; +} + ++ (void)loginWithCode:(HttpRequestHelperCompletion)completion + email:(NSString *)email + code:(NSString *)code + client_secret:(NSString *)client_secret + version:(NSString *)version + client_id:(NSString *)client_id + grant_type:(NSString *)grant_type { + NSString * fang = [NSString stringFromBase64String:@"b2F1dGgvdG9rZW4="];///oauth/token + [self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,email,code,client_secret,version, client_id, grant_type, nil]; +} + @end diff --git a/YuMi/Modules/YMLogin/Presenter/LoginPresenter.h b/YuMi/Modules/YMLogin/Presenter/LoginPresenter.h index 04657412..aa7364c7 100644 --- a/YuMi/Modules/YMLogin/Presenter/LoginPresenter.h +++ b/YuMi/Modules/YMLogin/Presenter/LoginPresenter.h @@ -55,6 +55,8 @@ NS_ASSUME_NONNULL_BEGIN photoURLString:(nullable NSString *)photoURLString contact:(nullable NSString *)contact; +- (void)sendMailVerificationCode:(NSString *)emailAddress type:(NSInteger)type; +- (void)loginWithEmail:(NSString *)email code:(NSString *)code; @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMLogin/Presenter/LoginPresenter.m b/YuMi/Modules/YMLogin/Presenter/LoginPresenter.m index 13cd712f..ab2459b8 100644 --- a/YuMi/Modules/YMLogin/Presenter/LoginPresenter.m +++ b/YuMi/Modules/YMLogin/Presenter/LoginPresenter.m @@ -136,8 +136,6 @@ if (model != nil) { [[AccountInfoStorage instance] saveAccountInfo:model]; [XNDJTDDLoadingTool hideOnlyView:kWindow]; - [[NSUserDefaults standardUserDefaults]setValue:@(type) forKey:@"kLoginSuccessType"]; - [[NSUserDefaults standardUserDefaults]synchronize]; [[self getView] loginThirdPartSuccess]; } } fail:^(NSInteger code, NSString * _Nullable msg) { @@ -224,8 +222,6 @@ AccountModel * model = [AccountModel modelWithDictionary:data.data]; if (model != nil) { [[AccountInfoStorage instance] saveAccountInfo:model]; - [[NSUserDefaults standardUserDefaults]setValue:@(ThirdLoginType_Gmail) forKey:@"kLoginSuccessType"]; - [[NSUserDefaults standardUserDefaults]synchronize]; [[self getView] loginThirdPartSuccess]; } }fail:^(NSInteger code, NSString * _Nullable msg) { @@ -247,9 +243,18 @@ - (void)phoneSmsCode:(NSString *)phone type:(GetSmsType)type phoneAreaCode:(NSString *)phoneAreaCode { NSString * desPhone = [DESEncrypt encryptUseDES:phone key:KeyWithType(KeyType_PasswordEncode)]; @kWeakify(self); - [Api phoneSmsCode:[self createHttpCompletion:^(id _Nonnull data) { + [Api phoneSmsCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) { @kStrongify(self); - [[self getView] phoneSmsCodeSuccess]; + if ([[self getView] respondsToSelector:@selector(phoneSmsCodeSuccess:)]) { + NSString *message = data.message; + [[self getView] phoneSmsCodeSuccess:message]; + } + + } fail:^(NSInteger code, NSString * _Nullable msg) { + @kStrongify(self); + if ([[self getView] respondsToSelector:@selector(phoneSmsCodeFailure)]) { + [[self getView] phoneSmsCodeFailure]; + } } showLoading:YES errorToast:YES] mobile:desPhone type:[NSString stringWithFormat:@"%lu", (unsigned long)type] phoneAreaCode:phoneAreaCode]; } @@ -288,7 +293,7 @@ } fail:^(NSInteger code, NSString * _Nullable msg) { @kStrongify(self); [[self getView] loginFailWithMsg:msg]; - } errorToast:YES] phone:desPhone password:desPassword client_secret:@"uyzjdhds" version:@"1" client_id:@"erban-client" grant_type:@"password"]; + } showLoading:YES errorToast:YES] phone:desPhone password:desPassword client_secret:@"uyzjdhds" version:@"1" client_id:@"erban-client" grant_type:@"password"]; } ///反馈 @@ -332,4 +337,45 @@ } +- (void)sendMailVerificationCode:(NSString *)emailAddress type:(NSInteger)type { + NSString * desEmail = [DESEncrypt encryptUseDES:emailAddress key:KeyWithType(KeyType_PasswordEncode)]; + @kWeakify(self); + [Api emailGetCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + @kStrongify(self); + if ([[self getView] respondsToSelector:@selector(emailCodeSucess:)]) { + [[self getView] emailCodeSucess:@""]; + } + } fail:^(NSInteger code, NSString * _Nullable msg) { + @kStrongify(self); + if ([[self getView] respondsToSelector:@selector(emailCodeFailure)]) { + [[self getView] emailCodeFailure]; + } + } showLoading:YES errorToast:YES] + emailAddress:desEmail type:@(type)]; +} + +- (void)loginWithEmail:(NSString *)email code:(NSString *)code { + NSString * desMail = [DESEncrypt encryptUseDES:email key:KeyWithType(KeyType_PasswordEncode)]; + @kWeakify(self); + [Api loginWithCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + @kStrongify(self); + AccountModel * accountModel = [AccountModel modelWithDictionary:data.data]; + if (accountModel && accountModel.access_token.length > 0) { + [[AccountInfoStorage instance] saveAccountInfo:accountModel]; + } + if ([[self getView] respondsToSelector:@selector(loginSuccess)]) { + [[self getView] loginSuccess]; + } + } fail:^(NSInteger code, NSString * _Nullable msg) { + @kStrongify(self); + [[self getView] loginFailWithMsg:msg]; + } errorToast:NO] + email:desMail + code:code + client_secret:@"uyzjdhds" + version:@"1" + client_id:@"erban-client" + grant_type:@"email"]; +} + @end diff --git a/YuMi/Modules/YMLogin/Protocol/LoginProtocol.h b/YuMi/Modules/YMLogin/Protocol/LoginProtocol.h index 50e714cc..df34dd0b 100644 --- a/YuMi/Modules/YMLogin/Protocol/LoginProtocol.h +++ b/YuMi/Modules/YMLogin/Protocol/LoginProtocol.h @@ -10,13 +10,17 @@ NS_ASSUME_NONNULL_BEGIN @protocol LoginProtocol - +@optional - (void)loginThirdPartSuccess; - (void)loginSuccess; +- (void)emailCodeSucess:(NSString *)message; +- (void)emailCodeFailure; ///请求手机号的验证码成功 -- (void)phoneSmsCodeSuccess; +- (void)phoneSmsCodeSuccess:(NSString *)message; +- (void)phoneSmsCodeFailure; ///手机号登录成功 - (void)loginWithPhoenSuccess; +- (void)loginWithEmailSuccess; ///登录失败 - (void)loginFailWithMsg:(NSString *)msg; @end diff --git a/YuMi/Modules/YMLogin/View/AccountBindingViewController.h b/YuMi/Modules/YMLogin/View/AccountBindingViewController.h new file mode 100644 index 00000000..a686bb0e --- /dev/null +++ b/YuMi/Modules/YMLogin/View/AccountBindingViewController.h @@ -0,0 +1,25 @@ +// +// AccountBindingViewController.h +// YuMi +// +// Created by P on 2025/3/14. +// + +#import "MvpViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSUInteger, BindingDisplayType) { + BindingDisplayType_email, + BindingDisplayType_phoneNum, +}; + +@interface AccountBindingViewController : MvpViewController + +- (instancetype)initWithType:(BindingDisplayType)type + currentBindingAccount:(NSString *)account; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMLogin/View/AccountBindingViewController.m b/YuMi/Modules/YMLogin/View/AccountBindingViewController.m new file mode 100644 index 00000000..985504f7 --- /dev/null +++ b/YuMi/Modules/YMLogin/View/AccountBindingViewController.m @@ -0,0 +1,222 @@ +// +// AccountBindingViewController.m +// YuMi +// +// Created by P on 2025/3/14. +// + +#import "AccountBindingViewController.h" +#import "LoginProtocol.h" +#import "LoginPresenter.h" +#import "LoginInputItemView.h" +#import "XPLoginAraeViewController.h" + +@interface AccountBindingViewController () +@property(nonatomic, assign) BindingDisplayType type; +@property(nonatomic, copy) NSString *currentAccount; +@property(nonatomic, strong) UILabel *currentAccountLabel; +@property(nonatomic, strong) UIStackView *stackView; +@property(nonatomic, strong) LoginInputItemView *firstLineInputView; +@property(nonatomic, strong) LoginInputItemView *secondLineInputView; +@property(nonatomic, strong) UIButton *bottomActionButton; + +@end + +@implementation AccountBindingViewController + +- (instancetype)initWithType:(BindingDisplayType)type + currentBindingAccount:(NSString *)account { + if (self = [super init]) { + self.type = type; + self.currentAccount = account; + } + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + [self setupUI]; +} + +- (void)setupUI { + + [self setupDefaultUI]; + + if ([NSString isEmpty:self.currentAccount]) { + [self setupNewBindingUI]; + } else { + [self setupUpdateBindingUI]; + } +} + +- (void)setupDefaultUI { + self.view.backgroundColor = [UIColor whiteColor]; + self.title = [self displayTitle]; +} + +- (void)setupNewBindingUI { + [self displayInputArea:25 + topView:self.view + isBottom:NO]; +} + +- (void)setupUpdateBindingUI { + UIImageView *topImageView = [self topImageView]; + [self.view addSubview:topImageView]; + [topImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.view).offset(16); + make.centerX.mas_equalTo(self.view); + make.size.mas_equalTo(CGSizeMake(170, 170)); + }]; + + UILabel *descLabel = [self descriptionLabel]; + [self.view addSubview:descLabel]; + [descLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(topImageView.mas_bottom).offset(14); + make.leading.trailing.mas_equalTo(self.view).inset(40); + }]; + + [self.view addSubview:self.currentAccountLabel]; + [self.currentAccountLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(descLabel.mas_bottom).offset(9); + make.centerX.mas_equalTo(self.view); + }]; + + [self displayInputArea:25 + topView:self.currentAccountLabel + isBottom:YES]; +} + +#pragma mark - +- (NSString *)displayTitle { + if ([NSString isEmpty:self.currentAccount]) { + if (self.type == BindingDisplayType_email) { + return YMLocalizedString(@"20.20.51_text_13"); + } else { + return YMLocalizedString(@"20.20.51_text_14"); + } + } else { + return YMLocalizedString(@"20.20.51_text_15"); + } +} + +- (void)displayInputArea:(NSInteger)topSpace + topView:(UIView *)topView + isBottom:(BOOL)isBottom { + [self.view addSubview:self.stackView]; + [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) { + if (isBottom) { + make.top.mas_equalTo(topView.mas_bottom).offset(topSpace); + } else { + make.top.mas_equalTo(topView).offset(topSpace); + } + make.leading.trailing.mas_equalTo(self.view).inset(40); + }]; + + if ([NSString isEmpty:self.currentAccount]) { + if (self.type == BindingDisplayType_email) { + self.firstLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_email]; + self.secondLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_verificationCode]; + } else { + self.firstLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_phoneNum]; + self.secondLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_verificationCode]; + } + [self.stackView addArrangedSubview:self.firstLineInputView]; + [self.stackView addArrangedSubview:self.secondLineInputView]; + [self.firstLineInputView updateBGColor:UIColorFromRGB(0xf2f3f7)]; + } else { + if (self.type == BindingDisplayType_email) { + self.secondLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_verificationCode]; + } else { + self.secondLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_verificationCode]; + } + [self.stackView addArrangedSubview:self.secondLineInputView]; + } + + [self.secondLineInputView updateBGColor:UIColorFromRGB(0xf2f3f7)]; + [self.stackView addArrangedSubview:self.bottomActionButton]; + + [self.firstLineInputView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(46); + }]; + + [self.secondLineInputView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(46); + }]; + + [self.bottomActionButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(46); + }]; +} + +#pragma mark - +- (void)didTapActionButton { + +} + +#pragma mark - +- (UIStackView *)stackView { + if (!_stackView) { + _stackView = [[UIStackView alloc] init]; + _stackView.axis = UILayoutConstraintAxisVertical; + _stackView.spacing = 24; + _stackView.distribution = UIStackViewDistributionFillEqually; + } + return _stackView; +} + +- (UIButton *)bottomActionButton { + if (!_bottomActionButton) { + _bottomActionButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_bottomActionButton setCornerRadius:23]; + [_bottomActionButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController8") forState:UIControlStateNormal]; + [_bottomActionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + UIImage *normalBG = [UIImage gradientColorImageFromColors:@[ + UIColorFromRGB(0xe29030), + UIColorFromRGB(0xfcc074) + ] + gradientType:GradientTypeLeftToRight + imgSize:CGSizeMake(KScreenWidth-84, 46)] ; + UIImage *disableBG = [UIImage gradientColorImageFromColors:@[ + [UIColor colorWithRed:245/255.0 green:199/255.0 blue:129/255.0 alpha:1], + [UIColor colorWithRed:253/255.0 green:217/255.0 blue:154/255.0 alpha:1], + ] + gradientType:GradientTypeLeftToRight + imgSize:CGSizeMake(KScreenWidth-84, 46)] ; + [_bottomActionButton setBackgroundImage:normalBG forState:UIControlStateNormal]; + [_bottomActionButton setBackgroundImage:disableBG forState:UIControlStateDisabled]; + [_bottomActionButton addTarget:self + action:@selector(didTapActionButton) + forControlEvents:UIControlEventTouchUpInside]; + _bottomActionButton.enabled = NO; + } + return _bottomActionButton; +} + +- (UIImageView *)topImageView { + UIImageView *imageView = [[UIImageView alloc] initWithImage:kImage(@"binding_page_top")]; + imageView.contentMode = UIViewContentModeScaleAspectFit; + return imageView; +} + +- (UILabel *)descriptionLabel { + UILabel *label = [UILabel labelInitWithText:YMLocalizedString(@"20.20.51_text_16") + font:kFontRegular(14) + textColor:UIColorFromRGB(0xafb1b3)]; + label.textAlignment = NSTextAlignmentCenter; + label.numberOfLines = 0; + return label; +} + +- (UILabel *)currentAccountLabel { + if (!_currentAccountLabel) { + _currentAccountLabel = [UILabel labelInitWithText:@"" + font:kFontMedium(16) + textColor:UIColorFromRGB(0x313131)]; + _currentAccountLabel.textAlignment = NSTextAlignmentCenter; + } + return _currentAccountLabel; +} + +@end diff --git a/YuMi/Modules/YMLogin/View/CustomView/LoginInputItemView.h b/YuMi/Modules/YMLogin/View/CustomView/LoginInputItemView.h new file mode 100644 index 00000000..cdcf342f --- /dev/null +++ b/YuMi/Modules/YMLogin/View/CustomView/LoginInputItemView.h @@ -0,0 +1,53 @@ +// +// LoginInputItemView.h +// YuMi +// +// Created by P on 2025/3/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSUInteger, LoginInputType) { + LoginInputType_id, + LoginInputType_email, + LoginInputType_phoneNum, + LoginInputType_password, + LoginInputType_createPassword, + LoginInputType_verificationCode, + LoginInputType_confirmPassword, + LoginInputType_forgetPassword, + LoginInputType_login, + LoginInputType_confirm, + LoginInputType_none +}; + + + +@interface LoginInputItemView : UIView +@property(nonatomic, copy) NSString *placeholderText; +@property(nonatomic, assign) LoginInputType inputType; +@property(nonatomic, strong) UITextField *inputTextField; +@property(nonatomic, strong) UIButton *rightActionButton; +@property(nonatomic, strong) UIButton *areaCodeButton; +@property(nonatomic, strong) UIButton *verificationCodeButton; +@property(nonatomic, assign) NSInteger verificationCountDown; +@property(nonatomic, strong) NSTimer *verificationTimer; + +@property(nonatomic, copy) void(^handleItemAction)(LoginInputType inputType); +@property(nonatomic, copy) void(^handleFirstInputContentUpdate)(NSString *inputContent); +@property(nonatomic, copy) void(^handleSecondInputContentUpdate)(NSString *inputContent); +@property(nonatomic, copy) void(^handleThirdInputContentUpdate)(NSString *inputContent); + +- (instancetype)initWithType:(LoginInputType)type; +- (NSString *)inputContent; +- (void)updateAreaCode:(NSString *)code; +- (NSString *)loadAreaCode; +- (void)startVerificationCountDown; +- (void)endVerificationCountDown; +- (void)updateBGColor:(UIColor *)color; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMLogin/View/CustomView/LoginInputItemView.m b/YuMi/Modules/YMLogin/View/CustomView/LoginInputItemView.m new file mode 100644 index 00000000..97d56c3c --- /dev/null +++ b/YuMi/Modules/YMLogin/View/CustomView/LoginInputItemView.m @@ -0,0 +1,289 @@ +// +// LoginInputItemView.m +// YuMi +// +// Created by P on 2025/3/14. +// + +#import "LoginInputItemView.h" + +static NSString *const kAreaCodePrefix = @"+"; + +@interface LoginInputItemView() + + +@end + +@implementation LoginInputItemView + +- (instancetype)initWithType:(LoginInputType)type { + if (self = [super init]) { + self.backgroundColor = [UIColor whiteColor]; + [self setCornerRadius:23]; + [self addSubview:self.inputTextField]; + + + self.inputType = type; + } + return self; +} + +- (void)setInputType:(LoginInputType)inputType { + _inputType = inputType; + switch (inputType) { + case LoginInputType_id: { + [self updatePlaceholder:YMLocalizedString(@"20.20.51_text_3")]; + self.inputTextField.keyboardType = UIKeyboardTypeNumberPad; +#if DEBUG + self.inputTextField.text = @"2356814"; +#endif + } + break; + case LoginInputType_email: { + [self updatePlaceholder:YMLocalizedString(@"20.20.51_text_4")]; + self.inputTextField.keyboardType = UIKeyboardTypeEmailAddress; +#if DEBUG + self.inputTextField.text = @"exzero@126.com"; +#endif + } + break; + case LoginInputType_phoneNum: { + [self updatePlaceholder:YMLocalizedString(@"20.20.51_text_5")]; + self.inputTextField.keyboardType = UIKeyboardTypePhonePad; + } + break; + case LoginInputType_password: { + [self updatePlaceholder:YMLocalizedString(@"20.20.51_text_6")]; + self.inputTextField.keyboardType = UIKeyboardTypeDefault; + self.inputTextField.secureTextEntry = YES; + } + case LoginInputType_createPassword: + break; + case LoginInputType_verificationCode: { + [self updatePlaceholder:YMLocalizedString(@"20.20.51_text_7")]; + self.inputTextField.keyboardType = UIKeyboardTypeDefault; + } + break; + case LoginInputType_confirmPassword: { + [self updatePlaceholder:YMLocalizedString(@"20.20.51_text_11")]; + self.inputTextField.keyboardType = UIKeyboardTypeDefault; + self.inputTextField.secureTextEntry = YES; + } + break; + default: + break; + } + + [self updateInputLayout]; +} + +- (void)updatePlaceholder:(NSString *)placeholder { + self.inputTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholder attributes:@{ + NSFontAttributeName: kFontRegular(14), + NSForegroundColorAttributeName: UIColorFromRGB(0xafb1b3) + }]; +} + +- (void)updateInputLayout { + switch (self.inputType) { + case LoginInputType_id: + case LoginInputType_email: + case LoginInputType_password: + case LoginInputType_createPassword: + { + [self.inputTextField mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self).insets(UIEdgeInsetsMake(12, 20, 12, 20)); + }]; + } + break; + case LoginInputType_phoneNum: { + [self insertAreaCodeButton]; + [self.inputTextField mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self.areaCodeButton.mas_trailing).offset(8); + make.bottom.top.mas_equalTo(self).inset(12); + make.trailing.mas_equalTo(self).offset(-12); + }]; + } + break; + case LoginInputType_verificationCode: { + [self insertVerificationCodeButton]; + [self.inputTextField mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self).offset(20); + make.bottom.top.mas_equalTo(self).inset(12); + make.trailing + .mas_equalTo(self.verificationCodeButton.mas_leading) + .offset(-20); + }]; + } + break; + default: + break; + } +} + +- (void)insertAreaCodeButton { + [self addSubview:self.areaCodeButton]; + [self.areaCodeButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self); + make.leading.mas_equalTo(13); + make.height.mas_equalTo(20); + }]; +} + +- (void)insertVerificationCodeButton { + [self addSubview:self.verificationCodeButton]; + [self.verificationCodeButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self); + make.trailing.mas_equalTo(-23); + make.height.mas_equalTo(20); + }]; +} + +- (NSString *)inputContent { + return self.inputTextField.text; +} + +- (void)updateAreaCode:(NSString *)code { + if (_areaCodeButton) { + [self.areaCodeButton setTitle:[NSString stringWithFormat:@"%@%@", kAreaCodePrefix, code] + forState:UIControlStateNormal]; + } +} + +- (NSString *)loadAreaCode { + NSString *code = [[self.areaCodeButton titleLabel] text]; + if ([code hasPrefix:kAreaCodePrefix]) { + [code stringByReplacingOccurrencesOfString:kAreaCodePrefix + withString:@""]; + } + return code; +} + +- (void)startVerificationCountDown { + self.verificationCountDown = 60; + @kWeakify(self); + self.verificationTimer = [NSTimer scheduledTimerWithTimeInterval:1 + repeats:YES + block:^(NSTimer * _Nonnull timer) { + @kStrongify(self); + [self updateVerificationCountDown]; + }]; +} + +- (void)endVerificationCountDown { + if (_verificationTimer) { + [self.verificationTimer invalidate]; + self.verificationTimer = nil; + } + self.verificationCodeButton.enabled = YES; +} + +- (void)updateBGColor:(UIColor *)color { + self.backgroundColor = color; +} + +#pragma mark - +- (void)handleVerificationCountDown { + if (_handleItemAction) { + self.handleItemAction(self.inputType); + } +} + +- (void)updateVerificationCountDown { + [self.verificationCodeButton setTitle:[NSString stringWithFormat:YMLocalizedString(@"20.20.51_text_9"), @(self.verificationCountDown)] + forState:UIControlStateDisabled]; + self.verificationCodeButton.enabled = NO; + self.verificationCountDown -= 1; + if (self.verificationCountDown < 0) { + [self endVerificationCountDown]; + } +} + +#pragma mark - +- (void)didTapAreaButton { + if (_handleItemAction) { + self.handleItemAction(self.inputType); + } +} + +- (void)didTapVerificationButton { + if (_handleItemAction) { + self.handleItemAction(self.inputType); + } +} + +#pragma mark - UITextFieldDelegate +- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { + NSString *updatedText = [textField.text stringByReplacingCharactersInRange:range withString:string]; + NSLog(@"当前文本:%@", updatedText); + switch (self.inputType) { + case LoginInputType_id: + case LoginInputType_email: + case LoginInputType_phoneNum: + if (_handleFirstInputContentUpdate) { + self.handleFirstInputContentUpdate(updatedText); + } + break; + case LoginInputType_password: + case LoginInputType_verificationCode: + if (_handleSecondInputContentUpdate) { + self.handleSecondInputContentUpdate(updatedText); + } + break; + case LoginInputType_confirmPassword: + if (_handleThirdInputContentUpdate) { + self.handleThirdInputContentUpdate(updatedText); + } + break; + default: + break; + } + return YES; +} + +#pragma mark - +- (UITextField *)inputTextField { + if (!_inputTextField) { + _inputTextField = [[UITextField alloc] init]; + _inputTextField.font = kFontMedium(14); + _inputTextField.textColor = UIColorFromRGB(0x313131); + _inputTextField.delegate = self; + } + return _inputTextField; +} + +- (UIButton *)areaCodeButton { + if (!_areaCodeButton) { + _areaCodeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_areaCodeButton.titleLabel setFont:kFontMedium(14)]; + [_areaCodeButton setTitle:[NSString getCountryCode] forState:UIControlStateNormal]; + [_areaCodeButton setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal]; + [_areaCodeButton setImage:kImage(@"login_page_area_arrow") forState:UIControlStateNormal]; + [_areaCodeButton addTarget:self + action:@selector(didTapAreaButton) + forControlEvents:UIControlEventTouchUpInside]; + if (isMSRTL()) { + [_areaCodeButton setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft]; + } else { + [_areaCodeButton setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; + } + } + return _areaCodeButton; +} + +- (UIButton *)verificationCodeButton { + if (!_verificationCodeButton) { + _verificationCodeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_verificationCodeButton.titleLabel setFont:kFontMedium(14)]; + [_verificationCodeButton setTitle:YMLocalizedString(@"20.20.51_text_8") forState:UIControlStateNormal]; + [_verificationCodeButton setTitleColor:UIColorFromRGB(0xff8c03) forState:UIControlStateNormal]; + [_verificationCodeButton setTitleColor:UIColorFromRGB(0xafb1b3) forState:UIControlStateDisabled]; + [_verificationCodeButton addTarget:self + action:@selector(didTapVerificationButton) + forControlEvents:UIControlEventTouchUpInside]; + } + return _verificationCodeButton; +} + + +@end diff --git a/YuMi/Modules/YMLogin/View/LoginTypesViewController.h b/YuMi/Modules/YMLogin/View/LoginTypesViewController.h new file mode 100644 index 00000000..b9abd01d --- /dev/null +++ b/YuMi/Modules/YMLogin/View/LoginTypesViewController.h @@ -0,0 +1,26 @@ +// +// LoginTypesViewController.h +// YuMi +// +// Created by P on 2025/3/11. +// + +#import "MvpViewController.h" +#import "LoginInputItemView.h" +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSUInteger, LoginDisplayType) { + LoginDisplayType_id, + LoginDisplayType_email, + LoginDisplayType_phoneNum, + LoginDisplayType_email_forgetPassword, + LoginDisplayType_phoneNum_forgetPassword, +}; + +@interface LoginTypesViewController : MvpViewController + +- (void)updateLoginType:(LoginDisplayType)type; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMLogin/View/LoginTypesViewController.m b/YuMi/Modules/YMLogin/View/LoginTypesViewController.m new file mode 100644 index 00000000..846421fb --- /dev/null +++ b/YuMi/Modules/YMLogin/View/LoginTypesViewController.m @@ -0,0 +1,427 @@ +// +// LoginTypesViewController.m +// YuMi +// +// Created by P on 2025/3/11. +// + +#import "LoginTypesViewController.h" +#import "LoginPresenter.h" +#import "XPLoginAraeViewController.h" +#import "LoginProtocol.h" +#import "PILoginManager.h" + +@interface LoginTypesViewController () + +@property(nonatomic, assign) LoginDisplayType type; +@property(nonatomic, strong) UILabel *titleLabel; +@property(nonatomic, strong) LoginInputItemView *firstLineInputView; +@property(nonatomic, strong) LoginInputItemView *secondLineInputView; +@property(nonatomic, strong) LoginInputItemView *thirdLineInputView; +@property(nonatomic, strong) UIButton *bottomActionButton; +@property(nonatomic, strong) UIButton *forgotPasswordButton; +@property(nonatomic, strong) UIStackView *stackView; + +@end + +@implementation LoginTypesViewController + +- (void)dealloc { + [self.secondLineInputView endVerificationCountDown]; +} + +- (BOOL)isHiddenNavBar { + return YES; +} + +- (LoginPresenter *)createPresenter { + return [[LoginPresenter alloc] init]; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + [self setupUI]; +} + +- (void)updateLoginType:(LoginDisplayType)type { + self.type = type; + [self setupInputArea]; +} + +- (void)setupUI { + [self setupDefaultUI]; + [self setupNavigationBar]; +} + +- (void)setupDefaultUI { + UIImageView *backagroundImageView = [[UIImageView alloc] initWithFrame:self.view.bounds]; + if (isMSRTL()) { + backagroundImageView.image = kImage(@"login_page_backage_ar"); + } else { + backagroundImageView.image = kImage(@"login_page_backage"); + } + [self.view addSubview:backagroundImageView]; + + UIImageView *hiImageView = [[UIImageView alloc] initWithImage:kImage(@"login_page_mail_HI")]; + [self.view addSubview:hiImageView]; + [hiImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(45); + make.top.mas_equalTo(111); + make.size.mas_equalTo(CGSizeMake(88, 45)); + }]; + + [self.view addSubview:self.titleLabel]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(45); + make.top.mas_equalTo(190); + }]; + + [self.view addSubview:self.stackView]; + [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(22); + make.leading.trailing.mas_equalTo(self.view).inset(40); + }]; +} + +- (void)setupNavigationBar { + UIButton *backButton = [self backButton]; + [self.view addSubview:backButton]; + [backButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self.view).offset(16); + make.top.mas_equalTo(self.view).offset(kStatusBarHeight); + make.size.mas_equalTo(CGSizeMake(22, 22)); + }]; +} + +- (void)setupInputArea { + switch (self.type) { + case LoginDisplayType_id: + [self setupIDInputArea]; + break; + case LoginDisplayType_email: + [self setupEmailInputArea]; + break; + case LoginDisplayType_phoneNum: + [self setupPhoneInputArea]; + break; + case LoginDisplayType_email_forgetPassword: + case LoginDisplayType_phoneNum_forgetPassword: + [self setupForgotPasswordArea]; + break; + default: + break; + } +} + +- (void)setupIDInputArea { + [self setupInpuArea:LoginInputType_id + second:LoginInputType_password + third:LoginInputType_none + action:LoginInputType_login + showForgetPassword:YES]; +} + +- (void)setupEmailInputArea { + [self setupInpuArea:LoginInputType_email + second:LoginInputType_verificationCode + third:LoginInputType_none + action:LoginInputType_login + showForgetPassword:NO]; +} + +- (void)setupPhoneInputArea { + [self setupInpuArea:LoginInputType_phoneNum + second:LoginInputType_verificationCode + third:LoginInputType_none + action:LoginInputType_login + showForgetPassword:NO]; +} + +- (void)setupForgotPasswordArea { + [self setupInpuArea:LoginInputType_phoneNum + second:LoginInputType_verificationCode + third:LoginInputType_confirmPassword + action:LoginInputType_confirm + showForgetPassword:NO]; +} + +- (void)setupInpuArea:(LoginInputType)first + second:(LoginInputType)second + third:(LoginInputType)third + action:(LoginInputType)action + showForgetPassword:(BOOL)showForgetPassword { + + @kWeakify(self); + + _firstLineInputView = [[LoginInputItemView alloc] initWithType:first]; + [self.firstLineInputView setHandleItemAction:^(LoginInputType inputType) { + @kStrongify(self); + if (inputType == LoginInputType_phoneNum) { + [self handleTapAreaCode]; + } + }]; + [self.firstLineInputView setHandleFirstInputContentUpdate:^(NSString *inputContent) { + @kStrongify(self); + [self checkActionButtonStatus]; + }]; + [self.stackView addArrangedSubview:self.firstLineInputView]; + [self.firstLineInputView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(46); + }]; + + _secondLineInputView = [[LoginInputItemView alloc] initWithType:second]; + [self.secondLineInputView setHandleItemAction:^(LoginInputType inputType) { + @kStrongify(self); + if (inputType == LoginInputType_verificationCode) { + if (self.type == LoginDisplayType_phoneNum) { + [self handleTapGetPhoneVerificationCode]; + } else if (self.type == LoginDisplayType_email) { + [self handleTapGetMailVerificationCode]; + } + } + }]; + [self.secondLineInputView setHandleSecondInputContentUpdate:^(NSString *inputContent) { + @kStrongify(self); + [self checkActionButtonStatus]; + }]; + [self.stackView addArrangedSubview:self.secondLineInputView]; + [self.secondLineInputView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(46); + }]; + + if (third != LoginInputType_none) { + _thirdLineInputView = [[LoginInputItemView alloc] initWithType:third]; + [self.thirdLineInputView setHandleThirdInputContentUpdate:^(NSString *inputContent) { + @kStrongify(self); + [self checkActionButtonStatus]; + }]; + [self.stackView addArrangedSubview:self.thirdLineInputView]; + [self.thirdLineInputView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(46); + }]; + } + + if (action != LoginInputType_none) { + if (action == LoginInputType_login) { + [_bottomActionButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController8") forState:UIControlStateNormal]; + [_bottomActionButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController8") forState:UIControlStateDisabled]; + } else if (action == LoginInputType_confirm) { + [_bottomActionButton setTitle:YMLocalizedString(@"20.20.51_text_10") forState:UIControlStateNormal]; + [_bottomActionButton setTitle:YMLocalizedString(@"20.20.51_text_10") forState:UIControlStateDisabled]; + } + [self.stackView addArrangedSubview:self.bottomActionButton]; + [self.bottomActionButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(46); + }]; + } + + if (showForgetPassword) { + [self.stackView addArrangedSubview:self.forgotPasswordButton]; + } +} + +#pragma mark - +- (void)didTapBack { + [self.navigationController popViewControllerAnimated:YES]; +} + +- (void)didTapActionButton { + [self.view endEditing:true]; + + switch (self.type) { + case LoginDisplayType_id: { + [self.presenter loginWithPhone:[self.firstLineInputView inputContent] + password:[self.secondLineInputView inputContent]]; + } + break; + case LoginDisplayType_phoneNum: { + [self.presenter loginWithPhone:[self.firstLineInputView inputContent] + code:[self.secondLineInputView inputContent] + phoneAreaCode:[self.firstLineInputView loadAreaCode]]; + } + break; + case LoginDisplayType_email: { + [self.presenter loginWithEmail:[self.firstLineInputView inputContent] + code:[self.secondLineInputView inputContent]]; + } + + default: + break; + } +} + +- (void)didTapForgotPasswordButton { + LoginTypesViewController *vc = [[LoginTypesViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + [vc updateLoginType:LoginDisplayType_phoneNum_forgetPassword]; +} + +- (void)handleTapAreaCode { + XPLoginAraeViewController *codeVC = [XPLoginAraeViewController new]; + codeVC.delegate = self; + [self.navigationController pushViewController:codeVC animated:YES]; +} + +- (void)handleTapGetPhoneVerificationCode { + NSString *phone = [self.firstLineInputView inputContent]; + if (phone.length == 0 ) { + [self showErrorToast:YMLocalizedString(@"XPLoginPhoneViewController0")]; + [self.secondLineInputView endVerificationCountDown]; + return; + } + + NSString *areaCode = [self.firstLineInputView loadAreaCode]; + [self.presenter phoneSmsCode:[NSString stringWithFormat:@"%@%@", areaCode,phone] + type:GetSmsType_Regist + phoneAreaCode:areaCode]; +} + +- (void)handleTapGetMailVerificationCode { + NSString *email = [self.firstLineInputView inputContent]; + if (email.length == 0 ) { + [self showErrorToast:YMLocalizedString(@"20.20.51_text_12")]; + [self.secondLineInputView endVerificationCountDown]; + return; + } + [self.presenter sendMailVerificationCode:email type:GetSmsType_Regist]; +} + +- (void)checkActionButtonStatus { + switch (self.type) { + case LoginDisplayType_id: + case LoginDisplayType_email: + case LoginDisplayType_phoneNum:{ + NSString *accountString = [self.firstLineInputView inputContent]; + NSString *codeString = [self.secondLineInputView inputContent]; + if (![NSString isEmpty:accountString] && ![NSString isEmpty:codeString]) { + self.bottomActionButton.enabled = YES; + } else { + self.bottomActionButton.enabled = NO; + } + } + break; + case LoginDisplayType_email_forgetPassword: + case LoginDisplayType_phoneNum_forgetPassword: { + NSString *accountString = [self.firstLineInputView inputContent]; + NSString *codeString = [self.secondLineInputView inputContent]; + NSString *passwordString = [self.thirdLineInputView inputContent]; + if (![NSString isEmpty:accountString] && ![NSString isEmpty:codeString] && ![NSString isEmpty:passwordString]) { + self.bottomActionButton.enabled = YES; + } else { + self.bottomActionButton.enabled = NO; + } + } + + default: + break; + } +} + +#pragma mark - XPLoginAraeViewControllerDelegate +- (void)chooseAreaCodeSuccess:(NSString *)code { + [self.firstLineInputView updateAreaCode:code]; +} + +- (void)loginSuccess { + [self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")]; + [PILoginManager loginWithVC:self isLoginPhone:NO]; +} + +- (void)loginFailWithMsg:(NSString *)msg { + +} + +#pragma mark - API presenter Delegate +- (void)phoneSmsCodeSuccess:(NSString *)message { + [self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController2")]; + [self.secondLineInputView startVerificationCountDown]; +} + +- (void)phoneSmsCodeFailure { + [self.secondLineInputView endVerificationCountDown]; +} + +- (void)emailCodeSucess:(NSString *)message { + [self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController2")]; + [self.secondLineInputView startVerificationCountDown]; +} + +- (void)emailCodeFailure { + [self.secondLineInputView endVerificationCountDown]; +} + +#pragma mark - +- (UIButton *)backButton { + UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom]; + [b setImage:[kImage(@"common_nav_back") ms_SetImageForRTL] + forState:UIControlStateNormal]; + [b addTarget:self + action:@selector(didTapBack) + forControlEvents:UIControlEventTouchUpInside]; + return b; +} + +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [UILabel labelInitWithText:YMLocalizedString(@"20.20.51_text_2") + font:kFontSemibold(20) + textColor:UIColorFromRGB(0x663c22)]; + } + return _titleLabel; +} + +- (UIButton *)bottomActionButton { + if (!_bottomActionButton) { + _bottomActionButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_bottomActionButton setCornerRadius:23]; + [_bottomActionButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController8") forState:UIControlStateNormal]; + [_bottomActionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + UIImage *normalBG = [UIImage gradientColorImageFromColors:@[ + UIColorFromRGB(0xe29030), + UIColorFromRGB(0xfcc074) + ] + gradientType:GradientTypeLeftToRight + imgSize:CGSizeMake(KScreenWidth-84, 46)] ; + UIImage *disableBG = [UIImage gradientColorImageFromColors:@[ + [UIColor colorWithRed:245/255.0 green:199/255.0 blue:129/255.0 alpha:1], + [UIColor colorWithRed:253/255.0 green:217/255.0 blue:154/255.0 alpha:1], + ] + gradientType:GradientTypeLeftToRight + imgSize:CGSizeMake(KScreenWidth-84, 46)] ; + [_bottomActionButton setBackgroundImage:normalBG forState:UIControlStateNormal]; + [_bottomActionButton setBackgroundImage:disableBG forState:UIControlStateDisabled]; + [_bottomActionButton addTarget:self + action:@selector(didTapActionButton) + forControlEvents:UIControlEventTouchUpInside]; + _bottomActionButton.enabled = NO; + } + return _bottomActionButton; +} + +- (UIButton *)forgotPasswordButton { + if (!_forgotPasswordButton) { + _forgotPasswordButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_forgotPasswordButton.titleLabel setFont:kFontRegular(12)]; + [_forgotPasswordButton setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal]; + [_forgotPasswordButton setTitle:YMLocalizedString(@"XPForgetPwdViewController3") forState:UIControlStateNormal]; + [_forgotPasswordButton setBackgroundColor:[UIColor clearColor]]; + [_forgotPasswordButton addTarget:self + action:@selector(didTapForgotPasswordButton) + forControlEvents:UIControlEventTouchUpInside]; + } + return _forgotPasswordButton; +} + +- (UIStackView *)stackView { + if (!_stackView) { + _stackView = [[UIStackView alloc] init]; + _stackView.axis = UILayoutConstraintAxisVertical; + _stackView.spacing = 24; + _stackView.distribution = UIStackViewDistributionFillEqually; + } + return _stackView; +} + +@end + diff --git a/YuMi/Modules/YMLogin/View/LoginViewController.h b/YuMi/Modules/YMLogin/View/LoginViewController.h new file mode 100644 index 00000000..24fb40af --- /dev/null +++ b/YuMi/Modules/YMLogin/View/LoginViewController.h @@ -0,0 +1,16 @@ +// +// LoginViewController.h +// YuMi +// +// Created by P on 2025/3/10. +// + +#import "MvpViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface LoginViewController : MvpViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMLogin/View/LoginViewController.m b/YuMi/Modules/YMLogin/View/LoginViewController.m new file mode 100644 index 00000000..ffd875a5 --- /dev/null +++ b/YuMi/Modules/YMLogin/View/LoginViewController.m @@ -0,0 +1,467 @@ +// +// LoginViewController.m +// YuMi +// +// Created by P on 2025/3/10. +// + +#import "LoginViewController.h" +#import "XPWebViewController.h" +#import "LoginPresenter.h" +#import "AESUtils.h" +#import "LoginTypesViewController.h" +#import "LoginProtocol.h" +#import "PILoginManager.h" +#import "PISwitchingEnvironmentVC.h" +#import "FeedBackViewController.h" + +NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; + +typedef NS_ENUM(NSUInteger, LoginType) { + LoginType_ID = 101, + LoginType_Email = 102, + LoginType_Google = 103, + LoginType_Apple = 104 +}; + +@interface LoginViewController () + +@property(nonatomic, strong) UIImageView *logoImageView; +@property(nonatomic, assign) BOOL lastPolicySelectedStatus; +@property(nonatomic, strong) UIButton *agreeButton; +@property(nonatomic, strong) YYLabel *policyLabel; +@property(nonatomic, strong) UIView *policyTips; + +///谷歌登录配置 +@property (nonatomic,strong) GIDConfiguration *configuration; + +@end + +@implementation LoginViewController + +- (LoginPresenter *)createPresenter { + return [[LoginPresenter alloc] init]; +} + +- (BOOL)isHiddenNavBar { + return YES; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + [self loadPolicySelectedStatus]; + [self setupUI]; +} + +- (void)setupUI { + [self setupBackground]; + [self setupNavigationBar]; + [self setupBottomPolicy]; + [self setupSMSLoginEntrcy]; + [self setupEntrcyButtons]; +} + +- (void)setupBackground { + [self.view addGradientBackgroundWithColors:@[ + UIColorFromRGB(0xfcf4df), + UIColorFromRGB(0xffd374) + ] + startPoint:CGPointMake(0.5, 0) + endPoint:CGPointMake(0.5, 1) + cornerRadius:0]; + + UIImageView *topImageView = [[UIImageView alloc] initWithImage:kImage(@"login_page_top")]; + topImageView.contentMode = UIViewContentModeScaleAspectFit; + [self.view addSubview:topImageView]; + [topImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.leading.trailing.mas_equalTo(self.view); + make.height.mas_equalTo(kGetScaleWidth(326)); + }]; + + [self.view addSubview:self.logoImageView]; + [self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.view); + make.centerY.mas_equalTo(topImageView.mas_bottom); + make.size.mas_equalTo(CGSizeMake(124, 48)); + }]; +} + +- (void)setupNavigationBar { +#if DEBUG + UIButton *debugButton = [self debugButton]; + [self.view addSubview:debugButton]; + [debugButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self.view).offset(16); + make.top.mas_equalTo(self.view).offset(kStatusBarHeight); + make.height.mas_equalTo(22); + make.width.mas_greaterThanOrEqualTo(84); + }]; +#endif + + UIButton *feedBackButton = [self feedBackButton]; + [self.view addSubview:feedBackButton]; + [feedBackButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.mas_equalTo(self.view).offset(-16); + make.top.mas_equalTo(self.view).offset(kStatusBarHeight); + make.height.mas_equalTo(22); + make.width.mas_greaterThanOrEqualTo(84); + }]; +} + +- (void)setupBottomPolicy { + UIStackView *stackView = [[UIStackView alloc] initWithArrangedSubviews:@[ + self.agreeButton, + self.policyLabel + ]]; + stackView.alignment = UIStackViewAlignmentCenter; + [self.view addSubview:stackView]; + [stackView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.view); + make.bottom.mas_equalTo(self.view).offset(-44); + make.height.mas_equalTo(34); + }]; + + [self.agreeButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(18,18)); + }]; +} + +- (void)setupSMSLoginEntrcy { + UIButton *smsLogin = [UIButton buttonWithType:UIButtonTypeCustom]; + [smsLogin setBackgroundImage:kImage(@"login_page_phone") forState:UIControlStateNormal]; + [smsLogin addTarget:self action:@selector(didTapSMS) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:smsLogin]; + [smsLogin mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.view); + make.bottom.mas_equalTo(self.view).offset(-104); + make.size.mas_equalTo(CGSizeMake(48, 48)); + }]; +} + +- (void)setupEntrcyButtons { + UIButton *idBUtton = [self entrcyButton:LoginType_ID tapSelector:@selector(didTapEntrcyButton:)]; + UIStackView *stackView = [[UIStackView alloc] initWithArrangedSubviews:@[ + idBUtton, + [self entrcyButton:LoginType_Email tapSelector:@selector(didTapEntrcyButton:)], + [self entrcyButton:LoginType_Google tapSelector:@selector(didTapEntrcyButton:)], + [self entrcyButton:LoginType_Apple tapSelector:@selector(didTapEntrcyButton:)], + ]]; + stackView.axis = UILayoutConstraintAxisVertical; + stackView.distribution = UIStackViewDistributionFillEqually; + stackView.spacing = 14; + [self.view addSubview:stackView]; + [stackView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.view); + make.top.mas_equalTo(self.logoImageView.mas_bottom).offset(34); + }]; + + [idBUtton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(294, 46)); + }]; +} + +- (UIButton *)entrcyButton:(LoginType)type tapSelector:(SEL)selector { + UIImageView *icon = [[UIImageView alloc] init]; + icon.contentMode = UIViewContentModeScaleAspectFill; + + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; + button.frame = CGRectMake(0, 0, 294, 46); + button.tag = type; + [button addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside]; + [button setCornerRadius:23]; + [button setBackgroundColor:[UIColor whiteColor]]; + [button.titleLabel setFont:kFontSemibold(14)]; + [button setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal]; + switch (type) { + case LoginType_ID:{ + [button setTitle:YMLocalizedString(@"1.0.37_text_26") forState:UIControlStateNormal]; + [icon setImage:kImage(@"login_page_id")]; + } + break; + case LoginType_Email:{ + [button setTitle:YMLocalizedString(@"20.20.51_text_1") forState:UIControlStateNormal]; + [icon setImage:kImage(@"login_page_mail")]; + } + break; + case LoginType_Google:{ + [button setTitle:YMLocalizedString(@"XPLoginViewController13") forState:UIControlStateNormal]; + [icon setImage:kImage(@"login_gmail")]; + } + break; + case LoginType_Apple:{ + [button setTitle:YMLocalizedString(@"XPLoginViewController12") forState:UIControlStateNormal]; + [icon setImage:kImage(@"mine_noble_center_apple")]; + } + break; + default: + break; + } + + [button addSubview:icon]; + [icon mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(button); + make.leading.mas_equalTo(15); + make.size.mas_equalTo(CGSizeMake(24, 24)); + }]; + + return button; +} + +#pragma mark - +- (void)didTapPolice:(NSString *)url { + XPWebViewController * webVC = [[XPWebViewController alloc] initWithRoomUID:nil]; + webVC.url = url; + [self.navigationController pushViewController:webVC animated:YES]; +} + +- (void)didTapAgreeButton { + self.agreeButton.selected = !self.agreeButton.isSelected; + [self updatePolicySelectedStatus:self.agreeButton.isSelected]; + [self hidePolicyTips]; +} + +- (void)didTapSMS { + if (self.lastPolicySelectedStatus == NO) { + [self displayPolicyTips]; + return; + } + + LoginTypesViewController *vc = [[LoginTypesViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + [vc updateLoginType:LoginDisplayType_phoneNum]; +} + +- (void)didTapEntrcyButton:(UIButton *)sender { + if (self.lastPolicySelectedStatus == NO) { + [self displayPolicyTips]; + return; + } + + switch (sender.tag) { + case LoginType_ID:{ + LoginTypesViewController *vc = [[LoginTypesViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + [vc updateLoginType:LoginDisplayType_id]; + } + break; + case LoginType_Email: { + LoginTypesViewController *vc = [[LoginTypesViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + [vc updateLoginType:LoginDisplayType_email]; + } + break; + case LoginType_Google: + [self.presenter thirdLoginByGoogleWithPresentingViewController:self + configuration:self.configuration]; + break; + case LoginType_Apple: + [self.presenter thirdLoginWithType:ThirdLoginType_Apple]; + break; + default: + break; + } +} + +- (void)didTapFeedback { + FeedBackViewController *vc = [[FeedBackViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; +} +#ifdef DEBUG +- (void)switchEnvironments { + PISwitchingEnvironmentVC *vc = [PISwitchingEnvironmentVC new]; + [self.navigationController pushViewController:vc animated:YES]; +} +#endif + +#pragma mark - LoginProtocol +- (void)loginThirdPartSuccess { + [self showSuccessToast:YMLocalizedString(@"XPLoginViewController4")]; + [PILoginManager loginWithVC:self isLoginPhone:NO]; +} + +#pragma mark - Polisy Status +- (void)loadPolicySelectedStatus { + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + self.lastPolicySelectedStatus = [defaults boolForKey:HadAgreePrivacy]; + self.agreeButton.selected = self.lastPolicySelectedStatus; +} + +- (void)updatePolicySelectedStatus:(BOOL)isSelected { + self.lastPolicySelectedStatus = isSelected; + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + [defaults setBool:isSelected forKey:HadAgreePrivacy]; +} + +- (void)displayPolicyTips { + [self.view addSubview:self.policyTips]; + [self.policyTips mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_equalTo(self.view).offset(-82); + make.leading.trailing.mas_equalTo(self.view).inset(22); + make.height.mas_equalTo(64); + }]; +} + +- (void)hidePolicyTips { + [self.policyTips removeFromSuperview]; +} + +#pragma mark - Lazy init +- (UIButton *)agreeButton { + if(!_agreeButton) { + _agreeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_agreeButton setImage:[UIImage imageNamed:@"login_page_privacy_selected"] forState:UIControlStateSelected]; + [_agreeButton setImage:[UIImage imageNamed:@"login_page_privacy_unselected"] forState:UIControlStateNormal]; + [_agreeButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10]; + [_agreeButton addTarget:self action:@selector(didTapAgreeButton) forControlEvents:UIControlEventTouchUpInside]; +// NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; +// NSString *hadAgree = [defaults objectForKey:HadAgreePrivacy]; +// if (hadAgree.length > 0) { +// _agreeBtn.selected = YES; +// } + } + return _agreeButton; +} + +- (YYLabel *)policyLabel { + if (!_policyLabel) { + _policyLabel = [[YYLabel alloc] init]; + _policyLabel.font = kFontRegular(12); + _policyLabel.numberOfLines = 0; + + NSMutableAttributedString *attString = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginViewController6")]; + attString.yy_color = UIColorFromRGB(0x7B7B7D); + NSRange userRange = [attString.string rangeOfString:YMLocalizedString(@"XPLoginViewController7")]; + [attString addAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x313131)} range:userRange]; + @kWeakify(self); + [attString yy_setTextHighlightRange:userRange color:nil backgroundColor:nil userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + @kStrongify(self); + // 跳转用户协议 + [self didTapPolice:URLWithType(kUserProtocalURL)]; + } longPressAction:nil]; + + NSRange andRange = [attString.string rangeOfString:YMLocalizedString(@"XPLoginViewController8")]; + [attString addAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x7B7B7D)} range:andRange]; + NSRange protocolRange = [attString.string rangeOfString:YMLocalizedString(@"XPLoginViewController9")]; + [attString addAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x313131)} range:protocolRange]; + + [attString yy_setTextHighlightRange:protocolRange color:nil backgroundColor:nil userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { + @kStrongify(self); + // 跳转隐私政策 + [self didTapPolice:URLWithType(kPrivacyURL)]; + } longPressAction:nil]; + + _policyLabel.attributedText = attString; + } + return _policyLabel; +} + +- (UIView *)policyTips { + if (!_policyTips) { + _policyTips = [[UIView alloc] init]; + [_policyTips setCornerRadius:8]; + [_policyTips setBackgroundColor:[UIColor colorWithWhite:0 alpha:0.5]]; + + UILabel *_policyTipsLabel = [[UILabel alloc] init]; + _policyTipsLabel.text = YMLocalizedString(@"XPLoginViewController11"); + _policyTipsLabel.font = kFontRegular(12); + _policyTipsLabel.textColor = UIColor.whiteColor; + _policyTipsLabel.numberOfLines = 0; + _policyTipsLabel.textAlignment = NSTextAlignmentCenter; + + [_policyTips addSubview:_policyTipsLabel]; + [_policyTipsLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(_policyTips).insets(UIEdgeInsetsMake(8, 12, 8, 12)); + }]; + } + return _policyTips; +} + +- (GIDConfiguration *)configuration{ + if (!_configuration){ + static dispatch_once_t onceToken; + static NSString *decryptedNumber; + dispatch_once(&onceToken, ^{ + decryptedNumber = [AESUtils aesDecrypt:@"ScLBu7ctIiyGCKPro3Jj6XMdsdCCpNT9L4wyjHEF+bguqubkXNSayFBGMKmoDwe1hjfAc958XSaBdMyEaFXLO38Bwq3xURYVNpgEM4b14zg="]; + }); + _configuration = [[GIDConfiguration alloc] initWithClientID:decryptedNumber]; + } + return _configuration; +} + +- (UIImageView *)logoImageView { + if (!_logoImageView) { + _logoImageView = [[UIImageView alloc] initWithImage:kImage(@"login_page_logo")]; + } + return _logoImageView; +} + +- (UIButton *)feedBackButton { + UIButton *feedBackButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [feedBackButton setTitle:YMLocalizedString(@"XPMineFeedbackViewController0") forState:UIControlStateNormal]; + [feedBackButton setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal]; + feedBackButton.titleLabel.font = kFontRegular(12); + [feedBackButton setBackgroundImage:[[UIImage imageWithColor:[UIColor whiteColor]] imageByApplyingAlpha:0.5] + forState:UIControlStateNormal]; + [feedBackButton setCornerRadius:10.5]; + [feedBackButton addTarget:self + action:@selector(didTapFeedback) + forControlEvents:UIControlEventTouchUpInside]; + [feedBackButton enlargeTouchArea:UIEdgeInsetsMake(10, 10, 10, 10)]; + return feedBackButton; +} + +#if DEBUG +- (UIButton *)debugButton { + UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom]; + b.frame = CGRectMake(0, 0, 84, 22); + [b setTitle:@"切换环境" forState:UIControlStateNormal]; + [b setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; + [self.view addSubview:b]; + [b addTarget:self action:@selector(switchEnvironments) forControlEvents:UIControlEventTouchUpInside]; + + + CAGradientLayer *gradientLayer = [CAGradientLayer layer]; + gradientLayer.frame = b.bounds; + gradientLayer.colors = @[ + (id)[UIColor redColor].CGColor, + (id)[UIColor blueColor].CGColor, + (id)[UIColor greenColor].CGColor + ]; + gradientLayer.startPoint = CGPointMake(0, 0.5); + gradientLayer.endPoint = CGPointMake(1, 0.5); + [b.layer addSublayer:gradientLayer]; + @kWeakify(self); + [NSTimer scheduledTimerWithTimeInterval:0.1 + repeats:YES + block:^(NSTimer * _Nonnull timer) { + @kStrongify(self); + if (!self) { + return; + } + NSArray *fromColors = gradientLayer.colors; + NSArray *toColors = [self shiftedColorsFromColors:fromColors]; + CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"colors"]; + animation.fromValue = fromColors; + animation.toValue = toColors; + animation.duration = 0.1; + animation.fillMode = kCAFillModeForwards; + animation.removedOnCompletion = NO; + [gradientLayer addAnimation:animation forKey:@"colorChange"]; + gradientLayer.colors = toColors; + }]; + + return b; +} + +- (NSArray *)shiftedColorsFromColors:(NSArray *)colors { + NSMutableArray *mutableColors = [colors mutableCopy]; + id firstColor = [mutableColors firstObject]; + [mutableColors removeObjectAtIndex:0]; + [mutableColors addObject:firstColor]; + return [mutableColors copy]; +} +#endif + + + +@end diff --git a/YuMi/Modules/YMLogin/View/NewLogin/XPLoginPhoneViewController.m b/YuMi/Modules/YMLogin/View/NewLogin/XPLoginPhoneViewController.m index 43c05d4d..c6a19979 100644 --- a/YuMi/Modules/YMLogin/View/NewLogin/XPLoginPhoneViewController.m +++ b/YuMi/Modules/YMLogin/View/NewLogin/XPLoginPhoneViewController.m @@ -227,14 +227,11 @@ #pragma mark - LoginVerifCodeProtocol - (void)loginWithPhoenSuccess{ [XNDJTDDLoadingTool hideOnlyView:self.view]; - [[NSUserDefaults standardUserDefaults]setValue:@(ThirdLoginType_Phone) forKey:@"kLoginSuccessType"]; - [[NSUserDefaults standardUserDefaults]synchronize]; [self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")]; [PILoginManager loginWithVC:self isLoginPhone:YES]; } - (void)loginSuccess { [XNDJTDDLoadingTool hideOnlyView:self.view]; - [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"kLoginSuccessType"]; [self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")]; [PILoginManager loginWithVC:self isLoginPhone:NO]; } diff --git a/YuMi/Modules/YMLogin/View/NewLogin/XPLoginViewController.m b/YuMi/Modules/YMLogin/View/NewLogin/XPLoginViewController.m index 6237981f..daf6f9c7 100644 --- a/YuMi/Modules/YMLogin/View/NewLogin/XPLoginViewController.m +++ b/YuMi/Modules/YMLogin/View/NewLogin/XPLoginViewController.m @@ -34,7 +34,7 @@ #import "IAPManager.h" UIKIT_EXTERN NSString * const kYouMiNumberCountKey; -NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; +NSString * const _HadAgreePrivacy = @"HadAgreePrivacy"; @interface XPLoginViewController () ///背景 @@ -108,6 +108,15 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; return YES; } +- (instancetype)init +{ + self = [super init]; + if (self) { + + } + return self; +} + - (void)viewDidLoad { [super viewDidLoad]; [self createUI]; @@ -154,7 +163,7 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; - (void)createUI { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults setObject:@"hadAgree" forKey:HadAgreePrivacy]; + [defaults setObject:@"hadAgree" forKey:_HadAgreePrivacy]; [defaults synchronize]; self.view.backgroundColor = [UIColor whiteColor]; @@ -320,35 +329,6 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; make.width.mas_equalTo(kGetScaleWidth(295)); make.height.mas_equalTo(kGetScaleWidth(46)); }]; - - id type = [[NSUserDefaults standardUserDefaults]valueForKey:@"kLoginSuccessType"]; - if(type != nil){ - UIButton *typeButton ; - if([type intValue] == ThirdLoginType_Apple){ - typeButton = self.appleButton; - }else if([type intValue] == ThirdLoginType_Gmail){ - typeButton = self.googleButtonView; - } -// else if([type intValue] == ThirdLoginType_FB){ -// typeButton = self.fbButtonView; -// }else if([type intValue] == ThirdLoginType_Line){ -// typeButton = self.lineButtonView; -// } -// if(typeButton == nil){ -// return; -// } -// [self.view addSubview:self.nextView]; -// [self.nextView addSubview:self.nextLabel]; -// [self.nextView mas_makeConstraints:^(MASConstraintMaker *make) { -// make.trailing.mas_equalTo(-kGetScaleWidth(28)); -// make.width.mas_equalTo(kGetScaleWidth(70)); -// make.height.mas_equalTo(kGetScaleWidth(24)); -// make.centerY.equalTo(typeButton.mas_top); -// }]; -// [self.nextLabel mas_makeConstraints:^(MASConstraintMaker *make) { -// make.edges.equalTo(self.nextView); -// }]; - } [self.feedBackButton mas_makeConstraints:^(MASConstraintMaker *make) { make.trailing.mas_equalTo(-15); @@ -402,7 +382,6 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; return; } [self.presenter thirdLoginWithType:type]; - } else { [UIView animateWithDuration:0.5 animations:^{ self.authBubbleView.alpha = 1.0; @@ -415,16 +394,16 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; self.agreeBtn.selected = !self.agreeBtn.selected; if (self.agreeBtn.isSelected) { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults setObject:@"hadAgree" forKey:HadAgreePrivacy]; + [defaults setObject:@"hadAgree" forKey:_HadAgreePrivacy]; [defaults synchronize]; [UIView animateWithDuration:0.5 animations:^{ self.authBubbleView.alpha = 0.0; }]; } else { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSString * hadAgree = [defaults stringForKey:HadAgreePrivacy]; + NSString * hadAgree = [defaults stringForKey:_HadAgreePrivacy]; if (hadAgree.length > 0) { - [defaults removeObjectForKey:HadAgreePrivacy]; + [defaults removeObjectForKey:_HadAgreePrivacy]; } } } @@ -556,8 +535,6 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; #pragma mark - LoginVerifCodeProtocol - (void)loginWithPhoenSuccess{ [XNDJTDDLoadingTool hideOnlyView:self.view]; - [[NSUserDefaults standardUserDefaults]setValue:@(ThirdLoginType_Phone) forKey:@"kLoginSuccessType"]; - [[NSUserDefaults standardUserDefaults]synchronize]; [self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")]; [PILoginManager loginWithVC:self isLoginPhone:YES]; } @@ -565,7 +542,6 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; - (void)loginSuccess { [self.codeInputView cancelTimer]; [XNDJTDDLoadingTool hideOnlyView:self.view]; - [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"kLoginSuccessType"]; [self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")]; [PILoginManager loginWithVC:self isLoginPhone:NO]; } @@ -589,7 +565,7 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; [_agreeBtn setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10]; [_agreeBtn addTarget:self action:@selector(agreeBtnClicked) forControlEvents:UIControlEventTouchUpInside]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSString *hadAgree = [defaults objectForKey:HadAgreePrivacy]; + NSString *hadAgree = [defaults objectForKey:_HadAgreePrivacy]; if (hadAgree.length > 0) { _agreeBtn.selected = YES; } diff --git a/YuMi/Modules/YMMine/Model/XPMineSettingItemModel.h b/YuMi/Modules/YMMine/Model/XPMineSettingItemModel.h index 87cff74b..b3d590da 100644 --- a/YuMi/Modules/YMMine/Model/XPMineSettingItemModel.h +++ b/YuMi/Modules/YMMine/Model/XPMineSettingItemModel.h @@ -10,6 +10,7 @@ NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSInteger, XPMineSettingItemType){ + XPMineSettingItemType_Email, ///邮箱 XPMineSettingItemType_Phone, ///手机号 XPMineSettingItemType_Pay_Password,///支付密码 ///登录密码 diff --git a/YuMi/Modules/YMMine/Presenter/XPMineSettingPresent.m b/YuMi/Modules/YMMine/Presenter/XPMineSettingPresent.m index cc8f88ec..08c37a2c 100644 --- a/YuMi/Modules/YMMine/Presenter/XPMineSettingPresent.m +++ b/YuMi/Modules/YMMine/Presenter/XPMineSettingPresent.m @@ -29,6 +29,7 @@ @interface XPMineSettingPresent () ///手机号 @property (nonatomic,strong) XPMineSettingItemModel *phoneItem; +@property (nonatomic,strong) XPMineSettingItemModel *emailItem; ///支付密码 @property (nonatomic,strong) XPMineSettingItemModel *payItem; ///登录密码 @@ -52,8 +53,15 @@ self.phoneItem.subTitle = userinfo.isBindPhone ? userinfo.phone : YMLocalizedString(@"XPMineSettingPresent0"); self.payItem.subTitle = userinfo.isBindPaymentPwd ? YMLocalizedString(@"XPMineSettingPresent26") : YMLocalizedString(@"XPMineSettingPresent2"); } else { + XPMineSettingItemModel *emailItem = [[XPMineSettingItemModel alloc] init]; + emailItem.title = YMLocalizedString(@"20.20.51_text_13"); + emailItem.subTitle = ![NSString isEmpty:userinfo.email] ? userinfo.email : YMLocalizedString(@"XPMineSettingPresent4"); + emailItem.type = XPMineSettingItemType_Email; + self.emailItem = emailItem; + + XPMineSettingItemModel * phoneItem = [[XPMineSettingItemModel alloc] init]; - phoneItem.title = YMLocalizedString(@"XPMineSettingPresent3"); + phoneItem.title = YMLocalizedString(@"20.20.51_text_14"); phoneItem.subTitle = userinfo.isBindPhone ? userinfo.phone : YMLocalizedString(@"XPMineSettingPresent4"); phoneItem.type = XPMineSettingItemType_Phone; self.phoneItem = phoneItem; @@ -125,7 +133,7 @@ vipItem.subTitle = @""; vipItem.type = XPMineSettingItemType_VIP; - NSArray * oneSection = @[phoneItem]; + NSArray * oneSection = @[emailItem, phoneItem]; NSArray * twoSection = @[loginItem, payItem, vipItem, notificaItem, shieldItem, blackListItem, languageItem]; NSArray * threeSection = @[privacyItem]; NSArray * fourthSection = @[helperItem, clearMemoryItem, updateItem, aboutusItem]; diff --git a/YuMi/Modules/YMMine/View/Friend/XPMineFansViewController.m b/YuMi/Modules/YMMine/View/Friend/XPMineFansViewController.m index 278fbf2b..ff977c68 100644 --- a/YuMi/Modules/YMMine/View/Friend/XPMineFansViewController.m +++ b/YuMi/Modules/YMMine/View/Friend/XPMineFansViewController.m @@ -140,7 +140,6 @@ [self showSuccessToast:YMLocalizedString(@"XPMineFansViewController2")]; [self.tableView reloadData]; }); - } #pragma mark - UITableViewDelegate And UITableViewDataSource diff --git a/YuMi/Modules/YMMine/View/Setting/XPMineSettingViewController.m b/YuMi/Modules/YMMine/View/Setting/XPMineSettingViewController.m index 67b7fc3b..ed8a50aa 100644 --- a/YuMi/Modules/YMMine/View/Setting/XPMineSettingViewController.m +++ b/YuMi/Modules/YMMine/View/Setting/XPMineSettingViewController.m @@ -44,7 +44,7 @@ ///不同模块的VC #import "XPWebViewController.h" #import "XPLoginVerifBindPhoneViewController.h" -#import "XPLoginBindPhoneResultViewController.h" +#import "AccountBindingViewController.h" #import "VipSettingViewController.h" @@ -127,19 +127,28 @@ - (void)pushViewControllerWithType:(XPMineSettingItemType)type { switch (type) { + case XPMineSettingItemType_Email:{ + AccountBindingViewController *bindingVC = [[AccountBindingViewController alloc] initWithType:BindingDisplayType_email + currentBindingAccount:self.userInfo.email]; + [self.navigationController pushViewController:bindingVC animated:YES]; + } + break; case XPMineSettingItemType_Phone: { + AccountBindingViewController *bindingVC = [[AccountBindingViewController alloc] initWithType:BindingDisplayType_phoneNum + currentBindingAccount:self.userInfo.phone]; + [self.navigationController pushViewController:bindingVC animated:YES]; // 绑定手机 - if (self.userInfo.isBindPhone) { // 如果已经绑定 - XPLoginBindPhoneResultViewController *vc = [[XPLoginBindPhoneResultViewController alloc] init]; - vc.userInfo = _userInfo; - [self.navigationController pushViewController:vc animated:YES]; - }else { - XPLoginVerifBindPhoneViewController *vc = [[XPLoginVerifBindPhoneViewController alloc] init]; - vc.bindingPhoneNumType = XPBindingPhoneNumTypeNormal; - vc.userInfo = _userInfo; - [self.navigationController pushViewController:vc animated:YES]; - } +// if (self.userInfo.isBindPhone) { // 如果已经绑定 +// XPLoginBindPhoneResultViewController *vc = [[XPLoginBindPhoneResultViewController alloc] init]; +// vc.userInfo = _userInfo; +// [self.navigationController pushViewController:vc animated:YES]; +// }else { +// XPLoginVerifBindPhoneViewController *vc = [[XPLoginVerifBindPhoneViewController alloc] init]; +// vc.bindingPhoneNumType = XPBindingPhoneNumTypeNormal; +// vc.userInfo = _userInfo; +// [self.navigationController pushViewController:vc animated:YES]; +// } } break; case XPMineSettingItemType_Pay_Password: diff --git a/YuMi/Modules/YMMine/View/XPSimpleMineHeaderView.m b/YuMi/Modules/YMMine/View/XPSimpleMineHeaderView.m index 9c95c9a8..9bdb0980 100644 --- a/YuMi/Modules/YMMine/View/XPSimpleMineHeaderView.m +++ b/YuMi/Modules/YMMine/View/XPSimpleMineHeaderView.m @@ -136,7 +136,6 @@ NSMutableAttributedString *browseAttrStr = [[NSMutableAttributedString alloc] initWithString:browseStr]; [browseAttrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16 weight:UIFontWeightMedium] range:NSMakeRange(browse.length, browseStr.length-browse.length)]; [self.browseBtn setAttributedTitle:browseAttrStr forState:UIControlStateNormal]; - } } diff --git a/YuMi/Modules/YMMonents/View/SubViews/XPMomentsTooBarView.m b/YuMi/Modules/YMMonents/View/SubViews/XPMomentsTooBarView.m index e33be524..b4275fa2 100644 --- a/YuMi/Modules/YMMonents/View/SubViews/XPMomentsTooBarView.m +++ b/YuMi/Modules/YMMonents/View/SubViews/XPMomentsTooBarView.m @@ -19,6 +19,8 @@ #import "XPWebViewController.h" #import "XCCurrentVCStackManager.h" +#import "ShareHelder.h" + @interface XPMomentsTooBarView () ///喜欢的容器 @property (nonatomic,strong) UIView * likeView; @@ -192,11 +194,17 @@ }]; [TTPopup actionSheetWithItems:@[action1]]; } else { + NSString * url= [NSString stringWithFormat:@"%@?reportUid=%@&source=%@", URLWithType(kReportRoomURL),self.momentsInfo.uid, @"WORLDDYNAMIC"]; + [ShareHelder shareImage:kImage(@"luck_package_bag_lv4") + url:url + fromController:[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController]; + + return; TTActionSheetConfig *action = [TTActionSheetConfig normalTitle:YMLocalizedString(@"XPMonentsTooBarView8") clickAction:^{ - if (self.delegate && [self.delegate respondsToSelector:@selector(XPMomentsTooBarView:didClickShielding:)]) { - [self.delegate XPMomentsTooBarView:self didClickShielding:self.momentsInfo]; - } - }]; + if (self.delegate && [self.delegate respondsToSelector:@selector(XPMomentsTooBarView:didClickShielding:)]) { + [self.delegate XPMomentsTooBarView:self didClickShielding:self.momentsInfo]; + } + }]; TTActionSheetConfig *black = [TTActionSheetConfig normalTitle:YMLocalizedString(@"XPMineUserInfoViewController1") clickAction:^{ [self addOrRemoveBlack:NO uid:self.momentsInfo.uid]; diff --git a/YuMi/Modules/YMTabbar/Api/Api+Main.h b/YuMi/Modules/YMTabbar/Api/Api+Main.h index cbdef686..cbe72789 100644 --- a/YuMi/Modules/YMTabbar/Api/Api+Main.h +++ b/YuMi/Modules/YMTabbar/Api/Api+Main.h @@ -13,10 +13,6 @@ NS_ASSUME_NONNULL_BEGIN + (void)requestTicket:(HttpRequestHelperCompletion)completion access_token:(NSString *)accessToken issue_type:(NSString *)issueType; - -/// 巨量广告回调 参数中有一个id 是系统的关键字 不知道怎么使用上面的那种方法构建参数 -+ (void)appInitObserverJuliangAd:(HttpRequestHelperCompletion)complection; - /// 初始化配置 /// @param complection 完成 + (void)clientInitConfig:(HttpRequestHelperCompletion)complection; diff --git a/YuMi/Modules/YMTabbar/Api/Api+Main.m b/YuMi/Modules/YMTabbar/Api/Api+Main.m index 73770a88..d939ab62 100644 --- a/YuMi/Modules/YMTabbar/Api/Api+Main.m +++ b/YuMi/Modules/YMTabbar/Api/Api+Main.m @@ -17,36 +17,6 @@ [self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, accessToken, issueType, nil]; } - -/// 巨量广告回调 参数中有一个id 是系统的关键字 不知道怎么使用上面的那种方法构建参数 -+ (void)appInitObserverJuliangAd:(HttpRequestHelperCompletion)complection { - NSMutableDictionary * params = [NSMutableDictionary dictionary]; - /// @param complection 完成 - /// @param evenType //事件类型 0:激活 - /// @param idfa idfa - /// @param idfaMd5 idfa的MD5 - /// @param ip ip - /// @param muid iOS:取idfa原值 - /// @param fid idfa - /// @param platOs 1 - [params safeSetObject:@"0" forKey:@"evenType"]; - if ([YYUtility idfa].length > 0) { - [params safeSetObject:[YYUtility idfa] forKey:@"idfa"]; - [params safeSetObject:[[YYUtility idfa] MD5String] forKey:@"idfaMd5"]; - [params safeSetObject:[YYUtility idfa] forKey:@"muid"];//iOS:取idfa原值 - [params safeSetObject:[YYUtility idfa] forKey:@"id"]; - } - - if ([YYUtility ipAddress].length > 0) { - [params safeSetObject:[YYUtility ipAddress] forKey:@"ip"]; - } - [params safeSetObject:@(1) forKey:@"platOs"]; - [params safeSetObject:@"" forKey:@"imei"]; - [params safeSetObject:@"" forKey:@"ua"]; - NSString * fang = [NSString stringFromBase64String:@"anVsaWFuZy9hZC9hY3RpdmVUcmFjaw=="];///juliang/ad/activeTrack - [HttpRequestHelper request:fang method:HttpRequestHelperMethodPOST params:params completion:complection]; -} - /// 初始化配置 /// @param complection 完成 + (void)clientInitConfig:(HttpRequestHelperCompletion)complection { diff --git a/YuMi/Modules/YMTabbar/Presenter/MainPresenter.h b/YuMi/Modules/YMTabbar/Presenter/MainPresenter.h index 0ae8946a..a5af102d 100644 --- a/YuMi/Modules/YMTabbar/Presenter/MainPresenter.h +++ b/YuMi/Modules/YMTabbar/Presenter/MainPresenter.h @@ -14,11 +14,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)autoLogin; - (void)loginNIM; - (void)getUserInfo; -/// 检查是否有未消费的内购订单 -//- (void)checkTranscation; - -/// 巨量广告 -- (void)juliandAdCallBackApi; ///获取邀请人信息 - (void)checkInviteUserInfo:(NSString *)inviteCode; diff --git a/YuMi/Modules/YMTabbar/Presenter/MainPresenter.m b/YuMi/Modules/YMTabbar/Presenter/MainPresenter.m index 61edc830..7505c0e5 100644 --- a/YuMi/Modules/YMTabbar/Presenter/MainPresenter.m +++ b/YuMi/Modules/YMTabbar/Presenter/MainPresenter.m @@ -73,38 +73,6 @@ static NSString * kUpdateVersionNum = @"kUpdateVersionNum"; }] uid:[[AccountInfoStorage instance] getUid]]; } -// MARK: 使用 IAPManager 替代 -- (void)checkTranscation { - NSString * uid = [AccountInfoStorage instance].getUid; - NSString * ticket = [AccountInfoStorage instance].getTicket; - NSArray * array = [RechargeStorage getAllReceiptsWithUid:uid]; - if (array == nil || array.count <= 0) { - return; - } - for (NSDictionary *transcation in array) { - NSString *orderId = transcation[@"orderId"]; - NSString *transcationId = transcation[@"transcationId"]; - ///二次验证 - [Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { - if (code == 200) { - NSString * uid = [AccountInfoStorage instance].getUid; - [RechargeStorage delegateTransactionId:transcationId uid:uid]; - } - - } chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket]; - } - -} - - -/// 巨量广告 -- (void)juliandAdCallBackApi { - [Api appInitObserverJuliangAd:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { - ///不需要回调 - }]; -} - - ///获取邀请人信息 - (void)checkInviteUserInfo:(NSString *)inviteCode { [Api checkInviteUserInRoom:[self createHttpCompletion:^(BaseModel * _Nonnull data) { diff --git a/YuMi/Modules/YMTabbar/View/TabbarViewController.m b/YuMi/Modules/YMTabbar/View/TabbarViewController.m index fdd59263..28b0aadd 100644 --- a/YuMi/Modules/YMTabbar/View/TabbarViewController.m +++ b/YuMi/Modules/YMTabbar/View/TabbarViewController.m @@ -55,7 +55,7 @@ ///VC #import "TabbarViewController.h" #import "XPBlankViewController.h" -#import "XPLoginViewController.h" +#import "LoginViewController.h" #import "BaseNavigationController.h" #import "LoginBindPhoneViewController.h" #import "LoginFullInfoViewController.h" @@ -448,7 +448,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey; #pragma mark - BaseMvpProtocol - (void)tokenInvalid { - XPLoginViewController *lvc = [[XPLoginViewController alloc] init]; + LoginViewController *lvc = [[LoginViewController alloc] init]; BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:lvc]; nav.modalPresentationStyle = UIModalPresentationFullScreen; kWindow.rootViewController = nav; diff --git a/YuMi/Structure/MVP/Model/UserInfoModel.h b/YuMi/Structure/MVP/Model/UserInfoModel.h index 8185c161..fe72bd74 100644 --- a/YuMi/Structure/MVP/Model/UserInfoModel.h +++ b/YuMi/Structure/MVP/Model/UserInfoModel.h @@ -64,6 +64,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic , assign) NSInteger uid; @property (nonatomic , assign) NSInteger defUser; @property (nonatomic , copy) NSString * phone; +@property (nonatomic , copy) NSString * email; @property (nonatomic , copy) NSString * nick; @property (nonatomic , assign) NSInteger remainDay; @property (nonatomic , copy) NSString * avatar; diff --git a/YuMi/Structure/MVP/Presenter/BaseMvpPresenter.m b/YuMi/Structure/MVP/Presenter/BaseMvpPresenter.m index 2c51a53b..8ce10809 100644 --- a/YuMi/Structure/MVP/Presenter/BaseMvpPresenter.m +++ b/YuMi/Structure/MVP/Presenter/BaseMvpPresenter.m @@ -9,7 +9,7 @@ #import "AccountInfoStorage.h" #import #import "ClientConfig.h" -#import "XPLoginViewController.h" +#import "LoginViewController.h" #import "BaseNavigationController.h" @interface BaseMvpPresenter() @@ -143,7 +143,7 @@ } - (void)tokenInvalid { - XPLoginViewController *loginVC = [[XPLoginViewController alloc] init]; + LoginViewController *loginVC = [[LoginViewController alloc] init]; BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:loginVC]; nav.modalPresentationStyle = UIModalPresentationFullScreen; kWindow.rootViewController = nav; diff --git a/YuMi/Structure/MVP/View/MvpViewController.m b/YuMi/Structure/MVP/View/MvpViewController.m index 6619ccda..34c532cf 100644 --- a/YuMi/Structure/MVP/View/MvpViewController.m +++ b/YuMi/Structure/MVP/View/MvpViewController.m @@ -8,7 +8,6 @@ #import "MvpViewController.h" #import "BaseMvpProtocol.h" #import "BaseMvpPresenter.h" -#import "XPLoginViewController.h" #import "BaseNavigationController.h" #import "LoginFullInfoViewController.h" #import "XPWebViewController.h" diff --git a/YuMi/ar.lproj/Localizable.strings b/YuMi/ar.lproj/Localizable.strings index d2de3063..3f0b860b 100644 --- a/YuMi/ar.lproj/Localizable.strings +++ b/YuMi/ar.lproj/Localizable.strings @@ -4127,3 +4127,20 @@ ineHeadView12" = "الحمل"; "1.0.37_text_50" = "تم وضع الكونزات في المحفظة!"; "1.0.37_text_51" = "تم وضع الهدايا في الحقيبة!"; "1.0.37_text_52" = "لا يمكنك استخدام هذه الميزة."; + +"20.20.51_text_1" = "Email 登入"; +"20.20.51_text_2" = "Welcome to MoliStar"; +"20.20.51_text_3" = "Please enter ID"; +"20.20.51_text_4" = "Please enter email"; +"20.20.51_text_5" = "Please enter your phone number"; +"20.20.51_text_6" = "Please enter password"; +"20.20.51_text_7" = "Please enter verification code"; +"20.20.51_text_8" = "Get"; +"20.20.51_text_9" = "%@s"; +"20.20.51_text_10" = "Comfirm"; +"20.20.51_text_11" = "6-16 Digits + English Letters"; +"20.20.51_text_12" = "Please enter a correct email address"; +"20.20.51_text_13" = "Email Binding"; +"20.20.51_text_14" = "Mobile Binding"; +"20.20.51_text_15" = "Account Verification"; +"20.20.51_text_16" = "For the security of your account, you need to enter verification code."; diff --git a/YuMi/en.lproj/Localizable.strings b/YuMi/en.lproj/Localizable.strings index 8f6266d2..2bc475a9 100644 --- a/YuMi/en.lproj/Localizable.strings +++ b/YuMi/en.lproj/Localizable.strings @@ -3909,3 +3909,20 @@ "1.0.37_text_50" = "Coins have been put into the wallet!"; "1.0.37_text_51" = "Gifts have been put into the bag!"; "1.0.37_text_52" = "Your cannot use this feature."; + +"20.20.51_text_1" = "Email 登入"; +"20.20.51_text_2" = "Welcome to MoliStar"; +"20.20.51_text_3" = "Please enter ID"; +"20.20.51_text_4" = "Please enter email"; +"20.20.51_text_5" = "Please enter your phone number"; +"20.20.51_text_6" = "Please enter password"; +"20.20.51_text_7" = "Please enter verification code"; +"20.20.51_text_8" = "Get"; +"20.20.51_text_9" = "%@s"; +"20.20.51_text_10" = "Comfirm"; +"20.20.51_text_11" = "6-16 Digits + English Letters"; +"20.20.51_text_12" = "Please enter a correct email address"; +"20.20.51_text_13" = "Email Binding"; +"20.20.51_text_14" = "Mobile Binding"; +"20.20.51_text_15" = "Account Verification"; +"20.20.51_text_16" = "For the security of your account, you need to enter verification code."; diff --git a/YuMi/tr.lproj/Localizable.strings b/YuMi/tr.lproj/Localizable.strings index 3493a553..ead71808 100644 --- a/YuMi/tr.lproj/Localizable.strings +++ b/YuMi/tr.lproj/Localizable.strings @@ -3703,3 +3703,20 @@ "1.0.37_text_50" = "Cüzdana paralar konuldu!"; "1.0.37_text_51" = "Çantaya hediyeler konuldu!"; "1.0.37_text_52" = "Bu özelliği kullanamazsınız."; + +"20.20.51_text_1" = "Email 登入"; +"20.20.51_text_2" = "Welcome to MoliStar"; +"20.20.51_text_3" = "Please enter ID"; +"20.20.51_text_4" = "Please enter email"; +"20.20.51_text_5" = "Please enter your phone number"; +"20.20.51_text_6" = "Please enter password"; +"20.20.51_text_7" = "Please enter verification code"; +"20.20.51_text_8" = "Get"; +"20.20.51_text_9" = "%@s"; +"20.20.51_text_10" = "Comfirm"; +"20.20.51_text_11" = "6-16 Digits + English Letters"; +"20.20.51_text_12" = "Please enter a correct email address"; +"20.20.51_text_13" = "Email Binding"; +"20.20.51_text_14" = "Mobile Binding"; +"20.20.51_text_15" = "Account Verification"; +"20.20.51_text_16" = "For the security of your account, you need to enter verification code."; diff --git a/YuMi/zh-Hant.lproj/Localizable.strings b/YuMi/zh-Hant.lproj/Localizable.strings index c87f768f..5bf85788 100644 --- a/YuMi/zh-Hant.lproj/Localizable.strings +++ b/YuMi/zh-Hant.lproj/Localizable.strings @@ -3574,3 +3574,21 @@ "1.0.37_text_50" = "硬幣已放入錢包!"; "1.0.37_text_51" = "禮物已放入背包!"; "1.0.37_text_52" = "您無法使用此功能。"; + + +"20.20.51_text_1" = "Email 登入"; +"20.20.51_text_2" = "Welcome to MoliStar"; +"20.20.51_text_3" = "Please enter ID"; +"20.20.51_text_4" = "Please enter email"; +"20.20.51_text_5" = "Please enter your phone number"; +"20.20.51_text_6" = "Please enter password"; +"20.20.51_text_7" = "Please enter verification code"; +"20.20.51_text_8" = "Get"; +"20.20.51_text_9" = "%@s"; +"20.20.51_text_10" = "Comfirm"; +"20.20.51_text_11" = "6-16 Digits + English Letters"; +"20.20.51_text_12" = "Please enter a correct email address"; +"20.20.51_text_13" = "Email Binding"; +"20.20.51_text_14" = "Mobile Binding"; +"20.20.51_text_15" = "Account Verification"; +"20.20.51_text_16" = "For the security of your account, you need to enter verification code.";