initialize method
Initialize and set up the app controller.
If enableNotifications
is true, a notification will be added to
the phone's notification system when a task is enqueued via the
enqueue method.
Implementation
Future<void> initialize({
bool enableNotifications = true,
}) async {
// set up a timer which cleans up in the queue once an hour
_garbageCollector = Timer.periodic(const Duration(hours: 1), (timer) {
for (var task in userTasks) {
if (task.expiresIn != null && task.expiresIn!.isNegative) {
expire(task.id);
}
}
});
// initialize notification controller if needed
notificationsEnabled = enableNotifications;
if (notificationsEnabled) {
await SmartPhoneClientManager().notificationController?.initialize();
}
}