苹果登录暂存
This commit is contained in:
parent
ebcc83ed6a
commit
05d2c74efa
@ -28,7 +28,6 @@ public static class XCodePostProcessBuild
|
||||
SetAssociatedDomains(projectPath, "wx.powerfun.com.cn");
|
||||
Assets.NativeLocale.AddLocalizedStringsIOS(pathToBuiltProject, Path.Combine(Application.dataPath, "Editor/Locale"));
|
||||
}
|
||||
|
||||
private static void SetFrameworksAndBuildSettings(string path)
|
||||
{
|
||||
PBXProject proj = new PBXProject();
|
||||
@ -46,6 +45,10 @@ public static class XCodePostProcessBuild
|
||||
proj.AddFrameworkToProject(target, csAddFrameworks[i], false);
|
||||
}
|
||||
|
||||
//苹果登录配置项
|
||||
//proj.AddCapability(target, PBXCapabilityType.SignInWithApple);
|
||||
proj.AddFrameworkToProject(proj.GetUnityFrameworkTargetGuid(), "AuthenticationServices.framework", false);
|
||||
|
||||
File.WriteAllText(path, proj.WriteToString());
|
||||
}
|
||||
|
||||
@ -98,7 +101,8 @@ public static class XCodePostProcessBuild
|
||||
|
||||
var entitlements = new ProjectCapabilityManager(pbxProjectPath, entitlementsFileName, targetName);
|
||||
entitlements.AddAssociatedDomains(new string[] { "applinks:" + domainUrl });
|
||||
|
||||
//苹果登录
|
||||
entitlements.AddSignInWithApple();
|
||||
entitlements.WriteToFile();
|
||||
}
|
||||
|
||||
|
||||
7
Assets/Plugins/iOS/SignWithApple.h
Normal file
7
Assets/Plugins/iOS/SignWithApple.h
Normal file
@ -0,0 +1,7 @@
|
||||
# import <AuthenticationServices/AuthenticationServices.h>
|
||||
|
||||
@interface AppleAuth: NSObject<ASAuthorizationControllerDelegate,ASAuthorizationProvider>
|
||||
- (void)authorizationAppleID;
|
||||
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(ASAuthorization *)authorization API_AVAILABLE(ios(13.0));
|
||||
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithError:(NSError *)error API_AVAILABLE(ios(13.0));
|
||||
@end
|
||||
33
Assets/Plugins/iOS/SignWithApple.h.meta
Normal file
33
Assets/Plugins/iOS/SignWithApple.h.meta
Normal file
@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6835d141abb752a4cbab8fd6ab05c069
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
124
Assets/Plugins/iOS/SignWithApple.m
Normal file
124
Assets/Plugins/iOS/SignWithApple.m
Normal file
@ -0,0 +1,124 @@
|
||||
#import "SignWithApple.h"
|
||||
|
||||
static AppleAuth * _appleAuth;
|
||||
|
||||
@implementation AppleAuth
|
||||
+(AppleAuth *)instance{
|
||||
if(_appleAuth==nil){
|
||||
_appleAuth = [[AppleAuth alloc] init];
|
||||
}
|
||||
return _appleAuth;
|
||||
}
|
||||
#pragma mark- 授权苹果ID
|
||||
- (void)authorizationAppleID{
|
||||
NSLog(@"cypen");
|
||||
if (@available(iOS 13.0, *)) {
|
||||
// 基于用户的Apple ID授权用户,生成用户授权请求的一种机制
|
||||
ASAuthorizationAppleIDProvider * appleIDProvider = [[ASAuthorizationAppleIDProvider alloc] init];
|
||||
// 创建新的AppleID 授权请求
|
||||
ASAuthorizationAppleIDRequest * authAppleIDRequest = [appleIDProvider createRequest];
|
||||
// 在用户授权期间请求的联系信息
|
||||
// authAppleIDRequest.requestedScopes = @[ASAuthorizationScopeFullName, ASAuthorizationScopeEmail];
|
||||
//如果 KeyChain 里面也有登录信息的话,可以直接使用里面保存的用户名和密码进行登录。
|
||||
// ASAuthorizationPasswordRequest * passwordRequest = [[[ASAuthorizationPasswordProvider alloc] init] createRequest];
|
||||
|
||||
NSMutableArray <ASAuthorizationRequest *> * array = [NSMutableArray arrayWithCapacity:2];
|
||||
if (authAppleIDRequest) {
|
||||
[array addObject:authAppleIDRequest];
|
||||
}
|
||||
// if (passwordRequest) {
|
||||
// [array addObject:passwordRequest];
|
||||
// }
|
||||
NSArray <ASAuthorizationRequest *> * requests = [array copy];
|
||||
// 由ASAuthorizationAppleIDProvider创建的授权请求 管理授权请求的控制器
|
||||
ASAuthorizationController * authorizationController = [[ASAuthorizationController alloc] initWithAuthorizationRequests:requests];
|
||||
// 设置授权控制器通知授权请求的成功与失败的代理
|
||||
authorizationController.delegate = self;
|
||||
// 设置提供 展示上下文的代理,在这个上下文中 系统可以展示授权界面给用户
|
||||
authorizationController.presentationContextProvider = self;
|
||||
// 在控制器初始化期间启动授权流
|
||||
[authorizationController performRequests];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark- ASAuthorizationControllerDelegate
|
||||
// 授权成功
|
||||
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(ASAuthorization *)authorization API_AVAILABLE(ios(13.0)) {
|
||||
NSLog(@"cypcg");
|
||||
if ([authorization.credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]) {
|
||||
|
||||
ASAuthorizationAppleIDCredential * credential = (ASAuthorizationAppleIDCredential *)authorization.credential;
|
||||
|
||||
// 苹果用户唯一标识符,该值在同一个开发者账号下的所有 App 下是一样的,开发者可以用该唯一标识符与自己后台系统的账号体系绑定起来。
|
||||
NSString * userID = credential.user;
|
||||
NSString * token = [[NSString alloc] initWithData:credential.identityToken encoding:NSUTF8StringEncoding];
|
||||
|
||||
// NSString * test = [[NSString alloc] initWithData:credential.authorizationCode encoding:NSUTF8StringEncoding];
|
||||
// NSLog(test);
|
||||
UnitySendMessage("LoginPanel", "OnAppleResp", [NSString stringWithFormat:@"true;%@,%@",userID,token ].UTF8String);
|
||||
//把用户的唯一标识 传给后台 判断该用户是否绑定手机号,如果绑定了直接登录,如果没绑定跳绑定手机号页面
|
||||
// // 苹果用户信息 如果授权过,可能无法再次获取该信息
|
||||
// NSPersonNameComponents * fullName = credential.fullName;
|
||||
// NSString * email = credential.email;
|
||||
//
|
||||
// // 服务器验证需要使用的参数
|
||||
// NSString * authorizationCode = [[NSString alloc] initWithData:credential.authorizationCode encoding:NSUTF8StringEncoding];
|
||||
// NSString * identityToken = [[NSString alloc] initWithData:credential.identityToken encoding:NSUTF8StringEncoding];
|
||||
//
|
||||
// // 用于判断当前登录的苹果账号是否是一个真实用户,取值有:unsupported、unknown、likelyReal
|
||||
// ASUserDetectionStatus realUserStatus = credential.realUserStatus;
|
||||
|
||||
// NSLog(@"userID: %@", userID);
|
||||
// NSLog(@"fullName: %@", fullName);
|
||||
// NSLog(@"email: %@", email);
|
||||
// NSLog(@"authorizationCode: %@", authorizationCode);
|
||||
// NSLog(@"identityToken: %@", identityToken);
|
||||
// NSLog(@"realUserStatus: %@", @(realUserStatus));
|
||||
}else if ([authorization.credential isKindOfClass:[ASPasswordCredential class]]) {
|
||||
// 这个获取的是iCloud记录的账号密码,需要输入框支持iOS 12 记录账号密码的新特性,如果不支持,可以忽略
|
||||
// 用户登录使用现有的密码凭证
|
||||
// ASPasswordCredential * passwordCredential = (ASPasswordCredential *)authorization.credential;
|
||||
// 密码凭证对象的用户标识 用户的唯一标识
|
||||
// NSString * user = passwordCredential.user;
|
||||
// NSLog(user);
|
||||
// UnitySendMessage("LoginPanel", "OnAppleResp", [NSString stringWithFormat:@"true,%@",user ].UTF8String);
|
||||
//把用户的唯一标识 传给后台 判断该用户是否绑定手机号,如果绑定了直接登录,如果没绑定跳绑定手机号页面
|
||||
|
||||
// // 密码凭证对象的密码
|
||||
// NSString * password = passwordCredential.password;
|
||||
// NSLog(@"userID: %@", user);
|
||||
// NSLog(@"password: %@", password);
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
// 授权失败
|
||||
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithError:(NSError *)error API_AVAILABLE(ios(13.0)) {
|
||||
NSString *errorMsg = nil;
|
||||
NSLog(@"cypsb");
|
||||
switch (error.code) {
|
||||
case ASAuthorizationErrorCanceled:
|
||||
errorMsg = @"用户取消了授权请求";
|
||||
break;
|
||||
case ASAuthorizationErrorFailed:
|
||||
errorMsg = @"授权请求失败";
|
||||
break;
|
||||
case ASAuthorizationErrorInvalidResponse:
|
||||
errorMsg = @"授权请求响应无效";
|
||||
break;
|
||||
case ASAuthorizationErrorNotHandled:
|
||||
errorMsg = @"未能处理授权请求";
|
||||
break;
|
||||
case ASAuthorizationErrorUnknown:
|
||||
errorMsg = @"授权请求失败未知原因";
|
||||
break;
|
||||
}
|
||||
UnitySendMessage("LoginPanel", "OnAppleResp", [NSString stringWithFormat:@"false;%@",errorMsg ].UTF8String);
|
||||
}
|
||||
@end
|
||||
|
||||
void authorizationAppleID(){
|
||||
AppleAuth * a = [AppleAuth instance];
|
||||
[a authorizationAppleID];
|
||||
}
|
||||
33
Assets/Plugins/iOS/SignWithApple.m.meta
Normal file
33
Assets/Plugins/iOS/SignWithApple.m.meta
Normal file
@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e087a9c3779cf14469c686f027a017cc
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Resources/Images/apple.meta
Normal file
8
Assets/Resources/Images/apple.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cff3b41e805182c4ca1edfe463693919
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Images/apple/white-logo-masked-circular.png
Normal file
BIN
Assets/Resources/Images/apple/white-logo-masked-circular.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 794a03e8daaf69242a9d6f1d63e35966
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@ -314,5 +314,15 @@ namespace Assets.Scripts.Apis
|
||||
{
|
||||
return await PostAsync<JsonResult<JObject>>("NoAuth/v1/ResetPassword", new {phone,captcha,newPwd });
|
||||
}
|
||||
|
||||
public async Task<JsonResult<JObject>> OnAppleIdLoginCheck(string userId,string token)
|
||||
{
|
||||
return await PostAsync<JsonResult<JObject>>("NoAuth/v1/OnAppleIdLoginCheck", new { appleUserId = userId,token });
|
||||
}
|
||||
|
||||
public async Task<JsonResult<object>> OnAppleIdLogin(string appleUserId, string token, string phone, string pwd, string Captcha)
|
||||
{
|
||||
return await PostAsync<JsonResult<object>>("NoAuth/v1/OnAppleIdLogin", new { appleUserId, token, phone, pwd, Captcha });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ public static class App
|
||||
Host = "http://192.168.0.101:5085/";
|
||||
UdpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.97"), 11000);
|
||||
TcpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.102"), 21001);
|
||||
Debug.unityLogger.logEnabled = false;
|
||||
//Debug.unityLogger.logEnabled = false;
|
||||
#endif
|
||||
var isRower = PlayerPrefs.GetString("IsRowerMode");
|
||||
if (!string.IsNullOrEmpty(isRower))
|
||||
|
||||
@ -41,6 +41,20 @@ public class LoginControllerMobile : MonoBehaviour, INativeOnMobileWxLoginResp
|
||||
DateTime.Now.ToString("HH:mm");
|
||||
weChat = App.weChatController;
|
||||
weChat.Init(App.WxAppId);
|
||||
#if UNITY_IOS
|
||||
UIManager.AddEvent(transform.Find("Panel/LoginContainer/LoginScrollView/Viewport/Content/FormContainer-Login/Mask/FormContainer-third/otherContainer/Apple").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
GetComponent<LoginController>()
|
||||
.OnAppleIdLoginCheck("000515.7d1f47f5171b4d66a4bb4a4e7e2c6899.0830", "eyJraWQiOiJZdXlYb1kiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiYXVkIjoiY29tLlpoaVhpbmdQYWkuUG93ZXJGdW4iLCJleHAiOjE2NDAwNDk3NzEsImlhdCI6MTYzOTk2MzM3MSwic3ViIjoiMDAwNTE1LjdkMWY0N2Y1MTcxYjRkNjZhNGJiNGE0ZTdlMmM2ODk5LjA4MzAiLCJjX2hhc2giOiJhekhJdTZNVE1OVGs4Q3RxNndIeHlRIiwiYXV0aF90aW1lIjoxNjM5OTYzMzcxLCJub25jZV9zdXBwb3J0ZWQiOnRydWV9.WM23STabsJqSV1FjPvYRXo3kOB2Cfo7HsPDUuJx8UlqTUthbif1uvhEFpFMF8G5B5_yl3kkmaDtv0nQA25DkDiYowfPVV8gkLx2IMMOm6rVqV5E7kA6xNa64pwgIHDnTSjnn862_DEb4QVkAfi-rXsbkZ1q-EpH5MG-5GLR3Ktq_1n59kQcJrvuvUEpbv8IbSzRLh4VVZLY5rmaoddZ2kg5hw234cwGCmiMxHi55tVHAiGnqgq74IY7HXz3udwRGufaFXpkYbdBuL5-wqAp1SQlQhwpTzhZ5JKr2y4ukejYPFZzLfnkUX0xhLmH8uooKb-TjOa5qaFKGXT0hXh4NHw");
|
||||
#else
|
||||
App.weChatController.SignWithApple();
|
||||
#endif
|
||||
});
|
||||
#else
|
||||
transform.Find("Panel/LoginContainer/LoginScrollView/Viewport/Content/FormContainer-Login/Mask/FormContainer-third/otherContainer/Apple").gameObject.SetActive(false);
|
||||
#endif
|
||||
|
||||
//App.weChatController.Init(App.WxAppId);
|
||||
//var s = App.weChatController.isApplicationAvilible("com.gugoumainapp","powerfun").ToString();
|
||||
//Utils.showToast(null, SystemInfo.batteryLevel.ToString());
|
||||
@ -68,9 +82,11 @@ public class LoginControllerMobile : MonoBehaviour, INativeOnMobileWxLoginResp
|
||||
}
|
||||
App.WorkoutsUrl = r.data.Value<JObject>("Apk").Value<string>("Url");
|
||||
#elif UNITY_IOS
|
||||
var sw = r.data.Value<string>("ThirdPartSwitch");
|
||||
//var sw = r.data.Value<string>("ThirdPartSwitch");
|
||||
//transform.Find("Panel/LoginContainer/LoginScrollView/Viewport/Content/FormContainer-Login/Mask/FormContainer/BtnThirdLogin")
|
||||
// .gameObject.SetActive(sw.Equals("on") && App.weChatController.IsWeChatAppInstalled());
|
||||
transform.Find("Panel/LoginContainer/LoginScrollView/Viewport/Content/FormContainer-Login/Mask/FormContainer/BtnThirdLogin")
|
||||
.gameObject.SetActive(sw.Equals("on") && App.weChatController.IsWeChatAppInstalled());
|
||||
.gameObject.SetActive(true);
|
||||
var info = r.data.Value<JObject>("UnityIos");
|
||||
if (Utils.isUpdate(App.AppVersion, info.Value<string>("Version")))
|
||||
{
|
||||
@ -140,4 +156,16 @@ public class LoginControllerMobile : MonoBehaviour, INativeOnMobileWxLoginResp
|
||||
Utils.showToast(null, res.Replace("false;", ""));
|
||||
}
|
||||
}
|
||||
|
||||
public void OnAppleResp(string res)
|
||||
{
|
||||
#if UNITY_IOS
|
||||
var sp = res.Replace("true;", "").Split(',');
|
||||
if (sp.Length == 2)
|
||||
{
|
||||
GetComponent<LoginController>().OnAppleIdLoginCheck(sp[0],sp[1]);
|
||||
}
|
||||
//Utils.showToast(null, "苹果返回"+res);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,6 +30,12 @@ public class WeChatController
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ShareImgToWX(int scene, byte[] msgByteArrayData, int arrayLength);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ShareUrlToWX(int scene, string url, string title, string description);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void authorizationAppleID();
|
||||
#endif
|
||||
#endregion
|
||||
/// <summary>
|
||||
@ -70,10 +76,17 @@ public class WeChatController
|
||||
#endif
|
||||
}
|
||||
|
||||
public void SignWithApple()
|
||||
{
|
||||
#if UNITY_IOS
|
||||
authorizationAppleID();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否是否安装了微信
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// 判断是否是否安装了微信
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsWeChatAppInstalled()
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
@ -109,7 +122,11 @@ public class WeChatController
|
||||
/// <param name="description">描述</param>
|
||||
public void ShareWebpageToWX(int scene, string url, string title, string description,byte[] image)
|
||||
{
|
||||
mainActivityClass.CallStatic("ShareWebpageToWX", scene, url, title, description,image);
|
||||
#if UNITY_ANDROID
|
||||
mainActivityClass.CallStatic("ShareWebpageToWX", scene, url, title, description, image);
|
||||
#else
|
||||
ShareUrlToWX(scene, url, title, description);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -150,7 +150,7 @@ public class LoginController : BaseScene
|
||||
var content = signScrollView.transform.Find("Viewport").Find("Content");
|
||||
signPage1 = content.Find("FirstPage");
|
||||
UIManager.AddEvent(signPage1.Find("next").GetComponent<Button>().gameObject,
|
||||
EventTriggerType.PointerClick, (b) => goRegNext());
|
||||
EventTriggerType.PointerClick, (b) => goRegNext(signType));
|
||||
UIManager.AddEvent(signPage1.Find("BtnModiPass").GetComponent<Button>().gameObject,
|
||||
EventTriggerType.PointerClick, (b) => goResetPassword());
|
||||
//signPage1.Find("next").GetComponent<Button>().onClick.AddListener(() => { goRegNext(); });
|
||||
@ -507,6 +507,38 @@ public class LoginController : BaseScene
|
||||
transform.Find("Panel").Find("Version").GetComponent<Text>().text = $"V{App.AppVersion}";
|
||||
#endif
|
||||
}
|
||||
private string appleUserId = "";
|
||||
private string appleToken = "";
|
||||
private int signType { get; set; }
|
||||
public async void OnAppleIdLoginCheck(string userId,string token)
|
||||
{
|
||||
appleUserId = userId;
|
||||
appleToken = token;
|
||||
signType = 2;
|
||||
var res = await ConfigHelper.userApi.OnAppleIdLoginCheck(userId, token);
|
||||
if (res.result) //判断是否成功登录
|
||||
{
|
||||
var data = res.data;
|
||||
|
||||
if (res.data.ContainsKey("success") && data.Value<string>("success") == "False")
|
||||
{
|
||||
goSign();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshWx3(data.ToObject<UserResultModel>(), 1);
|
||||
wxLogin3.gameObject.SetActive(true);
|
||||
signContainer.gameObject.SetActive(false);
|
||||
pageNums = 3;
|
||||
MobileAni(true);
|
||||
StartScrollPanel(2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void Test(string key)
|
||||
{
|
||||
@ -514,8 +546,6 @@ public class LoginController : BaseScene
|
||||
}
|
||||
async void Init()
|
||||
{
|
||||
|
||||
Debug.Log(535);
|
||||
UIManager.Instance.ModalsPanel = this.transform.Find("ModalPanel").GetComponent<PFUIPanel>();
|
||||
userInfos = UIManager.Instance.userInfos;
|
||||
App.DefaultRotateTexture = Utils.ReadTextureFromPlayerPrefs("rotateImage");
|
||||
@ -697,6 +727,7 @@ public class LoginController : BaseScene
|
||||
JObject data = JObject.FromObject(r.data);
|
||||
if (data.Value<string>("success") != null && data.Value<string>("success") == "False")
|
||||
{
|
||||
signType = 1;
|
||||
wxInfoJson = data;
|
||||
wxLogin2.gameObject.SetActive(true);
|
||||
Utils.DisplayImage(wxLogin2.Find("Avatar").GetComponent<RawImage>(),
|
||||
@ -759,7 +790,7 @@ public class LoginController : BaseScene
|
||||
//Timer t = new Ti
|
||||
if (r.result)
|
||||
{
|
||||
if (pageNums == 5)
|
||||
if (signType == 1 || signType == 2)
|
||||
{
|
||||
if (r.data.Value<bool>("isExist"))
|
||||
{
|
||||
@ -820,7 +851,7 @@ public class LoginController : BaseScene
|
||||
signForm.cpassword.text = "";
|
||||
StartScrollSign(0);
|
||||
}
|
||||
//0-普通 1-微信
|
||||
//0-普通 1-微信 2-苹果
|
||||
private async void goRegNext(int signType = 0)
|
||||
{
|
||||
var Email = signForm.email;
|
||||
@ -851,6 +882,10 @@ public class LoginController : BaseScene
|
||||
wxInfoJson.Value<string>("unionId"),
|
||||
wxInfoJson.Value<string>("openId"));
|
||||
}
|
||||
else if (signType == 2)
|
||||
{
|
||||
r = await ConfigHelper.userApi.OnAppleIdLogin(appleUserId,appleToken,Email.text,Password.text,Captcha.text);
|
||||
}
|
||||
if (r != null && r.result)
|
||||
{
|
||||
var u = JObject.FromObject(r.data).ToObject<UserResultModel>();
|
||||
@ -870,21 +905,33 @@ public class LoginController : BaseScene
|
||||
{
|
||||
var Email = signForm.email;
|
||||
var Captcha = signForm.captcha;
|
||||
var r = await ConfigHelper.userApi.OnWebWxLogin(Email.text,
|
||||
JsonResult<object> r = null;
|
||||
if (signType == 2)
|
||||
{
|
||||
//苹果登录
|
||||
r = await ConfigHelper.userApi.OnAppleIdLogin(appleUserId, appleToken, Email.text, "", Captcha.text);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = await ConfigHelper.userApi.OnWebWxLogin(Email.text,
|
||||
Captcha.text,
|
||||
"",
|
||||
wxInfoJson.Value<string>("unionId"),
|
||||
wxInfoJson.Value<string>("openId"));
|
||||
if (r.result)
|
||||
{
|
||||
var u = JObject.FromObject(r.data).ToObject<UserResultModel>();
|
||||
RefreshWx3(u, 1);
|
||||
MobileAni(true);
|
||||
StartScrollPanel(4);
|
||||
}
|
||||
else
|
||||
if (r != null)
|
||||
{
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
if (r.result)
|
||||
{
|
||||
var u = JObject.FromObject(r.data).ToObject<UserResultModel>();
|
||||
RefreshWx3(u, 1);
|
||||
MobileAni(true);
|
||||
StartScrollPanel(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@ -1201,6 +1248,10 @@ public class LoginController : BaseScene
|
||||
if (type == 0)
|
||||
{
|
||||
pageNums = 4;
|
||||
if (signType != 2)
|
||||
{
|
||||
signType = 0;
|
||||
}
|
||||
signContainer.Find("signText").GetComponent<Text>().text = App.GetLocalString("SIGN UP");
|
||||
wxLogin2.gameObject.SetActive(false);
|
||||
signPage1.Find("next").gameObject.SetActive(true);
|
||||
|
||||
@ -22,6 +22,7 @@ public class MainController : BaseScene
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
Debug.Log("执行25");
|
||||
Version = this.transform.Find("GameObject").Find("Version").GetComponent<Text>();
|
||||
Version.text = "V"+App.AppVersion;
|
||||
DeviceCache.Init(PFConstants.DeviceCacheFolder);
|
||||
@ -176,9 +177,12 @@ public class MainController : BaseScene
|
||||
void FinishMessageLeft()
|
||||
{
|
||||
msgIndex = 0;
|
||||
foreach (var item in msgs)
|
||||
if (msgs != null)
|
||||
{
|
||||
item.DOFade(0, 0.3f);
|
||||
foreach (var item in msgs)
|
||||
{
|
||||
item.DOFade(0, 0.3f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -381,15 +381,15 @@ public class DeviceView : MonoBehaviour
|
||||
break;
|
||||
case SensorType.SpeedCadence:
|
||||
case SensorType.Cadence:
|
||||
return "Cadence Sensor";
|
||||
return App.GetLocalString("Cadence Sensor");
|
||||
case SensorType.HeartRate:
|
||||
return "Heart Rate Monitor";
|
||||
return App.GetLocalString("Heart Rate Monitor");
|
||||
case SensorType.Power:
|
||||
return "Power Meter";
|
||||
return App.GetLocalString("Power Meter");
|
||||
case SensorType.Speed:
|
||||
return "Speed Meter";
|
||||
return App.GetLocalString("Speed Meter");
|
||||
case SensorType.Trainer:
|
||||
return "Smart Trainer";
|
||||
return App.GetLocalString("Smart Trainer");
|
||||
case SensorType.Rower:
|
||||
return "Rower Machine";
|
||||
case SensorType.VirtualPower:
|
||||
|
||||
@ -181,7 +181,15 @@ public class RouteItem : MonoBehaviour
|
||||
UIManager.AddEvent(left.Find("Main/ShareContainer/Wx").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
Debug.Log(App.CurrentUser.WebHost);
|
||||
App.weChatController.ShareWebpageToWX(0, "http://192.168.0.101:3081/RoutesRecords/" + result.RankingId, result.RouteName, "By " + App.CurrentUser.Nickname, null);
|
||||
if (App.weChatController.IsWeChatAppInstalled())
|
||||
{
|
||||
App.weChatController.ShareWebpageToWX(0, "http://192.168.0.101:3081/RoutesRecords/" + result.RankingId, result.RouteName, "By " + App.CurrentUser.Nickname, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(null, "未安装微信");
|
||||
}
|
||||
|
||||
});
|
||||
UIManager.AddEvent(btnDelete.gameObject, EventTriggerType.PointerClick, (b) => Detail());
|
||||
#else
|
||||
|
||||
@ -38,7 +38,6 @@ GraphicsSettings:
|
||||
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_PreloadedShaders: []
|
||||
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
|
||||
type: 0}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user