Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit a368b258
authored
2025-12-08 15:46:53 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
清理缓存的时候,增加清理WebView的localStorage和cache
1 parent
63830387
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
lib/bloc/web_cubit.dart
lib/bloc/web_cubit.dart
View file @
a368b25
...
...
@@ -244,14 +244,14 @@ class WebCubit extends Cubit<WebState> {
// 读取 h5 版本号
_readH5ShowVersion
();
// 登录IM
_loginIM
();
// 初始化其它一些属性
_fluwx
=
getIt
.
get
<
Fluwx
>();
_playerService
=
getIt
.
get
<
PlayerService
>();
_playerService
?.
sendResponse
=
_sendResponse
;
_recorderService
=
getIt
.
get
<
RecorderService
>();
// 登录IM
_loginIM
();
}
Future
<
Map
<
String
,
String
>>
_getVersionConfig
()
async
{
...
...
@@ -305,7 +305,6 @@ class WebCubit extends Cubit<WebState> {
await
tempZipFile
.
copy
(
saveZipFilePath
);
// 删除临时文件
await
tempZipFile
.
delete
();
}
finally
{
dio
.
close
(
force:
true
);
}
...
...
@@ -487,7 +486,11 @@ class WebCubit extends Cubit<WebState> {
}
Future
<
void
>
clearStorage
()
async
{
// 1 清理非 h5_version 的缓存
// 1 清理 localStorage
_controller
.
clearLocalStorage
();
_controller
.
clearCache
();
// 2 清理非 h5_version 的缓存
var
sharedPreferences
=
getIt
.
get
<
SharedPreferences
>();
sharedPreferences
.
getKeys
().
forEach
((
key
)
async
{
if
(!
key
.
startsWith
(
'h5'
))
{
...
...
@@ -495,7 +498,7 @@ class WebCubit extends Cubit<WebState> {
}
});
//
2
清理 http_dist_assets 下的非当前版本号的文件和目录
//
3
清理 http_dist_assets 下的非当前版本号的文件和目录
var
dir
=
await
getApplicationSupportDirectory
();
var
httpDir
=
Directory
(
'
${dir.path}
/
${Constant.h5DistDir}
'
);
if
(
httpDir
.
existsSync
())
{
...
...
@@ -516,7 +519,7 @@ class WebCubit extends Cubit<WebState> {
}
}
//
3
清理临时目录下的所有文件和目录
//
4
清理临时目录下的所有文件和目录
var
tempDir
=
await
getTemporaryDirectory
();
if
(
tempDir
.
existsSync
())
{
await
for
(
final
FileSystemEntity
entity
in
tempDir
.
list
())
{
...
...
@@ -539,7 +542,7 @@ class WebCubit extends Cubit<WebState> {
});
// IM 登出
await
getIt
.
get
<
ImService
>().
logout
();
//
await getIt.get<ImService>().logout();
goLogin
();
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment