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 b86b157b
authored
2026-04-27 10:38:18 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化取消上传处理
1 parent
8621cc6f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
lib/data/repositories/message/upload_start_handler.dart
lib/data/repositories/message/upload_start_handler.dart
View file @
b86b157
...
@@ -105,16 +105,22 @@ class UploadStartHandler extends MessageHandler {
...
@@ -105,16 +105,22 @@ class UploadStartHandler extends MessageHandler {
}
on
ChunkSigException
{
}
on
ChunkSigException
{
debugPrint
(
'====================>上传失败:签名错误'
);
debugPrint
(
'====================>上传失败:签名错误'
);
// 确保发送了 uploadEnd 指令
// 确保发送了 uploadEnd 指令
_webCubit
?.
sendUploadEnd
(
_cmdUnique
,
_cmdUploadId
,
''
,
errMsg:
'网络错误,签名失败'
);
if
(!
_isCancelled
)
{
_webCubit
?.
sendUploadEnd
(
_cmdUnique
,
_cmdUploadId
,
''
,
errMsg:
'网络错误,签名失败'
);
}
}
on
ChunkUploadFailedException
{
}
on
ChunkUploadFailedException
{
debugPrint
(
'====================>上传失败:网络错误'
);
debugPrint
(
'====================>上传失败:网络错误'
);
// 确保发送了 uploadEnd 指令
// 确保发送了 uploadEnd 指令
_webCubit
?.
sendUploadEnd
(
_cmdUnique
,
_cmdUploadId
,
''
,
errMsg:
'网络错误,上传失败'
);
if
(!
_isCancelled
)
{
_webCubit
?.
sendUploadEnd
(
_cmdUnique
,
_cmdUploadId
,
''
,
errMsg:
'网络错误,上传失败'
);
}
}
catch
(
e
)
{
}
catch
(
e
)
{
// Dio close 产生的 DioException 也会走到这里
// Dio close 产生的 DioException 也会走到这里
final
msg
=
(
e
is
DioException
&&
e
.
type
==
DioExceptionType
.
cancel
)
?
'上传已取消'
:
e
.
toString
();
final
msg
=
(
e
is
DioException
&&
e
.
type
==
DioExceptionType
.
cancel
)
?
'上传已取消'
:
e
.
toString
();
debugPrint
(
'====================>上传失败:
$msg
'
);
debugPrint
(
'====================>上传失败:
$msg
'
);
_webCubit
?.
sendUploadEnd
(
_cmdUnique
,
_cmdUploadId
,
''
,
errMsg:
msg
);
if
(!
_isCancelled
)
{
_webCubit
?.
sendUploadEnd
(
_cmdUnique
,
_cmdUploadId
,
''
,
errMsg:
msg
);
}
}
finally
{
}
finally
{
_unfollowCubit
();
_unfollowCubit
();
_uploadDio
?.
close
(
force:
true
);
_uploadDio
?.
close
(
force:
true
);
...
@@ -166,7 +172,9 @@ class UploadStartHandler extends MessageHandler {
...
@@ -166,7 +172,9 @@ class UploadStartHandler extends MessageHandler {
debugPrint
(
'转码进度:
$_cmdUnique
$progress
%'
);
debugPrint
(
'转码进度:
$_cmdUnique
$progress
%'
);
/// 发送转码进度
/// 发送转码进度
_webCubit
?.
sendUploadProgress
(
_cmdUnique
,
_cmdUploadId
,
1
,
progress
,
0
,
0
,
0
,
0
);
if
(!
_isCancelled
)
{
_webCubit
?.
sendUploadProgress
(
_cmdUnique
,
_cmdUploadId
,
1
,
progress
,
0
,
0
,
0
,
0
);
}
},
},
);
);
}
else
{
}
else
{
...
@@ -179,7 +187,9 @@ class UploadStartHandler extends MessageHandler {
...
@@ -179,7 +187,9 @@ class UploadStartHandler extends MessageHandler {
debugPrint
(
'压缩进度:
$_cmdUnique
$progress
%'
);
debugPrint
(
'压缩进度:
$_cmdUnique
$progress
%'
);
/// 发送压缩进度
/// 发送压缩进度
_webCubit
?.
sendUploadProgress
(
_cmdUnique
,
_cmdUploadId
,
1
,
progress
,
0
,
0
,
0
,
0
);
if
(!
_isCancelled
)
{
_webCubit
?.
sendUploadProgress
(
_cmdUnique
,
_cmdUploadId
,
1
,
progress
,
0
,
0
,
0
,
0
);
}
},
},
);
);
}
}
...
...
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