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 4381b3c8
authored
2025-12-03 09:27:15 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
一些小调整
1 parent
a6505868
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
30 deletions
lib/bloc/web_cubit.dart
lib/ui/pages/web_page.dart
lib/bloc/web_cubit.dart
View file @
4381b3c
...
...
@@ -211,7 +211,8 @@ class WebCubit extends Cubit<WebState> {
emit
(
state
.
copyWith
(
isUpgrading:
true
));
await
_upgrade
(
correctVersion
,
downloadUrl
);
// 升级完成后取消遮罩,继续初始化其它数据
emit
(
state
.
copyWith
(
isUpgrading:
false
));
// 同时设置h5版本号
emit
(
state
.
copyWith
(
isUpgrading:
false
,
h5Version:
correctVersion
));
}
else
{
// 后台下载,完成后提示用户
_upgrade
(
correctVersion
,
downloadUrl
).
then
(
...
...
@@ -264,6 +265,7 @@ class WebCubit extends Cubit<WebState> {
String
zip
=
response
.
data
[
'zip'
]
as
String
;
return
{
'version'
:
version
,
// 'force': "0",
'force'
:
force
,
// 'zip': 'http://192.168.2.177/1.0.0.zip',
'zip'
:
'
$zip$version
.zip'
,
...
...
@@ -554,9 +556,9 @@ class WebCubit extends Cubit<WebState> {
///
/// 升级提示
///
void
suggestUpgrade
(
BuildContext
c
ontext
)
{
void
suggestUpgrade
(
BuildContext
c
tx
)
{
showDialog
(
context:
c
ontext
,
context:
c
tx
,
barrierDismissible:
false
,
builder:
(
BuildContext
context
)
{
return
AlertDialog
(
...
...
@@ -566,18 +568,18 @@ class WebCubit extends Cubit<WebState> {
TextButton
(
child:
Text
(
'取消'
),
onPressed:
()
{
emit
(
state
.
copyWith
(
suggestUpgrade:
false
));
Navigator
.
of
(
context
).
pop
();
emit
(
state
.
copyWith
(
suggestUpgrade:
false
));
},
),
TextButton
(
child:
Text
(
'确定'
),
onPressed:
()
{
Navigator
.
of
(
context
).
pop
();
emit
(
state
.
copyWith
(
suggestUpgrade:
false
));
getIt
.
get
<
LocalServerService
>().
resetHttpDirectory
();
_controller
.
reload
();
// _loadHtml();
Navigator
.
of
(
context
).
pop
();
},
),
],
...
...
@@ -628,6 +630,14 @@ class WebCubit extends Cubit<WebState> {
}
void
_chooseImageFromAlbum
(
BuildContext
context
,
int
count
,
String
unique
,
String
cmd
)
async
{
// 检查是否已被永久拒绝,此时需要对用户进行引导
if
(
await
_checkGalleryPermanentlyDenied
())
{
var
resp
=
{
'unique'
:
unique
,
'cmd'
:
cmd
,
'data'
:
null
,
'errMsg'
:
'no auth'
};
_sendResponse
(
resp
);
_permissionLead
(
context
,
'相册权限'
);
return
;
}
final
List
<
AssetEntity
>?
result
;
try
{
result
=
await
AssetPicker
.
pickAssets
(
...
...
@@ -643,12 +653,6 @@ class WebCubit extends Cubit<WebState> {
}
catch
(
e
)
{
var
resp
=
{
'unique'
:
unique
,
'cmd'
:
cmd
,
'data'
:
null
,
'errMsg'
:
'no auth'
};
_sendResponse
(
resp
);
// 权限异常之后,检查是否已被永久拒绝,此时需要对用户进行引导
if
(
await
_checkGalleryPermanentlyDenied
())
{
_permissionLead
(
context
,
'相册权限'
);
}
return
;
}
...
...
@@ -675,17 +679,20 @@ class WebCubit extends Cubit<WebState> {
}
void
_chooseImageFromCamera
(
BuildContext
context
,
String
unique
,
String
cmd
)
async
{
// 检查是否已被永久拒绝,此时需要对用户进行引导
if
(
await
_checkCameraPermanentlyDenied
())
{
var
resp
=
{
'unique'
:
unique
,
'cmd'
:
cmd
,
'data'
:
null
,
'errMsg'
:
'no auth'
};
_sendResponse
(
resp
);
_permissionLead
(
context
,
'相机权限'
);
return
;
}
AssetEntity
?
asset
;
try
{
asset
=
await
CameraPicker
.
pickFromCamera
(
context
,
pickerConfig:
const
CameraPickerConfig
());
}
catch
(
e
)
{
var
resp
=
{
'unique'
:
unique
,
'cmd'
:
cmd
,
'data'
:
null
,
'errMsg'
:
'no auth'
};
_sendResponse
(
resp
);
if
(
await
_checkCameraPermanentlyDenied
())
{
_permissionLead
(
context
,
'相机权限'
);
}
return
;
}
...
...
@@ -831,8 +838,15 @@ class WebCubit extends Cubit<WebState> {
}
void
_chooseVideoFromAlbum
(
BuildContext
context
,
int
count
,
String
unique
,
String
cmd
)
async
{
List
<
AssetEntity
>?
result
;
// 检查是否已被永久拒绝,此时需要对用户进行引导
if
(
await
_checkGalleryPermanentlyDenied
())
{
var
resp
=
{
'unique'
:
unique
,
'cmd'
:
cmd
,
'data'
:
null
,
'errMsg'
:
'no auth'
};
_sendResponse
(
resp
);
_permissionLead
(
context
,
'相册权限'
);
return
;
}
List
<
AssetEntity
>?
result
;
try
{
result
=
await
AssetPicker
.
pickAssets
(
context
,
...
...
@@ -845,12 +859,6 @@ class WebCubit extends Cubit<WebState> {
}
catch
(
e
)
{
var
resp
=
{
'unique'
:
unique
,
'cmd'
:
cmd
,
'data'
:
null
,
'errMsg'
:
'no auth'
};
_sendResponse
(
resp
);
// 权限异常之后,检查是否已被永久拒绝,此时需要对用户进行引导
if
(
await
_checkGalleryPermanentlyDenied
())
{
_permissionLead
(
context
,
'相册权限'
);
}
return
;
}
...
...
@@ -877,6 +885,14 @@ class WebCubit extends Cubit<WebState> {
}
void
_chooseVideoFromCamera
(
BuildContext
context
,
int
maxDuration
,
String
unique
,
String
cmd
)
async
{
// 检查是否已被永久拒绝,此时需要对用户进行引导
if
(
await
_checkCameraPermanentlyDenied
())
{
var
resp
=
{
'unique'
:
unique
,
'cmd'
:
cmd
,
'data'
:
null
,
'errMsg'
:
'no auth'
};
_sendResponse
(
resp
);
_permissionLead
(
context
,
'相机权限'
);
return
;
}
AssetEntity
?
asset
;
try
{
asset
=
await
CameraPicker
.
pickFromCamera
(
...
...
@@ -891,11 +907,6 @@ class WebCubit extends Cubit<WebState> {
}
catch
(
e
)
{
var
resp
=
{
'unique'
:
unique
,
'cmd'
:
cmd
,
'data'
:
null
,
'errMsg'
:
'no auth'
};
_sendResponse
(
resp
);
if
(
await
_checkCameraPermanentlyDenied
())
{
_permissionLead
(
context
,
'相机权限'
);
}
return
;
}
...
...
lib/ui/pages/web_page.dart
View file @
4381b3c
...
...
@@ -269,8 +269,9 @@ class WebPage extends StatelessWidget {
child:
Text
(
'确认'
),
onPressed:
()
{
Navigator
.
of
(
context
).
pop
();
ctx
.
read
<
WebCubit
>().
clearStorage
();
ctx
.
read
<
WebCubit
>().
goLogin
();
var
webCubit
=
ctx
.
read
<
WebCubit
>();
webCubit
.
clearStorage
();
webCubit
.
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