diff --git a/external/nextcloud-notifications b/external/nextcloud-notifications index a380eabe..69069071 160000 --- a/external/nextcloud-notifications +++ b/external/nextcloud-notifications @@ -1 +1 @@ -Subproject commit a380eabe8b369a7103d1f529c82d6b44dce4f6a6 +Subproject commit 69069071ff7a5775ddb06418f55f39593afdbbb1 diff --git a/external/nextcloud-server b/external/nextcloud-server index 62cfd3b4..8cfcb8e2 160000 --- a/external/nextcloud-server +++ b/external/nextcloud-server @@ -1 +1 @@ -Subproject commit 62cfd3b4c9ff4d8cdbbe6dcc8b63a1085bb94e3d +Subproject commit 8cfcb8e2a2f9ba1bbe993161f00d7dcebf07708f diff --git a/packages/neon/neon/lib/src/utils/push_utils.dart b/packages/neon/neon/lib/src/utils/push_utils.dart index ed407d15..6d715bdb 100644 --- a/packages/neon/neon/lib/src/utils/push_utils.dart +++ b/packages/neon/neon/lib/src/utils/push_utils.dart @@ -91,38 +91,40 @@ class PushUtils { debugPrint(s.toString()); } - final appID = notification?.app ?? pushNotification.subject.app ?? 'nextcloud'; - String? appName = localizations.appImplementationName(appID); - if (appName == '') { - debugPrint('Missing app name for $appID'); - appName = null; - } - final title = (notification?.subject ?? pushNotification.subject.subject)!; - final message = (notification?.message.isNotEmpty ?? false) ? notification!.message : null; - final when = notification != null ? DateTime.parse(notification.datetime) : null; + if (notification?.shouldNotify ?? true) { + final appID = notification?.app ?? pushNotification.subject.app ?? 'nextcloud'; + String? appName = localizations.appImplementationName(appID); + if (appName == '') { + debugPrint('Missing app name for $appID'); + appName = null; + } + final title = (notification?.subject ?? pushNotification.subject.subject)!; + final message = (notification?.message.isNotEmpty ?? false) ? notification!.message : null; + final when = notification != null ? DateTime.parse(notification.datetime) : null; - await localNotificationsPlugin.show( - _getNotificationID(instance, pushNotification), - message != null && appName != null ? '$appName: $title' : title, - message, - NotificationDetails( - android: AndroidNotificationDetails( - appID, - appName ?? appID, - subText: accounts.length > 1 && account != null ? account.client.humanReadableID : null, - groupKey: 'app_$appID', - icon: '@mipmap/ic_launcher', - when: when?.millisecondsSinceEpoch, - color: themePrimaryColor, - category: pushNotification.type == 'voip' ? AndroidNotificationCategory.call : null, - importance: Importance.max, - priority: pushNotification.priority == 'high' - ? (pushNotification.type == 'voip' ? Priority.max : Priority.high) - : Priority.defaultPriority, + await localNotificationsPlugin.show( + _getNotificationID(instance, pushNotification), + message != null && appName != null ? '$appName: $title' : title, + message, + NotificationDetails( + android: AndroidNotificationDetails( + appID, + appName ?? appID, + subText: accounts.length > 1 && account != null ? account.client.humanReadableID : null, + groupKey: 'app_$appID', + icon: '@mipmap/ic_launcher', + when: when?.millisecondsSinceEpoch, + color: themePrimaryColor, + category: pushNotification.type == 'voip' ? AndroidNotificationCategory.call : null, + importance: Importance.max, + priority: pushNotification.priority == 'high' + ? (pushNotification.type == 'voip' ? Priority.max : Priority.high) + : Priority.defaultPriority, + ), ), - ), - payload: json.encode(pushNotification.toJson()), - ); + payload: json.encode(pushNotification.toJson()), + ); + } } Global.onPushNotificationReceived?.call(instance); diff --git a/packages/neon/neon_notifications/lib/pages/main.dart b/packages/neon/neon_notifications/lib/pages/main.dart index 7e0c0c18..c04e98e1 100644 --- a/packages/neon/neon_notifications/lib/pages/main.dart +++ b/packages/neon/neon_notifications/lib/pages/main.dart @@ -81,7 +81,7 @@ class _NotificationsMainPageState extends State { width: 40, height: 40, child: NeonCachedUrlImage( - url: notification.icon, + url: notification.icon!, width: 40, height: 40, svgColor: Theme.of(context).colorScheme.primary, diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.dart b/packages/nextcloud/lib/src/nextcloud.openapi.dart index 3bce5928..8c27481a 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.dart @@ -4743,12 +4743,13 @@ class NextcloudNotificationsNotification { required this.subject, required this.message, required this.link, - required this.subjectRich, - required this.subjectRichParameters, - required this.messageRich, - required this.messageRichParameters, - required this.icon, required this.actions, + this.subjectRich, + this.subjectRichParameters, + this.messageRich, + this.messageRichParameters, + this.icon, + this.shouldNotify, }); // coverage:ignore-start @@ -4782,15 +4783,17 @@ class NextcloudNotificationsNotification { final String link; - final String subjectRich; + final String? subjectRich; final dynamic subjectRichParameters; - final String messageRich; + final String? messageRich; final dynamic messageRichParameters; - final String icon; + final String? icon; + + final bool? shouldNotify; final List actions; diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.g.dart b/packages/nextcloud/lib/src/nextcloud.openapi.g.dart index d60c0502..fadfea3d 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.g.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.g.dart @@ -1541,6 +1541,7 @@ NextcloudNotificationsNotification _$NextcloudNotificationsNotificationFromJson( 'messageRich', 'messageRichParameters', 'icon', + 'shouldNotify', 'actions' ], ); @@ -1554,14 +1555,15 @@ NextcloudNotificationsNotification _$NextcloudNotificationsNotificationFromJson( subject: json['subject'] as String, message: json['message'] as String, link: json['link'] as String, - subjectRich: json['subjectRich'] as String, - subjectRichParameters: json['subjectRichParameters'], - messageRich: json['messageRich'] as String, - messageRichParameters: json['messageRichParameters'], - icon: json['icon'] as String, actions: (json['actions'] as List) .map((e) => NextcloudNotificationsNotificationAction.fromJson(e as Map)) .toList(), + subjectRich: json['subjectRich'] as String?, + subjectRichParameters: json['subjectRichParameters'], + messageRich: json['messageRich'] as String?, + messageRichParameters: json['messageRichParameters'], + icon: json['icon'] as String?, + shouldNotify: json['shouldNotify'] as bool?, ); } @@ -1581,6 +1583,7 @@ Map _$NextcloudNotificationsNotificationToJson(NextcloudNotific 'messageRich': instance.messageRich, 'messageRichParameters': instance.messageRichParameters, 'icon': instance.icon, + 'shouldNotify': instance.shouldNotify, 'actions': instance.actions.map((e) => e.toJson()).toList(), }; diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.json b/packages/nextcloud/lib/src/nextcloud.openapi.json index ae7c2c03..f41dcb88 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.json +++ b/packages/nextcloud/lib/src/nextcloud.openapi.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "info": { "title": "Nextcloud", - "version": "26.0.0", + "version": "26.0.1", "description": "All supported Nextcloud APIs in one", "license": { "name": "agpl", @@ -1274,11 +1274,6 @@ "subject", "message", "link", - "subjectRich", - "subjectRichParameters", - "messageRich", - "messageRichParameters", - "icon", "actions" ], "properties": { @@ -1324,6 +1319,9 @@ "icon": { "type": "string" }, + "shouldNotify": { + "type": "boolean" + }, "actions": { "type": "array", "items": { diff --git a/packages/nextcloud/test/core.dart b/packages/nextcloud/test/core.dart index c2023b89..12e52c74 100644 --- a/packages/nextcloud/test/core.dart +++ b/packages/nextcloud/test/core.dart @@ -27,8 +27,8 @@ Future run(final DockerImage image) async { expect(status.installed, true); expect(status.maintenance, false); expect(status.needsDbUpgrade, false); - expect(status.version, startsWith('26.0.0')); - expect(status.versionstring, '26.0.0'); + expect(status.version, startsWith('26.0.1')); + expect(status.versionstring, '26.0.1'); expect(status.edition, ''); expect(status.productname, 'Nextcloud'); expect(status.extendedSupport, false); @@ -37,7 +37,7 @@ Future run(final DockerImage image) async { test('Get capabilities', () async { final capabilities = await client.core.getCapabilities(); expect(capabilities.ocs.data.version.major.toString(), '26'); - expect(capabilities.ocs.data.version.string, '26.0.0'); + expect(capabilities.ocs.data.version.string, '26.0.1'); expect(capabilities.ocs.data.capabilities.theming!.name, 'Nextcloud'); expect(capabilities.ocs.data.capabilities.theming!.url, 'https://nextcloud.com'); expect(capabilities.ocs.data.capabilities.theming!.slogan, 'a safe home for all your data'); diff --git a/specs/core.json b/specs/core.json index c4e3e878..a88c14d2 100644 --- a/specs/core.json +++ b/specs/core.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "info": { "title": "Core", - "version": "26.0.0", + "version": "26.0.1", "description": "Core functionality of Nextcloud", "license": { "name": "agpl", diff --git a/specs/notifications.json b/specs/notifications.json index 4da3f6f4..340a16cb 100644 --- a/specs/notifications.json +++ b/specs/notifications.json @@ -89,11 +89,6 @@ "subject", "message", "link", - "subjectRich", - "subjectRichParameters", - "messageRich", - "messageRichParameters", - "icon", "actions" ], "properties": { @@ -139,6 +134,9 @@ "icon": { "type": "string" }, + "shouldNotify": { + "type": "boolean" + }, "actions": { "type": "array", "items": { diff --git a/specs/templates/appinfo_core.xml b/specs/templates/appinfo_core.xml index 6ab01f32..ff8571a6 100644 --- a/specs/templates/appinfo_core.xml +++ b/specs/templates/appinfo_core.xml @@ -4,6 +4,6 @@ Core Core functionality of Nextcloud - 26.0.0 + 26.0.1 agpl diff --git a/specs/templates/core.json b/specs/templates/core.json index c7ab973d..ce3abdb5 100644 --- a/specs/templates/core.json +++ b/specs/templates/core.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "info": { "title": "Core", - "version": "26.0.0", + "version": "26.0.1", "description": "Core functionality of Nextcloud", "license": { "name": "agpl", diff --git a/specs/templates/notifications.json b/specs/templates/notifications.json index d672e45c..a44561df 100644 --- a/specs/templates/notifications.json +++ b/specs/templates/notifications.json @@ -114,6 +114,46 @@ } } }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/notifications/exists": { + "parameters": [ + { + "name": "apiVersion", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "post": { + "operationId": "endpoint-confirmidsforuser-TODO", + "tags": [ + "notifications" + ], + "parameters": [ + { + "name": "ids", + "in": "query", + "required": true, + "schema": { + "type": "array" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, "/ocs/v2.php/apps/notifications/api/{apiVersion}/push": { "parameters": [ { diff --git a/tool/Dockerfile.dev b/tool/Dockerfile.dev index ffa2aac5..9261fdfc 100644 --- a/tool/Dockerfile.dev +++ b/tool/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM nextcloud:26.0.0 +FROM nextcloud:26.0.1 WORKDIR /usr/src/nextcloud RUN chown -R www-data:www-data . USER www-data