diff --git a/cocos/platform/android/jni/JniImp.cpp b/cocos/platform/android/jni/JniImp.cpp index 7e47c8b..f4095d0 100644 --- a/cocos/platform/android/jni/JniImp.cpp +++ b/cocos/platform/android/jni/JniImp.cpp @@ -658,6 +658,11 @@ void showQRCodeJNI(const std::string& funid, const std::string& content) JniHelper::callStaticVoidMethod(JCSDK, "showQRCode", funid, content); } +void showWebPageJNI(const std::string& funid, const std::string& content) +{ + JniHelper::callStaticVoidMethod(JCSDK, "showWebPage", funid, content); +} + void showRestoreQRJNI(const std::string& funid, const std::string& content, const std::string& title, const std::string& oid) { JniHelper::callStaticVoidMethod(JCSDK, "showRestoreQR", funid, content, title, oid); @@ -677,7 +682,10 @@ void signWithGoogleJNI(const std::string& funid) { JniHelper::callStaticVoidMethod(JCSDK, "signWithGoogle", funid); } - +void signWithAppleJNI(const std::string& funid) +{ + JniHelper::callStaticVoidMethod(JCSDK, "signWithApple", funid); +} void signWithTiktokJNI(const std::string& funid) { JniHelper::callStaticVoidMethod(JCSDK, "signWithTiktok", funid); @@ -698,6 +706,11 @@ void signWithTwitterJNI(const std::string& funid) JniHelper::callStaticVoidMethod(JCSDK, "signWithTwitter", funid); } +void signWithEmailJNI(const std::string& funid) +{ + JniHelper::callStaticVoidMethod(JCSDK, "signWithEmail", funid); +} + void callJcVoidMethodJNI(const std::string& funid, const std::string& method_name) { diff --git a/cocos/platform/android/jni/JniImp.h b/cocos/platform/android/jni/JniImp.h index 8f06d28..927e72c 100644 --- a/cocos/platform/android/jni/JniImp.h +++ b/cocos/platform/android/jni/JniImp.h @@ -38,12 +38,15 @@ extern std::string getPackageNameJNI(); void showQRCodeJNI(const std::string& funid, const std::string& content); void showRestoreQRJNI(const std::string& funid, const std::string& content, const std::string& title, const std::string& id); void scanQRCodeJNI(const std::string& funid, const std::string& title); +void showWebPageJNI(const std::string& funid, const std::string& url); void loadRestoreKeyJNI(const std::string& funid, const std::string& oid); void signWithGoogleJNI(const std::string& funid); +void signWithAppleJNI(const std::string& funid); void signWithTiktokJNI(const std::string& funid); 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 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); diff --git a/cocos/scripting/js-bindings/manual/jsb_global.cpp b/cocos/scripting/js-bindings/manual/jsb_global.cpp index 2e28b59..59e516a 100644 --- a/cocos/scripting/js-bindings/manual/jsb_global.cpp +++ b/cocos/scripting/js-bindings/manual/jsb_global.cpp @@ -875,6 +875,23 @@ static bool JSB_signWithGoogle(se::State& s) } SE_BIND_FUNC(JSB_signWithGoogle) +static bool JSB_signWithApple(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!"); + signWithAppleJNI(funid); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(JSB_signWithApple) + //JSB_signWithTiktok static bool JSB_signWithTiktok(se::State& s) { @@ -927,6 +944,23 @@ static bool JSB_signWithTwitter(se::State& s) } SE_BIND_FUNC(JSB_signWithTwitter) +static bool JSB_signWithEmail(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!"); + signWithEmailJNI(funid); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(JSB_signWithEmail) + static bool JSB_callJcVoidMethodJNI(se::State& s) { const auto& args = s.args(); @@ -982,6 +1016,24 @@ static bool JSB_showQRCode(se::State& s) return false; } SE_BIND_FUNC(JSB_showQRCode) + +bool jsb_showWebPage(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 url; + ok = seval_to_std_string(args[1], &url); + SE_PRECONDITION2(ok, false, "Error processing arguments"); + showWebPageJNI(funid, url); + return true; + } + return false; +} +SE_BIND_FUNC(jsb_showWebPage) #endif static bool JSB_toWallet(se::State& s) @@ -1393,13 +1445,16 @@ bool jsb_register_global_variables(se::Object* global) __jsbObj->defineFunction("scanQRCode", _SE(JSB_scanQRCode)); __jsbObj->defineFunction("restoreKey", _SE(JSB_restoreKey)); __jsbObj->defineFunction("signWithGoogle", _SE(JSB_signWithGoogle)); + __jsbObj->defineFunction("signWithApple", _SE(JSB_signWithApple)); __jsbObj->defineFunction("signWithTikTok", _SE(JSB_signWithTiktok)); __jsbObj->defineFunction("signWithFacebook", _SE(JSB_signWithFacebook)); __jsbObj->defineFunction("signWithTwitter", _SE(JSB_signWithTwitter)); + __jsbObj->defineFunction("signWithEmail", _SE(JSB_signWithEmail)); __jsbObj->defineFunction("callJcVoidMethodJNI", _SE(JSB_callJcVoidMethodJNI)); __jsbObj->defineFunction("signOutGoogle", _SE(JSB_signOutGoogle)); __jsbObj->defineFunction("showQRCode", _SE(JSB_showQRCode)); - + __jsbObj->defineFunction("showWebPage", _SE(jsb_showWebPage)); + #endif __jsbObj->defineFunction("toWallet", _SE(JSB_toWallet));