TF-1861 Config and abstraction work manager
(cherry picked from commit ee2dca9b34a907c8356ceccf0b23efba2893a01c)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
|
||||
import 'package:core/utils/platform_info.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:tmail_ui_user/features/offline_mode/scheduler/worker_type.dart';
|
||||
|
||||
/// Equivalent to the task or work that needs to be done in the background
|
||||
class Worker with EquatableMixin {
|
||||
|
||||
final String id;
|
||||
final WorkerType type;
|
||||
final Map<String, dynamic> data;
|
||||
|
||||
Worker(this.id, this.type, this.data);
|
||||
|
||||
String get uniqueId {
|
||||
if (PlatformInfo.isIOS) {
|
||||
return type.iOSUniqueId;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
Map<String, dynamic> get inputData {
|
||||
data['workerType'] = type;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, type, data];
|
||||
}
|
||||
Reference in New Issue
Block a user