增加discord登录

This commit is contained in:
CounterFire2023 2024-01-25 13:05:35 +08:00
parent 0d5329ee9e
commit 78afae4fb6
24 changed files with 2703 additions and 946 deletions

View File

@ -8,6 +8,7 @@
#import <QuartzCore/CADisplayLink.h>
#import <Availability.h>
#import <AVFoundation/AVFoundation.h>
#include "JcWallet.h"
#include <mach/mach_time.h>
@ -278,7 +279,6 @@ extern "C" void UnityCleanupTrampoline()
- (BOOL)application:(UIApplication*)app openURL:(NSURL*)url options:(NSDictionary<NSString*, id>*)options
{
id sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey], annotation = options[UIApplicationOpenURLOptionsAnnotationKey];
NSMutableDictionary<NSString*, id>* notifData = [NSMutableDictionary dictionaryWithCapacity: 3];
if (url)
{
@ -294,19 +294,6 @@ extern "C" void UnityCleanupTrampoline()
return YES;
}
// for tiktok and facebook
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
[[TikTokOpenSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
[[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
return YES;
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
[[TikTokOpenSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:nil annotation:nil];
return YES;
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
#if defined(__IPHONE_12_0) || defined(__TVOS_12_0)
@ -455,6 +442,8 @@ extern "C" void UnityCleanupTrampoline()
// need to do this with delay because FMOD restarts audio in AVAudioSessionInterruptionNotification handler
[self performSelector: @selector(updateUnityAudioOutput) withObject: nil afterDelay: 0.1];
UnitySetPlayerFocus(1);
std::vector<std::string> sparams;
cocos2d::nativeCallJS("1", "onGameResume", sparams);
}
else if (!_startUnityScheduled)
{

View File

@ -51,10 +51,11 @@ bool AppDelegate::applicationDidFinishLaunching()
jsb_set_xxtea_key("");
jsb_init_file_operation_delegate();
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
// Enable debugger here
jsb_enable_debugger("0.0.0.0", 6086, false);
#endif
//#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
// // Enable debugger here
// jsb_enable_debugger("0.0.0.0", 6086, false);
//#endif
se->setExceptionCallback([](const char *location, const char *message, const char *stack) {
// Send exception information to server like Tencent Bugly.
@ -66,6 +67,7 @@ bool AppDelegate::applicationDidFinishLaunching()
se->start();
se::AutoHandleScope hs;
jsb_run_code("window.platform='game_ios';");
jsb_run_script("js/jsb-adapter/jsb-builtin.js");
jsb_run_script("js/jcwallet.js");
jsb_run_script("js/platform.js");

View File

@ -0,0 +1,18 @@
//
// GlobalData.h
// Unity-iPhone
//
// Created by Hl Zhang on 2023/9/8.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface GlobalData : NSObject
+(instancetype) shareInstance;
- (NSString *) getGameData;
-(void) setGameData:(NSString *) data;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,43 @@
//
// GlobalData.m
// Unity-iPhone
//
// Created by Hl Zhang on 2023/9/8.
//
#import "GlobalData.h"
@implementation GlobalData
static GlobalData *_instance = nil;
NSString *_gamedata = nil;
+(instancetype) shareInstance
{
static dispatch_once_t onceToken ;
dispatch_once(&onceToken, ^{
_instance = [[super allocWithZone:NULL] init] ;
}) ;
return _instance ;
}
+(id) allocWithZone:(struct _NSZone *)zone
{
return [GlobalData shareInstance] ;
}
-(id) copyWithZone:(struct _NSZone *)zone
{
return [GlobalData shareInstance] ;
}
- (nonnull NSString *)getGameData {
return _gamedata;
}
- (void)setGameData:(nonnull NSString *)data {
_gamedata = data;
}
@end

View File

@ -13,12 +13,11 @@ NS_CC_BEGIN
struct JSMethodParam {
std::string methodName;
std::string funId;
int paramCount;
unsigned long paramCount;
se::ValueArray args;
};
bool addToArgArray(se::ValueArray *args, const char *valChar);
int nativeCallBack(const char *funId, const char *methodName, const char *cparams);
int nativeCallJS(std::string funId, std::string methodName, std::vector<std::string> sparams);
class CC_DLL JcWallet {
public:
void initEnv();

View File

@ -17,6 +17,7 @@
#import "UIViewController+Wallet.h"
#import "UIViewController+QR.h"
#import "UIViewController+Purchase.h"
#import "GlobalData.h"
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
@ -203,6 +204,9 @@ NS_CC_BEGIN
}
int runWalletMethod(const char *funId, const char *methodName, int paramCount, char **paramList) {
if (!_isStarted) {
return 0;
}
JSMethodParam *data = new JSMethodParam();
std::string methodNameStr(methodName);
data->methodName = methodNameStr;
@ -221,14 +225,19 @@ NS_CC_BEGIN
}
}
int nativeCallBack(const char *funId, const char *methodName, const char *cparams) {
int nativeCallJS(std::string funId, std::string methodName, std::vector<std::string> sparams) {
if (!_isStarted) {
return 0;
}
JSMethodParam *data = new JSMethodParam();
std::string methodNameStr(methodName);
data->methodName = methodNameStr;
data->methodName = methodName;
data->funId = funId;
data->paramCount = 1;
addToArgArray(&data->args, funId);
addToArgArray(&data->args, cparams);
data->paramCount = sparams.size();
addToArgArray(&data->args, funId.c_str());
for (int i = 0; i < sparams.size(); i++) {
addToArgArray(&data->args, sparams[i].c_str());
}
std::shared_ptr<JSMethodParam> params(data);
int result = schedule_task_into_server_thread_task_queue(&gasync, [=](){
JcWallet::getInstance()->runJsMethod(params);
@ -269,8 +278,17 @@ bool jsb_wallet_callback(se::State& s) {
std::string msg;
ok = seval_to_std_string(args[1], &msg);
SE_PRECONDITION2(ok, false, "Error processing arguments");
// WalletEvent::Emit(funId.c_str(), msg.c_str());
// if funId begin with "webpage_" then call webview callback
if (funId.find("webpage_") == 0) {
NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init];
userInfo[@"funid"] = [NSString stringWithCString:funId.c_str() encoding:NSUTF8StringEncoding];
userInfo[@"data"] = [NSString stringWithCString:msg.c_str() encoding:NSUTF8StringEncoding];
[[NSNotificationCenter defaultCenter]
postNotificationName:@"ProxyCBNotification"
object: nil userInfo:userInfo];
} else {
RUN_IN_GAMETHREAD(JcWallet::getInstance()->jsToUnity(funId, msg));
}
return true;
}
return false;
@ -396,6 +414,29 @@ bool jsb_signWithTwitter(se::State& s) {
}
SE_BIND_FUNC(jsb_signWithTwitter)
bool jsb_signWithOAuth(se::State& s) {
const auto& args = s.args();
size_t argc = args.size();
if (argc >= 2) {
bool ok;
std::string funid;
ok = seval_to_std_string(args[0], &funid);
SE_PRECONDITION2(ok, false, "Error processing arguments");
std::string jsondata;
ok = seval_to_std_string(args[1], &jsondata);
SE_PRECONDITION2(ok, false, "jsondata is invalid!");
NSString *nfunid = [NSString stringWithCString:funid.c_str() encoding:NSUTF8StringEncoding];
NSString *njsondata = [NSString stringWithCString:jsondata.c_str() encoding:NSUTF8StringEncoding];
dispatch_async(dispatch_get_main_queue(), ^{
UIWindow* window = [[[UIApplication sharedApplication] delegate] window];
[window.rootViewController signWithOAuth:nfunid jsondata:njsondata ];
});
return true;
}
return false;
}
SE_BIND_FUNC(jsb_signWithOAuth)
bool jsb_signOutGoogle(se::State& s) {
const auto& args = s.args();
size_t argc = args.size();
@ -618,6 +659,29 @@ static bool JSB_storagePass(se::State& s)
}
SE_BIND_FUNC(JSB_storagePass)
static bool JSB_storageGameInfo(se::State& s)
{
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc > 1) {
std::string funid;
ok = seval_to_std_string(args[0], &funid);
SE_PRECONDITION2(ok, false, "funid is invalid!");
std::string param0;
ok = seval_to_std_string(args[1], &param0);
SE_PRECONDITION2(ok, false, "param0 is invalid!");
NSString *nParam0 = [NSString stringWithCString:param0.c_str() encoding: NSUTF8StringEncoding];
NSString *nfunid = [NSString stringWithCString:funid.c_str() encoding: NSUTF8StringEncoding];
[[GlobalData shareInstance] setGameData:nParam0];
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3);
return false;
}
SE_BIND_FUNC(JSB_storageGameInfo)
static bool JSB_authGetStoragePass(se::State& s)
{
const auto& args = s.args();
@ -675,6 +739,7 @@ bool jsb_register_walletevent_modules(se::Object* global) {
__jsbObj->defineFunction("signWithTikTok", _SE(jsb_signWithTikTok));
__jsbObj->defineFunction("signWithFacebook", _SE(jsb_signWithFacebook));
__jsbObj->defineFunction("signWithTwitter", _SE(jsb_signWithTwitter));
__jsbObj->defineFunction("signWithOAuth", _SE(jsb_signWithOAuth));
__jsbObj->defineFunction("signOutGoogle", _SE(jsb_signOutGoogle));
__jsbObj->defineFunction("showQRCode", _SE(JSB_showQRCode));
__jsbObj->defineFunction("showWebPage", _SE(jsb_showWebPage));
@ -686,6 +751,7 @@ bool jsb_register_walletevent_modules(se::Object* global) {
__jsbObj->defineFunction("storagePass", _SE(JSB_storagePass));
__jsbObj->defineFunction("getClientId", _SE(JSB_getClientId));
__jsbObj->defineFunction("passStorageState", _SE(JSB_passStorageState));
__jsbObj->defineFunction("updateGameInfo", _SE(JSB_storageGameInfo));
// JSB_signWithEmail
// JSB_beginBuyJNI
return true;

View File

@ -0,0 +1,17 @@
//
// NSDictionary+Customer.h
// Unity-iPhone
//
// Created by Hl Zhang on 2023/9/7.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSDictionary (Customer)
+(NSDictionary *)parseJSONString:(NSString *)jsonString;
+(NSString *)toJSONString: (NSDictionary *) json minify:(BOOL) minify;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,39 @@
//
// NSDictionary+Customer.m
// Unity-iPhone
//
// Created by Hl Zhang on 2023/9/7.
//
#import "NSDictionary+Customer.h"
@implementation NSDictionary (Customer)
+(NSDictionary *)parseJSONString:(NSString *)jsonString {
NSData *data = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error = nil;
NSDictionary *result = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
if (error != nil) {
NSLog(@"Error parsing JSON string: %@", error.localizedDescription);
return nil;
}
return result;
}
+(NSString *)toJSONString: (NSDictionary *) json minify:(BOOL) minify {
NSError *error = nil;
NSJSONWritingOptions option = minify ? (NSJSONWritingOptions)0 : NSJSONWritingPrettyPrinted;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:json options:option error:&error];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
if (minify) {
jsonString = [jsonString stringByReplacingOccurrencesOfString:@"\\s"
withString:@""
options:NSRegularExpressionSearch
range:NSMakeRange(0, [jsonString length])];
}
if (error != nil) {
NSLog(@"Error stringify JSON data: %@", error.localizedDescription);
return nil;
}
return jsonString;
}
@end

View File

@ -10,6 +10,7 @@
#import "UIViewController+Logger.h"
#import <Foundation/Foundation.h>
#import "NSString+Customer.h"
#import "NSDictionary+Customer.h"
@import FBSDKCoreKit;
@import FirebaseAnalytics;
@ -17,23 +18,13 @@
-(NSDictionary *)parseJSONString:(NSString *)jsonString{
NSData *data = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error = nil;
NSDictionary *result = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
if (error != nil) {
NSLog(@"Error parsing JSON string: %@", error.localizedDescription);
return nil;
}
return result;
}
-(void)logEvent:(NSString *)content{
if ([NSString isStringEmpty:content]) {
NSLog(@"Content is empty");
return;
}
NSDictionary *jsonDict = [self parseJSONString:content];
NSDictionary *jsonDict = [NSDictionary parseJSONString:content];
if (jsonDict == nil) {
NSLog(@"Error parsing JSON string");
return;

View File

@ -17,6 +17,7 @@
- (void)signWithTikTok:(NSString *)funid;
- (void)signWithFacebook:(NSString *)funid;
- (void)signWithTwitter:(NSString *)funid;
- (void)signWithOAuth:(NSString *)funid jsondata: (NSString *) jsondata;
- (void)signOutGoogle:(NSString *)funid;
- (void)clientLogin:(NSString *)funid;
- (void)saveKey:(NSString *)account key:(NSString *)key;
@ -26,4 +27,5 @@
- (void)passStorageState:(NSString *)funid account:(NSString *)account;
- (void)storagePass:(NSString *)funid account:(NSString *)account pass:(NSString *)pass;
- (void)authGetStoragePass:(NSString *)funid account:(NSString *)account;
- (void)storageGameInfo:(NSString *)funid data:(NSString *)data;
@end

View File

@ -19,6 +19,8 @@
#import "AppleSignIn.h"
#include "cocos/scripting/js-bindings/manual/jsb_global.h"
#import <LocalAuthentication/LocalAuthentication.h>
#import "NSDictionary+Customer.h"
@import SafariServices;
@import FBSDKLoginKit;
@import GoogleSignIn;
@ -150,8 +152,9 @@ static WebPageViewController *webpageVC = nil;
if (resp.errCode == 0) {
NSString *responseCode = resp.code;
// Upload response code to your server and obtain user access token
[self nativeCb:funid hasErr:NO dataStr:responseCode];
NSLog(@"tiktok resp: %@", responseCode);
[self nativeCb:funid hasErr:NO dataStr:responseCode];
// NSLog(@"tiktok resp: %@", responseCode);
} else {
// User authorization failed. Handle errors
NSLog(@"tiktok resp error: %@", resp.description);
@ -190,11 +193,82 @@ static WebPageViewController *webpageVC = nil;
- (void) signWithTwitter:(NSString *) funid {
}
- (void) signWithOAuth:(NSString *) funid jsondata: (NSString *) jsondata {
// convert jsondata to NSDictionary
NSError *error;
NSData *jsonData = [jsondata dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
if (error) {
[self nativeCb:funid hasErr:YES dataStr: error.localizedDescription];
return;
}
NSString *url = [NSString stringWithFormat:@"%@?client_id=%@&response_type=%@&redirect_uri=%@&scope=%@&state=%@", json[@"endpoint"], json[@"client_id"], json[@"response_type"], json[@"redirect_uri"], json[@"scopes"], funid];
// check if json has "response_mode"
if (json[@"response_mode"] != nil) {
url = [NSString stringWithFormat:@"%@&response_mode=%@", url, json[@"response_mode"]];
}
NSString* webStringURL = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL* authURL = [NSURL URLWithString:webStringURL];
// Create a Safari View Controller with the auth URL
SFSafariViewController *safariViewController = [[SFSafariViewController alloc] initWithURL:authURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(receiveDeepLinkNotification:)
name:@"kUnityOnOpenURL"
object:nil];
// Present the Safari View Controller
[self presentViewController:safariViewController animated:NO completion:nil];
}
- (void) receiveDeepLinkNotification: (NSNotification *) notification {
NSDictionary *userInfo = notification.userInfo;
// check if userInfo is nil
if (userInfo == nil) {
return;
}
NSURL *url = userInfo[@"url"];
NSString *sourceApplication = userInfo[@"sourceApplication"];
// check if url is nil or sourceApplication is nil
if (url == nil || [NSString isStringEmpty:sourceApplication]) {
return;
}
// check if scheme is equal to cfoauthcb
if (![url.scheme isEqualToString:@"cfoauthcb"]) {
return;
}
// check if sourceApplication is equal to com.apple.SafariViewService
if ([sourceApplication isEqualToString:@"com.apple.SafariViewService"]) {
NSURLComponents *components = [[NSURLComponents alloc] initWithURL:url resolvingAgainstBaseURL:YES];
// check if url has token and state
if (components.queryItems == nil) {
return;
}
NSString *token = nil;
NSString *state = nil;
for (NSURLQueryItem *item in components.queryItems) {
if ([item.name isEqualToString:@"token"]) {
token = item.value;
} else if ([item.name isEqualToString:@"state"]) {
state = item.value;
}
}
if ([NSString isStringEmpty:token] || [NSString isStringEmpty:state]) {
return;
}
// send token to server
[self nativeCb:state hasErr:NO dataStr:token];
}
}
-(void)nativeCb:(NSString *)funid hasErr: (BOOL) hasErr dataStr:(NSString *) dataStr {
// check if had presentViewController, if had, then dismiss it
if (self.presentedViewController != nil) {
[self dismissViewControllerAnimated:NO completion:nil];
}
if ([NSString isStringEmpty:funid]) {
NSLog(@"nativeCallBack with empty funid: %@", funid);
return;
}
std::string methodName = "nativeCallBack";
NSMutableDictionary *json = [[NSMutableDictionary alloc] init];
if (hasErr) {
@ -204,19 +278,24 @@ static WebPageViewController *webpageVC = nil;
json[@"errcode"] = @0;
json[@"data"] = dataStr;
}
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:json options:NSJSONWritingPrettyPrinted error:&error];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
std::string sfunid = std::string([funid UTF8String], [funid lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
if (error) {
NSLog(@"Got an error: %@", error);
NSString *errorStr = [NSString stringWithFormat:@"{\"errcode\": 1, \"errmessage\": \"%@\"}", error];
std::string sparam = std::string([errorStr UTF8String], [errorStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
cocos2d::nativeCallBack(sfunid.c_str(), methodName.c_str(), sparam.c_str());
NSString *jsonString = [NSDictionary toJSONString:json minify:YES];
// check if funid begin with "webpage_"
if ([funid hasPrefix:@"webpage_"]) {
funid = [funid substringFromIndex:8];
NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init];
userInfo[@"funid"] = funid;
userInfo[@"data"] = jsonString;
[[NSNotificationCenter defaultCenter]
postNotificationName:@"CallPageNotification"
object: nil userInfo:userInfo];
return;
}
std::string sfunid = std::string([funid UTF8String], [funid lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
std::string sparam = std::string([jsonString UTF8String], [jsonString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
cocos2d::nativeCallBack(sfunid.c_str(), methodName.c_str(), sparam.c_str());
std::vector<std::string> sparams = {sparam};
cocos2d::nativeCallJS(sfunid, methodName, sparams);
// cocos2d::nativeCallBack(sfunid.c_str(), methodName.c_str(), sparam.c_str());
}
#pragma mark -- show webpage
@ -342,5 +421,8 @@ static WebPageViewController *webpageVC = nil;
[self nativeCb:funid hasErr:YES dataStr:error.localizedDescription];
}
}
}
- (void)storageGameInfo:(NSString *)funid data:(NSString *)data {
}
@end

View File

@ -11,6 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface WebPageViewController : UIViewController
@property (nonatomic, copy) NSString* url;
- (void) callPageJS:(NSString *) script;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,44 +0,0 @@
//
// WebPageViewController.m
// Unity-iPhone
//
// Created by Hl Zhang on 2023/3/14.
//
#import "WebPageViewController.h"
#import <WebKit/WebKit.h>
#define SCREENWIDTH [UIScreen mainScreen].bounds.size.width
#define SCREENHEIGHT [UIScreen mainScreen].bounds.size.height
@interface WebPageViewController ()
@property (nonatomic, strong) WKWebView *webView;
@end
@implementation WebPageViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Create the WKWebView
self.webView = [[WKWebView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:self.webView];
// Load the URL
NSURL *url = [NSURL URLWithString:self.url];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end

View File

@ -0,0 +1,251 @@
//
// WebPageViewController.m
// Unity-iPhone
//
// Created by Hl Zhang on 2023/3/14.
//
#import "WebPageViewController.h"
#import <WebKit/WebKit.h>
#include "cocos/scripting/js-bindings/manual/jsb_global.h"
#include "JcWallet.h"
#define SCREENWIDTH [UIScreen mainScreen].bounds.size.width
#define SCREENHEIGHT [UIScreen mainScreen].bounds.size.height
#import "NSDictionary+Customer.h"
#import "UIViewController+Wallet.h"
#import "UIViewController+QR.h"
#import "UIViewController+Purchase.h"
#include "cocos/scripting/js-bindings/manual/jsb_global.h"
#import "GlobalData.h"
#import "QRCodeReaderViewController.h"
#import "QRCodeReader.h"
#import "QRCodeReaderDelegate.h"
#import "SimpleQRViewController.h"
#import "LBXPermission.h"
#import "LBXPermissionSetting.h"
@interface WebPageViewController ()<WKScriptMessageHandler>
@property (nonatomic, strong) WKWebView *webView;
@end
static QRCodeReaderViewController *qrcodeReaderVC = nil;
static SimpleQRViewController *sqrVC = nil;
@implementation WebPageViewController
- (void)viewDidLoad {
[super viewDidLoad];
WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
config.preferences.minimumFontSize = 10;
config.preferences.javaScriptEnabled = YES;
//不通过用户交互,是否可以打开窗口
config.preferences.javaScriptCanOpenWindowsAutomatically = NO;
// custom user agent
config.applicationNameForUserAgent = @"ios_game_web";
// [config.preferences setValue:@TRUE forKey:@"allowFileAccessFromFileURLs"];
// [config setValue:@TRUE forKey:@"allowUniversalAccessFromFileURLs"];
// Create the WKWebView
self.webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:config];
[self.view addSubview:self.webView];
// load from local
// NSString *filePath = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"html"];
// NSURL *baseURL = [[NSBundle mainBundle] bundleURL];
// [self.webView loadHTMLString:[NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil] baseURL:baseURL];
// NSURL *fileUrl = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html" subdirectory:@"html"];
// [self.webView loadFileURL:fileUrl allowingReadAccessToURL:fileUrl];
// NSURLRequest *request = [NSURLRequest requestWithURL:fileUrl];
// [self.webView loadRequest:request];
// Load the URL
// NSURL *url = [NSURL URLWithString:self.url];
// NSURL *url = [NSURL URLWithString: @"http://192.168.1.16/web-wallet/index.html?t=1"];
// NSURL *url = [NSURL URLWithString: @"http://192.168.100.185/web-wallet/index.html?t=3"];
// NSURL *url = [NSURL URLWithString: @"https://test.kingsome.cn/html/wallet/web-wallet/index.html?t=3"];
//
NSURL *url = [NSURL URLWithString: @"https://doc.kingsome.cn/game2006web/data/web-mobile/index.html"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
WKUserContentController *userCC = config.userContentController;
//JS调用OC 添加处理脚本
[userCC addScriptMessageHandler:self name:@"pageCall"];
NSString *gameData = [[GlobalData shareInstance] getGameData];
NSString *jSString = [NSString stringWithFormat:@"window.platform='ios_game_web'; window.gameData='%@';", gameData];
//用于进行JavaScript注入
WKUserScript *wkUScript = [[WKUserScript alloc] initWithSource:jSString injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
[config.userContentController addUserScript:wkUScript];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(receiveProxyCBNotification:)
name:@"ProxyCBNotification"
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(receiveCallPageNotification:)
name:@"CallPageNotification"
object:nil];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self removeAllScriptMsgHandle];
}
-(void)removeAllScriptMsgHandle{
WKUserContentController *controller = self.webView.configuration.userContentController;
[controller removeScriptMessageHandlerForName:@"pageCall"];
}
#pragma mark - WKScriptMessageHandler
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
NSLog(@"%@",NSStringFromSelector(_cmd));
NSLog(@"%@",message.body);
if ([message.name isEqualToString:@"pageCall"]) {
// [self showMsg: message.body];
NSDictionary *params = [NSDictionary parseJSONString:message.body];
NSString *action = params[@"action"];
NSString *funid = [NSString stringWithFormat:@"webpage_%@", params[@"funid"]];
NSDictionary *subData = params[@"data"];
if ([action isEqualToString:@"closepage"]) {
[self dismissSelf:nil];
} else if ([action isEqualToString:@"scanQRCode"]) {
NSString *title = params[@"title"];
[self scanQRCode:funid title:title];
} else if ([action isEqualToString:@"showQRCode"]) {
NSString *title = params[@"title"];
[self showQRCode:title];
} else if ([action isEqualToString:@"authGetStoragePass"]) {
UIWindow* window = [[[UIApplication sharedApplication] delegate] window];
NSString *key = params[@"key"];
[window.rootViewController authGetStoragePass:funid account:key];
} else if ([action isEqualToString:@"passStorageState"]) {
UIWindow* window = [[[UIApplication sharedApplication] delegate] window];
NSString *key = params[@"key"];
[window.rootViewController passStorageState:funid account:key];
} else if ([action isEqualToString:@"storagePass"]) {
UIWindow* window = [[[UIApplication sharedApplication] delegate] window];
NSString *key = params[@"key"];
NSString *pass = params[@"pass"];
[window.rootViewController storagePass:funid account:key pass:pass];
} else if ([action isEqualToString:@"proxyMethod"]) {
NSString *methodNmae = params[@"methodname"];
NSArray *paramsArr = params[@"params"];
std::vector<std::string> sparams;
for (int i = 0; i < paramsArr.count; i++) {
NSString *param = paramsArr[i];
sparams.push_back(std::string([param UTF8String], [param lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
}
std::string sMethdoName = std::string([methodNmae UTF8String], [methodNmae lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
std::string sfunid = std::string([funid UTF8String], [funid lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
cocos2d::nativeCallJS(sfunid, sMethdoName, sparams);
} else {
NSLog(@"unknown action: %@, data: %@", action, subData);
}
}
}
- (void) callPageJS:(NSString *) script {
NSLog(@"call page script: %@", script);
[self.webView evaluateJavaScript:script completionHandler:^(id _Nullable response, NSError * _Nullable error) {
//JS 返回结果
NSLog(@"%@ %@",response,error);
}];
}
-(void)dismissSelf:(UIButton *)button{
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)showMsg:(NSString *)msg {
[[[UIAlertView alloc] initWithTitle:nil message:msg delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil] show];
}
- (void) receiveProxyCBNotification: (NSNotification *) notification {
if ([[notification name] isEqualToString:@"ProxyCBNotification"]) {
NSDictionary *userInfo = notification.userInfo;
NSString *funid = userInfo[@"funid"];
if ([funid hasPrefix:@"webpage_"]) {
funid = [funid substringFromIndex:8];
}
NSString *data = userInfo[@"data"];
NSLog (@"received ProxyCBNotification::funid: %@, data: %@", funid, data);
NSString *jscode = [NSString stringWithFormat:@"proxyCallback('%@', '%@');", funid, data];
[self callPageJS: jscode];
}
}
- (void) receiveCallPageNotification: (NSNotification *) notification {
if ([[notification name] isEqualToString:@"CallPageNotification"]) {
NSDictionary *userInfo = notification.userInfo;
NSString *funid = userInfo[@"funid"];
if ([funid hasPrefix:@"webpage_"]) {
funid = [funid substringFromIndex:8];
}
NSString *data = userInfo[@"data"];
NSLog (@"received CallPageNotification::funid: %@, data: %@", funid, data);
NSString *jscode = [NSString stringWithFormat:@"nativeCall('%@', '%@');", funid, data];
[self callPageJS: jscode];
}
}
#pragma mark -- qrcode
-(void)showQRCode:(NSString *)content {
if (qrcodeReaderVC == nil) {
sqrVC = [SimpleQRViewController new];
}
sqrVC.content = content;
// next three code set transparent for simple qr view
self.definesPresentationContext = YES;
sqrVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
sqrVC.view.backgroundColor = [UIColor colorWithRed: 0.0/255.0 green: 0.0/255.0 blue: 0.0/255.0 alpha: 100.0/255.0];
[self presentViewController:sqrVC animated:YES completion:nil];
}
-(void)beginScanQRCode:(NSString *)funid title:(NSString *) title{
std::string sfunid = std::string([funid UTF8String], [funid lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
// __weak __typeof(self) weakSelf = self;
if ([QRCodeReader supportsMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]]) {
// static dispatch_once_t onceToken;
dispatch_async(dispatch_get_main_queue(), ^{
// if we are active again, we don't need to do this anymore
if (qrcodeReaderVC == nil) {
QRCodeReader *reader = [QRCodeReader readerWithMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]];
qrcodeReaderVC = [QRCodeReaderViewController readerWithCancelButtonTitle:@"Cancel" codeReader:reader startScanningAtLoad:YES showSwitchCameraButton:YES showTorchButton:YES];
qrcodeReaderVC.modalPresentationStyle = UIModalPresentationFormSheet;
}
[qrcodeReaderVC setCompletionWithBlock:^(NSString *resultAsString, NSError *error){
if (error != nil) {
[self nativeCb:funid hasErr:YES dataStr: error.localizedDescription];
} else {
NSLog(@"scan result: %@", resultAsString);
[self nativeCb:funid hasErr:NO dataStr: resultAsString];
}
}];
[self presentViewController:qrcodeReaderVC animated:YES completion:NULL];
});
}
}
-(void)scanQRCode:(NSString *)funid title:(NSString *) title{
NSLog(@"scanQRCode:: funId: %@ title: %@", funid, title);
__weak __typeof(self) weakSelf = self;
[LBXPermission authorizeWithType:LBXPermissionType_Camera completion:^(BOOL granted, BOOL firstTime) {
if (granted) {
[weakSelf beginScanQRCode:funid title:title];
}
else if(!firstTime) {
[LBXPermissionSetting showAlertToDislayPrivacySettingWithTitle:@"Error" msg:@"The camera is need to scan QR codes" cancel:@"Cancel" setting:@"Setting" completion:^{
[weakSelf nativeCb:funid hasErr:YES dataStr: @"no permission, need resend"];
}];
}
}];
}
@end

View File

@ -50,19 +50,35 @@
<string>fb1204701000119770</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>tebg</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>cfoauthcb</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>0</string>
<key>FacebookAdvertiserIDCollectionEnabled</key>
<true/>
<key>FacebookAppID</key>
<string>1204701000119770</string>
<key>FacebookAutoLogAppEventsEnabled</key>
<true/>
<key>FacebookClientToken</key>
<string>3e29f2606ae15a99bb3824d2ef1a9d0b</string>
<key>FacebookDisplayName</key>
<string>CEBG</string>
<key>FacebookAutoLogAppEventsEnabled</key>
<true/>
<key>FacebookAdvertiserIDCollectionEnabled</key>
<true/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
@ -74,8 +90,6 @@
<string>snssdk1180</string>
<string>snssdk1233</string>
</array>
<key>TikTokAppID</key>
<string>awqbuzh2qymmq8hs</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
@ -85,12 +99,12 @@
</dict>
<key>NSCameraUsageDescription</key>
<string>The camera is need to scan QR codes</string>
<key>NSFaceIDUsageDescription</key>
<string>Use Face ID to unlock the wallet</string>
<key>NSMicrophoneUsageDescription</key>
<string>THe microphoe is need to talk in game.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Restore Wallet recovery key need Photo Libray</string>
<key>NSFaceIDUsageDescription</key>
<string>Use Face ID to unlock the wallet</string>
<key>SKAdNetworkItems</key>
<array>
<dict>
@ -314,6 +328,8 @@
<string>4DZT52R2T5.skadnetwork</string>
</dict>
</array>
<key>TikTokAppID</key>
<string>awqbuzh2qymmq8hs</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen-iPhone</string>
<key>UILaunchStoryboardName~ipad</key>
@ -331,8 +347,6 @@
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UISupportsTrueScreenSizeOnMac</key>
<true/>
<key>UIRequiresPersistentWiFi</key>
<false/>
<key>UIStatusBarHidden</key>
@ -344,6 +358,8 @@
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
</array>
<key>UISupportsTrueScreenSizeOnMac</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UnityCloudProjectID</key>

View File

@ -85,7 +85,7 @@ typedef struct NotificationSettingsData {
int showPreviewsSetting;
} NotificationSettingsData;
const int kDefaultPresentationOptions = -1;
@interface UnityNotificationManager : NSObject <UNUserNotificationCenterDelegate>

View File

@ -15,7 +15,7 @@
@implementation UnityNotificationManager
const int kDefaultPresentationOptions = -1;
+ (instancetype)sharedInstance
{
static UnityNotificationManager *sharedInstance = nil;

File diff suppressed because it is too large Load Diff

View File

@ -3,4 +3,879 @@
uuid = "FBE6B024-8F98-4B20-920C-CB18880934F0"
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "4604224B-AA3B-4B3F-92B1-11913FF3B5D7"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "156"
endingLineNumber = "156"
landmarkName = "-signWithTikTok:"
landmarkType = "7">
<Locations>
<Location
uuid = "4604224B-AA3B-4B3F-92B1-11913FF3B5D7 - 1444efee473fa6f6"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__43-[UIViewController(Wallet) signWithTikTok:]_block_invoke"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "153"
endingLineNumber = "153"
offsetFromSymbolStart = "124">
</Location>
<Location
uuid = "4604224B-AA3B-4B3F-92B1-11913FF3B5D7 - 1444efee473fa629"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__43-[UIViewController(Wallet) signWithTikTok:]_block_invoke"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "154"
endingLineNumber = "154"
offsetFromSymbolStart = "152">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "500A79D8-4B4E-475A-B444-78E2938D7FB6"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "111"
endingLineNumber = "111"
landmarkName = "-userContentController:didReceiveScriptMessage:"
landmarkType = "7">
<Locations>
<Location
uuid = "500A79D8-4B4E-475A-B444-78E2938D7FB6 - 17324010e7a1e6b2"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController userContentController:didReceiveScriptMessage:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "69"
endingLineNumber = "69"
offsetFromSymbolStart = "496">
</Location>
<Location
uuid = "500A79D8-4B4E-475A-B444-78E2938D7FB6 - 17324010e7ae183e"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController userContentController:didReceiveScriptMessage:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "81"
endingLineNumber = "81"
offsetFromSymbolStart = "564">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "A74661E7-4009-490E-A718-E0A67E91B650"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "167"
endingLineNumber = "167"
landmarkName = "-showMsg:"
landmarkType = "7">
<Locations>
<Location
uuid = "A74661E7-4009-490E-A718-E0A67E91B650 - 17324010e7ae1113"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController userContentController:didReceiveScriptMessage:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "134"
endingLineNumber = "134"
offsetFromSymbolStart = "6416">
</Location>
<Location
uuid = "A74661E7-4009-490E-A718-E0A67E91B650 - 17324010e7ae1134"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController userContentController:didReceiveScriptMessage:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "135"
endingLineNumber = "135"
offsetFromSymbolStart = "6488">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "B7D97674-91C4-4996-8008-86EE56573B79"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "166"
endingLineNumber = "166"
landmarkName = "-showMsg:"
landmarkType = "7">
<Locations>
<Location
uuid = "B7D97674-91C4-4996-8008-86EE56573B79 - 17324010e7ae1134"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController userContentController:didReceiveScriptMessage:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "135"
endingLineNumber = "135"
offsetFromSymbolStart = "6460">
</Location>
<Location
uuid = "B7D97674-91C4-4996-8008-86EE56573B79 - 17324010e7ae1113"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController userContentController:didReceiveScriptMessage:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "134"
endingLineNumber = "134"
offsetFromSymbolStart = "6444">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "1302D5E9-906E-48B2-9C62-FB020D0F8664"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "174"
endingLineNumber = "174"
landmarkName = "-receiveProxyCBNotification:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "6FD88F52-E137-4A72-8960-21C33C006B67"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/JcWallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "280"
endingLineNumber = "280"
landmarkName = "jsb_wallet_callback(s)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "45093B72-466E-44C8-BF27-A1DF8504BC27"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "212"
endingLineNumber = "212"
landmarkName = "-beginScanQRCode:title:"
landmarkType = "7">
<Locations>
<Location
uuid = "45093B72-466E-44C8-BF27-A1DF8504BC27 - 7f1818c9e9db3648"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController receiveCallPageNotification:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "210"
endingLineNumber = "210"
offsetFromSymbolStart = "524">
</Location>
<Location
uuid = "45093B72-466E-44C8-BF27-A1DF8504BC27 - bd115d11bebb99e7"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController receiveProxyCBNotification:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "210"
endingLineNumber = "210"
offsetFromSymbolStart = "296">
</Location>
<Location
uuid = "45093B72-466E-44C8-BF27-A1DF8504BC27 - bd115d11bebb99e7"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController receiveProxyCBNotification:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "210"
endingLineNumber = "210"
offsetFromSymbolStart = "340">
</Location>
<Location
uuid = "45093B72-466E-44C8-BF27-A1DF8504BC27 - cd20625e4c015fca"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController beginScanQRCode:title:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "211"
endingLineNumber = "211"
offsetFromSymbolStart = "156">
</Location>
<Location
uuid = "45093B72-466E-44C8-BF27-A1DF8504BC27 - cd20625e4c015f88"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController beginScanQRCode:title:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "213"
endingLineNumber = "213"
offsetFromSymbolStart = "156">
</Location>
<Location
uuid = "45093B72-466E-44C8-BF27-A1DF8504BC27 - cd20625e4c015f88"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController beginScanQRCode:title:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "213"
endingLineNumber = "213"
offsetFromSymbolStart = "592">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "17BD8BD1-D356-41D8-9F0D-7BE8AF442DB5"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "220"
endingLineNumber = "220"
landmarkName = "-signWithOAuth:jsondata:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "7964288C-6751-40EE-9F34-F93D40ABABF0"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "198"
endingLineNumber = "198"
landmarkName = "-showQRCode:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "85F01FDB-2BDA-426F-A36D-F33364C4A972"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/JcWallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "459"
endingLineNumber = "459"
landmarkName = "JSB_showQRCode(s)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "E82F90B3-7C16-4BBA-844E-3C6EB1E71873"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+QR.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "51"
endingLineNumber = "51"
landmarkName = "-showQRCode:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "6374755A-2BF7-43A6-B187-57EE5F578460"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "66"
endingLineNumber = "66"
landmarkName = "-viewDidLoad"
landmarkType = "7">
<Locations>
<Location
uuid = "6374755A-2BF7-43A6-B187-57EE5F578460 - 6c111bbdbb09e5d9"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController viewDidLoad]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "51"
endingLineNumber = "51"
offsetFromSymbolStart = "704">
</Location>
<Location
uuid = "6374755A-2BF7-43A6-B187-57EE5F578460 - 6c111bbdbb09e5d9"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController viewDidLoad]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "51"
endingLineNumber = "51"
offsetFromSymbolStart = "604">
</Location>
<Location
uuid = "6374755A-2BF7-43A6-B187-57EE5F578460 - 6c111bbdbb09e5d9"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController viewDidLoad]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "51"
endingLineNumber = "51"
offsetFromSymbolStart = "788">
</Location>
<Location
uuid = "6374755A-2BF7-43A6-B187-57EE5F578460 - 6c111bbdbb09e5d9"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController viewDidLoad]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "51"
endingLineNumber = "51"
offsetFromSymbolStart = "792">
</Location>
<Location
uuid = "6374755A-2BF7-43A6-B187-57EE5F578460 - 6c111bbdbb09e69f"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[WebPageViewController viewDidLoad]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "57"
endingLineNumber = "57"
offsetFromSymbolStart = "932">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "50246B59-127E-419D-868A-6C932054EF15"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "42"
endingLineNumber = "42"
landmarkName = "-viewDidLoad"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "BA83AFB6-0F82-4F1E-B66C-69F0B1E28749"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/WebPageViewController.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "133"
endingLineNumber = "133"
landmarkName = "-userContentController:didReceiveScriptMessage:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "B63977ED-31BC-4F0A-B2EC-A670225F26CC"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1132"
endingLineNumber = "1132"
landmarkName = "XMLHttpRequest_setResponseType(s)"
landmarkType = "9">
<Locations>
<Location
uuid = "B63977ED-31BC-4F0A-B2EC-A670225F26CC - 6002f8acdb143fdc"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "XMLHttpRequest_setResponseType(se::State&amp;)"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1126"
endingLineNumber = "1126"
offsetFromSymbolStart = "1572">
</Location>
<Location
uuid = "B63977ED-31BC-4F0A-B2EC-A670225F26CC - 6002f8acdb143ea6"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "XMLHttpRequest_setResponseType(se::State&amp;)"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1132"
endingLineNumber = "1132"
offsetFromSymbolStart = "1188">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "172C710D-D3C7-4F99-BFC7-24541B8F3546"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_global.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1384"
endingLineNumber = "1384"
landmarkName = "JSB_walletSign(s)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "463FD24C-5F99-4FA1-AE20-9FB8C1B7855C"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/AppDelegate.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "91"
endingLineNumber = "91"
landmarkName = "AppDelegate::onPause()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "77886134-4691-48ED-BBAE-9E4FB5EB305A"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1049"
endingLineNumber = "1049"
landmarkName = "XMLHttpRequest_setTimeout(s)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "828615B8-EC68-420A-A27E-E8CED25D8520"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "307"
endingLineNumber = "307"
landmarkName = "XMLHttpRequest::setTimeout(timeoutInMilliseconds)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "F8924819-7208-4AA7-BA81-CB4A40EE785A"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../crypto/cocos_js/cocos/network/HttpClient-apple.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "114"
endingLineNumber = "114"
landmarkName = "HttpClient::networkThreadAlone(request, response)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "64DC57C9-39C1-4ACC-90FF-3F952F920849"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "363"
endingLineNumber = "363"
landmarkName = "XMLHttpRequest::getHeader(header)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "F306CF09-451B-4A2C-91C2-12A7FE75444D"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "365"
endingLineNumber = "365"
landmarkName = "XMLHttpRequest::getHeader(header)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "DC5DADD6-5C26-452C-A831-460B68354E9F"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "385"
endingLineNumber = "385"
landmarkName = "XMLHttpRequest::getHeader(header)"
landmarkType = "7">
<Locations>
<Location
uuid = "DC5DADD6-5C26-452C-A831-460B68354E9F - bd2010ad56aea0f7"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "XMLHttpRequest::getHeader(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt;&gt; const&amp;)"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "385"
endingLineNumber = "385"
offsetFromSymbolStart = "1316">
</Location>
<Location
uuid = "DC5DADD6-5C26-452C-A831-460B68354E9F - bd2010ad56aea0f7"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "XMLHttpRequest::getHeader(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt;&gt; const&amp;)"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "385"
endingLineNumber = "385"
offsetFromSymbolStart = "1312">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "EAB9B239-7884-4A2B-BAFF-F6160C72E6B2"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_global.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1402"
endingLineNumber = "1402"
landmarkName = "JSB_preRegistClient(s)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "D134C588-032B-4793-983F-E09121A348E0"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_global.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1401"
endingLineNumber = "1401"
landmarkName = "JSB_preRegistClient(s)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "0995A557-F634-4A29-B166-3E64AE251475"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_global.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1405"
endingLineNumber = "1405"
landmarkName = "JSB_preRegistClient(s)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "C1AB6DAD-FCEB-495C-A7CC-377107371044"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../crypto/cocos_js/cocos/scripting/js-bindings/manual/jsb_global.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "321"
endingLineNumber = "321"
landmarkName = "require(s)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "D8BB00DC-AA20-47C3-93F9-9D03FDFA9F42"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "217"
endingLineNumber = "217"
landmarkName = "-signWithOAuth:jsondata:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "D37987A6-101C-48CD-B00C-BA0151037B3A"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "219"
endingLineNumber = "219"
landmarkName = "-signWithOAuth:jsondata:"
landmarkType = "7">
<Locations>
<Location
uuid = "D37987A6-101C-48CD-B00C-BA0151037B3A - 8543151a2b853e4"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[UIViewController(Wallet) receiveDeepLinkNotification:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "224"
endingLineNumber = "224"
offsetFromSymbolStart = "248">
</Location>
<Location
uuid = "D37987A6-101C-48CD-B00C-BA0151037B3A - 8543151a2b853c5"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[UIViewController(Wallet) receiveDeepLinkNotification:]"
moduleName = "tebg"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhl/Documents/workspace/ios/ios-unity/Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "225"
endingLineNumber = "225"
offsetFromSymbolStart = "240">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "EBCF2018-FCC5-40F8-A7D5-63FE9EB34E47"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "205"
endingLineNumber = "205"
landmarkName = "-signWithOAuth:jsondata:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -3,10 +3,18 @@
version = "1.0">
<ContextStates>
<ContextState
contextName = "-[UIViewController(Purchase) beginBuy:productId:orderId:]:UIViewController+Purchase.mm">
contextName = "-[UnityAppController application:openURL:options:]:UnityAppController.mm">
<PersistentStrings>
<PersistentString
value = "self.currentFunId">
value = "sourceApplication">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "JSB_prepareRelayRSAKey(se::State&amp;):jsb_global.cpp">
<PersistentStrings>
<PersistentString
value = "key_str.length()">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -18,5 +26,29 @@
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "-[WebPageViewController userContentController:didReceiveScriptMessage:]:WebPageViewController.mm">
<PersistentStrings>
<PersistentString
value = "params[@&quot;methodname&quot;]">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "(anonymous namespace)::require(se::State&amp;):jsb_global.cpp">
<PersistentStrings>
<PersistentString
value = "args[0].toString()">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "-[UIViewController(Purchase) beginBuy:productId:orderId:]:UIViewController+Purchase.mm">
<PersistentStrings>
<PersistentString
value = "self.currentFunId">
</PersistentString>
</PersistentStrings>
</ContextState>
</ContextStates>
</VariablesViewState>

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,5 @@
console.log('>> begin load wallet main file.');
!window.jc || !jc.wallet ? new jcwallet.default() : jc.wallet;
function promiseCb(funId, promiseFun, dataParser) {
dataParser = dataParser || ((v) => v);
promiseFun
@ -12,24 +13,51 @@ function promiseCb(funId, promiseFun, dataParser) {
}
/**
* oauth login before init internal wallet
* @param {*} channel 0: google, 1: apple, 2: tiktok, 3: facebook, 4: twitter 5: tg, 6: email, 7: discord 10: client
* @param {string} channel:
* 0: google,
* 1: apple,
* 2: tiktok,
* 3: facebook,
* 4: twitter
* 5: tg,
* 6: email,
* 7: discord
* 10: client
* @param {string} env: dev release
* @param {string} account: guest account to bind
* @return {string} {token: string, address: string | null}
* token: token for wallet services
* address: address of wallet if already created (optional)
*/
function walletLogin(funId, channel, env) {
function walletLogin(funId, channel, env, account) {
channel = parseInt(channel);
env = env || 'dev';
console.log('walletLogin: ' + channel);
const wallet = !window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
promiseCb(funId, wallet.preLogin(channel, env));
promiseCb(funId, jc.wallet.preLogin(channel, env, account));
}
function logout(funId, channel) {
channel = parseInt(channel || '0');
promiseCb(funId, jc.wallet.logout(channel));
}
function updateGameInfo(funId, info) {
jsb.updateGameInfo(funId, info);
promiseCb(funId, Promise.resolve(1));
}
/**
* init internal wallet with password
* @param {number | string} chain chain id
* @param {string} pass
* @param {string} chain: chain id
* @param {string} pass: password for wallet
* @param {string} env: dev release
* @param {string} useApi: 1: yes, 0: no
* @return {string} address
* @throws {Error} if password is wrong
*/
function initInternalWallet(funId, chain, pass, env) {
function initInternalWallet(funId, chain, pass, env, useApi) {
chain = parseInt(chain);
const wallet = !window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
promiseCb(funId, wallet.initInternalWallet(chain, pass, env), () => {
useApi = (useApi && useApi == '1') ? true: false
promiseCb(funId, jc.wallet.initInternalWallet(chain, pass, env, useApi), () => {
return jc.wallet.nativeAccount;
});
}
@ -42,41 +70,58 @@ function verifyPassword(funId, pass) {
promiseCb(funId, jc.wallet.verifyLocalPass(pass));
}
/**
* @Deprecated
* init third party wallet
* @param {number | string} chain chain id
*/
function initThirdPartyWallet(funId, chain, env) {
function initThirdPartyWallet(funId, chain, env, wallettype, provider) {
chain = parseInt(chain);
const wallet = !window.jc || !jc.wallet ? new jcwallet.default({ type: 1 }) : jc.wallet;
promiseCb(funId, wallet.initThirdPartyWallet(chain, env), () => {
return jc.wallet.currentAccount();
});
wallettype = parseInt(wallettype || '1');
promiseCb(funId, jc.wallet.initThirdPartyWallet(chain, env, wallettype, provider));
}
function initRelayWallet(funId, chain, env) {
chain = parseInt(chain);
promiseCb(funId, jc.wallet.initRelayWallet(chain, env));
}
/**
* all chain list we supported
* @return {string} JSON string of
* [{ name: string
* type: string
* rpc: string
* id: number
* network?: string
* symbol?: string
* explorerurl?: string
* decimals?: number
* }]
*/
function chainList(funId) {
try {
let data = jc.wallet.chainList;
return JSON.stringify({ errcode: 0, data });
} catch (err) {
return JSON.stringify({ errcode: 1, errmsg: err.message || err });
}
promiseCb(funId, Promise.resolve(data));
}
/**
* chain active
* current actived chain info
* @return {string} JSON string of
* { name: string
* type: string
* rpc: string
* id: number
* network?: string
* symbol?: string
* explorerurl?: string
* decimals?: number
* }
*/
function currentChain(funId) {
try {
let data = jc.wallet.currentChain;
return JSON.stringify({ errcode: 0, data });
} catch (err) {
return JSON.stringify({ errcode: 1, errmsg: err.message || err });
}
promiseCb(funId, Promise.resolve(data));
}
/**
* [BOTH]change chain
* change current actived chain
*/
function changeChain(funId, chainId) {
chainId = parseInt(chainId);
@ -97,18 +142,18 @@ function loginSign(funId, nonce, tips) {
* if account is null, we`ll query for current account of wallet
*/
function getEthBalance(funId, account) {
promiseCb(funId, jc.wallet.getBalance(account));
promiseCb(funId, jc.wallet.chainCommon.getBalance(account));
}
/**
* send ETH from current account
* @param {string} to: target account
* @param {string} amount:
* @param {number} estimate: 1: only estimate gas price
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function sendEth(funId, to, amount, estimate) {
estimate = (estimate || '0') | 0;
promiseCb(funId, jc.wallet.sendEth(to, amount, estimate));
promiseCb(funId, jc.wallet.chainCommon.sendEth(to, amount, estimate));
}
/**
@ -139,22 +184,30 @@ function erc20Info(funId, address) {
* @param {string} account:
*/
function erc20Balance(funId, address, account) {
promiseCb(funId, jc.wallet.erc20Balance(address, account));
promiseCb(funId, jc.wallet.erc20Standard.getBalanceOf(address, account));
}
/**
* send ERC20 token to to
* @param {string} address: contract address of ERC20
* @param {string} to: target account
* @param {string} amount: amount of token to send
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function sendErc20(funId, address, to, amount, estimate) {
estimate = (estimate || '0') | 0;
promiseCb(funId, jc.wallet.sendErc20(address, to, amount, estimate));
promiseCb(funId, jc.wallet.erc20Standard.transfer({address, to, amount, estimate}));
}
/**
* send ERC721 NFT to to
* @param {string} address: contract address of NFT
* @param {string} to: target account
* @param {string} tokenId: nft id of NFT
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function sendErc721(funId, address, to, tokenId, estimate) {
estimate = (estimate || '0') | 0;
promiseCb(funId, jc.wallet.sendNFT(address, to, tokenId, estimate));
promiseCb(funId, jc.wallet.erc721Standard.transfer({address, to, tokenId, estimate}));
}
/**
@ -169,33 +222,42 @@ function erc721Balance(funId, address, account, chainId) {
/**
* get balance of ERC1155
* @param {string} address:
* @param {string} account:
* @param {string} tokenId:
* @param {string} address: contract address of NFT
* @param {string} account: wallet address
* @param {string} tokenId: nft id of NFT
*/
function erc1155Balance(funId, address, account, tokenId) {
promiseCb(funId, jc.wallet.erc1155Balance(address, account, tokenId));
promiseCb(funId, jc.wallet.erc1155Standard.getBalanceOf(address, account, tokenId));
}
/**
* send ERC1155 to to
* @param {string} address: contract address of NFT
* @param {string} to: target account
* @param {string} tokenIds: nft id of NFT, json string of array
* @param {string} amounts: amount of token to send, json string of array
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function sendErc1155(funId, address, to, tokenIds, amounts, estimate) {
tokenIds = JSON.parse(tokenIds);
amounts = JSON.parse(amounts);
estimate = (estimate || '0') | 0;
promiseCb(funId, jc.wallet.sendErc1155(address, to, tokenIds, amounts, estimate));
promiseCb(funId, jc.wallet.erc1155Standard.transferBatch({address, to, tokenIds, amounts, estimate}));
}
/**
* show QRCode for content
* @param {string} content: content to show
*/
function showQRCode(funId, content) {
try {
jsb.showQRCode(funId, content);
return JSON.stringify({ errcode: 0, data: 1 });
} catch (err) {
return JSON.stringify({ errcode: 1, errmsg: err.message || err });
promiseCb(funId, Promise.resolve(1));
}
}
/**
* show webpage
* don't call this when in web page
* @param {string} url: url to show
*/
function showWebPage(funId, url) {
try {
jsb.showWebPage(funId, url);
@ -206,23 +268,37 @@ function showWebPage(funId, url) {
}
}
/**
* show QRCode scaner
* @param {string} title: title of scaner
*/
function scanQRCode(funId, title) {
console.log('scanQRCode: ' + title);
promiseCb(funId, jc.wallet.nativeSvr.scanQRCode(title));
}
/**
* export wallet private key
* @param {string} pass: password of wallet
*/
function exportWalletSecKey(funId, pass) {
try {
let key = jc.wallet.exportPrivateKey(pass);
return JSON.stringify({ errcode: 0, data: key });
} catch (err) {
return JSON.stringify({ errcode: 1, errmsg: err.message || err });
}
let data = jc.wallet.exportPrivateKey(pass);
promiseCb(funId, Promise.resolve(data));
}
// ======= begin of interact with contract =======
/**
* mint NFT
* @param {string} address: contract address of NFT
* @param {string} tokenIds: token id of NFT, JSON string of string array
* @param {string} startTime: time of signature generation
* @param {string} saltNonce: nonce of signature
* @param {string} signature: signature
* @param {string} estimate: 1: only estimate gas price
*/
function mintNFT(funId, address, tokenIds, startTime, saltNonce, signature, estimate) {
tokenIds = JSON.parse(tokenIds);
estimate = (estimate || '0') | 0;
promiseCb(
funId,
jc.wallet.jcStandard.mintNFT({
@ -239,8 +315,10 @@ function mintNFT(funId, address, tokenIds, startTime, saltNonce, signature, esti
// ======= end of interact with contract =======
// ======= begin of pay =======
/**
* crypto: 'CEC' or 'CEG', 'ETH'
* address: wallet address of user
* begin buy crypto with alchemy
* @param {string} network: 'mainnet' or 'testnet'
* @param {string} crypto: 'CEC' or 'CEG', 'ETH'
* @param {string} address: wallet address of user
* fiat: 'USD' or 'CNY'
* fiatAmount: '100'
* payWayCode: '10001'
@ -284,17 +362,23 @@ function beginPay(
// ======= end of pay =======
// ======= begin of transaction history =======
/**
*
* @param {*} funId
* @param {*} start
* @param {*} limit
* @param {*} moreParam e.g. {timeBegin: 1655716867832, timeEnd: 1655716867832}
* query eth transaction history
* @param {string} start
* @param {string} limit
* @param {JSON string} moreParam e.g. {timeBegin: 1655716867832, timeEnd: 1655716867832}
*/
function ethHistory(funId, start, limit, moreParam) {
moreParam = moreParam ? JSON.parse(moreParam) : {};
promiseCb(funId, jc.wallet.historySvr.ethRecords(start, limit, moreParam));
}
/**
* query token transaction history
* @param {string} start
* @param {string} limit
* @param {string} address
* @param {string} tokenId
* @param {JSON string} moreParam e.g. {timeBegin: 1655716867832, timeEnd: 1655716867832}
*/
function tokenHistory(funId, start, limit, address, tokenId, moreParam) {
moreParam = moreParam ? JSON.parse(moreParam) : {};
var data = { start, limit, address, tokenId };
@ -310,17 +394,16 @@ function emailInfo(funId) {
}
/**
* send code with email
* @param {*} email
* @param {*} type
* @param {string} email
* @param {string} type
*/
function sendEmailCode(funId, email, type) {
const wallet = !window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
promiseCb(funId, wallet.emailVerifySvr.sendEmailCode(email, type));
promiseCb(funId, jc.wallet.emailVerifySvr.sendEmailCode(email, type));
}
/**
* verify email with code, and update email
* @param {*} email
* @param {*} code
* @param {string} email
* @param {string} code
*/
function verifyEmail(funId, email, code) {
promiseCb(funId, jc.wallet.emailVerifySvr.updateEmailVerify(email, code));
@ -328,11 +411,10 @@ function verifyEmail(funId, email, code) {
/**
* check if email had already been registed
* @param {*} email
* @param {string} email
*/
function checkEmailExists(funId, email) {
const wallet = !window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
promiseCb(funId, wallet.emailVerifySvr.isEmailRegister(email));
promiseCb(funId, jc.wallet.emailVerifySvr.isEmailRegister(email));
}
/**
* regist with email
@ -341,8 +423,7 @@ function checkEmailExists(funId, email) {
* @param {*} code
*/
function emailRegist(funId, email, password, code) {
const wallet = !window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
promiseCb(funId, wallet.emailVerifySvr.registByEmail(email, password, code));
promiseCb(funId, jc.wallet.emailVerifySvr.registByEmail(email, password, code));
}
/**
@ -351,20 +432,15 @@ function emailRegist(funId, email, password, code) {
* @param {*} password
*/
function emailLogin(funId, email, password) {
const wallet = !window.jc || !jc.wallet ? new jcwallet.default({ type: 0 }) : jc.wallet;
promiseCb(funId, wallet.emailLogin(email, password));
promiseCb(funId, jc.wallet.emailLogin(email, password));
}
/**
* token list of current chain
*/
function tokenList(funId) {
try {
let data = jc.wallet.currentChainCfg.tokens;
return JSON.stringify({ errcode: 0, data });
} catch (err) {
return JSON.stringify({ errcode: 1, errmsg: err.message || err });
}
promiseCb(funId, Promise.resolve(data));
}
/**
* calc token price of USD
@ -399,19 +475,28 @@ function getCryptoPriceOfUSD(funId, crypto, chain) {
/**
* format price
* @param {string} value
* @param {string} decimal: decimal of price
* @param {string} fixed: fixed of price
*/
function formatPrice(funId, value, decimal, fixed) {
try {
let data = jc.wallet.formatPrice(value, decimal, fixed);
return JSON.stringify({ errcode: 0, data });
} catch (err) {
return JSON.stringify({ errcode: 1, errmsg: err.message || err });
}
promiseCb(funId, Promise.resolve(data));
}
// begin of market
// begin sell nft with market
/**
* sell nft with market
* @param {string} nftToken: address of nft token to sell
* @param {string} currency: address of currency
* @param {string} tokenId: token id of nft to sell
* @param {string} price: price of nft
* @param {string} amount: amount of nft to sell, must be 1 for ERC721
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function marketSellNFT(funId, nftToken, currency, tokenId, price, amount, estimate) {
estimate = (estimate || '0') | 0;
promiseCb(
funId,
jc.wallet.jcStandard.marketSellNFT({
@ -425,8 +510,14 @@ function marketSellNFT(funId, nftToken, currency, tokenId, price, amount, estima
(v) => JSON.stringify(v)
);
}
// update price of order
/**
* update price of existed order
* @param {string} orderId: order id
* @param {string} price: new price
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function marketUpdatePrice(funId, orderId, price, estimate) {
estimate = (estimate || '0') | 0;
promiseCb(
funId,
jc.wallet.jcStandard.marketUpdatePrice({
@ -437,8 +528,13 @@ function marketUpdatePrice(funId, orderId, price, estimate) {
(v) => JSON.stringify(v)
);
}
// cancel order
/**
* cancel order
* @param {string} orderId: order id
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function marketCancelOrder(funId, orderId, estimate) {
estimate = (estimate || '0') | 0;
promiseCb(
funId,
jc.wallet.jcStandard.marketCancelOrder({
@ -448,8 +544,14 @@ function marketCancelOrder(funId, orderId, estimate) {
(v) => JSON.stringify(v)
);
}
// buy order
/**
* buy order
* @param {string} orderId: order id
* @param {string} price: price of order
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function marketBuy(funId, orderId, price, estimate) {
estimate = (estimate || '0') | 0;
promiseCb(
funId,
jc.wallet.jcStandard.marketBuy({
@ -460,8 +562,26 @@ function marketBuy(funId, orderId, price, estimate) {
(v) => JSON.stringify(v)
);
}
// buy item of game from market
/**
* get order info from chain
* @param {string} orderId: order id
*/
function marketOrderInfo(funId, orderId) {
promiseCb(funId, jc.wallet.jcStandard.marketOrderInfo(orderId));
}
/**
* buy item of game from market
* @param {string} orderId: order id
* @param {string} seller: seller address
* @param {string} currency: address of currency
* @param {string} price: price of order
* @param {string} startTime: time for signature
* @param {string} saltNonce: nonce for signature
* @param {string} signature: signature
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function gameMarketBuy(funId, orderId, seller, currency, price, startTime, saltNonce, signature, estimate) {
estimate = (estimate || '0') | 0;
promiseCb(
funId,
jc.wallet.jcStandard.gameMarketBuy({
@ -477,15 +597,21 @@ function gameMarketBuy(funId, orderId, seller, currency, price, startTime, saltN
(v) => JSON.stringify(v)
);
}
// get order info from chain
function marketOrderInfo(funId, orderId) {
promiseCb(funId, jc.wallet.jcStandard.marketOrderInfo(orderId));
}
// end of market
// begin of mall
// buy item of game from mall
/**
* buy item of game from mall
* @param {string} orderId: order id
* @param {string} currency: address of currency
* @param {string} price: price of order
* @param {string} startTime: time for signature
* @param {string} saltNonce: nonce for signature
* @param {string} signature: signature
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function gameMallBuy(funId, orderId, currency, price, startTime, saltNonce, signature, estimate) {
estimate = (estimate || '0') | 0;
promiseCb(
funId,
jc.wallet.jcStandard.gameMallBuy({
@ -500,10 +626,24 @@ function gameMallBuy(funId, orderId, currency, price, startTime, saltNonce, sign
(v) => JSON.stringify(v)
);
}
// end of mall
// begin of NFT mall
/**
* buy nft from mall
* @param {string} currency: address of currency
* @param {string} addresses: address of nft token, JSON string of array
* @param {string} ids: token id of nft, JSON string of array
* @param {string} amounts: amount of nft, JSON string of array
* @param {string} values: JSON string, e.g. [orderId, price, startTime, saltNonce]
* orderId: order id
* price: price of order
* startTime: time for signature
* saltNonce: nonce for signature
* @param {string} signature: signature
* @param {string} gas: gas price
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function nftMallBuy(funId, currency, addresses, ids, amounts, values, signature, gas, estimate) {
estimate = (estimate || '0') | 0;
addresses = JSON.parse(addresses);
ids = JSON.parse(ids);
amounts = JSON.parse(amounts);
@ -524,11 +664,15 @@ function nftMallBuy(funId, currency, addresses, ids, amounts, values, signature,
);
}
// end of NFT mall
// begin of token mall
// buy ceg with usdt, usdc
/**
* buy ceg with usdt, usdc
* @param {string} currency: address of currency
* @param {string} amount: amount of currency
* @param {string} gas: gas price
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function buyTokenWithErc20(funId, currency, amount, gas, estimate) {
estimate = (estimate || '0') | 0;
promiseCb(
funId,
jc.wallet.jcStandard.buyTokenWithErc20({
@ -539,9 +683,13 @@ function buyTokenWithErc20(funId, currency, amount, gas, estimate) {
(v) => JSON.stringify(v)
);
}
// begin of token mall
// end of mall
// begin of in-app pay
/**
* query google or ios products with product ids
* @param {string} productIds: product id for query, JSON string of array
*/
function queryGoogleProducts(funId, productIds) {
let ids = JSON.parse(productIds);
console.log('queryGoogleProducts:: ' + productIds);
@ -551,7 +699,9 @@ function queryGoogleProducts(funId, productIds) {
promiseCb(funId, jc.wallet.paySvr.queryIOSProducts(ids));
}
}
/**
* query google or ios purchases unfinished
*/
function queryGooglePurchases(funId) {
if (window.JavascriptJavaBridge) {
promiseCb(funId, jc.wallet.paySvr.queryGooglePurchases());
@ -559,7 +709,11 @@ function queryGooglePurchases(funId) {
promiseCb(funId, jc.wallet.paySvr.queryIOSPurchases());
}
}
/**
* begin google or ios pay
* @param {string} productId: product id
* @param {string} orderId: order id
*/
function beginGoogleBuy(funId, productId, orderId) {
if (window.JavascriptJavaBridge) {
promiseCb(funId, jc.wallet.paySvr.buyGoogleProduct(productId, orderId));
@ -569,18 +723,126 @@ function beginGoogleBuy(funId, productId, orderId) {
}
// end of in-app pay
// begin of staking
/**
* stake nft
* @param {string} nfts: address of nft token, JSON string of array
* @param {string} tokenIds: token id of nft, JSON string of array
* @param {string} staketimes: staking time of nft, JSON string of array
* @param {string} gas: gas price
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function stakeNfts(funId, nfts, tokenIds, staketimes, gas, estimate) {
estimate = (estimate || '0') | 0;
nfts = JSON.parse(nfts);
tokenIds = JSON.parse(tokenIds);
staketimes = JSON.parse(staketimes);
promiseCb(funId, jc.wallet.jcStandard.stakeNfts({ nfts, tokenIds, staketimes, gas, estimate }), (v) =>
JSON.stringify(v)
);
}
/**
* redeem nft
* @param {string} nfts: address of nft token, JSON string of array
* @param {string} tokenIds: token id of nft, JSON string of array
* @param {string} gas: gas price
* @param {string} estimate: 0: execute; 1: only estimate gas price; default: 0
*/
function redeemNfts(funId, nfts, tokenIds, gas, estimate) {
estimate = (estimate || '0') | 0;
nfts = JSON.parse(nfts);
tokenIds = JSON.parse(tokenIds);
promiseCb(funId, jc.wallet.jcStandard.redeemNfts({ nfts, tokenIds, gas, estimate }), (v) => JSON.stringify(v));
}
/**
* query nft stake info
* @param {string} nft: address of nft token
* @param {string} tokenId: token id of nft
*/
function nftStakeInfo(funId, nft, tokenId) {
promiseCb(funId, jc.wallet.jcStandard.nftStakeInfo({ nft, tokenId }));
}
// end of staking
// begin of gold bricks
/**
* mint Gold Bricks
* @param {string} address: contract address of NFT
* @param {string} tokenIds: token id of NFT, JSON string of string array
* @param {string} startTime: time of signature generation
* @param {string} saltNonce: nonce of signature
* @param {string} signature: signature
* @param {string} estimate: 1: only estimate gas price
*/
function mintBricks(funId, address, tokenIds, startTime, saltNonce, signature, estimate) {
tokenIds = JSON.parse(tokenIds);
estimate = (estimate || '0') | 0;
promiseCb(
funId,
jc.wallet.jcStandard.mintBricks({
address,
tokenIds,
startTime,
saltNonce,
signature,
estimate,
}),
(v) => JSON.stringify(v)
);
}
/**
* decompose Gold Bricks
* @param {string} address: contract address of NFT
* @param {string} tokenIds: token id of NFT, JSON string of string array
* @param {string} startTime: time of signature generation
* @param {string} saltNonce: nonce of signature
* @param {string} signature: signature
* @param {string} estimate: 1: only estimate gas price
*/
function decomposeBricks(funId, address, tokenIds, startTime, saltNonce, signature, estimate) {
tokenIds = JSON.parse(tokenIds);
estimate = (estimate || '0') | 0;
promiseCb(
funId,
jc.wallet.jcStandard.decomposeBricks({
address,
tokenIds,
startTime,
saltNonce,
signature,
estimate,
}),
(v) => JSON.stringify(v)
);
}
// end of gold bricks
/**
* delete account
* delete account will delete game data for current account
* wallet for current account will be remained
*/
function deleteAccount(funId) {
promiseCb(funId, jc.wallet.deleteAccount());
}
/**
* reset wallet address for current account
*/
function resetWalletAddress(funId) {
promiseCb(funId, jc.wallet.resetWalletAddress());
}
/**
* storage pass with google drive
* @param {string} key: current account address
* @param {string} val: pass for current account
*/
function storePassLocal(funId, key, val) {
promiseCb(funId, jc.wallet.nativeSvr.storagePass(key, val));
}
/**
* restore pass from google drive
* @param {string} key: current account address
*/
function restorePassLocal(funId, key) {
promiseCb(funId, jc.wallet.nativeSvr.authGetStoragePass(key));
}
@ -588,3 +850,4 @@ function restorePassLocal(funId, key) {
function getLocalPassState(funId, key) {
promiseCb(funId, jc.wallet.nativeSvr.passStorageState(key));
}

View File

@ -15,7 +15,23 @@ window.jumpToWallet = function(url) {
jsb.toWallet(url);
}
window.toRelayPage = function(url) {
// https://metamask.app.link/dapp/www.sample.com/page.html
// okx://wallet/dapp/details?dappUrl=https://www.sample.com/page.html
let okxUrl = `okx://wallet/dapp/details?dappUrl=${url}`;
// let okxUrl = `https://metamask.app.link/dapp/${url.replace('https://', '')}`;
jsb.toWallet(okxUrl);
}
function nativeCallBack(...args) {
console.log(`jniCallback: ${args[0]}`);
jc.wallet.nativeSvr.handleNativeCallback(...args);
}
function onGamePause() {
console.log('game pause');
}
function onGameResume() {
console.log('game resume');
jc.wallet.relaySvr.checkResult();
}