苹果登录暂存

This commit is contained in:
Caiyanpeng committed 2021-12-21 09:58:07 +08:00
1 parent ebcc83ed6a
commit 05d2c74efa
18 files changed
+1651 -1197

No files matched your search

+30 -2
View File
@@ -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
}
}
+21 -4
View File
@@ -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>