Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhangbo1_wd
2024-05-28 17:31:05 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c8d39952bb086790840ed9b4df3f9151b6496537
c8d39952
1 parent
b9622dd5
仅wifi下加载图片开关逻辑修改
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
sight_harmony/features/wdComponent/src/main/ets/utils/lazyloadImg.ets
sight_harmony/features/wdComponent/src/main/ets/utils/lazyloadImg.ets
View file @
c8d3995
import { NetworkUtil, SPHelper } from 'wdKit';
import { SpConstants } from 'wdConstant';
async function onlyWifiLoadImg()
: Promise<boolean> {
async function onlyWifiLoadImg(): Promise<boolean> {
let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_IMAGE_SWITCH, '') || false;
let isNetConnected = NetworkUtil.isNetConnected();
if (!loadImageOnlyWifiSwitch) {
// 开关没开,直接让加载图片
return true
}
let netWorkStatus = NetworkUtil.getNetworkType();
if (isNetConnected) {
if (netWorkStatus === NetworkUtil.TYPE_WIFI) {
return true;
} else {
if (loadImageOnlyWifiSwitch) {
return false
} else {
return true;
}
}
} else {
return false;
// 开关打开,wifi下才加载图片
if (netWorkStatus === NetworkUtil.TYPE_WIFI) {
return true
}
return false
}
export { onlyWifiLoadImg }
\ No newline at end of file
...
...
Please
register
or
login
to post a comment