backend changes
This commit is contained in:
parent
8c2227df73
commit
fe03554fbf
@ -44,7 +44,8 @@ class NotificationsHelper {
|
||||
|
||||
// loop through grades and see which hasn't been seen yet
|
||||
for (Grade grade in grades) {
|
||||
if (grade.seenDate.isAfter(lastSeenGrade)) {
|
||||
// if the grade was added over a week ago, don't show it to avoid notification spam
|
||||
if (grade.seenDate.isAfter(lastSeenGrade) && grade.date.difference(DateTime.now()).inDays * -1 < 7) {
|
||||
// send notificiation about new grade
|
||||
const AndroidNotificationDetails androidNotificationDetails =
|
||||
AndroidNotificationDetails('GRADES', 'Jegyek',
|
||||
|
@ -89,6 +89,7 @@ Future<List<DateWidget>> getFilterWidgets(FilterType activeData,
|
||||
|
||||
// Grades
|
||||
case FilterType.grades:
|
||||
gradeProvider.seenAll();
|
||||
items = grade_filter.getWidgets(
|
||||
gradeProvider.grades, gradeProvider.lastSeenDate);
|
||||
if (settingsProvider.gradeOpeningFun) {
|
||||
|
@ -51,7 +51,6 @@ class GradeProvider with ChangeNotifier {
|
||||
final userStore = _database.userStore;
|
||||
userStore.storeLastSeenGrade(DateTime.now(), userId: userId);
|
||||
_lastSeen = DateTime.now();
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -444,11 +444,7 @@ class _SettingsScreenState extends State<SettingsScreen>
|
||||
borderRadius: BorderRadius.circular(12.0)),
|
||||
title: Row(children: [
|
||||
Icon(FeatherIcons.messageSquare,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.secondary
|
||||
.withOpacity(
|
||||
settings.notificationsEnabled ? 1 : .25)),
|
||||
color: settings.notificationsEnabled ? Theme.of(context).colorScheme.secondary : AppColors.of(context).text.withOpacity(.25)),
|
||||
const SizedBox(width: 14.0),
|
||||
Text(
|
||||
"notifications".i18n,
|
||||
|
Loading…
x
Reference in New Issue
Block a user