Add TypeLoadException in Notification and NotificationEventListener
authorSeungha Son <seungha.son@samsung.com>
Wed, 24 May 2017 02:16:51 +0000 (11:16 +0900)
committerSon seungha <seungha.son@samsung.com>
Tue, 30 May 2017 06:04:36 +0000 (06:04 +0000)
 This patch adds TypeLoadException to support in API version 3.0
 in Notification and NotificationEventListener

Signed-off-by: Seungha Son <seungha.son@samsung.com>
Change-Id: Ifb17b3ff2fc5b002fb5ff8e26fe32c7f6d166811

src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs
src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs

index b7eee0d..b5a1fe1 100755 (executable)
@@ -83,7 +83,15 @@ namespace Tizen.Applications.Notifications
                 style.GetRemoveTime(out hidetime, out deletetime);
 
                 Interop.Notification.SetHideTime(notification.Handle, hidetime);
-                Interop.Notification.SetDeleteTime(notification.Handle, deletetime);
+                try
+                {
+                    Interop.Notification.SetDeleteTime(notification.Handle, deletetime);
+                }
+                catch (TypeLoadException)
+                {
+                    // To support in API version 3.0
+                    style.SetRemoveTime(hidetime, 60);
+                }
             }
 
             ret = Interop.Notification.SetImage(notification.Handle, NotificationImage.Background, style?.BackgroundImage);
@@ -151,7 +159,16 @@ namespace Tizen.Applications.Notifications
                 {
                     int hidetime, deletetime;
                     Interop.Notification.GetHideTime(notification.Handle, out hidetime);
-                    Interop.Notification.GetDeleteTime(notification.Handle, out deletetime);
+                    try
+                    {
+                        Interop.Notification.GetDeleteTime(notification.Handle, out deletetime);
+                    }
+                    catch (TypeLoadException)
+                    {
+                        // To support in API version 3.0
+                        deletetime = 60;
+                    }
+
                     active.SetRemoveTime(hidetime, deletetime);
                 }
 
index 930c946..6ccb63d 100755 (executable)
@@ -16,6 +16,8 @@
 
 namespace Tizen.Applications.NotificationEventListener
 {
+    using System;
+
     internal static class NotificationStyleArgBinder
     {
         internal static void BindObject(NotificationEventArgs eventargs)
@@ -46,7 +48,15 @@ namespace Tizen.Applications.NotificationEventListener
                 Interop.NotificationEventListener.GetHideTimeout(eventargs.Handle, out timeout);
                 activeStyle.HideTimeout = timeout;
 
-                Interop.NotificationEventListener.GetDeleteTimeout(eventargs.Handle, out timeout);
+                try
+                {
+                    Interop.NotificationEventListener.GetDeleteTimeout(eventargs.Handle, out timeout);
+                }
+                catch (TypeLoadException)
+                {
+                    //To support in API version 3.0
+                    timeout = 60;
+                }
                 activeStyle.DeleteTimeout = timeout;
 
                 NotificationReplyActionArgBinder.BindObject(eventargs);