From: jomui Date: Tue, 4 Jul 2017 10:43:05 +0000 (+0900) Subject: [TCSACR-74] Add property and modify method for user consent X-Git-Tag: submit/trunk/20170823.075128~101^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66d3dbf023957b1ad36487a41e6f934d3c1b3fc5;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [TCSACR-74] Add property and modify method for user consent Signed-off-by: jomui Change-Id: I279711e0ceacc53fdfc078eb58f1b55138d40332 --- diff --git a/packaging/csapi-maps.spec b/packaging/csapi-maps.spec index fa5cc87..3279a08 100644 --- a/packaging/csapi-maps.spec +++ b/packaging/csapi-maps.spec @@ -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 diff --git a/src/Tizen.Maps/Interop/Interop.Service.cs b/src/Tizen.Maps/Interop/Interop.Service.cs index 0cd154f..021b4b4 100755 --- a/src/Tizen.Maps/Interop/Interop.Service.cs +++ b/src/Tizen.Maps/Interop/Interop.Service.cs @@ -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(this.GetUserConsent); } + } + internal string ProviderKey { get { return NativeGet(this.GetProviderKey); } diff --git a/src/Tizen.Maps/Tizen.Maps.csproj b/src/Tizen.Maps/Tizen.Maps.csproj index 91e2e1a..19c9f38 100755 --- a/src/Tizen.Maps/Tizen.Maps.csproj +++ b/src/Tizen.Maps/Tizen.Maps.csproj @@ -1,7 +1,7 @@  - 1.0.15 + 1.0.16 Samsung Electronics © Samsung Electronics Co., Ltd All Rights Reserved Map Services API for Tizen .NET @@ -21,7 +21,7 @@ - + diff --git a/src/Tizen.Maps/Tizen.Maps/MapService.cs b/src/Tizen.Maps/Tizen.Maps/MapService.cs index 3d737da..4002c3b 100755 --- a/src/Tizen.Maps/Tizen.Maps/MapService.cs +++ b/src/Tizen.Maps/Tizen.Maps/MapService.cs @@ -83,6 +83,19 @@ namespace Tizen.Maps public string Provider { get { return _serviceProvider; } } /// + /// Gets a user consent for map service provider + /// + /// 3 + /// http://tizen.org/privilege/mapservice + public bool UserConsented + { + get + { + return handle.UserConsented; + } + } + + /// /// Gets and sets a string representing keys for map service provider /// /// 3 @@ -182,21 +195,20 @@ namespace Tizen.Maps /// /// Gets the user's consent to use maps data. /// - /// 3 - /// A string which representing the name of maps provider + /// 3 /// Returns true if user agreed that the application can use maps data, otherwise false. /// http://tizen.org/privilege/mapservice /// Thrown when the required feature is not supported. /// Thrown when application does not have some privilege to access this method. - public static async Task RequestUserConsent(string provider) + public async Task RequestUserConsent() { TaskCompletionSource tcs = new TaskCompletionSource(); - 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"));