mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-10 16:00:28 -07:00
fix: Sync leaving left over temp files (#73)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
c5e39db9ec
commit
8d15e319d3
15 changed files with 644 additions and 406 deletions
|
|
@ -20,6 +20,7 @@ import 'package:fladder/models/items/trick_play_model.dart';
|
|||
import 'package:fladder/models/syncing/i_synced_item.dart';
|
||||
import 'package:fladder/providers/sync/sync_provider_helpers.dart';
|
||||
import 'package:fladder/providers/sync_provider.dart';
|
||||
import 'package:fladder/util/localization_helper.dart';
|
||||
|
||||
part 'sync_item.freezed.dart';
|
||||
|
||||
|
|
@ -29,6 +30,7 @@ class SyncedItem with _$SyncedItem {
|
|||
|
||||
factory SyncedItem({
|
||||
required String id,
|
||||
@Default(false) bool syncing,
|
||||
String? parentId,
|
||||
required String userId,
|
||||
String? path,
|
||||
|
|
@ -72,7 +74,7 @@ class SyncedItem with _$SyncedItem {
|
|||
_ => SyncStatus.partially,
|
||||
};
|
||||
|
||||
String? get taskId => null;
|
||||
String? get taskId => task?.taskId;
|
||||
|
||||
bool get childHasTask => false;
|
||||
|
||||
|
|
@ -126,6 +128,7 @@ class SyncedItem with _$SyncedItem {
|
|||
parentId: isarSyncedItem.parentId,
|
||||
userId: isarSyncedItem.userId ?? "",
|
||||
sortName: isarSyncedItem.sortName,
|
||||
syncing: isarSyncedItem.syncing,
|
||||
path: joinAll([savePath, isarSyncedItem.path ?? ""]),
|
||||
fileSize: isarSyncedItem.fileSize,
|
||||
videoFileName: isarSyncedItem.videoFileName,
|
||||
|
|
@ -155,21 +158,25 @@ class SyncedItem with _$SyncedItem {
|
|||
|
||||
enum SyncStatus {
|
||||
complete(
|
||||
"Synced",
|
||||
Color.fromARGB(255, 141, 214, 58),
|
||||
IconsaxOutline.tick_circle,
|
||||
),
|
||||
partially(
|
||||
"Partially",
|
||||
Color.fromARGB(255, 221, 135, 23),
|
||||
IconsaxOutline.more_circle,
|
||||
),
|
||||
;
|
||||
|
||||
const SyncStatus(this.label, this.color, this.icon);
|
||||
const SyncStatus(this.color, this.icon);
|
||||
|
||||
final Color color;
|
||||
final String label;
|
||||
String label(BuildContext context) {
|
||||
return switch (this) {
|
||||
SyncStatus.partially => context.localized.syncStatusPartially,
|
||||
SyncStatus.complete => context.localized.syncStatusSynced,
|
||||
};
|
||||
}
|
||||
|
||||
final IconData icon;
|
||||
}
|
||||
|
||||
|
|
@ -183,14 +190,14 @@ extension StatusExtension on TaskStatus {
|
|||
TaskStatus.paused => Colors.orangeAccent,
|
||||
};
|
||||
|
||||
String get name => switch (this) {
|
||||
TaskStatus.enqueued => 'Enqueued',
|
||||
TaskStatus.running => 'Running',
|
||||
TaskStatus.complete => 'Complete',
|
||||
TaskStatus.notFound => 'Not Found',
|
||||
TaskStatus.failed => 'Failed',
|
||||
TaskStatus.canceled => 'Canceled',
|
||||
TaskStatus.waitingToRetry => 'Waiting To Retry',
|
||||
TaskStatus.paused => 'Paused',
|
||||
String name(BuildContext context) => switch (this) {
|
||||
TaskStatus.enqueued => context.localized.syncStatusEnqueued,
|
||||
TaskStatus.running => context.localized.syncStatusRunning,
|
||||
TaskStatus.complete => context.localized.syncStatusComplete,
|
||||
TaskStatus.notFound => context.localized.syncStatusNotFound,
|
||||
TaskStatus.failed => context.localized.syncStatusFailed,
|
||||
TaskStatus.canceled => context.localized.syncStatusCanceled,
|
||||
TaskStatus.waitingToRetry => context.localized.syncStatusWaitingToRetry,
|
||||
TaskStatus.paused => context.localized.syncStatusPaused,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue