update:更新Rustore的Review

This commit is contained in:
2026-02-02 15:23:24 +08:00
parent f233be2646
commit a6db6d438c
6 changed files with 334 additions and 11 deletions

View File

@@ -27,5 +27,5 @@ public class ConfigManager {
public static final String PAY_TYPE_CALLBACK_FUNCTION_NAME = "SKUListResult";
public static final String FCM_NOTICE_FUNCTION_NAME = "FCMCallback";
public static final String FCM_REALNAME_CALLBACK_FUNCTION_NAME = "RealNameCallback";
}

View File

@@ -476,20 +476,125 @@ public class SDKManager {
public static void Review()
{
ReviewManager manager = ReviewManagerFactory.create(SDKWrapper.getInstance().getContext());
Task<ReviewInfo> request = manager.requestReviewFlow();
request.addOnCompleteListener(reqTask -> {
if (reqTask.isSuccessful()) {
ReviewInfo reviewInfo = reqTask.getResult();
Activity activity = UnityPlayer.currentActivity;
manager.launchReviewFlow(activity, reviewInfo);
} else {
@ReviewErrorCode int reviewErrorCode = ((ReviewException) request.getException()).getErrorCode();
Log.e(TAG,"Review Error code: " + reviewErrorCode);
// ReviewManager manager = ReviewManagerFactory.create(SDKWrapper.getInstance().getContext());
// Task<ReviewInfo> request = manager.requestReviewFlow();
// request.addOnCompleteListener(reqTask -> {
// if (reqTask.isSuccessful()) {
// ReviewInfo reviewInfo = reqTask.getResult();
// Activity activity = UnityPlayer.currentActivity;
// manager.launchReviewFlow(activity, reviewInfo);
// } else {
// @ReviewErrorCode int reviewErrorCode = ((ReviewException) request.getException()).getErrorCode();
// Log.e(TAG,"Review Error code: " + reviewErrorCode);
// }
// });
// Runnable
RuStoreReview();
}
//- Rustore相关接口
public interface ReviewResultCallback {
void onReviewSuccess(JSONObject result);
void onReviewError(int code, String msg);
}
// # 第一步 请求评分request
public static void RequestRustoreReView(ReviewResultCallback callback) {
JSONObject json = new JSONObject();
try {
json.put("action", "ACTION_REQUEST_REVIEW");
} catch (JSONException e) {
throw new RuntimeException(e);
}
SDKAPI.getIns().thirdExtend(json.toString(), (code, msg) -> {
Log.e(TAG, "====>RequestRustoreReView code= " + code + " msg= " + msg);
JSONObject result = new JSONObject();
try {
result.put("code", code);
if (code == SDKCallBack.Extend.EXTEND_CODE_SUCCESS) {
Log.e(TAG, "RequestRustoreReView Success: " + msg);
//获取成功msg即为对应的json字符串
// 成功时调用回调
if (callback != null) {
callback.onReviewSuccess(result);
}
} else {
Log.e(TAG, "RequestRustoreReView Failed: " + msg);
result.put("thirdExtend_errStr", msg);
// 失败时调用回调
if (callback != null) {
callback.onReviewError(code, msg);
}
}
//code 说明:
// 0 : 获取成功
// 26012001 : RuStoreNotInstalledException
// 26012002 : RuStoreOutdatedException
// 26012003 : RuStoreUserUnauthorizedException
// 26012004 : RuStoreUserBannedException
// 26012005 : RuStoreApplicationBannedException
// 26012006 : RuStoreRequestLimitReached
// 26012007 : RuStoreReviewExists
// 26012008 : RuStoreInvalidReviewInfo
// 26012009 : RuStoreException
// -1 : 其他未知异常
// msg 说明:
// 失败时为error msg
// UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.RUSTORE_REVIEW_CALLBACK, result.toString());
} catch (Exception e) {
SDKLog.e("SDKManager-RequestRustoreReView-Exception" + e);
// UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.RUSTORE_REVIEW_CALLBACK, result.toString());
}
});
}
// # 第二步展示评分UI 。请求评分request成功后调用且一次成功的request只能调用一次展示
public static void LaunchRustoreView(){
JSONObject json = new JSONObject();
try {
json.put("action", "ACTION_LAUNCH_REVIEW");
} catch (JSONException e) {
throw new RuntimeException(e);
}
SDKAPI.getIns().thirdExtend(json.toString(), (code, msg) -> {
Log.e(TAG, "====>LaunchRustoreView code= " + code + " msg= " + msg);
JSONObject result = new JSONObject();
try {
result.put("code", code);
if (code == SDKCallBack.Extend.EXTEND_CODE_SUCCESS) {
Log.e(TAG, "LaunchRustoreView Success: " + msg);
//获取成功msg即为对应的json字符串
// UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.RUSTORE_LAUNCH_REVIEW, result.toString());
} else {
Log.e(TAG, "LaunchRustoreView Failed: " + msg);
result.put("thirdExtend_errStr", msg);
}
// UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.RUSTORE_LAUNCH_REVIEW, result.toString());
} catch (Exception e) {
SDKLog.e("SDKManager-LaunchRustoreReView-Exception" + e);
// UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.RUSTORE_LAUNCH_REVIEW, result.toString());
}
});
}
public static void RuStoreReview(){
RequestRustoreReView(new ReviewResultCallback() {
@Override
public void onReviewSuccess(JSONObject result) {
LaunchRustoreView();
}
@Override
public void onReviewError(int code, String msg) {
}
});
}
public static void FBShareLink(String title, String content, String url)
{
Log.e(TAG,"FBShareLink : " + title + " " + content + " " + url);

View File

@@ -140,6 +140,11 @@ namespace tysdk
public static bool IsLoggedIn => _accountInfo != null;
// 记录一下渠道,保证客户端可以调用
public static string Channel => "hwVkid";
//-
public void Logout()
{

View File

@@ -272,6 +272,7 @@ namespace tysdk
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
{
sdkManager.CallStatic("Review");
// sdkManager.CallStataic("RuStoreReview");
}
}