增加jsb调用google登录和登出的方法
This commit is contained in:
parent
de20174459
commit
0a782e88cf
@ -186,6 +186,10 @@ public:
|
|||||||
|
|
||||||
void scanQRCode(const std::string &funid, const std::string &title);
|
void scanQRCode(const std::string &funid, const std::string &title);
|
||||||
|
|
||||||
|
void signWithGoogle(const std::string &funid);
|
||||||
|
|
||||||
|
void signOutGoogle(const std::string &funid);
|
||||||
|
|
||||||
void toWallet(const std::string &url);
|
void toWallet(const std::string &url);
|
||||||
|
|
||||||
std::string getSystemVersion();
|
std::string getSystemVersion();
|
||||||
|
@ -295,6 +295,14 @@ void Application::scanQRCode(const std::string &funid, const std::string &title)
|
|||||||
scanQRCodeJNI(funid, title);
|
scanQRCodeJNI(funid, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::signWithGoogle(const std::string &funid) {
|
||||||
|
signWithGoogleJNI(funid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::signOutGoogle(const std::string &funid) {
|
||||||
|
signOutGoogleJNI(funid);
|
||||||
|
}
|
||||||
|
|
||||||
void Application::toWallet(const std::string &url) {
|
void Application::toWallet(const std::string &url) {
|
||||||
toWalletJNI(url);
|
toWalletJNI(url);
|
||||||
}
|
}
|
||||||
|
@ -658,6 +658,16 @@ void scanQRCodeJNI(const std::string& funid, const std::string& title)
|
|||||||
JniHelper::callStaticVoidMethod(JCSDK, "scanQRCode", funid, title);
|
JniHelper::callStaticVoidMethod(JCSDK, "scanQRCode", funid, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void signWithGoogleJNI(const std::string& funid)
|
||||||
|
{
|
||||||
|
JniHelper::callStaticVoidMethod(JCSDK, "signWithGoogle", funid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void signOutGoogleJNI(const std::string& funid)
|
||||||
|
{
|
||||||
|
JniHelper::callStaticVoidMethod(JCSDK, "signOutGoogle", funid);
|
||||||
|
}
|
||||||
|
|
||||||
void toWalletJNI(const std::string& url)
|
void toWalletJNI(const std::string& url)
|
||||||
{
|
{
|
||||||
JniHelper::callStaticVoidMethod(JCSDK, "toWallet", url);
|
JniHelper::callStaticVoidMethod(JCSDK, "toWallet", url);
|
||||||
|
@ -36,6 +36,8 @@ extern void exitApplication();
|
|||||||
extern std::string getApkPathJNI();
|
extern std::string getApkPathJNI();
|
||||||
extern std::string getPackageNameJNI();
|
extern std::string getPackageNameJNI();
|
||||||
void scanQRCodeJNI(const std::string& funid, const std::string& title);
|
void scanQRCodeJNI(const std::string& funid, const std::string& title);
|
||||||
|
void signWithGoogleJNI(const std::string& funid);
|
||||||
|
void signOutGoogleJNI(const std::string& funid);
|
||||||
void toWalletJNI(const std::string& url);
|
void toWalletJNI(const std::string& url);
|
||||||
extern int getObbAssetFileDescriptorJNI(const std::string& path, long* startOffset, long* size);
|
extern int getObbAssetFileDescriptorJNI(const std::string& path, long* startOffset, long* size);
|
||||||
extern void convertEncodingJNI(const std::string& src, int byteSize, const std::string& fromCharset, std::string& dst, const std::string& newCharset);
|
extern void convertEncodingJNI(const std::string& src, int byteSize, const std::string& fromCharset, std::string& dst, const std::string& newCharset);
|
||||||
|
@ -335,6 +335,14 @@ void Application::scanQRCode(const std::string &funid, const std::string &title)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::signWithGoogle(const std::string &funid) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::signOutGoogle(const std::string &funid) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Application::toWallet(const std::string &url) {
|
void Application::toWallet(const std::string &url) {
|
||||||
UIApplication *app = [UIApplication sharedApplication];
|
UIApplication *app = [UIApplication sharedApplication];
|
||||||
NSString *uri = [NSString stringWithCString:url.c_str() encoding:NSUTF8StringEncoding];
|
NSString *uri = [NSString stringWithCString:url.c_str() encoding:NSUTF8StringEncoding];
|
||||||
|
@ -817,6 +817,40 @@ static bool JSB_scanQRCode(se::State& s)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SE_BIND_FUNC(JSB_scanQRCode)
|
SE_BIND_FUNC(JSB_scanQRCode)
|
||||||
|
|
||||||
|
static bool JSB_signWithGoogle(se::State& s)
|
||||||
|
{
|
||||||
|
const auto& args = s.args();
|
||||||
|
size_t argc = args.size();
|
||||||
|
CC_UNUSED bool ok = true;
|
||||||
|
if (argc > 0) {
|
||||||
|
std::string funid;
|
||||||
|
ok = seval_to_std_string(args[0], &funid);
|
||||||
|
SE_PRECONDITION2(ok, false, "funid is invalid!");
|
||||||
|
Application::getInstance()->signWithGoogle(funid);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SE_BIND_FUNC(JSB_signWithGoogle)
|
||||||
|
|
||||||
|
static bool JSB_signOutGoogle(se::State& s)
|
||||||
|
{
|
||||||
|
const auto& args = s.args();
|
||||||
|
size_t argc = args.size();
|
||||||
|
CC_UNUSED bool ok = true;
|
||||||
|
if (argc > 0) {
|
||||||
|
std::string funid;
|
||||||
|
ok = seval_to_std_string(args[0], &funid);
|
||||||
|
SE_PRECONDITION2(ok, false, "funid is invalid!");
|
||||||
|
Application::getInstance()->signOutGoogle(funid);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SE_BIND_FUNC(JSB_signOutGoogle)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool JSB_toWallet(se::State& s)
|
static bool JSB_toWallet(se::State& s)
|
||||||
@ -860,6 +894,8 @@ bool jsb_register_global_variables(se::Object* global)
|
|||||||
__jsbObj->defineFunction("copyTextToClipboard", _SE(JSB_copyTextToClipboard));
|
__jsbObj->defineFunction("copyTextToClipboard", _SE(JSB_copyTextToClipboard));
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
__jsbObj->defineFunction("scanQRCode", _SE(JSB_scanQRCode));
|
__jsbObj->defineFunction("scanQRCode", _SE(JSB_scanQRCode));
|
||||||
|
__jsbObj->defineFunction("signWithGoogle", _SE(JSB_signWithGoogle));
|
||||||
|
__jsbObj->defineFunction("signOutGoogle", _SE(JSB_signOutGoogle));
|
||||||
#endif
|
#endif
|
||||||
__jsbObj->defineFunction("toWallet", _SE(JSB_toWallet));
|
__jsbObj->defineFunction("toWallet", _SE(JSB_toWallet));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user