From 55478d7ce098a2e01e8238ecce12d8c26e8464ba Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Thu, 14 Dec 2017 17:57:51 +0900 Subject: [PATCH] [NotificationEventListener] Add method for get all count related patch -data-provider-master : https://review.tizen.org/gerrit/#/c/163585/ -notification : https://review.tizen.org/gerrit/#/c/163584/ Signed-off-by: Seungha Son Change-Id: Iba5d5cf81b12fa131104fa2371c97ac03f124871 --- .../Interop/Interop.NotificationEventListener.cs | 3 +++ .../NotificationListenerManager.cs | 30 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs b/src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs index 85fbc4b..255be6d 100755 --- a/src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs +++ b/src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs @@ -168,6 +168,9 @@ internal static partial class Interop [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_load")] internal static extern IntPtr LoadNotification(string appID, int uniqueID); + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_all_count")] + internal static extern ErrorCode GetAllCount(NotificationType type, out int count); + internal static ErrorCode GetAppId(NotificationSafeHandle handle, out string appid) { ErrorCode err; diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationListenerManager.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationListenerManager.cs index d0c8382..c42923f 100755 --- a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationListenerManager.cs +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationListenerManager.cs @@ -440,5 +440,35 @@ namespace Tizen.Applications.NotificationEventListener return eventArgs; } + + /// + /// Gets the number of all notifications + /// + /// The number of all notifications + /// Thrown in case of a permission is denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/notification + /// 4 + [EditorBrowsable(EditorBrowsableState.Never)] + public static int GetAllCount() + { + int count; + Interop.NotificationEventListener.ErrorCode error; + + error = Interop.NotificationEventListener.GetAllCount(NotificationType.None, out count); + if (error != Interop.NotificationEventListener.ErrorCode.None) + { + if (error == Interop.NotificationEventListener.ErrorCode.PermissionDenied) + { + throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.PermissionDenied, "failed to get all count"); + } + else + { + throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.InvalidOperation, "failed to get all count"); + } + } + + return count; + } } } -- 2.7.4