修改discord登录代码, 改为通用的oauth登录
This commit is contained in:
parent
e8f07f028c
commit
14a9ca9671
@ -372,9 +372,9 @@ void signWithEmailJNI(const std::string &funid)
|
||||
JniHelper::callStaticVoidMethod(JCSDK, "signWithEmail", funid);
|
||||
}
|
||||
|
||||
void signWithDiscordJNI(const std::string &funid)
|
||||
void signWithOAuthJNI(const std::string &funid, const std::string &jsondata)
|
||||
{
|
||||
JniHelper::callStaticVoidMethod(JCSDK, "signWithDiscord", funid);
|
||||
JniHelper::callStaticVoidMethod(JCSDK, "signWithOAuth", funid, jsondata);
|
||||
}
|
||||
|
||||
void callJcVoidMethodJNI(const std::string &funid, const std::string &method_name)
|
||||
|
@ -45,7 +45,7 @@ void signOutGoogleJNI(const std::string &funid);
|
||||
void signWithFacebookJNI(const std::string &funid);
|
||||
void signWithTwitterJNI(const std::string &funid);
|
||||
void signWithEmailJNI(const std::string &funid);
|
||||
void signWithDiscordJNI(const std::string &funid);
|
||||
void signWithOAuthJNI(const std::string &funid, const std::string &jsondata);
|
||||
void callJcVoidMethodJNI(const std::string &funid, const std::string &method_name);
|
||||
void toWalletJNI(const std::string &url);
|
||||
void beginBuyJNI(const std::string &funid, const std::string &productid, const std::string &orderid);
|
||||
|
@ -969,23 +969,26 @@ static bool JSB_signWithEmail(se::State &s)
|
||||
}
|
||||
SE_BIND_FUNC(JSB_signWithEmail)
|
||||
|
||||
static bool JSB_signWithDiscord(se::State &s)
|
||||
static bool JSB_signWithOAuth(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!");
|
||||
signWithDiscordJNI(funid);
|
||||
std::string jsondata;
|
||||
ok = seval_to_std_string(args[1], &jsondata);
|
||||
SE_PRECONDITION2(ok, false, "jsondata is invalid!");
|
||||
signWithOAuthJNI(funid, jsondata);
|
||||
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_signWithDiscord)
|
||||
SE_BIND_FUNC(JSB_signWithOAuth)
|
||||
|
||||
static bool JSB_callJcVoidMethodJNI(se::State &s)
|
||||
{
|
||||
@ -1720,7 +1723,7 @@ bool jsb_register_global_variables(se::Object *global)
|
||||
__jsbObj->defineFunction("signWithFacebook", _SE(JSB_signWithFacebook));
|
||||
__jsbObj->defineFunction("signWithTwitter", _SE(JSB_signWithTwitter));
|
||||
__jsbObj->defineFunction("signWithEmail", _SE(JSB_signWithEmail));
|
||||
__jsbObj->defineFunction("signWithDiscord", _SE(JSB_signWithDiscord));
|
||||
__jsbObj->defineFunction("signWithOAuth", _SE(JSB_signWithOAuth));
|
||||
__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