Skip to content

Commit

Permalink
fix notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonavichus committed Dec 9, 2022
1 parent 0d4c4be commit 687fa77
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/app/services/isar_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ class IsarServices {
await isar.writeTxn(() async {
await isar.todos.put(todosCreate);
await todosCreate.task.save();
if (todosCreate.todoCompletedTime != null) {
if (timeEdit.text.isNotEmpty) {
NotificationShow().showNotification(
todosCreate.id,
todosCreate.name,
todosCreate.description,
todosCreate.todoCompletedTime,
DateTime.tryParse(timeEdit.text),
);
}
});
Expand Down Expand Up @@ -237,13 +237,13 @@ class IsarServices {
todo.task.value = task;
await isar.todos.put(todo);
await todo.task.save();
await flutterLocalNotificationsPlugin.cancel(todo.id);
if (todo.todoCompletedTime != null) {
if (timeEdit.text.isNotEmpty) {
await flutterLocalNotificationsPlugin.cancel(todo.id);
NotificationShow().showNotification(
todo.id,
todo.name,
todo.description,
todo.todoCompletedTime,
DateTime.tryParse(timeEdit.text),
);
}
});
Expand Down Expand Up @@ -316,13 +316,6 @@ class IsarServices {
}

Future<void> noArchiveTask(Tasks task, Function() set) async {
// No archive Task
await isar.writeTxn(() async {
task.archive = false;
await isar.tasks.put(task);
});
EasyLoading.showSuccess('noTaskArchive'.tr,
duration: const Duration(milliseconds: 500));
// Create Notification
List<Todos> getTodo;
final taskCollection = isar.todos;
Expand All @@ -341,6 +334,13 @@ class IsarServices {
);
}
}
// No archive Task
await isar.writeTxn(() async {
task.archive = false;
await isar.tasks.put(task);
});
EasyLoading.showSuccess('noTaskArchive'.tr,
duration: const Duration(milliseconds: 500));
set();
}
}

0 comments on commit 687fa77

Please sign in to comment.