mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 14:48:41 +00:00
maybe fixing #316
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
This commit is contained in:
parent
5758749bd1
commit
9cb2503cdb
4 changed files with 22 additions and 18 deletions
|
|
@ -100,9 +100,11 @@ Future<void> handleDownloadStatusUpdate(TaskStatusUpdate update) async {
|
|||
failed = false;
|
||||
} else {
|
||||
failed = true;
|
||||
Log.error(
|
||||
'Got invalid response status code: ${update.responseStatusCode}',
|
||||
);
|
||||
if (update.responseStatusCode != null) {
|
||||
Log.error(
|
||||
'Got invalid response status code: ${update.responseStatusCode}',
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.info('Got ${update.status} for $mediaId');
|
||||
|
|
|
|||
|
|
@ -203,9 +203,6 @@ Future<void> performTwonlySafeBackup({bool force = false}) async {
|
|||
Future<void> handleBackupStatusUpdate(TaskStatusUpdate update) async {
|
||||
if (update.status == TaskStatus.failed ||
|
||||
update.status == TaskStatus.canceled) {
|
||||
Log.error(
|
||||
'twonly Backup upload failed. ${update.responseStatusCode} ${update.responseBody} ${update.responseHeaders} ${update.exception}',
|
||||
);
|
||||
await updateUserdata((user) {
|
||||
if (user.twonlySafeBackup != null) {
|
||||
user.twonlySafeBackup!.backupUploadState = LastBackupUploadState.failed;
|
||||
|
|
|
|||
|
|
@ -260,6 +260,7 @@ class _ChatMessagesViewState extends State<ChatMessagesView> {
|
|||
});
|
||||
|
||||
final items = await MemoryItem.convertFromMessages(storedMediaFiles);
|
||||
if (!mounted) return;
|
||||
galleryItems = items.values.toList();
|
||||
setState(() {});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,12 +172,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
|||
showSendTextMessageInput = false;
|
||||
});
|
||||
|
||||
// if (Platform.isAndroid) {
|
||||
// await flutterLocalNotificationsPlugin
|
||||
// .cancel(allMediaFiles.first.contactId);
|
||||
// } else {
|
||||
await flutterLocalNotificationsPlugin.cancelAll();
|
||||
// }
|
||||
unawaited(flutterLocalNotificationsPlugin.cancelAll());
|
||||
|
||||
final stream =
|
||||
twonlyDB.mediaFilesDao.watchMedia(allMediaFiles.first.mediaId!);
|
||||
|
|
@ -261,6 +256,8 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
|||
return nextMediaOrExit();
|
||||
}
|
||||
|
||||
var timerRequired = false;
|
||||
|
||||
if (currentMediaLocal.mediaFile.type == MediaType.video) {
|
||||
videoController = VideoPlayerController.file(currentMediaLocal.tempPath);
|
||||
await videoController?.setLooping(
|
||||
|
|
@ -292,12 +289,17 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
|||
currentMediaLocal.mediaFile.displayLimitInMilliseconds!,
|
||||
),
|
||||
);
|
||||
timerRequired = true;
|
||||
}
|
||||
}
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
currentMedia = currentMediaLocal;
|
||||
});
|
||||
if (timerRequired) {
|
||||
startTimer();
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
currentMedia = currentMediaLocal;
|
||||
});
|
||||
}
|
||||
|
||||
void startTimer() {
|
||||
|
|
@ -310,14 +312,16 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
|||
}
|
||||
});
|
||||
progressTimer = Timer.periodic(const Duration(milliseconds: 10), (timer) {
|
||||
if (currentMedia!.mediaFile.displayLimitInMilliseconds == null ||
|
||||
final mediaFile = currentMedia?.mediaFile;
|
||||
if (mediaFile == null) return;
|
||||
if (mediaFile.displayLimitInMilliseconds == null ||
|
||||
canBeSeenUntil == null) {
|
||||
return;
|
||||
}
|
||||
final difference = canBeSeenUntil!.difference(DateTime.now());
|
||||
// Calculate the progress as a value between 0.0 and 1.0
|
||||
progress = difference.inMilliseconds /
|
||||
(currentMedia!.mediaFile.displayLimitInMilliseconds!);
|
||||
progress =
|
||||
difference.inMilliseconds / (mediaFile.displayLimitInMilliseconds!);
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue