[M] all functional
This commit is contained in:
@@ -21,6 +21,7 @@ public class ConfigManager {
|
||||
|
||||
public static final String UNITY_FACADE_NAME = "TYSdkFacade";
|
||||
public static final String LOGIN_CALLBACK_FUNCTION_NAME = "LoginResult";
|
||||
public static final String CHECKLINK_CALLBACK_FUNCTION_NAME = "CheckLinkResult";
|
||||
public static final String PAY_CALLBACK_FUNCTION_NAME = "PayResult";
|
||||
public static final String PAY_TYPE_CALLBACK_FUNCTION_NAME = "SKUListResult";
|
||||
public static final String FCM_NOTICE_FUNCTION_NAME = "FCMCallback";
|
||||
|
||||
@@ -65,7 +65,6 @@ public class SDKManager {
|
||||
|
||||
|
||||
public static void parseLoginInfo(int i, String s) {
|
||||
Log.e(TAG,"parseLoginInfo!!" );
|
||||
try {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("code", i);
|
||||
@@ -74,19 +73,15 @@ public class SDKManager {
|
||||
JSONObject userInfo = serverResponse.getJSONObject("result");
|
||||
JSONObject userInfoReorganization = new JSONObject();
|
||||
userInfoReorganization.put("userId", userInfo.optString("userId"));
|
||||
userInfoReorganization.put("authorCode", userInfo.optString("authorCode"));
|
||||
userInfoReorganization.put("token", userInfo.optString("token"));
|
||||
userInfoReorganization.put("jwttoken", userInfo.optString("jwttoken"));
|
||||
userInfoReorganization.put("loginChannelTypeC", userInfo.optString("loginChannelTypeC"));
|
||||
JSONObject userInfoResult = new JSONObject();
|
||||
userInfoResult.put("result", userInfoReorganization);
|
||||
result.put("respObj", userInfoResult);
|
||||
|
||||
Log.e(TAG,"userId:::::" + userInfo.optString("userId"));
|
||||
Log.e(TAG,"token:::::" + userInfo.optString("token"));
|
||||
} else {
|
||||
Log.e(TAG,"errStr:::::" +s);
|
||||
result.put("errStr", s);
|
||||
Log.e(TAG,"errStrInfo:::::" +result.toString());
|
||||
}
|
||||
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, result.toString());
|
||||
@@ -163,13 +158,59 @@ public class SDKManager {
|
||||
});
|
||||
}
|
||||
|
||||
public static void UnityLogOutByChannel(string type) {
|
||||
public static void UnityLogOutByChannel(String type) {
|
||||
// Log.e(TAG,"UnityLoginOut!!!");
|
||||
SDKLog.i("UnityLoginOut : ");
|
||||
handler.post(() -> SDKAPI.getIns().logout(type));
|
||||
}
|
||||
|
||||
public static void UnityKnow(String userId, String productId, String productPrice, String productName, String productCount, String prodorderId, String appInfo) {
|
||||
public static void LinkAccount(String type, String userId)
|
||||
{
|
||||
SDKAPI.getIns().getSnsInfo(type, (code, snsInfo, msg) -> {
|
||||
if(code == SDKCallBack.CODE_SUCCESS && snsInfo != null){
|
||||
SDKAPI.getIns().bindBySnsId(snsInfo, userId, mLogin);
|
||||
}else {
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, "{\"code\":1}}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void LinkCheck(String type)
|
||||
{
|
||||
SDKAPI.getIns().getSnsInfo(type, (code, snsInfo, msg) -> {
|
||||
if(code == SDKCallBack.CODE_SUCCESS && snsInfo != null){
|
||||
SDKAPI.getIns().checkSnsInfo(snsInfo, (code1, msg1) -> {
|
||||
if(code1 == SDKCallBack.CODE_SUCCESS && !TextUtils.isEmpty(msg1)){
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(msg1).optJSONObject("result");
|
||||
//返回信息中code为0时表示服务端查询成功,exit为1表示此渠道用户信息已产生过途游账号,可直接进行登录,exit为0表示此渠道用户信息未产生过途游账号,可以进行绑定
|
||||
if(jsonObject.optString("code").equals("0")
|
||||
&& jsonObject.optString("exist").equals("0")){
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "1");
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void UnityKnow(String productId, String productName, String productCount, String prodorderId, String appInfo) {
|
||||
SDKLog.i("UnityKnow : " + productId);
|
||||
HashMap<String, String> extraInfo = new HashMap<String, String>();
|
||||
extraInfo.put("appInfo", appInfo);
|
||||
|
||||
@@ -218,24 +218,80 @@ extern "C" {
|
||||
|
||||
}
|
||||
|
||||
//广告相关
|
||||
void UnitySetAdBoxUserInfo(char* userId)
|
||||
void LinkGoogle(const int userId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UnityInitADSConfig()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UnityLoadRvADS()
|
||||
{
|
||||
|
||||
NSLog(@"TYSdkInterface LinkGoogle");
|
||||
NSDictionary * userDic = [XYApi XYGetCurrentUserDict];
|
||||
XYBindReq *bindReq = [XYBindReq initBindWithPlatform:XYBindGoodle UserId: [ [userDic objectForKey:@"userId"] unsignedIntegerValue]];
|
||||
[XYApi XYBindByBindReq:bindReq isUnbindGuest:@"false" completionHandler:^(XYResp * _Nonnull resp) {
|
||||
if(resp.errCode == XYSuccess)
|
||||
{
|
||||
NSLog(@"TYSdkInterface LinkGoogle Success");
|
||||
UnitySendMessage("TYSdkFacade","LinkAccoutResult", "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"TYSdkInterface LinkGoogle Faild");
|
||||
UnityLogoutGoogle();
|
||||
UnitySendMessage("TYSdkFacade","LinkAccoutResult", "0");
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
void UnityShowRVAD()
|
||||
void IsLinkedGoogle()
|
||||
{
|
||||
[XYApi CheckUserExist:XYBindGoodle completion:^(XYResp * _Nonnull resp) {
|
||||
if (resp.errCode == XYSNSExist) {
|
||||
UnitySendMessage("TYSdkFacade","CheckLinkResult", "1");
|
||||
}else if (resp.errCode == XYSNSNotExist){
|
||||
UnitySendMessage("TYSdkFacade","CheckLinkResult", "0");
|
||||
} else {
|
||||
UnitySendMessage("TYSdkFacade","CheckLinkResult", "-1");
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
void UnlinkGoogle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LinkFacebook(const int userId)
|
||||
{
|
||||
NSLog(@"TYSdkInterface LinkFacebook");
|
||||
NSDictionary * userDic = [XYApi XYGetCurrentUserDict];
|
||||
XYBindReq *bindReq = [XYBindReq initBindWithPlatform:XYBindFB UserId: [ [userDic objectForKey:@"userId"] unsignedIntegerValue]];
|
||||
[XYApi XYBindByBindReq:bindReq isUnbindGuest:@"false" completionHandler:^(XYResp * _Nonnull resp) {
|
||||
if(resp.errCode == XYSuccess)
|
||||
{
|
||||
NSLog(@"TYSdkInterface LinkFacebook Success");
|
||||
UnitySendMessage("TYSdkFacade","LinkAccoutResult", "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"TYSdkInterface LinkFacebook Faild");
|
||||
UnityLogoutFacebook();
|
||||
UnitySendMessage("TYSdkFacade","LinkAccoutResult", "0");
|
||||
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
void IsLinkedFacebook()
|
||||
{
|
||||
[XYApi CheckUserExist:XYBindFB completion:^(XYResp * _Nonnull resp) {
|
||||
if (resp.errCode == XYSNSExist) {
|
||||
UnitySendMessage("TYSdkFacade","CheckLinkResult", "1");
|
||||
}else if (resp.errCode == XYSNSNotExist){
|
||||
UnitySendMessage("TYSdkFacade","CheckLinkResult", "0");
|
||||
} else {
|
||||
UnitySendMessage("TYSdkFacade","CheckLinkResult", "-1");
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
void UnlinkFacebook()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user