From a9a9f4004a1b539f22bd27ca643d65b9ab058790 Mon Sep 17 00:00:00 2001 From: iPel Date: Tue, 6 Sep 2022 20:10:46 +0800 Subject: [PATCH] feat(android): provide sdk version information --- android/sdk/build.gradle | 1 + .../com/tencent/mtt/hippy/bridge/HippyBridgeManagerImpl.java | 3 +++ core/js/global/Platform.js | 1 + 3 files changed, 5 insertions(+) diff --git a/android/sdk/build.gradle b/android/sdk/build.gradle index 4cb184202fd..b155332631f 100644 --- a/android/sdk/build.gradle +++ b/android/sdk/build.gradle @@ -55,6 +55,7 @@ android { consumerProguardFiles 'proguard-rules.pro' buildConfigField("boolean", "ENABLE_SO_DOWNLOAD", ENABLE_SO_DOWNLOAD) + buildConfigField("String", "LIBRARY_VERSION", "\"$VERSION_NAME\"") packagingOptions { if (!INCLUDE_ABI_ARMEABI.toBoolean()) { diff --git a/android/sdk/src/main/java/com/tencent/mtt/hippy/bridge/HippyBridgeManagerImpl.java b/android/sdk/src/main/java/com/tencent/mtt/hippy/bridge/HippyBridgeManagerImpl.java index 16e59c83ec1..2c4957ddef7 100644 --- a/android/sdk/src/main/java/com/tencent/mtt/hippy/bridge/HippyBridgeManagerImpl.java +++ b/android/sdk/src/main/java/com/tencent/mtt/hippy/bridge/HippyBridgeManagerImpl.java @@ -25,6 +25,8 @@ import android.text.TextUtils; import androidx.annotation.Nullable; + +import com.tencent.mtt.hippy.BuildConfig; import com.tencent.mtt.hippy.HippyEngine; import com.tencent.mtt.hippy.HippyEngine.BridgeTransferType; import com.tencent.mtt.hippy.HippyEngine.ModuleLoadStatus; @@ -659,6 +661,7 @@ String getGlobalConfigs() { platformParams.pushString("VersionName", (versionName == null) ? "" : versionName); platformParams.pushInt("APILevel", Build.VERSION.SDK_INT); platformParams.pushBoolean("NightMode", getNightMode()); + platformParams.pushString("SDKVersion", BuildConfig.LIBRARY_VERSION); HippyMap Localization = new HippyMap(); Localization.pushString("language", I18nUtil.getLanguage()); diff --git a/core/js/global/Platform.js b/core/js/global/Platform.js index df736ada3b1..12b9e248c88 100644 --- a/core/js/global/Platform.js +++ b/core/js/global/Platform.js @@ -75,6 +75,7 @@ if (typeof __HIPPYNATIVEGLOBAL__ !== 'undefined') { } else { Hippy.device.platform.OS = __HIPPYNATIVEGLOBAL__.Platform.OS; Hippy.device.platform.APILevel = __HIPPYNATIVEGLOBAL__.Platform.APILevel; + Hippy.device.platform.SDKVersion = __HIPPYNATIVEGLOBAL__.SDKVersion; Hippy.device.platform.Localization = __HIPPYNATIVEGLOBAL__.Platform.Localization || Localization; } }