xugenyuan

ref |> 修复进入web页面之前存在崩溃问题

http://192.168.1.3:8080/zentao/bug-view-20592.html

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
... ... @@ -43,7 +43,10 @@ export class LaunchPageModel {
static async dealWithLaunchDataModel(model?: LaunchDataModel) {
if (!model) {
let dataModelStr = SPHelper.default.getSync(SpConstants.APP_LAUNCH_PAGE_DATA_MODEL, '') as string
model = JSON.parse(dataModelStr ?? "")
if (dataModelStr.length == 0) {
return
}
model = JSON.parse(dataModelStr)
if (!model) { return }
}
... ...
import { FileUtils as imageFileUtils } from '@ohos/imageknife'
import { Action } from 'wdBean'
import { AppUtils, FileUtils, SPHelper } from 'wdKit'
import { AppUtils, FileUtils, Logger, SPHelper } from 'wdKit'
import { JumpInterceptorAction, RouterJumpInterceptor, WDRouterPage } from 'wdRouter'
import { JSON, uri } from '@kit.ArkTS'
import { SpConstants } from 'wdConstant'
... ... @@ -46,7 +46,12 @@ class DefaultWebJumpHandler implements JumpInterceptorAction {
return list
}
let filePath = AppUtils.gotApplicationContextFunc().getApplicationContext().filesDir + "/h5_whitelist.txt"
try {
Logger.debug("读取文件:" + filePath)
const jsonStr = FileUtils.readFileAsString(filePath)
if (jsonStr.length == 0) {
return list
}
const listObj = JSON.parse(jsonStr) as WhiteListModel
if (listObj && listObj.whiteurls && listObj.whiteurls.length) {
... ... @@ -59,6 +64,9 @@ class DefaultWebJumpHandler implements JumpInterceptorAction {
list.push(...urls)
}
} catch (error) {
Logger.error("读取文件报错:" + JSON.stringify(error))
}
return list
}
... ...