[TCSACR-74] Add property and modify method for user consent 09/137109/11 submit/tizen/20170801.234326 submit/tizen/20170808.004716
authorjomui <jongmun.woo@samsung.com>
Tue, 4 Jul 2017 10:43:05 +0000 (19:43 +0900)
committerjomui <jongmun.woo@samsung.com>
Tue, 1 Aug 2017 07:08:51 +0000 (16:08 +0900)
Signed-off-by: jomui <jongmun.woo@samsung.com>
Change-Id: I279711e0ceacc53fdfc078eb58f1b55138d40332

Tizen.Maps/Interop/Interop.Service.cs
Tizen.Maps/Tizen.Maps.csproj
Tizen.Maps/Tizen.Maps/MapService.cs
packaging/csapi-maps.spec

index 0cd154f..021b4b4 100755 (executable)
@@ -81,6 +81,9 @@ internal static partial class Interop
     [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
     internal delegate bool SearchRouteCallback(ErrorCode /* maps_error_e */ error, int requestId, int index, int total, IntPtr /* maps_route_h */ route, IntPtr /* void */ userData);
 
+    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+    internal delegate void RequestUserConsentwithHandleCallback(bool consented, IntPtr /* void */ userData);
+
 
     [DllImport(Libraries.MapService, EntryPoint = "maps_service_cancel_request")]
     internal static extern ErrorCode CancelRequest(this ServiceHandle /* maps_service_h */ maps, int requestId);
@@ -121,6 +124,8 @@ internal static partial class Interop
     [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_route_waypoints")]
     internal static extern ErrorCode SearchRouteWaypoints(this ServiceHandle /* maps_service_h */ maps, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] [In] IntPtr[] /* maps_coordinates_h */ waypointList, int waypointNum, PreferenceHandle /* maps_preference_h */ preference, SearchRouteCallback callback, IntPtr /* void */ userData, out int requestId);
 
+    [DllImport(Libraries.MapService, EntryPoint = "maps_service_get_user_consent")]
+    internal static extern ErrorCode GetUserConsent(this ServiceHandle /* maps_service_h */ maps, out bool consent);
 
     [DllImport(Libraries.MapService, EntryPoint = "maps_service_set_provider_key")]
     internal static extern ErrorCode SetProviderKey(this ServiceHandle /* maps_service_h */ maps, string providerKey);
@@ -140,26 +145,28 @@ internal static partial class Interop
     [DllImport(Libraries.MapService, EntryPoint = "maps_service_provider_is_data_supported")]
     internal static extern ErrorCode IsDataSupported(this ServiceHandle /* maps_service_h */ maps, ServiceData /* maps_service_data_e */ data, out bool supported);
 
+    [DllImport(Libraries.MapService, EntryPoint = "maps_service_request_user_consent_with_handle")]
+    internal static extern ErrorCode RequestUserConsent(this ServiceHandle /* maps_service_h */ maps, RequestUserConsentwithHandleCallback callback, IntPtr /* void */ userData);
+
     internal class ServiceHandle : SafeMapsHandle
     {
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void RequestUserConsentCallback(bool consented, string provider, IntPtr /* void */ userData);
-
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate bool ProviderInfoCallback(string mapsProvider, IntPtr /* void */ userData);
 
-        [DllImport(Libraries.MapService, EntryPoint = "maps_service_request_user_consent")]
-        internal static extern ErrorCode RequestUserConsent(string provider, RequestUserConsentCallback callback, IntPtr /* void */ userData);
-
         [DllImport(Libraries.MapService, EntryPoint = "maps_service_foreach_provider")]
         internal static extern ErrorCode ForeachProvider(ProviderInfoCallback callback, IntPtr /* void */ userData);
 
-        [DllImport(Libraries.MapService, EntryPoint = "maps_service_create")]
+        [DllImport(Libraries.MapService, EntryPoint = "maps_service_create_without_user_consent")]
         internal static extern ErrorCode Create(string provider, out IntPtr /* maps_service_h */ maps);
 
         [DllImport(Libraries.MapService, EntryPoint = "maps_service_destroy")]
         internal static extern ErrorCode Destroy(IntPtr /* maps_service_h */ maps);
 
+               internal bool UserConsented
+               {
+                       get { return NativeGet<bool>(this.GetUserConsent); }
+               }
+
         internal string ProviderKey
         {
             get { return NativeGet(this.GetProviderKey); }
index 91e2e1a..19c9f38 100755 (executable)
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <Version>1.0.15</Version>
+    <Version>1.0.16</Version>
     <Authors>Samsung Electronics</Authors>
     <Copyright>© Samsung Electronics Co., Ltd All Rights Reserved</Copyright>
     <Description>Map Services API for Tizen .NET</Description>
@@ -21,7 +21,7 @@
   <ItemGroup>
     <PackageReference Include="System.ComponentModel" Version="4.3.0" />
     <PackageReference Include="Tizen" Version="1.0.5" />
-    <PackageReference Include="ElmSharp" Version="1.2.1" />
+    <PackageReference Include="ElmSharp" Version="1.2.2" />
   </ItemGroup>
 
 </Project>
index 3d737da..4002c3b 100755 (executable)
@@ -83,6 +83,19 @@ namespace Tizen.Maps
         public string Provider { get { return _serviceProvider; } }
 
         /// <summary>
+        /// Gets a user consent for map service provider
+        /// </summary>
+        /// <since_tizen> 3 </since_tizen>
+        /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+        public bool UserConsented
+        {
+            get
+            {
+                return handle.UserConsented;
+            }
+        }
+
+        /// <summary>
         /// Gets and sets a string representing keys for map service provider
         /// </summary>
         /// <since_tizen>3</since_tizen>
@@ -182,21 +195,20 @@ namespace Tizen.Maps
         /// <summary>
         /// Gets the user's consent to use maps data.
         /// </summary>
-        /// <since_tizen>3</since_tizen>
-        /// <param name="provider">A string which representing the name of maps provider</param>
+        /// <since_tizen> 3 </since_tizen>
         /// <returns>Returns true if user agreed that the application can use maps data, otherwise false.</returns>
         /// <privilege>http://tizen.org/privilege/mapservice</privilege>
         /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
         /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
-        public static async Task<bool> RequestUserConsent(string provider)
+        public async Task<bool> RequestUserConsent()
         {
             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
-            Interop.ServiceHandle.RequestUserConsentCallback cb = (consented, serviceProvider, userData) =>
+            Interop.RequestUserConsentwithHandleCallback cb = (consented, userData) =>
             {
                 tcs.TrySetResult(consented);
             };
 
-            var err = Interop.ServiceHandle.RequestUserConsent(provider, cb, IntPtr.Zero);
+            var err = handle.RequestUserConsent(cb, IntPtr.Zero);
             if (err.IsFailed())
             {
                 tcs.TrySetException(err.GetException("Failed to get user consent"));
index fa5cc87..3279a08 100644 (file)
@@ -1,6 +1,6 @@
 Name:       csapi-maps
 Summary:    Tizen Map Service API for C#
-Version:    1.0.15
+Version:    1.0.16
 Release:    1
 Group:      Development/Libraries
 License:    Apache-2.0 and SAMSUNG