Browse Source

neon: Display account on notification if multiple accounts are present

pull/258/head
jld3103 2 years ago
parent
commit
1e002f5455
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 6
      packages/neon/neon/lib/src/utils/push_utils.dart

6
packages/neon/neon/lib/src/utils/push_utils.dart

@ -77,8 +77,11 @@ class PushUtils {
await cache.init(); await cache.init();
NextcloudNotificationsNotification? notification; NextcloudNotificationsNotification? notification;
var accounts = <Account>[];
Account? account;
try { try {
final account = loadAccounts(AppStorage('accounts', sharedPreferences)).find(instance); accounts = loadAccounts(AppStorage('accounts', sharedPreferences));
account = accounts.find(instance);
if (account != null) { if (account != null) {
notification = notification =
(await account.client.notifications.getNotification(id: pushNotification.subject.nid!)).ocs.data; (await account.client.notifications.getNotification(id: pushNotification.subject.nid!)).ocs.data;
@ -105,6 +108,7 @@ class PushUtils {
android: AndroidNotificationDetails( android: AndroidNotificationDetails(
appID, appID,
appName, appName,
subText: accounts.length > 1 && account != null ? account.client.humanReadableID : null,
groupKey: 'app_$appID', groupKey: 'app_$appID',
icon: '@mipmap/ic_launcher', icon: '@mipmap/ic_launcher',
color: themePrimaryColor, color: themePrimaryColor,

Loading…
Cancel
Save