FB登录功能暂存;苹果有问题

This commit is contained in:
CaiYanPeng 2021-12-24 13:58:14 +08:00
parent 6423007638
commit 769b75e2e2
7 changed files with 84 additions and 12 deletions

View File

@ -25,7 +25,7 @@ MonoBehaviour:
xfbml: 0 xfbml: 0
frictionlessRequests: 1 frictionlessRequests: 1
androidKeystorePath: D:\u3d\powerfun-unity\Assets\Plugins\Android\powerfun.keystore androidKeystorePath: D:\u3d\powerfun-unity\Assets\Plugins\Android\powerfun.keystore
iosURLSuffix: iosURLSuffix: powerfunx
appLinkSchemes: appLinkSchemes:
- list: [] - list: []
uploadAccessToken: uploadAccessToken:

View File

@ -10,7 +10,7 @@ dependencies {
implementation files ('libs/PowerFunAndroidPlugin-release.aar') implementation files ('libs/PowerFunAndroidPlugin-release.aar')
implementation files ('libs/UniWebView.aar') implementation files ('libs/UniWebView.aar')
implementation files ('libs/facebook-android-wrapper-11.0.0.aar') implementation files ('libs/facebook-android-wrapper-11.0.0.aar')
implementation 'com.facebook.android:facebook-android-sdk:[8,9)' implementation 'com.facebook.android:facebook-android-sdk:[11,12)'
implementation ('com.mapbox.maps:android:10.2.0-beta.1'){ implementation ('com.mapbox.maps:android:10.2.0-beta.1'){
exclude group: 'group_name', module: 'module_name' exclude group: 'group_name', module: 'module_name'
} }

View File

@ -288,7 +288,9 @@
"All Route": "全部线路", "All Route": "全部线路",
"Reconnect": "重新连接", "Reconnect": "重新连接",
"Did you want to reconnect the trip that was interrupted abnormally?": "你有异常中断的骑行,是否重新连接开始骑行?", "Did you want to reconnect the trip that was interrupted abnormally?": "你有异常中断的骑行,是否重新连接开始骑行?",
"LIST MODE": "线路模式" "LIST MODE": "线路模式",
"User refusal of authorisation": "用户拒绝授权",
"User deauthorisation": "用户取消授权"
}, },
"en": { "en": {
"HOT ROUTES": "HOT ROUTES", "HOT ROUTES": "HOT ROUTES",
@ -570,6 +572,8 @@
"All Route": "All Route", "All Route": "All Route",
"Reconnect": "Reconnect", "Reconnect": "Reconnect",
"Did you want to reconnect the trip that was interrupted abnormally?": "Did you want to reconnect the trip that was interrupted abnormally?", "Did you want to reconnect the trip that was interrupted abnormally?": "Did you want to reconnect the trip that was interrupted abnormally?",
"LIST MODE": "LIST MODE" "LIST MODE": "LIST MODE",
"User refusal of authorisation": "User refusal of authorisation",
"User deauthorisation": "User deauthorisation"
} }
} }

View File

@ -298,6 +298,18 @@ namespace Assets.Scripts.Apis
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnAppleIdLogin", new { appleUserId, token, phone, pwd, Captcha }); var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnAppleIdLogin", new { appleUserId, token, phone, pwd, Captcha });
return GetDataAfterSetCookie(r); return GetDataAfterSetCookie(r);
} }
public async Task<JsonResult<object>> OnFacebookLoginCheck(string userId, string token)
{
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnFacebookLoginCheck", new { faceBookUserId = userId, token });
return GetDataAfterSetCookie(r);
}
public async Task<JsonResult<object>> OnFacebookLogin(string faceBookUserId, string token, string phone, string pwd, string Captcha)
{
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnFacebookLogin", new { faceBookUserId, token, phone, pwd, Captcha });
return GetDataAfterSetCookie(r);
}
private JsonResult<object> GetDataAfterSetCookie(JsonResult<object> r) private JsonResult<object> GetDataAfterSetCookie(JsonResult<object> r)
{ {
if (r.result) if (r.result)
@ -316,5 +328,7 @@ namespace Assets.Scripts.Apis
} }
return r; return r;
} }
} }
} }

View File

@ -19,7 +19,7 @@ public delegate void ChangeLanguageDelegate();
public static class App public static class App
{ {
public static string Host = "http://192.168.0.101:5084/"; public static string Host = "http://192.168.0.101:5085/";
public static string AppVersion = Application.version; public static string AppVersion = Application.version;

View File

@ -154,9 +154,19 @@ public class LoginControllerMobile : MonoBehaviour, INativeOnMobileWxLoginResp
/// <param name="res"></param> /// <param name="res"></param>
private void onFaceBookResp(ILoginResult res) private void onFaceBookResp(ILoginResult res)
{ {
Debug.Log(res.ToString());
if (string.IsNullOrEmpty(res.Error)) if (string.IsNullOrEmpty(res.Error))
{ {
Debug.Log("用戶Id" + res.ResultDictionary["user_id"]); if (res.Cancelled)
{
Utils.showToast(null, App.GetLocalString("User deauthorisation"));
}
else
{
GetComponent<LoginController>()
.OnFacebookLoginCheck(res.ResultDictionary["user_id"].ToString(), res.ResultDictionary["access_token"].ToString());
Debug.Log("用戶Id" + res.ResultDictionary["user_id"]);
}
} }
else else
{ {

View File

@ -507,6 +507,38 @@ public class LoginController : BaseScene
transform.Find("Panel").Find("Version").GetComponent<Text>().text = $"V{App.AppVersion}"; transform.Find("Panel").Find("Version").GetComponent<Text>().text = $"V{App.AppVersion}";
#endif #endif
} }
private string fbUserId = "";
private string fbToken = "";
public async void OnFacebookLoginCheck(string userId, string token)
{
fbUserId = userId;
fbToken = token;
signType = 3;
var res = await ConfigHelper.userApi.OnFacebookLoginCheck(userId, token);
if (res.result) //判断是否成功登录
{
var data = JObject.FromObject(res.data);
if (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
{
Utils.showToast(null, res.errMsg);
}
}
private string appleUserId = ""; private string appleUserId = "";
private string appleToken = ""; private string appleToken = "";
private int signType { get; set; } private int signType { get; set; }
@ -789,7 +821,7 @@ public class LoginController : BaseScene
//Timer t = new Ti //Timer t = new Ti
if (r.result) if (r.result)
{ {
if (signType == 1 || signType == 2) if (isThird())
{ {
if (r.data.Value<bool>("isExist")) if (r.data.Value<bool>("isExist"))
{ {
@ -850,7 +882,7 @@ public class LoginController : BaseScene
signForm.cpassword.text = ""; signForm.cpassword.text = "";
StartScrollSign(0); StartScrollSign(0);
} }
//0-普通 1-微信 2-苹果 //0-普通 1-微信 2-苹果 3-facebook
private async void goRegNext(int signType = 0) private async void goRegNext(int signType = 0)
{ {
var Email = signForm.email; var Email = signForm.email;
@ -881,9 +913,13 @@ public class LoginController : BaseScene
wxInfoJson.Value<string>("unionId"), wxInfoJson.Value<string>("unionId"),
wxInfoJson.Value<string>("openId")); wxInfoJson.Value<string>("openId"));
} }
else if (signType == 2) else if (signType == 2)
{ {
r = await ConfigHelper.userApi.OnAppleIdLogin(appleUserId,appleToken,Email.text,Password.text,Captcha.text); r = await ConfigHelper.userApi.OnAppleIdLogin(appleUserId, appleToken, Email.text, Password.text, Captcha.text);
}
else
{
r = await ConfigHelper.userApi.OnFacebookLogin(fbUserId, fbToken, Email.text, Password.text, Captcha.text);
} }
if (r != null && r.result) if (r != null && r.result)
{ {
@ -910,7 +946,11 @@ public class LoginController : BaseScene
//苹果登录 //苹果登录
r = await ConfigHelper.userApi.OnAppleIdLogin(appleUserId, appleToken, Email.text, "", Captcha.text); r = await ConfigHelper.userApi.OnAppleIdLogin(appleUserId, appleToken, Email.text, "", Captcha.text);
} }
else else if (signType == 3)
{
r = await ConfigHelper.userApi.OnFacebookLogin(fbUserId, fbToken, Email.text, "", Captcha.text);
}
else
{ {
r = await ConfigHelper.userApi.OnWebWxLogin(Email.text, r = await ConfigHelper.userApi.OnWebWxLogin(Email.text,
Captcha.text, Captcha.text,
@ -1218,6 +1258,10 @@ public class LoginController : BaseScene
//signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners(); //signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
//signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(() => { ; }); //signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(() => { ; });
} }
bool isThird()
{
return signType > 0;
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -1247,7 +1291,7 @@ public class LoginController : BaseScene
if (type == 0) if (type == 0)
{ {
pageNums = 4; pageNums = 4;
if (signType != 2) if (signType < 2)
{ {
signType = 0; signType = 0;
} }