Add WatchfaceComplication.dll and fix some bugs (#703)
authorHyunho Kang <hhstark.kang@samsung.com>
Fri, 15 Feb 2019 04:35:55 +0000 (13:35 +0900)
committerGitHub <noreply@github.com>
Fri, 15 Feb 2019 04:35:55 +0000 (13:35 +0900)
* Add Tizen.Applications.WatchfaceComplication.dll

Signed-off-by: hyunho <hhstark.kang@samsung.com>
* Remove unused using

Signed-off-by: hyunho <hhstark.kang@samsung.com>
* Fix wrong dispose sequence

Signed-off-by: hyunho <hhstark.kang@samsung.com>
* Fix wrong assignment

Validation is already done and initialize should be done without validation

Signed-off-by: hyunho <hhstark.kang@samsung.com>
* Fix register callback bug

Signed-off-by: hyunho <hhstark.kang@samsung.com>
* Modify field that is only assigned in constructor

Field that is only assigned in constructor should be readonly

Signed-off-by: hyunho <hhstark.kang@samsung.com>
packaging/PlatformFileList.txt
src/Tizen.Applications.WatchfaceComplication/Tizen.Applications/Complication.cs
src/Tizen.Applications.WatchfaceComplication/Tizen.Applications/ComplicationProvider.cs
src/Tizen.Applications.WatchfaceComplication/Tizen.Applications/EditablesContainer.cs
src/Tizen.Applications.WatchfaceComplication/Tizen.Applications/RangedValueData.cs [changed mode: 0755->0644]

index 72ccf27..9dd87b3 100755 (executable)
@@ -24,6 +24,7 @@ Tizen.Applications.Shortcut.dll                    #mobile #mobile-emul
 Tizen.Applications.ToastMessage.dll                #common #mobile #mobile-emul #tv #wearable
 Tizen.Applications.UI.dll                          #common #mobile #mobile-emul #tv #wearable
 Tizen.Applications.WatchApplication.dll            #wearable
+Tizen.Applications.WatchfaceComplication.dll       #wearable
 Tizen.Applications.WidgetApplication.dll           #mobile #mobile-emul #tv #wearable
 Tizen.Applications.WidgetControl.dll               #mobile #mobile-emul #tv #wearable
 Tizen.Content.Download.dll                         #common #mobile #mobile-emul #tv #wearable
index 3ec7f6c..27f00d6 100644 (file)
@@ -17,7 +17,6 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
-using Tizen.Applications;
 
 
 namespace Tizen.Applications.WatchfaceComplication
@@ -893,8 +892,8 @@ namespace Tizen.Applications.WatchfaceComplication
         {
             if (!_disposed)
             {
-                Interop.WatchfaceComplication.Destroy(_handle);
                 Interop.WatchfaceComplication.RemoveUpdatedCallback(_handle, _updatedCallback);
+                Interop.WatchfaceComplication.Destroy(_handle);
                 _disposed = true;
             }
         }
index 646a848..86ff96c 100644 (file)
@@ -17,6 +17,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using static Interop.WatchfaceComplication;
 
 namespace Tizen.Applications.WatchfaceComplication
 {
@@ -29,6 +30,7 @@ namespace Tizen.Applications.WatchfaceComplication
         private string _providerId;
         private bool _disposed = false;
         private const string LogTag = "WatchfaceComplication";
+        private readonly UpdateRequestedCallback _updatedCallback;
 
         /// <summary>
         /// Initializes the ComplicationProvider class.
@@ -56,7 +58,8 @@ namespace Tizen.Applications.WatchfaceComplication
         /// <since_tizen> 6 </since_tizen>
         protected ComplicationProvider(string providerId)
         {
-            ComplicationError err = Interop.WatchfaceComplication.AddUpdateRequestedCallback(providerId, DataUpdateRequested, IntPtr.Zero);
+            _updatedCallback = new Interop.WatchfaceComplication.UpdateRequestedCallback(DataUpdateRequested);
+            ComplicationError err = Interop.WatchfaceComplication.AddUpdateRequestedCallback(providerId, _updatedCallback, IntPtr.Zero);
             if (err != ComplicationError.None)
                 ErrorFactory.ThrowException(err, "fail to create provider");
             _providerId = providerId;
@@ -247,7 +250,7 @@ namespace Tizen.Applications.WatchfaceComplication
         {
             if (!_disposed)
             {
-                Interop.WatchfaceComplication.RemoveUpdateRequestedCallback(_providerId, DataUpdateRequested);
+                Interop.WatchfaceComplication.RemoveUpdateRequestedCallback(_providerId, _updatedCallback);
                 _disposed = true;
             }
         }
index 1a0dbde..336d927 100644 (file)
@@ -29,6 +29,7 @@ namespace Tizen.Applications.WatchfaceComplication
         internal IList<Complication> _compList = new List<Complication>();
         internal IntPtr _container = IntPtr.Zero;
         private Interop.WatchfaceComplication.EditableUpdateRequestedCallback _editableUpdatedCallback;
+        private readonly Interop.WatchfaceComplication.EditReadyCallback _editReadyCallback;
         private bool _disposed = false;
         private static string _logTag = "WatchfaceComplication";
 
@@ -41,7 +42,8 @@ namespace Tizen.Applications.WatchfaceComplication
         /// <since_tizen> 6 </since_tizen>
         protected EditablesContainer()
         {
-            ComplicationError err = Interop.WatchfaceComplication.AddEditReadyCallback(EditReady, IntPtr.Zero);
+            _editReadyCallback = new Interop.WatchfaceComplication.EditReadyCallback(EditReady);
+            ComplicationError err = Interop.WatchfaceComplication.AddEditReadyCallback(_editReadyCallback, IntPtr.Zero);
             if (err != ComplicationError.None)
                 ErrorFactory.ThrowException(err, "Fail to add edit ready callback");
             Log.Debug(_logTag, "Edit container ready");
@@ -330,7 +332,7 @@ namespace Tizen.Applications.WatchfaceComplication
         {
             if (!_disposed)
             {
-                Interop.WatchfaceComplication.RemoveEditReadyCallback(EditReady);
+                Interop.WatchfaceComplication.RemoveEditReadyCallback(_editReadyCallback);
                 _disposed = true;
             }
         }
old mode 100755 (executable)
new mode 100644 (file)
index 5eee4de..2b446a3
@@ -58,9 +58,9 @@ namespace Tizen.Applications.WatchfaceComplication
             if (minValue > maxValue || currentValue < minValue || currentValue > maxValue)
                 ErrorFactory.ThrowException(ComplicationError.InvalidParam, "Invalid value range min(" + minValue + "), cur(" + currentValue + "), max(" + maxValue + ")");
             Type = ComplicationTypes.RangedValue;
-            RangeCurrent = currentValue;
-            RangeMin = minValue;
-            RangeMax = maxValue;
+            base.RangeMin = minValue;
+            base.RangeMax = maxValue;
+            base.RangeCurrent = currentValue;
             ShortText = shortText;
             IconPath = iconPath;
             Title = title;