[M] login & logout & payment

- login by token
- save account info
- logout remove accout info
- iOS SKU list parser
- iOS Pay
This commit is contained in:
2024-08-13 23:53:35 +08:00
parent 7f576df319
commit c355784122
10 changed files with 663 additions and 112 deletions

View File

@@ -142,7 +142,6 @@ public class SDKManager {
}
public static void UnityGetIdentityFun(String type) {
curType = type;
Log.e(TAG,"UnityGetIdentityFun : " + type);
SDKLog.i("UnityGetIdentityFun : " + type);
handler.post(new Runnable() {
@@ -154,7 +153,6 @@ public class SDKManager {
}
public static void UnityLogin(String type) {
curType = type;
Log.e(TAG,"UnityLogin : " + type);
SDKLog.i("UnityLogin : " + type);
handler.post(new Runnable() {
@@ -165,10 +163,10 @@ public class SDKManager {
});
}
public static void UnityLoginOut() {
public static void UnityLogOutByChannel(string type) {
// Log.e(TAG,"UnityLoginOut!!!");
SDKLog.i("UnityLoginOut : ");
handler.post(() -> SDKAPI.getIns().logout(curType));
handler.post(() -> SDKAPI.getIns().logout(type));
}
public static void UnityKnow(String userId, String productId, String productPrice, String productName, String productCount, String prodorderId, String appInfo) {

View File

@@ -1,6 +1,9 @@
#import <Foundation/Foundation.h>
#import <XYSDK/XYSDK.h>
#import <GASDK/GAConstants.h>
#import <GASDK/GASDK.h>
#import "TYConfig.h"
#define TOKEN_ERROR @"-8"
extern "C" {
@@ -118,6 +121,23 @@ extern "C" {
}];
}
void UnityLogoutGoogle()
{
NSLog(@"TYSdkInterface UnityLogOut Google");
[XYApi XYLogoutChannelWithType:XYLoginWithGoogle];
}
void UnityLogoutFacebook()
{
NSLog(@"TYSdkInterface UnityLogOut Facebook");
[XYApi XYLogoutChannelWithType:XYLoginWithFB];
}
void UnityLogoutGuest()
{
NSLog(@"TYSdkInterface UnityLogOutGuset");
[XYApi XYLogoutChannelWithType:XYLoginWithGuest];
}
//支付
void UnityKnow(const char* userId,const char* productId,const char* productPrice,const char* productName,const char* productCount,const char* orderid,const char* appinfo)
{
@@ -171,16 +191,30 @@ extern "C" {
//打点
void SetGaUserInfo(const char* userId)
{
NSString *userid = [[NSString alloc] initWithCString:userId encoding:NSUTF8StringEncoding];
[[GASDK getGAlog:SDK_PROJECTID] setUserId:userid];
}
void SetGaCommonInfo(const char* SetGaCommonInfo)
{
NSString * jsonString = [NSString stringWithFormat:@"%s", SetGaCommonInfo];
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError* err;
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&err];
if(!err){
[[GASDK getGAlog:SDK_PROJECTID] initWithGameId:SDK_GAMEID clientId:SDK_CLIENTID withCommonParams:dic serverUrl:GA_INTERNATIONAL];
}
}
void GAReportParams(int type, const char* eventstr, const char* paramstr)
{
NSString * jsonString = [NSString stringWithFormat:@"%s", paramstr];
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError* err;
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&err];
if(!err){
[[GASDK getGAlog:SDK_PROJECTID] initWithGameId:SDK_GAMEID clientId:SDK_CLIENTID withCommonParams:dic serverUrl:GA_INTERNATIONAL];
}
}