Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading