增加一个通用的jni调用void方法的方法
This commit is contained in:
parent
cf12e99545
commit
42e33b830d
@ -683,21 +683,16 @@ void signWithTiktokJNI(const std::string& funid)
|
||||
JniHelper::callStaticVoidMethod(JCSDK, "signWithTiktok", funid);
|
||||
}
|
||||
|
||||
void signWithFacebookJNI(const std::string& funid)
|
||||
{
|
||||
JniHelper::callStaticVoidMethod(JCSDK, "signWithFacebook", funid);
|
||||
}
|
||||
|
||||
void signWithTwitterJNI(const std::string& funid)
|
||||
{
|
||||
JniHelper::callStaticVoidMethod(JCSDK, "signWithTwitter", funid);
|
||||
}
|
||||
|
||||
void signOutGoogleJNI(const std::string& funid)
|
||||
{
|
||||
JniHelper::callStaticVoidMethod(JCSDK, "signOutGoogle", funid);
|
||||
}
|
||||
|
||||
void callJcVoidMethodJNI(const std::string& funid, const std::string& method_name)
|
||||
{
|
||||
JniHelper::callStaticVoidMethod(JCSDK, method_name, funid);
|
||||
}
|
||||
|
||||
void toWalletJNI(const std::string& url)
|
||||
{
|
||||
JniHelper::callStaticVoidMethod(JCSDK, "toWallet", url);
|
||||
|
@ -41,9 +41,8 @@ void scanQRCodeJNI(const std::string& funid, const std::string& title);
|
||||
void loadRestoreKeyJNI(const std::string& funid, const std::string& oid);
|
||||
void signWithGoogleJNI(const std::string& funid);
|
||||
void signWithTiktokJNI(const std::string& funid);
|
||||
void signWithFacebookJNI(const std::string& funid);
|
||||
void signWithTwitterJNI(const std::string& funid);
|
||||
void signOutGoogleJNI(const std::string& funid);
|
||||
void callJcVoidMethodJNI(const std::string& funid, const std::string& method_name);
|
||||
void toWalletJNI(const std::string& url);
|
||||
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);
|
||||
|
@ -893,39 +893,24 @@ static bool JSB_signWithTiktok(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(JSB_signWithTiktok)
|
||||
|
||||
static bool JSB_signWithFacebook(se::State& s)
|
||||
static bool JSB_callJcVoidMethodJNI(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc > 0) {
|
||||
if (argc > 1) {
|
||||
std::string funid;
|
||||
ok = seval_to_std_string(args[0], &funid);
|
||||
SE_PRECONDITION2(ok, false, "funid is invalid!");
|
||||
signWithFacebookJNI(funid);
|
||||
std::string method_name;
|
||||
ok = seval_to_std_string(args[1], &method_name);
|
||||
callJcVoidMethodJNI(funid, method_name);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(JSB_signWithFacebook)
|
||||
|
||||
static bool JSB_signWithTwitter(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!");
|
||||
signWithTwitterJNI(funid);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(JSB_signWithTwitter)
|
||||
SE_BIND_FUNC(JSB_callJcVoidMethodJNI)
|
||||
|
||||
static bool JSB_signOutGoogle(se::State& s)
|
||||
{
|
||||
@ -1244,8 +1229,7 @@ bool jsb_register_global_variables(se::Object* global)
|
||||
__jsbObj->defineFunction("restoreKey", _SE(JSB_restoreKey));
|
||||
__jsbObj->defineFunction("signWithGoogle", _SE(JSB_signWithGoogle));
|
||||
__jsbObj->defineFunction("signWithTikTok", _SE(JSB_signWithTiktok));
|
||||
__jsbObj->defineFunction("signWithFacebook", _SE(JSB_signWithFacebook));
|
||||
__jsbObj->defineFunction("signWithTwitter", _SE(JSB_signWithTwitter));
|
||||
__jsbObj->defineFunction("callJcVoidMethodJNI", _SE(JSB_callJcVoidMethodJNI));
|
||||
__jsbObj->defineFunction("signOutGoogle", _SE(JSB_signOutGoogle));
|
||||
__jsbObj->defineFunction("showQRCode", _SE(JSB_showQRCode));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user