[NUI.Gadget] Add a new internal API (#4976)
authorhjhun <36876573+hjhun@users.noreply.github.com>
Wed, 8 Mar 2023 04:11:40 +0000 (13:11 +0900)
committerGitHub <noreply@github.com>
Wed, 8 Mar 2023 04:11:40 +0000 (13:11 +0900)
* [NUI.Gadget] Add new internal APIs

If the UI gadget developer sets the class name, the application developer
can adds a new NUIGadget instance using the NUIGadgetInfo object.

The following APIs are added:
 + NUIGadgetManager.Add(NUIGadgetInfo gadgetInfo); [method]
 + NUIGadgetManager.GetGadgetInfos(); [method]
 + NUIGadgetInfo.ClassName; [property]

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
* Change the visibility of the ClasaName property

The visibility of the NUIGadgetInfo.ClassName property is changed to internal.

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
* Modify description of GetGadgets()

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
* Remove Add() method

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
---------

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
Co-authored-by: Jay Cho <chojoong@gmail.com>
src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetManager.cs

index 1795293..1c77e1d 100755 (executable)
@@ -129,6 +129,11 @@ namespace Tizen.NUI
         /// <since_tizen> 10 </since_tizen>
         public static NUIGadget Add(string resourceType, string className)
         {
+            if (string.IsNullOrEmpty(resourceType) || string.IsNullOrEmpty(className))
+            {
+                throw new ArgumentException("Invalid argument");
+            }
+
             if (!_gadgetInfos.TryGetValue(resourceType, out NUIGadgetInfo info))
             {
                 throw new ArgumentException("Failed to find NUIGadgetInfo. resource type: " + resourceType);
@@ -165,7 +170,7 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// Gets the information of the running NUIGadgets.
+        /// Gets the instance of the running NUIGadgets.
         /// </summary>
         /// <returns>The NUIGadget list.</returns>
         /// <since_tizen> 10 </since_tizen>
@@ -175,6 +180,21 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Gets the information of the available NUIGadgets.
+        /// </summary>
+        /// <remarks>
+        /// This method only returns the available gadget informations, not all installed gadget informations.
+        /// The resource package of the NUIGadget can set the allowed packages using "allowed-package".
+        /// When executing an application, the platform mounts the resource package into the resource path of the application.
+        /// </remarks>
+        /// <returns>The NUIGadgetInfo list.</returns>
+        /// <since_tizen> 10 </since_tizen>
+        public static IEnumerable<NUIGadgetInfo> GetGadgetInfos()
+        {
+            return _gadgetInfos.Values.ToList();
+        }
+
+        /// <summary>
         /// Removes the NUIGadget from a NUIGadgetManager.
         /// </summary>
         /// <param name="gadget">The NUIGadget object.</param>