mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 20:38:40 +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;
|
failed = false;
|
||||||
} else {
|
} else {
|
||||||
failed = true;
|
failed = true;
|
||||||
Log.error(
|
if (update.responseStatusCode != null) {
|
||||||
'Got invalid response status code: ${update.responseStatusCode}',
|
Log.error(
|
||||||
);
|
'Got invalid response status code: ${update.responseStatusCode}',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.info('Got ${update.status} for $mediaId');
|
Log.info('Got ${update.status} for $mediaId');
|
||||||
|
|
|
||||||
|
|
@ -203,9 +203,6 @@ Future<void> performTwonlySafeBackup({bool force = false}) async {
|
||||||
Future<void> handleBackupStatusUpdate(TaskStatusUpdate update) async {
|
Future<void> handleBackupStatusUpdate(TaskStatusUpdate update) async {
|
||||||
if (update.status == TaskStatus.failed ||
|
if (update.status == TaskStatus.failed ||
|
||||||
update.status == TaskStatus.canceled) {
|
update.status == TaskStatus.canceled) {
|
||||||
Log.error(
|
|
||||||
'twonly Backup upload failed. ${update.responseStatusCode} ${update.responseBody} ${update.responseHeaders} ${update.exception}',
|
|
||||||
);
|
|
||||||
await updateUserdata((user) {
|
await updateUserdata((user) {
|
||||||
if (user.twonlySafeBackup != null) {
|
if (user.twonlySafeBackup != null) {
|
||||||
user.twonlySafeBackup!.backupUploadState = LastBackupUploadState.failed;
|
user.twonlySafeBackup!.backupUploadState = LastBackupUploadState.failed;
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,7 @@ class _ChatMessagesViewState extends State<ChatMessagesView> {
|
||||||
});
|
});
|
||||||
|
|
||||||
final items = await MemoryItem.convertFromMessages(storedMediaFiles);
|
final items = await MemoryItem.convertFromMessages(storedMediaFiles);
|
||||||
|
if (!mounted) return;
|
||||||
galleryItems = items.values.toList();
|
galleryItems = items.values.toList();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,12 +172,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
showSendTextMessageInput = false;
|
showSendTextMessageInput = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// if (Platform.isAndroid) {
|
unawaited(flutterLocalNotificationsPlugin.cancelAll());
|
||||||
// await flutterLocalNotificationsPlugin
|
|
||||||
// .cancel(allMediaFiles.first.contactId);
|
|
||||||
// } else {
|
|
||||||
await flutterLocalNotificationsPlugin.cancelAll();
|
|
||||||
// }
|
|
||||||
|
|
||||||
final stream =
|
final stream =
|
||||||
twonlyDB.mediaFilesDao.watchMedia(allMediaFiles.first.mediaId!);
|
twonlyDB.mediaFilesDao.watchMedia(allMediaFiles.first.mediaId!);
|
||||||
|
|
@ -261,6 +256,8 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
return nextMediaOrExit();
|
return nextMediaOrExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var timerRequired = false;
|
||||||
|
|
||||||
if (currentMediaLocal.mediaFile.type == MediaType.video) {
|
if (currentMediaLocal.mediaFile.type == MediaType.video) {
|
||||||
videoController = VideoPlayerController.file(currentMediaLocal.tempPath);
|
videoController = VideoPlayerController.file(currentMediaLocal.tempPath);
|
||||||
await videoController?.setLooping(
|
await videoController?.setLooping(
|
||||||
|
|
@ -292,12 +289,17 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
currentMediaLocal.mediaFile.displayLimitInMilliseconds!,
|
currentMediaLocal.mediaFile.displayLimitInMilliseconds!,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
timerRequired = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {
|
||||||
|
currentMedia = currentMediaLocal;
|
||||||
|
});
|
||||||
|
if (timerRequired) {
|
||||||
startTimer();
|
startTimer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setState(() {
|
|
||||||
currentMedia = currentMediaLocal;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void startTimer() {
|
void startTimer() {
|
||||||
|
|
@ -310,14 +312,16 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
progressTimer = Timer.periodic(const Duration(milliseconds: 10), (timer) {
|
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) {
|
canBeSeenUntil == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final difference = canBeSeenUntil!.difference(DateTime.now());
|
final difference = canBeSeenUntil!.difference(DateTime.now());
|
||||||
// Calculate the progress as a value between 0.0 and 1.0
|
// Calculate the progress as a value between 0.0 and 1.0
|
||||||
progress = difference.inMilliseconds /
|
progress =
|
||||||
(currentMedia!.mediaFile.displayLimitInMilliseconds!);
|
difference.inMilliseconds / (mediaFile.displayLimitInMilliseconds!);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue