8756c5fefb
(cherry picked from commit 3077cc3b414d4894ac13f5636aa5d59b0096c9fb)
30 lines
794 B
Dart
30 lines
794 B
Dart
|
|
import 'package:core/utils/platform_info.dart';
|
|
import 'package:equatable/equatable.dart';
|
|
import 'package:tmail_ui_user/features/offline_mode/config/work_manager_constants.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.addAll({WorkManagerConstants.workerTypeKey: type.name});
|
|
return data;
|
|
}
|
|
|
|
@override
|
|
List<Object?> get props => [id, type, data];
|
|
} |