Skip to content

Commit

Permalink
fix: notifications not shown
Browse files Browse the repository at this point in the history
  • Loading branch information
KevMCarp committed Oct 21, 2024
1 parent f6a6712 commit 76084f2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/services/sync/sync_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class SyncService extends StateNotifier<SyncState> {
}

final name = userMap[asset.ownerId] ?? 'unknown';
final count = map[name] ?? AssetCount();
final count = map[name] ??= AssetCount();

switch (asset.type) {
case AssetType.image:
Expand Down Expand Up @@ -219,7 +219,6 @@ class SyncService extends StateNotifier<SyncState> {
}

if (newActivity.isNotEmpty) {
_logger.info('Sending activity notification');
_notifyActivity(newActivity);
}

Expand Down Expand Up @@ -275,13 +274,14 @@ class SyncService extends StateNotifier<SyncState> {
continue;
}

final count = map[event.user.name] ?? ActivityCount();
final count = map[event.user.name] ??= ActivityCount();
// TODO: Should we separate asset types?
// This would involve looking up each asset in the db.
// Maybe only do this if there is only a small number of activity.
switch (event.type) {
case ActivityType.like:
count.otherLikes++;
break;
case ActivityType.comment:
count.otherComments++;
break;
Expand All @@ -299,6 +299,8 @@ class SyncService extends StateNotifier<SyncState> {
entry.value.describe(buf, entry.key, locale);
}

_logger.info('Sending activity notification');

await _notifications.activity(
title: locale.newActivityNotification,
content: buf.toString(),
Expand Down

0 comments on commit 76084f2

Please sign in to comment.