diff --git a/web/webview/interfaces/native/arkweb_error_code.h b/web/webview/interfaces/native/arkweb_error_code.h index 4caab8f5df045eb1f12b84c9ab4a79b45c722548..4cd84eaecb42ff5818829a293a31e8115932180f 100644 --- a/web/webview/interfaces/native/arkweb_error_code.h +++ b/web/webview/interfaces/native/arkweb_error_code.h @@ -71,5 +71,55 @@ ARKWEB_LIBRARY_OPEN_FAILURE = 17100105, ARKWEB_LIBRARY_SYMBOL_NOT_FOUND = 17100106, } ArkWeb_ErrorCode; +typedef enum ArkWeb_BlanklessErrorCode { +/* + * @brief Success. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ +ARKWEB_BLANKLESS_SUCCESS = 0, + +/* + * @brief Unknown error. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ +ARKWEB_BLANKLESS_ERR_UNKNOWN = -1, + +/* + * @brief Invalid args. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ +ARKWEB_BLANKLESS_ERR_INVALID_ARGS = -2, + +/* + * @brief Init error. The web controller is not binded with the component. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ +ARKWEB_BLANKLESS_ERR_CONTROLLER_NOT_INITED = -3, + +/* + * @brief The key of blankless was not matched. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ +ARKWEB_BLANKLESS_KEY_NOT_MATCH = -4, + +/* + * @brief There are significant changes for the loading page. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ +ARKWEB_BLANKLESS_SIGNIFICANT_CHANGE = -5 +} ArkWeb_BlanklessErrorCode; + #endif // ARKWEB_ERROR_CODE_H /** @} */ diff --git a/web/webview/interfaces/native/native_interface_arkweb.h b/web/webview/interfaces/native/native_interface_arkweb.h index 7d40e22df06a3d600a5ce666932afef69adc2b32..79e040435dc29e49d36c91e25483470f2bd041eb 100644 --- a/web/webview/interfaces/native/native_interface_arkweb.h +++ b/web/webview/interfaces/native/native_interface_arkweb.h @@ -69,6 +69,20 @@ typedef void (*NativeArkWeb_OnValidCallback)(const char*); */ typedef void (*NativeArkWeb_OnDestroyCallback)(const char*); +/** + * @brief Defines the blankless info. + * + * @since 20 + */ +typedef struct { + /** The errCode of the blankless. */ + ArkWeb_BlanklessErrorCode errCode; + /** The estimated similarity of the history snapshots. */ + double similarity; + /** The loadingTime of the history loading. */ + int32_t loadingTime; +} ArkWeb_BlanklessInfo; + /** * @brief Loads a piece of code and execute JS code in the context of the currently displayed page. * @@ -185,6 +199,54 @@ ArkWeb_ErrorCode OH_NativeArkWeb_LoadData(const char* webTag, const char* baseUrl, const char* historyUrl); +/** + * @brief get the white screen optimization info when the current page is loaded. + * + * @param webTag The name of the web component. + * @param key A key string of the loading page, should not be NULL. + * @return Blankless info. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ +ArkWeb_BlanklessInfo OH_NativeArkWeb_GetBlanklessInfoWithKey(const char* webTag, const char* key); + +/** + * @brief set the white screen optimization solution when the current page is loaded. + * + * @param webTag The name of the web component. + * @param key A key string of the loading page, should not be NULL. + * @return Blankless result code. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ +ArkWeb_BlanklessErrorCode OH_NativeArkWeb_SetBlanklessLoadingWithKey(const char* webTag, + const char* key, + bool isStarted); + +/** + * @brief The apps can use this interface to clear the page cache. The "Clear Page" + * here is within the page range set in the API getBlanklessInfoWithKey. + * + * @param key A array of key string. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ +void OH_NativeArkWeb_ClearBlanklessLoadingCache(const char* key[]); + +/** + * @brief Set the capacity of the blankless cache. + * + * @param capacity The blankless capacity the apps want to set. + * @return The real blankless capacity, 0-100. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ +int32_t OH_NativeArkWeb_SetBlanklessLoadingCacheCapacity(int32_t capacity); + #ifdef __cplusplus }; #endif