From 6b2c7b889430feb0173dda973117746ae5b481e7 Mon Sep 17 00:00:00 2001 From: Ickhee Woo Date: Wed, 7 Dec 2016 19:15:15 +0900 Subject: [PATCH 01/16] move csapi to public Change-Id: Ic7a8e686808a79b2a3d2eab6d659c72c329eb7a5 Signed-off-by: Ickhee Woo --- LICENSE | 202 +++++++ .../Interop/Interop.Account.cs | 151 ++++++ .../Interop/Interop.AccountProvider.cs | 90 ++++ .../Interop/Interop.AccountService.cs | 117 ++++ .../Interop/Interop.Libraries.cs | 31 ++ .../Properties/AssemblyInfo.cs | 35 ++ .../Tizen.Account.AccountManager.Net45.csproj | 66 +++ ...Tizen.Account.AccountManager.Net45.project.json | 11 + .../Tizen.Account.AccountManager.csproj | 115 ++++ .../Tizen.Account.AccountManager.nuspec | 16 + .../Tizen.Account.AccountManager.project.json | 17 + .../Tizen.Account.AccountManager.snk | Bin 0 -> 596 bytes .../Tizen.Account.AccountManager/Account.cs | 595 +++++++++++++++++++++ .../Tizen.Account.AccountManager/AccountEnums.cs | 143 +++++ .../AccountErrorFactory.cs | 184 +++++++ .../AccountProvider.cs | 352 ++++++++++++ .../Tizen.Account.AccountManager/AccountService.cs | 578 ++++++++++++++++++++ .../AccountSucriberEventArgs.cs | 70 +++ packaging/csapi-account-manager.manifest | 5 + packaging/csapi-account-manager.spec | 76 +++ 20 files changed, 2854 insertions(+) create mode 100644 LICENSE create mode 100644 Tizen.Account.AccountManager/Interop/Interop.Account.cs create mode 100644 Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs create mode 100644 Tizen.Account.AccountManager/Interop/Interop.AccountService.cs create mode 100644 Tizen.Account.AccountManager/Interop/Interop.Libraries.cs create mode 100644 Tizen.Account.AccountManager/Properties/AssemblyInfo.cs create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.csproj create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.project.json create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager.project.json create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager.snk create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSucriberEventArgs.cs create mode 100644 packaging/csapi-account-manager.manifest create mode 100755 packaging/csapi-account-manager.spec diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Tizen.Account.AccountManager/Interop/Interop.Account.cs b/Tizen.Account.AccountManager/Interop/Interop.Account.cs new file mode 100644 index 0000000..f52da1c --- /dev/null +++ b/Tizen.Account.AccountManager/Interop/Interop.Account.cs @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Account.AccountManager; +/// +/// Interop for Account class APIs +/// +internal static partial class Interop +{ + /// + /// Interop for Account class APIs + /// + internal static partial class Account + { + [DllImport(Libraries.AccountSvc, EntryPoint = "account_create", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Create(out IntPtr handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_destroy", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_account_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountId(IntPtr data, out int accountId); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountUserName(IntPtr data, out string userName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountUserName(IntPtr handle, string userName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_display_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountDisplayName(IntPtr handle, out string displayName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_display_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountDisplayName(IntPtr handle, string displayName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountCapability(IntPtr handle, string capabilityType, out int capabilityValue); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_capability", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountCapability(IntPtr handle, string capabilityType, int capabilityValue); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_icon_path", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountIconPath(IntPtr handle, out string iconPath); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_icon_path", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountIconPath(IntPtr handle, string iconPath); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_domain_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountDomainName(IntPtr handle, out string domainName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_domain_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountDomainName(IntPtr handle, string domainName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_email_address", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountEmail(IntPtr handle, out string email); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_email_address", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountEmail(IntPtr handle, string email); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_package_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountPackageName(IntPtr handle, out string name); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_package_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountPackageName(IntPtr handle, string name); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_access_token", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountAccessToken(IntPtr handle, out string accessToken); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_access_token", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountAccessToken(IntPtr handle, string accessToken); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_text", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountUserText(IntPtr handle, int index, out string userText); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_text", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountUserText(IntPtr handle, int index, string userText); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_int", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountUserInt(IntPtr handle, int index, out int value); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_int", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountUserInt(IntPtr handle, int index, int value); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_auth_type", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountAuthType(IntPtr handle, out int authType); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_auth_type", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountAuthType(IntPtr handle, int authType); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_secret", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountSercet(IntPtr handle, out int secretType); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_secret", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountSecret(IntPtr handle, int secretType); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_sync_support", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountSyncSupport(IntPtr handle, out int syncType); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_sync_support", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountSyncSupport(IntPtr handle, int syncType); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_source", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountSource(IntPtr handle, out string source); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_source", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountSource(IntPtr handle, string source); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountCustomValue(IntPtr handle, string key, out string value); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_custom", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountCustomValue(IntPtr handle, string key, string value); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_sync_status_by_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int UpdateAccountSyncStatusById(int accountId, int status); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability_all")] + internal static extern int GetAllAccountCapabilities(IntPtr handle, AccountCapabilityCallback callback, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_capability_by_account_id")] + internal static extern int QueryAccountCapabilityById(AccountCapabilityCallback callback, int accountId, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom_all")] + internal static extern int GetAllAccountCustomValues(IntPtr handle, AccountCustomCallback callback, IntPtr userData); + + //Callbacks + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AccountCapabilityCallback(string capabilityType, int capabilityState, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AccountCustomCallback(string key, string value, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AccountCallback(IntPtr data, IntPtr userData); + } +} diff --git a/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs b/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs new file mode 100644 index 0000000..2f82aa1 --- /dev/null +++ b/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Account.AccountManager; + +/// +/// Interop for AccountProvider class APIs +/// +internal static partial class Interop +{ + /// + /// Interop for AccountProvider class APIs + /// + internal static partial class AccountProvider + { + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_create", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Create(out IntPtr handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_destroy", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_app_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAppId(IntPtr handle, out string appId); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_supported_feature", CallingConvention = CallingConvention.Cdecl)] + internal static extern bool IsFeatureSupported(string appId, string capabilty); + + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_service_provider_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetServiceProviderId(IntPtr handle, out string providerId); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_icon_path", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountProviderIconPath(IntPtr handle, out string iconPath); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_small_icon_path", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountProviderSmallIconPath(IntPtr handle, out string iconPath); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_multiple_account_support", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetMultipleAccountSupport(IntPtr handle, out int suppport); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_label_by_locale", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetlabelbyLocale(IntPtr handle, string locale, out string label); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_app_id_exist", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAppIdExists(string appId); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_foreach_account_type_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAllAccountProviders(AccountProviderCallback callback, IntPtr data); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_provider_feature_by_app_id")] + internal static extern int GetAccountProviderFeaturesByAppId(AccountProviderFeatureCallback callback, string appId, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_provider_feature_all")] + internal static extern int GetAccountProviderFeatures(IntPtr handle, AccountProviderFeatureCallback callback, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_label")] + internal static extern int GetAccountProviderLabels(IntPtr handle, LabelCallback callback, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_label_by_app_id")] + internal static extern int GetLablesByAppId(LabelCallback callback, string appId, IntPtr userData); + + + //Callbacks + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AccountProviderFeatureCallback(string appId, string key, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AccountProviderCallback(IntPtr handle, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool LabelCallback(string appId, string label, string locale, IntPtr user_data); + + } +} diff --git a/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs b/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs new file mode 100644 index 0000000..9804c1c --- /dev/null +++ b/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Interop for Account class APIs +/// +internal static partial class Interop +{ + /// + /// Interop for Account class APIs + /// + internal static partial class AccountService + { + [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int UpdateAccountToDBById(IntPtr handle, int id); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_user_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int UpdateAccountToDBByUserName(IntPtr handle, string userName, string packageName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_account_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int QueryAccountById(int accountId, out IntPtr handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_user_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int QueryAccountByUserName(Interop.Account.AccountCallback callback, string userName, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_package_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int QueryAccountByPackageName(Interop.Account.AccountCallback callback, string packageName, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_capability_by_account_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int QueryAccountCapabilityById(Interop.Account.AccountCapabilityCallback callback, int accoutId, IntPtr data); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_sync_status_by_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int UpdateAccountSyncStatusById(int accoutId, int status); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_insert_to_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern int AddAccount(IntPtr handle, out int accountId); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeleteAccountById(int accountId); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_user_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeleteAccountByUser(string userName, string packageName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_package_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeleteAccountByPackage(string packageName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_total_count_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountCount(out int count); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_foreach_account_from_db")] + internal static extern int AccountForeachAccountFromDb(Interop.Account.AccountCallback callback, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_capability")] + internal static extern int GetAccountByCapability(Interop.Account.AccountCallback callback, string capabilityType, int value, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_capability_type")] + internal static extern int GetAccountByCapabilityType(Interop.Account.AccountCallback callback, string capabilityType, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_foreach_account_type_from_db")] + internal static extern int GetAllAccountproviders(Interop.AccountProvider.AccountProviderCallback callback, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_by_provider_feature")] + internal static extern int GetAccountProviderByFeature(Interop.AccountProvider.AccountProviderCallback callback, string key, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_by_app_id")] + internal static extern int GetAccountProviderByAppId(string appId, out IntPtr handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_subscribe_create")] + internal static extern int CreateAccountSubscriber(out Interop.AccountService.SafeAccountSubscriberHandle handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_subscribe_notification")] + internal static extern int RegisterSubscriber(Interop.AccountService.SafeAccountSubscriberHandle handle, Interop.AccountService.SubscribeCallback callback, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_unsubscribe_notification")] + internal static extern int UnregisterSubscriber(Interop.AccountService.SafeAccountSubscriberHandle handle); + + //Callbacks + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SubscribeCallback(string eventType, int accountId, IntPtr userData); + + internal sealed class SafeAccountSubscriberHandle : SafeHandle + { + public SafeAccountSubscriberHandle() + : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + Account.Destroy(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + } +} diff --git a/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs b/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..f18aa0d --- /dev/null +++ b/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/// +/// Interop for Library reference +/// +internal static partial class Interop +{ + /// + /// Interop for Library reference + /// + internal static partial class Libraries + { + public const string AccountSvc = "libaccounts-svc.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/Tizen.Account.AccountManager/Properties/AssemblyInfo.cs b/Tizen.Account.AccountManager/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..eac89fd --- /dev/null +++ b/Tizen.Account.AccountManager/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tizen.Account.AccountManager")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tizen.Account.AccountManager")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2548b842-f053-4fb2-a15b-43d95239759b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.csproj b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.csproj new file mode 100644 index 0000000..659ca68 --- /dev/null +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.csproj @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {67948043-E29E-4E57-B77E-26B206043718} + Library + Properties + Tizen.Account.AccountManager + Tizen.Account.AccountManager + v4.5 + 512 + + + true + full + false + bin\Debug\Net45\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\Net45\ + TRACE + prompt + 4 + + + true + + + Tizen.Account.AccountManager.snk + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.project.json b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.project.json new file mode 100644 index 0000000..5787764 --- /dev/null +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.project.json @@ -0,0 +1,11 @@ +{ + "dependencies": { + "Tizen": "1.0.0" + }, + "frameworks": { + "net45": {} + }, + "runtimes": { + "win": {} + } +} diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj new file mode 100644 index 0000000..6a54d6c --- /dev/null +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj @@ -0,0 +1,115 @@ + + + + 14.0 + Debug + AnyCPU + 8.0.30703 + 2.0 + {2548B842-F053-4FB2-A15B-43D95239759B} + Library + Properties + Tizen.Account.AccountManager + Tizen.Account.AccountManager + 512 + en-US + + + .NETStandard + v1.6 + .NETStandard,Version=v1.6 + .NETStandard,Version=v1.6 + false + true + $(NoWarn);1701 + false + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + + + Tizen.Account.AccountManager.snk + + + + + + + + + + + + + + + + + + + + + + + + + + + <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory) + <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory) + true + + + + $(MSBuildExtensionsPath)\Tizen + $(TizenBuildPath)\bin + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec new file mode 100644 index 0000000..af9093d --- /dev/null +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec @@ -0,0 +1,16 @@ + + + + Tizen.Account.AccountManager + $version$ + Tizen Developers + Account Service APIs for Tizen.Account.AccountManager + + + + + + + + + diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.project.json b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.project.json new file mode 100644 index 0000000..27943bf --- /dev/null +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.project.json @@ -0,0 +1,17 @@ +{ + "buildOptions": { + "debugType": "portable", + "platform": "AnyCPU", + "preserveCompilationContext": true + }, + "dependencies": { + "NETStandard.Library": "1.6.0", + "Tizen": "1.0.0" + }, + "runtimes": { + "win": {} + }, + "frameworks": { + "netstandard1.6": {} + } +} diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.snk b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.snk new file mode 100644 index 0000000000000000000000000000000000000000..24dc9719c9296eef31633107d50ee33d3d6f1de2 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097-Kw&Z@*)c_xVp06}7-$!$wnwu~AeE~c z)F(tEOd7EbF(^U?b{aPtIlx@;$%;6~hOEz4jHvn!r zd(O_5T!*9T$@t6wLj*vb)q~KZAV&nrEoa#w8DYT9ZKzLk%ThkIc?5}&%+)8QXQr_u zB;q;RXt|xw{2-mk`b)Y82t3q{)k9A&{P$2Y()_xSsmr~Rs*b`n-Q*$^!JMe?os7qR zBvd|H8bsVp_Gt7eod6&Ec)}Dvh{q0bt=Oa*H$YN1ig;#wujJ(uv=&T^>0mQ1pM%N( zg`$>r1{8y%1GT)(trFcFOVc^=028{Sz{VXCY@)x>PjG$LXZ%^P(c#ML?+i^I~O6MtO966(E$Y zb;!f8Vsz^*D57mguWkp3<)QlehSaq*m4RK}o za3<-s5$X9Tkded;%AH4zQAv~uEHLq0iB+u~L5#|v)=Q)Yg)d=FecIqYMXjs%6}%S{ zI*nK8ylM-P-VN%&n^m+Gf#&|vX$PoCOiB&jrsr5Np=;a!$e!7&EKAE9D)^%;lfK~t zA{?PSWo^M1p3lvl@ZR4X_HUbXls~xtC~CQ(Uc;!PuNMQg%in+(-|y`dytNYNmb{pE iSmNtDx}gsqUVNw;6%_2*9~+1DJgUE8d#(7BiJodJcOe@9 literal 0 HcmV?d00001 diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs new file mode 100644 index 0000000..cabe14c --- /dev/null +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs @@ -0,0 +1,595 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Account.AccountManager +{ + /// + /// Represents the Account Information. + /// + public class Account : IDisposable + { + private IntPtr _handle = IntPtr.Zero; + internal Account(IntPtr handle) + { + Handle = handle; + } + + ~Account() + { + Dispose(false); + } + /// + /// Creates a new Account instance. + /// + /// Account Instance. + public static Account CreateAccount() + { + IntPtr handle; + AccountError err = (AccountError)Interop.Account.Create(out handle); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to create new error."); + } + + return new Account(handle); + } + + /// + /// Id of the Account. + /// + /// Account Id shall be created only when account is added to the database. + public int AccountId + { + get + { + int id = 0; + AccountError res = (AccountError)Interop.Account.GetAccountId(_handle, out id); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get Id for the Account"); + } + + return id; + } + } + + /// + /// UserName of the Account. + /// + /// User Name of the Account. + public string UserName + { + get + { + string name = ""; + AccountError res = (AccountError)Interop.Account.GetAccountUserName(_handle, out name); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get UserName for the Account"); + } + + return name; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountUserName(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set UserName for Account"); + } + } + } + + /// + /// Display Name of the Account. + /// + /// DisplayName of the Account. + public string DisplayName + { + get + { + string name = ""; + AccountError res = (AccountError)Interop.Account.GetAccountDisplayName(_handle, out name); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get DisplayName for the Account"); + } + + return name; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountDisplayName(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set DisplayName for Account"); + } + } + } + + /// + /// Icon path of the Account. + /// + /// Icon path of the Account. + public string IconPath + { + get + { + string path = ""; + AccountError res = (AccountError)Interop.Account.GetAccountIconPath(_handle, out path); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get IconPath for the Account"); + } + + return path; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountIconPath(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set IconPath for Account"); + } + } + } + + /// + /// Domain name of the Account. + /// + /// Domain name of the Account. + public string DomainName + { + get + { + string name = ""; + AccountError res = (AccountError)Interop.Account.GetAccountDomainName(_handle, out name); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get DomainName for the Account"); + } + + return name; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountDomainName(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set DomainName for Account"); + } + } + } + + /// + /// Email Id of the Account. + /// + /// Email Id of the Account. + public string EmailId + { + get + { + string email = ""; + AccountError res = (AccountError)Interop.Account.GetAccountEmail(_handle, out email); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get email for the Account"); + } + + return email; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountEmail(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set email for Account"); + } + } + } + + /// + /// Package Name of the Account. + /// + /// Package Name. + public string PackageName + { + get + { + string name = ""; + AccountError res = (AccountError)Interop.Account.GetAccountPackageName(_handle, out name); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get PacakageName for the Account"); + } + + return name; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountPackageName(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set PacakageName for Account"); + } + } + } + + /// + /// Access Token of the Account. + /// + /// Access Token. + public string AccessToken + { + get + { + string token = ""; + AccountError res = (AccountError)Interop.Account.GetAccountAccessToken(_handle, out token); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get token for the Account"); + } + + return token; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountAccessToken(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set token for Account"); + } + } + } + + /// + /// Authentication type of the Account. + /// + /// Authentication type. + public AccountAuthType AuthType + { + get + { + int user; + AccountError res = (AccountError)Interop.Account.GetAccountAuthType(_handle, out user); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get AuthType for the Account"); + } + + return (AccountAuthType)user; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountAuthType(_handle, (int)value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set AuthType for Account"); + } + } + } + + /// + /// Secrecy State of the Account. + /// + /// Secrecy State. + public AccountSecrecyState SecrecyState + { + get + { + int state; + AccountError res = (AccountError)Interop.Account.GetAccountSercet(_handle, out state); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get User Secret for the Account"); + } + + return (AccountSecrecyState)state; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountSecret(_handle, (int)value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set User Secret for Account"); + } + } + } + + /// + /// Sync State of the Account. + /// + /// Sync State. + public AccountSyncState SyncState + { + get + { + int supported; + AccountError res = (AccountError)Interop.Account.GetAccountSyncSupport(_handle, out supported); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get AuthType for the Account"); + } + + return (AccountSyncState)supported; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountSyncSupport(_handle, (int)value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set AuthType for Account"); + } + } + } + + /// + /// Source of the Account . + /// + /// Account Source. + public string Source + { + get + { + string text = ""; + AccountError res = (AccountError)Interop.Account.GetAccountSource(_handle, out text); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get User Secret for the Account"); + } + + return text; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountSource(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set User Secret for Account"); + } + } + } + + internal IntPtr Handle + { + get + { + return _handle; + } + + set + { + _handle = value; + } + } + /// + /// Sets the account capability. + /// + /// The Account capability type + /// The Account capability state + /// In case of invalid parameters + public void SetCapability(string capabilityType, CapabilityState state) + { + AccountError ret = (AccountError)Interop.Account.SetAccountCapability(_handle, capabilityType, (int)state); + if (ret != AccountError.None) + { + throw AccountErrorFactory.CreateException(ret, "failed to set account capability"); + } + } + /// + /// Gets all the capabilities of an account. + /// + /// The capability type to get the capability value. + /// The capability value (on/off) of the specified CapabilityState . + /// In case of invalid parameters + public CapabilityState GetCapability(string capabilityType) + { + int type; + AccountError res = (AccountError)Interop.Account.GetAccountCapability(_handle, capabilityType, out type); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to GetCapability for Account"); + } + + return (CapabilityState)type; + } + + /// + /// Gets all the capabilities of an account. + /// + /// List of Cpabailities as Dictionary + public Dictionary GetAllCapabilities() + { + + AccountError res = AccountError.None; + Dictionary list = new Dictionary(); + Interop.Account.AccountCapabilityCallback capabilityCallback = (string type, int state, IntPtr data) => + { + list.Add(type, (CapabilityState)state); + return true; + }; + + res = (AccountError)Interop.Account.GetAllAccountCapabilities(_handle, capabilityCallback, IntPtr.Zero); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to get account capabilities"); + } + + return list; + } + + /// + /// Sets the Custom Value to the Account. + /// + /// key to be added to the Account. + /// value to be updated for respective key for the Account. + /// In case of invalid parameters + public void SetCustomValue(string key, string value) + { + AccountError err = (AccountError)Interop.Account.SetAccountCustomValue(_handle, key, value); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to set the value for : " + key); + } + } + + /// + /// Gets the user specific custom text of an account key. + /// + /// The key to retrieve custom text . + /// The text of the given key + /// In case of invalid parameters + /// If there is no given capability type in the account + public string GetCustomValue(string key) + { + string result = ""; + AccountError err = (AccountError)Interop.Account.GetAccountCustomValue(_handle, key, out result); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to get the value for : " + key); + } + + return result; + } + + /// + /// Gets All the custome values. + /// + /// List of custom key, value pairs as Dictionary. + public Dictionary GetAllCustomValues() + { + AccountError res = AccountError.None; + Dictionary list = new Dictionary(); + + Interop.Account.AccountCustomCallback customCallback = (string key, string value, IntPtr data) => + { + list.Add(key, value); + return true; + }; + + res = (AccountError)Interop.Account.GetAllAccountCustomValues(_handle, customCallback, IntPtr.Zero); + + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to get account capabilities"); + } + + return list; + } + + /// + /// Sets the user text. + /// + /// The index of the user text (must be in range from 0 to 4) + /// The text string to set as the user text + /// In case of invalid parameters + public void SetUserText(int index, string text) + { + AccountError err = (AccountError)Interop.Account.SetAccountUserText(_handle, index, text); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to get the value for : " + index); + } + } + + /// + /// Gets the user text. + /// + /// The index of the user text (range: 0 ~ 4) + /// The user text of the given key + /// In case of invalid parameters + /// In case of out of memory + public string GetUserText(int index) + { + string result = ""; + AccountError err = (AccountError)Interop.Account.GetAccountUserText(_handle, index, out result); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to get the value for : " + index); + } + + return result; + } + + /// + /// Gets the user int value. + /// + /// The index of the user int (range: 0 ~ 4) + /// The user int of the given key + /// In case of invalid parameters + public int GetUserInt(int index) + { + int result = -1; + AccountError err = (AccountError)Interop.Account.GetAccountUserInt(_handle, index, out result); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to get the value for : " + index); + } + + return result; + } + + /// + /// Sets the user integer value. + /// + /// The index of the user integer (must be in range from 0 to 4) + /// The integer to set as the user integer + /// In case of invalid parameters + public void SetUserInt(int index, int value) + { + AccountError err = (AccountError)Interop.Account.SetAccountUserInt(_handle, index, value); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to get the value for : " + index); + } + } + + /// + /// Overloaded Dispose API for destroying the Account Handle. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (!disposing) + { + if (_handle != IntPtr.Zero) + { + Interop.Account.Destroy(_handle); + _handle = IntPtr.Zero; + } + } + } + } +} diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs new file mode 100644 index 0000000..045cac7 --- /dev/null +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Account.AccountManager +{ + /// + /// Enumeration for the state of capability + /// + public enum CapabilityState + { + /// + /// Account capability is invalid + /// + InvalidState, + + /// + /// Account capability is disabled + /// + Disabled, + + /// + /// Account capability is enabled + /// + Enabled + } + + /// + /// Enumeration for the state of account secrecy. + /// + public enum AccountSecrecyState + { + /// + /// Account secrecy is invalid + /// + InvalidState, + + /// + /// Account is not visible + /// + Invisible, + + /// + /// Account is visible + /// + Visible + } + + /// + /// Enumeration for the account sync status. + /// + public enum AccountSyncState + { + /// + /// Account sync is invalid + /// + InvalidState, + + /// + /// Account sync not supported + /// + NotSupported, + + /// + /// Account sync supported but all synchronization functionalities are off + /// + Off, + + /// + /// Account sync support and sync status is idle + /// + Idle, + + /// + /// Account sync support and sync status is running + /// + Running + } + + /// + /// Enumeration for the account auth type. + /// + public enum AccountAuthType + { + /// + /// Auth type is invalid + /// + Invalid, + + /// + /// XAuth type + /// + XAuth, + + /// + /// OAuth type + /// + OAuth, + + /// + /// Client-Login type + /// + ClientLogin + } + + /// + /// Account information change notification type + /// + /// + /// When the account database is changed, You can distinguish one event type from the other which are set for subscribing notification. + /// + public enum AccountNotificationType + { + /// + /// The insert notification type. + /// + Insert, + /// + /// The delete notification type. + /// + Delete, + /// + /// The update notification type. + /// + Update, + /// + /// The sync update notification type. + /// + syncUpdate + } +} diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs new file mode 100644 index 0000000..13cd203 --- /dev/null +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen; + +namespace Tizen.Account.AccountManager +{ + /// + /// Enum to give the type of error occured, if any. + /// + public enum AccountError + { + //TIZEN_ERROR_ACCOUNT = -0x01000000 + /// + /// Successful. + /// + None = Tizen.Internals.Errors.ErrorCode.None, + /// + /// Invalid parameter. + /// + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + /// + /// Out of memory. + /// + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + /// + /// Same user name exists in your application + /// + Duplcated = -0x01000000 | 0x01, + /// + /// Empty Data + /// + NoData = Tizen.Internals.Errors.ErrorCode.NoData, + /// + /// elated record does not exist + /// + RecordNotFound = -0x01000000 | 0x03, + /// + /// Invalid Operation. + /// + InvalidOperation = Tizen.Internals.Errors.ErrorCode.InvalidOperation, + /// + /// DB operation failed. + /// + DBFailed = -0x01000000 | 0x04, + /// + /// DB is not connected. + /// + DBNotOpened = -0x01000000 | 0x05, + /// + /// DB query syntax error + /// + QuerySyntaxError = -0x01000000 | 0x06, + /// + /// Iterator has reached the end + /// + IteratorEnd = -0x01000000 | 0x07, + /// + /// Notification failed + /// + NotificationFailed = -0x01000000 | 0x08, + /// + /// Permission denied. + /// + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + /// + /// XML parse failed + /// + XMLParseFailed = -0x01000000 | 0x0a, + /// + /// XML File not found + /// + XMLFileNotFound = -0x01000000 | 0x0b, + /// + /// Subscription failed + /// + EventSubscriptionFailed = -0x01000000 | 0x0c, + /// + /// Account provider is not registered + /// + ProviderNotRegistered = -0x01000000 | 0x0d, + /// + /// Multiple accounts are not supported. + /// + MultipleNotAllowed = -0x01000000 | 0x0e, + /// + /// SQLite busy handler expired + /// + DBBusy = -0x01000000 | 0x10 + }; + + internal class AccountErrorFactory + { + internal const string LogTag = "Tizen.Account.AccountManager"; + + internal static Exception CreateException(AccountError err, string msg) + { + Log.Info(LogTag, "Got Error " + err + " throwing Exception with msg " + msg); + Exception exp; + switch (err) + { + case AccountError.InvalidParameter: + { + exp = new ArgumentException(msg + " Invalid Parameters Provided"); + break; + } + + case AccountError.OutOfMemory: + { + exp = new OutOfMemoryException(msg + " Out Of Memory"); + break; + } + + case AccountError.InvalidOperation: + { + exp = new InvalidOperationException(msg + " Inavlid operation"); + break; + } + + case AccountError.NoData: + { + exp = new InvalidOperationException(msg + " Empty Data"); + break; + } + + case AccountError.PermissionDenied: + { + exp = new UnauthorizedAccessException(msg + " Permission Denied"); + break; + } + + case AccountError.DBFailed: + { + exp = new InvalidOperationException(msg + " DataBase Failed"); + break; + } + + case AccountError.DBBusy: + { + exp = new InvalidOperationException(msg + " DataBase Busy"); + break; + } + + case AccountError.QuerySyntaxError: + { + exp = new InvalidOperationException(msg + " Network Error"); + break; + } + case AccountError.XMLFileNotFound: + { + exp = new System.IO.FileNotFoundException(msg + " XML File not found"); + break; + } + case AccountError.XMLParseFailed: + { + exp = new System.IO.InvalidDataException(msg + " XML parse error"); + break; + } + + default: + { + exp = new InvalidOperationException(err + " " + msg); + break; + } + } + + return exp; + } + } +} diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs new file mode 100644 index 0000000..8aa882f --- /dev/null +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs @@ -0,0 +1,352 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using Tizen.Internals.Errors; + +namespace Tizen.Account.AccountManager +{ + /// + /// Account Id. + /// + public class AccountProvider : IDisposable + { + internal IntPtr _handle; + internal AccountProvider(IntPtr handle) + { + Handle = handle; + } + + ~AccountProvider() + { + Dispose(false); + } + + internal IntPtr Handle + { + get + { + return _handle; + } + + set + { + _handle = value; + } + } + /// + /// Account Id. + /// + public string AppId + { + get + { + string id = ""; + AccountError res = (AccountError)Interop.AccountProvider.GetAppId(Handle, out id); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get AppId for the AccountProvider"); + } + + return id; + } + } + + /// + /// Serviceprovider Id of the account provider. + /// + public string ServiceProviderId + { + get + { + string id = ""; + AccountError res = (AccountError)Interop.AccountProvider.GetServiceProviderId(Handle, out id); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get ServiceProviderId for the AccountProvider"); + } + + return id; + } + } + + /// + /// Icon path of an account provider. + /// + public string IconPath + { + get + { + string path = ""; + AccountError res = (AccountError)Interop.AccountProvider.GetAccountProviderIconPath(Handle, out path); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get IconPath for the AccountProvider"); + } + + return path; + } + } + + /// + /// Small icon path of an account provider. + /// + public string SmallIconPath + { + get + { + string path = ""; + AccountError res = (AccountError)Interop.AccountProvider.GetAccountProviderSmallIconPath(Handle, out path); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get SmallIconPath for the AccountProvider"); + } + + return path; + } + } + + /// + /// Flag for account provider If supports multiple accounts. + /// + public bool MultipleAccountSupport + { + get + { + int multiple = 0; + AccountError res = (AccountError)Interop.AccountProvider.GetMultipleAccountSupport(Handle, out multiple); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get SmallIconPath for the AccountProvider"); + } + + return (multiple == 0) ? false : true; + } + } + + /// + /// Retrieves all the capability information of the account provider. + /// + /// http://tizen.org/privilege/account.read + /// + /// list of capability information. + /// + /// In case of any DB error + /// In case of privilege not defined. + public IEnumerable GetAllCapabilities() + { + List capabilities = new List(); + AccountError res; + Interop.AccountProvider.AccountProviderFeatureCallback callback = (string appId, string key, IntPtr data) => + { + capabilities.Add(key); + return true; + }; + + res = (AccountError)Interop.AccountProvider.GetAccountProviderFeatures(Handle, callback, IntPtr.Zero); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to GetAllCapabilities for AccountProvider"); + } + + return capabilities; + } + + /// + /// Gets the specific label information detail of an account provider. + /// + /// + /// The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code. + /// For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English. + /// + /// The label text given for the locale + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given locale + /// In case of privilege not defined. + public string GetLabel(string locale) + { + string label; + AccountError res = (AccountError)Interop.AccountProvider.GetlabelbyLocale(Handle, locale, out label); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to GetLabel for AccountProvider"); + } + + return label; + } + + /// + /// Gets the specific label information detail of an account provider. + /// + /// + /// The application ID to search + /// + /// All the labels information for the given application Id. + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given appid + /// In case of invalid parameter + /// In case of privilege not defined. + public static Dictionary GetLabelsByAppId(string appId) + { + + Dictionary labels = new Dictionary(); + Interop.AccountProvider.LabelCallback callback = (string applicationId, string label, string locale, IntPtr userData) => + { + labels.Add(locale, label); + return true; + }; + + AccountError err = (AccountError)Interop.AccountProvider.GetLablesByAppId(callback, appId, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetLablesByAppId"); + } + + return labels; + } + + /// + /// Gets the label information detail of an account provider. + /// + /// All the labels information for the given account provider. + /// http://tizen.org/privilege/account.read + /// In case of any DB error + /// In case of privilege not defined. + public Dictionary GetLabels() + { + + Dictionary labels = new Dictionary(); + Interop.AccountProvider.LabelCallback callback = (string applicationId, string label, string locale, IntPtr userData) => + { + labels.Add(locale, label); + return true; + }; + + AccountError err = (AccountError)Interop.AccountProvider.GetAccountProviderLabels(Handle, callback, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountProviderLabels"); + } + + return labels; + } + + /// + /// Checks whether the given appId exists in the account provider DB. + /// + /// The application ID to check. + /// returns true If App is supported + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given appid + /// In case of invalid parameter + /// In case of privilege not defined. + public bool IsAppSupported(string appId) + { + bool isSupported = false; + AccountError res = (AccountError)Interop.AccountProvider.GetAppIdExists(appId); + + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to GetLabel for AccountProvider"); + } + else + { + isSupported = true; + } + + return isSupported; + } + + /// + /// Checks whether the given application ID supports the capability. + /// + /// The application Id + /// The capability information + /// + /// TRUE if the application supports the given capability, + /// otherwise FALSE if the application does not support the given capability + /// + /// http://tizen.org/privilege/account.read + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + public static bool IsFeatureSupportedByApp(string appId, string capability) + { + bool supported = Interop.AccountProvider.IsFeatureSupported(appId, capability); + if (!supported) + { + //Get last result and validate error code. + AccountError err = (AccountError)ErrorFacts.GetLastResult(); + if ((err != AccountError.None) && (err != AccountError.RecordNotFound)) + { + throw AccountErrorFactory.CreateException(err, "Failed to get IsFeatureSupported"); + } + } + + return supported; + } + + /// + /// Retrieves capability information with application ID. + /// + /// application Id + /// Capability information list for the given appId. + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given appid + /// In case of invalid parameter + /// In case of privilege not defined. + public static IEnumerable GetFeaturesByAppId(string appId) + { + + List features = new List(); + Interop.AccountProvider.AccountProviderFeatureCallback callback = (string applicationId, string key, IntPtr userData) => + { + features.Add(key); + return true; + }; + + AccountError err = (AccountError)Interop.AccountProvider.GetAccountProviderFeaturesByAppId(callback, appId, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountProviderFeaturesByAppId"); + } + + return (IEnumerable)features; + } + + /// + /// Overloaded Dispose API for destroying the AccountProvider Handle. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (!disposing) + { + if (_handle != IntPtr.Zero) + { + Interop.AccountProvider.Destroy(_handle); + _handle = IntPtr.Zero; + } + } + } + } +} diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs new file mode 100644 index 0000000..4f3f3ae --- /dev/null +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs @@ -0,0 +1,578 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Account.AccountManager +{ + /// + /// The AccountManager APIs is separated into two major sections: + /// 1. Registering an account provider while an application is installed. This information will be used for the Add account screen. + /// 2. Adding an account information when an application signs in successfully to share the account information to the Tizen system. This information will be shown in the Tizen settings account menu. + /// + /// The APIs of both of the sections consist of the following functionality: + /// + /// Create an account or account provider + /// Update an account or account provider(Only available for the creator) + /// Delete an account or account provider(Only available for the creator) + /// Read an account or account provider with some filter + /// + /// + + public static class AccountService + { + /// + /// This is contact capability string. + /// + public static readonly string ContactCapability = "http://tizen.org/account/capability/contact"; + + /// + /// This is calendar capability string. + /// + public static readonly string CalendarCapability = "http://tizen.org/account/capability/calendar"; + + /// + /// This is email capability string. + /// + public static readonly string EmailCapability = "http://tizen.org/account/capability/email"; + + /// + /// This is photo capability string. + /// + public static readonly string PhotoCapability = "http://tizen.org/account/capability/photo"; + + /// + /// This is video capability string. + /// + public static readonly string VideoCapability = "http://tizen.org/account/capability/video"; + + /// + /// This is music capability string. + /// + public static readonly string MusicCapability = "http://tizen.org/account/capability/music"; + + /// + /// This is document capability string. + /// + public static readonly string DocumentCapability = "http://tizen.org/account/capability/document"; + + /// + /// This is message capability string. + /// + public static readonly string MessageCapability = "http://tizen.org/account/capability/message"; + + /// + /// This is game capability string. + /// + public static readonly string GameCapability = "http://tizen.org/account/capability/game"; + + /// + /// Retrieves all accounts details from the account database. + /// + /// List of Accounts + /// http://tizen.org/privilege/account.read + /// In case of any DB error. + /// In case of privilege not defined. + public static IEnumerable GetAccountsAsync() + { + List accounts = new List(); + List values = new List(); + Interop.Account.AccountCallback accountCallback = (IntPtr data, IntPtr userdata) => + { + Account account = new Account(data); + values.Add(account.AccountId); + account.Dispose(); + return true; + }; + + AccountError res = (AccountError)Interop.AccountService.AccountForeachAccountFromDb(accountCallback, IntPtr.Zero); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to AccountForeachAccountFromDb"); + } + + foreach (int i in values) + { + Account account = AccountService.GetAccountById(i); + accounts.Add(account); + } + + return accounts; + } + + /// + /// Retrieve an account with the account ID. + /// + /// The account Id to be searched. + /// Account instance with reference to the given id. + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given account id + /// In case of invalid parameter + /// In case of privilege not defined. + public static Account GetAccountById(int accountId) + { + Account account = Account.CreateAccount(); + IntPtr handle = account.Handle; + AccountError res = (AccountError)Interop.AccountService.QueryAccountById(accountId, out handle); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to get accounts from the database for account id: " + accountId); + } + + account.Handle = handle; + return account; + } + + /// + /// Retrieves all AccountProviders details from the account database. + /// + /// List of AccountProviders + /// http://tizen.org/privilege/account.read + /// In case of any DB error + /// In case of privilege not defined. + public static IEnumerable GetAccountProviders() + { + List values = new List(); + List providers = new List(); + Interop.AccountProvider.AccountProviderCallback accountCallback = (IntPtr handle, IntPtr data) => + { + AccountProvider provider = new AccountProvider(handle); + values.Add(provider.AppId); + provider.Dispose(); + return true; + }; + + AccountError res = (AccountError)Interop.AccountService.GetAllAccountproviders(accountCallback, IntPtr.Zero); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get account providers from the database"); + throw AccountErrorFactory.CreateException(res, "Failed to get account providers from the database"); + } + + foreach (string val in values) + { + AccountProvider provider = GetAccountProviderByAppId(val); + providers.Add(provider); + } + + return providers; + } + + /// + /// Retrieves the account provider information with application Id. + /// + /// Application Id. + /// The AccountProvider instance associated with the given application Id. + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given appid + /// In case of invalid parameter + /// In case of privilege not defined. + public static AccountProvider GetAccountProviderByAppId(string appId) + { + IntPtr handle; + Interop.AccountProvider.Create(out handle); + AccountError err = (AccountError)Interop.AccountService.GetAccountProviderByAppId(appId, out handle); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountProviderByAppId"); + } + + AccountProvider provider = new AccountProvider(handle); + return provider; + } + + /// + /// Retrieves all the account providers information with feature. + /// + /// The capability value to search for account providers. + /// Retrieves AccountProviders information with the capability name. + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given feature + /// In case of invalid parameter + /// In case of privilege not defined. + public static IEnumerable GetAccountProvidersByFeature(string feature) + { + List values = new List(); + List providers = new List(); + Interop.AccountProvider.AccountProviderCallback providerCallback = (IntPtr handle, IntPtr data) => + { + AccountProvider provider = new AccountProvider(handle); + values.Add(provider.AppId); + provider.Dispose(); + return true; + }; + + AccountError err = (AccountError)Interop.AccountService.GetAccountProviderByFeature(providerCallback, feature, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountProviderByFeature"); + } + + foreach (string val in values) + { + AccountProvider provider = GetAccountProviderByAppId(val); + providers.Add(provider); + } + + return providers; + } + + /// + /// Inserts into the Database with the new account Infomration. + /// + /// New Account instance to be added. + /// http://tizen.org/privilege/account.read + /// http://tizen.org/privilege/account.write + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + /// In case of OutOfMemory error. + public static int AddAccount(Account account) + { + if (account == null) + { + throw AccountErrorFactory.CreateException(AccountError.InvalidParameter, "Failed to AddAccount"); + } + + int id = -1; + AccountError err = (AccountError)Interop.AccountService.AddAccount(account.Handle, out id); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to AddAccount"); + } + + return id; + } + + /// + /// Updates the account details to the account database. + /// + /// account instance to be updated. + /// http://tizen.org/privilege/account.read + /// http://tizen.org/privilege/account.write + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + /// In case of OutOfMemory error. + public static void UpdateAccount(Account account) + { + if (account == null) + { + throw AccountErrorFactory.CreateException(AccountError.InvalidParameter, "Failed to UpdateAccount"); + } + + AccountError err = (AccountError)Interop.AccountService.UpdateAccountToDBById(account.Handle, account.AccountId); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to UpdateAccount"); + } + } + + /// + /// Deletes the account information from the Database. + /// + /// Account instance to be deleted from the database. + /// http://tizen.org/privilege/account.read + /// http://tizen.org/privilege/account.write + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + public static void DeleteAccount(Account account) + { + if (account == null) + { + throw AccountErrorFactory.CreateException(AccountError.InvalidParameter, "Failed to DeleteAccount"); + } + + AccountError err = (AccountError)Interop.AccountService.DeleteAccountById(account.AccountId); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to delete the account by Id: " + account.AccountId); + } + } + + /// + /// Deletes an account from the account database by user name. + /// + /// The user name of the account to delete. + /// The package name of the account to delete. + /// http://tizen.org/privilege/account.read + /// http://tizen.org/privilege/account.write + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + public static void DeleteAccount(string userName, string packageName) + { + AccountError err = (AccountError)Interop.AccountService.DeleteAccountByUser(userName, packageName); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to delete the account by userName: " + userName); + } + } + + /// + /// Deletes an account from the account database by package name. + /// + /// The package name of the account to delete. + /// http://tizen.org/privilege/account.read + /// http://tizen.org/privilege/account.write + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + public static void DeleteAccount(string packageName) + { + AccountError err = (AccountError)Interop.AccountService.DeleteAccountByPackage(packageName); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to delete the account by package name: " + packageName); + } + + } + + /// + /// Retrieves all accounts with the given user name. + /// + /// The user name to search . + /// Accounts list matched with the user name + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given username + /// In case of invalid parameter + /// In case of privilege not defined. + public static IEnumerable GetAccountsByUserName(string userName) + { + List accounts = new List(); + List values = new List(); + Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) => + { + Account account = new Account(handle); + values.Add(account.AccountId); + account.Dispose(); + return true; + }; + + AccountError err = (AccountError)Interop.AccountService.QueryAccountByUserName(accountCallback, userName, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountByUserName"); + } + + foreach (int i in values) + { + Account account = AccountService.GetAccountById(i); + accounts.Add(account); + } + + return accounts; + } + + /// + /// Retrieves all accounts with the given package name. + /// + /// The package name to Search + /// Accounts list matched with the package name + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given package name + /// In case of invalid parameter + /// In case of privilege not defined. + public static IEnumerable GetAccountsByPackageName(string packageName) + { + List accounts = new List(); + List values = new List(); + Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) => + { + Account account = new Account(handle); + values.Add(account.AccountId); + account.Dispose(); + return true; + }; + + AccountError err = (AccountError)Interop.AccountService.QueryAccountByPackageName(accountCallback, packageName, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountByPackageName"); + } + + foreach (int i in values) + { + Account account = AccountService.GetAccountById(i); + accounts.Add(account); + } + + return accounts; + } + + /// + /// Retrieves all accounts with the given cpability type. + /// + /// Capability type + /// Accounts list matched with the capability type + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given capability type + /// In case of invalid parameter + /// In case of privilege not defined. + public static IEnumerable GetAccountsByCapabilityType(string type) + { + List accounts = new List(); + List values = new List(); + Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) => + { + Account account = new Account(handle); + values.Add(account.AccountId); + account.Dispose(); + return true; + }; + + AccountError err = (AccountError)Interop.AccountService.GetAccountByCapabilityType(accountCallback, type, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountByCapabilityType"); + } + + foreach (int i in values) + { + Account account = AccountService.GetAccountById(i); + accounts.Add(account); + } + + return accounts; + } + + /// + /// Retrieves all capabilities with the given account + /// + /// account instance + /// Capabilities list as Dictionary of Capability type and State. + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given account id + /// In case of invalid parameter + /// In case of privilege not defined. + public static Dictionary GetCapabilitiesById(int accountId) + { + Dictionary capabilities = new Dictionary(); + Interop.Account.AccountCapabilityCallback capabilityCallback = (string type, int capabilityState, IntPtr data) => + { + capabilities.Add(type, (CapabilityState)capabilityState); + return true; + }; + + AccountError err = (AccountError)Interop.AccountService.QueryAccountCapabilityById(capabilityCallback, accountId, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAllCapabilitiesById"); + } + + return capabilities; + } + + /// + /// Gets the count of accounts in the account database. + /// + /// The number of accounts in the database + /// http://tizen.org/privilege/account.read + /// In case of any DB error + /// In case of privilege not defined. + public static int GetAccountsCount() + { + int count = 0; + AccountError err = (AccountError)Interop.AccountService.GetAccountCount(out count); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountCount"); + } + + return count; + } + + /// + /// Updates the sync status of the given account. + /// + /// Account for which sync status needs to be updated + /// Sync State + /// http://tizen.org/privilege/account.read + /// http://tizen.org/privilege/account.write + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + public static void UpdateSyncStatusById(Account account, AccountSyncState status) + { + AccountError err = (AccountError)Interop.AccountService.UpdateAccountSyncStatusById(account.AccountId, (int)status); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to UpdateSyncStatusById"); + } + } + + private static readonly Interop.AccountService.SubscribeCallback s_accountUpdatedCallback = (string eventType, int accountId, IntPtr userData) => + { + AccountSucriberEventArgs eventArgs = new AccountSucriberEventArgs(eventType, accountId); + s_accountUpdated?.Invoke(null, eventArgs); + return true; + }; + + private static Interop.AccountService.SafeAccountSubscriberHandle s_subscriberHandle; + + private static event EventHandler s_accountUpdated; + /// + /// ContentUpdated event is triggered when the media item info from DB changes. + /// + /// + /// ContentUpdate event is triggered if the MediaInformaion updated/deleted or new Inforamtion is Inserted. + /// + /// + /// A ContentUpdatedEventArgs object that contains information about the update operation. + /// http://tizen.org/privilege/account.read + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + public static event EventHandler AccountUpdated + { + add + { + if (s_accountUpdated == null) + { + if (s_subscriberHandle == null) + { + Interop.AccountService.CreateAccountSubscriber(out s_subscriberHandle); + } + + AccountError ret = (AccountError)Interop.AccountService.RegisterSubscriber(s_subscriberHandle, s_accountUpdatedCallback, IntPtr.Zero); + + if (ret != AccountError.None) + { + throw AccountErrorFactory.CreateException(ret, "Error in callback handling"); + } + } + + s_accountUpdated += value; + } + + remove + { + s_accountUpdated -= value; + if (s_accountUpdated == null) + { + AccountError ret = (AccountError)Interop.AccountService.UnregisterSubscriber(s_subscriberHandle); + if (ret != AccountError.None) + { + throw AccountErrorFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + } +} diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSucriberEventArgs.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSucriberEventArgs.cs new file mode 100644 index 0000000..a9b9215 --- /dev/null +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSucriberEventArgs.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Account.AccountManager +{ + /// + /// Event arguments passed when Event is triggered to notify that account is updated/removed from the account database. + /// + public class AccountSucriberEventArgs : EventArgs + { + private const string NotiInsert = "insert"; + private const string NotiDelete = "delete"; + private const string NotiUpdate = "update"; + private const string NotiSyncUpdate = "sync_update"; + internal AccountSucriberEventArgs(string eventType, int accountId) + { + if (eventType.CompareTo(NotiInsert) == 0) + { + EventType = AccountNotificationType.Insert; + } + else if (eventType.CompareTo(NotiDelete) == 0) + { + EventType = AccountNotificationType.Delete; + } + else if (eventType.CompareTo(NotiUpdate) == 0) + { + EventType = AccountNotificationType.Update; + } + else if (eventType.CompareTo(NotiSyncUpdate) == 0) + { + EventType = AccountNotificationType.syncUpdate; + } + + AccountId = accountId; + } + + /// + /// The account event type + /// + public AccountNotificationType EventType + { + get; + internal set; + } + + /// + /// The account ID to update + /// + public int AccountId + { + get; + internal set; + } + } +} diff --git a/packaging/csapi-account-manager.manifest b/packaging/csapi-account-manager.manifest new file mode 100644 index 0000000..75b0fa5 --- /dev/null +++ b/packaging/csapi-account-manager.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/csapi-account-manager.spec b/packaging/csapi-account-manager.spec new file mode 100755 index 0000000..5577314 --- /dev/null +++ b/packaging/csapi-account-manager.spec @@ -0,0 +1,76 @@ +%{!?dotnet_assembly_path: %define dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework} + +%if 0%{?tizen_build_devel_mode} +%define BUILDCONF Debug +%else +%define BUILDCONF Release +%endif + +Name: csapi-account-manager +Summary: Tizen account manager API for C# +Version: 1.0.1 +Release: 1 +Group: Development/Libraries +License: Apache-2.0 +URL: https://www.tizen.org +Source0: %{name}-%{version}.tar.gz +Source1: %{name}.manifest + +AutoReqProv: no + +BuildRequires: mono-compiler +BuildRequires: mono-devel + +BuildRequires: dotnet-build-tools + +# NuGet for Dependencies +BuildRequires: csapi-tizen-nuget + + +%description +Account Manager C# API for Tizen + +%prep +%setup -q +cp %{SOURCE1} . + +%define Assemblies Tizen.Account.AccountManager + +%build +for ASM in %{Assemblies}; do +# NuGet Restore +find $ASM/*.project.json -exec nuget restore {} \; +# Build +find $ASM/*.csproj -exec xbuild {} /p:Configuration=%{BUILDCONF} \; +# NuGet Pack +nuget pack $ASM/$ASM.nuspec -Version %{version} -Properties Configuration=%{BUILDCONF} +done + +%install +# Runtime Binary +mkdir -p %{buildroot}%{dotnet_assembly_path} +for ASM in %{Assemblies}; do +%if 0%{?_with_corefx} + install -p -m 644 $ASM/bin/%{BUILDCONF}/$ASM.dll %{buildroot}%{dotnet_assembly_path} +%else + install -p -m 644 $ASM/bin/%{BUILDCONF}/Net45/$ASM.dll %{buildroot}%{dotnet_assembly_path} +%endif +done +# NuGet +mkdir -p %{buildroot}/nuget +install -p -m 644 *.nupkg %{buildroot}/nuget + +%files +%manifest %{name}.manifest +%license LICENSE +%attr(644,root,root) %{dotnet_assembly_path}/*.dll + +%package nuget +Summary: NuGet package for %{name} +Group: Development/Libraries + +%description nuget +NuGet package for %{name} + +%files nuget +/nuget/*.nupkg -- 2.7.4 From a3545af06a19e8e519e928bc7bd52cdd45a90b0c Mon Sep 17 00:00:00 2001 From: Younho Park Date: Thu, 15 Dec 2016 09:31:12 +0900 Subject: [PATCH 02/16] added ExcludeArch statement - modified wrong class name Change-Id: I1adb59ddeb26bfd1dc954c3168bef88709dad36c Signed-off-by: Younho Park --- .../Tizen.Account.AccountManager.Net45.csproj | 2 +- Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj | 2 +- .../Tizen.Account.AccountManager/AccountService.cs | 6 +++--- .../{AccountSucriberEventArgs.cs => AccountSubscriberEventArgs.cs} | 4 ++-- packaging/csapi-account-manager.spec | 3 ++- 5 files changed, 9 insertions(+), 8 deletions(-) rename Tizen.Account.AccountManager/Tizen.Account.AccountManager/{AccountSucriberEventArgs.cs => AccountSubscriberEventArgs.cs} (94%) mode change 100755 => 100644 packaging/csapi-account-manager.spec diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.csproj b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.csproj index 659ca68..787cfc1 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.csproj +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.csproj @@ -50,7 +50,7 @@ - + diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj index 6a54d6c..69e059f 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj @@ -63,7 +63,7 @@ - + diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs index 4f3f3ae..368bb54 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs @@ -518,14 +518,14 @@ namespace Tizen.Account.AccountManager private static readonly Interop.AccountService.SubscribeCallback s_accountUpdatedCallback = (string eventType, int accountId, IntPtr userData) => { - AccountSucriberEventArgs eventArgs = new AccountSucriberEventArgs(eventType, accountId); + AccountSubscriberEventArgs eventArgs = new AccountSubscriberEventArgs(eventType, accountId); s_accountUpdated?.Invoke(null, eventArgs); return true; }; private static Interop.AccountService.SafeAccountSubscriberHandle s_subscriberHandle; - private static event EventHandler s_accountUpdated; + private static event EventHandler s_accountUpdated; /// /// ContentUpdated event is triggered when the media item info from DB changes. /// @@ -538,7 +538,7 @@ namespace Tizen.Account.AccountManager /// In case of any DB error /// In case of invalid parameter /// In case of privilege not defined. - public static event EventHandler AccountUpdated + public static event EventHandler AccountUpdated { add { diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSucriberEventArgs.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs similarity index 94% rename from Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSucriberEventArgs.cs rename to Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs index a9b9215..84ee0da 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSucriberEventArgs.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs @@ -21,13 +21,13 @@ namespace Tizen.Account.AccountManager /// /// Event arguments passed when Event is triggered to notify that account is updated/removed from the account database. /// - public class AccountSucriberEventArgs : EventArgs + public class AccountSubscriberEventArgs : EventArgs { private const string NotiInsert = "insert"; private const string NotiDelete = "delete"; private const string NotiUpdate = "update"; private const string NotiSyncUpdate = "sync_update"; - internal AccountSucriberEventArgs(string eventType, int accountId) + internal AccountSubscriberEventArgs(string eventType, int accountId) { if (eventType.CompareTo(NotiInsert) == 0) { diff --git a/packaging/csapi-account-manager.spec b/packaging/csapi-account-manager.spec old mode 100755 new mode 100644 index 5577314..0c12d25 --- a/packaging/csapi-account-manager.spec +++ b/packaging/csapi-account-manager.spec @@ -8,7 +8,7 @@ Name: csapi-account-manager Summary: Tizen account manager API for C# -Version: 1.0.1 +Version: 1.0.2 Release: 1 Group: Development/Libraries License: Apache-2.0 @@ -17,6 +17,7 @@ Source0: %{name}-%{version}.tar.gz Source1: %{name}.manifest AutoReqProv: no +ExcludeArch: %{ix86} aarch64 BuildRequires: mono-compiler BuildRequires: mono-devel -- 2.7.4 From 24821e19c23a8dcdae01309290b8d947139bc43f Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Mon, 19 Dec 2016 18:34:39 +0900 Subject: [PATCH 03/16] Apply dotnet RPM macros Change-Id: I7cafbd8bfc9a3371fed42ee6144017f3c22a5d2a Signed-off-by: WonYoung Choi --- .../Tizen.Account.AccountManager.project.json | 3 -- packaging/csapi-account-manager.spec | 51 ++++------------------ 2 files changed, 9 insertions(+), 45 deletions(-) diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.project.json b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.project.json index 27943bf..0614e80 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.project.json +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.project.json @@ -8,9 +8,6 @@ "NETStandard.Library": "1.6.0", "Tizen": "1.0.0" }, - "runtimes": { - "win": {} - }, "frameworks": { "netstandard1.6": {} } diff --git a/packaging/csapi-account-manager.spec b/packaging/csapi-account-manager.spec index 0c12d25..efe77f1 100644 --- a/packaging/csapi-account-manager.spec +++ b/packaging/csapi-account-manager.spec @@ -1,11 +1,3 @@ -%{!?dotnet_assembly_path: %define dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework} - -%if 0%{?tizen_build_devel_mode} -%define BUILDCONF Debug -%else -%define BUILDCONF Release -%endif - Name: csapi-account-manager Summary: Tizen account manager API for C# Version: 1.0.2 @@ -17,61 +9,36 @@ Source0: %{name}-%{version}.tar.gz Source1: %{name}.manifest AutoReqProv: no -ExcludeArch: %{ix86} aarch64 - -BuildRequires: mono-compiler -BuildRequires: mono-devel +ExcludeArch: aarch64 %ix86 BuildRequires: dotnet-build-tools # NuGet for Dependencies BuildRequires: csapi-tizen-nuget +%define Assemblies Tizen.Account.AccountManager %description -Account Manager C# API for Tizen +%{summary} + +%dotnet_import_sub_packages %prep %setup -q cp %{SOURCE1} . -%define Assemblies Tizen.Account.AccountManager - %build for ASM in %{Assemblies}; do -# NuGet Restore -find $ASM/*.project.json -exec nuget restore {} \; -# Build -find $ASM/*.csproj -exec xbuild {} /p:Configuration=%{BUILDCONF} \; -# NuGet Pack -nuget pack $ASM/$ASM.nuspec -Version %{version} -Properties Configuration=%{BUILDCONF} +%dotnet_build $ASM +%dotnet_pack $ASM/$ASM.nuspec %{version} done %install -# Runtime Binary -mkdir -p %{buildroot}%{dotnet_assembly_path} for ASM in %{Assemblies}; do -%if 0%{?_with_corefx} - install -p -m 644 $ASM/bin/%{BUILDCONF}/$ASM.dll %{buildroot}%{dotnet_assembly_path} -%else - install -p -m 644 $ASM/bin/%{BUILDCONF}/Net45/$ASM.dll %{buildroot}%{dotnet_assembly_path} -%endif +%dotnet_install $ASM done -# NuGet -mkdir -p %{buildroot}/nuget -install -p -m 644 *.nupkg %{buildroot}/nuget %files %manifest %{name}.manifest %license LICENSE -%attr(644,root,root) %{dotnet_assembly_path}/*.dll - -%package nuget -Summary: NuGet package for %{name} -Group: Development/Libraries - -%description nuget -NuGet package for %{name} - -%files nuget -/nuget/*.nupkg +%attr(644,root,root) %{dotnet_assembly_files} \ No newline at end of file -- 2.7.4 From ae4140965699898f68ef4fceb08a6f198fe33e28 Mon Sep 17 00:00:00 2001 From: Ickhee Woo Date: Wed, 11 Jan 2017 13:57:44 +0900 Subject: [PATCH 04/16] change ExcludeArch by removing ix86 Change-Id: Ic93f2e9873c4bc506dd26b651744b63e7cb5f256 Signed-off-by: Ickhee Woo --- packaging/csapi-account-manager.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/csapi-account-manager.spec b/packaging/csapi-account-manager.spec index efe77f1..377358b 100644 --- a/packaging/csapi-account-manager.spec +++ b/packaging/csapi-account-manager.spec @@ -1,6 +1,6 @@ Name: csapi-account-manager Summary: Tizen account manager API for C# -Version: 1.0.2 +Version: 1.0.3 Release: 1 Group: Development/Libraries License: Apache-2.0 @@ -9,7 +9,7 @@ Source0: %{name}-%{version}.tar.gz Source1: %{name}.manifest AutoReqProv: no -ExcludeArch: aarch64 %ix86 +ExcludeArch: aarch64 BuildRequires: dotnet-build-tools @@ -41,4 +41,4 @@ done %files %manifest %{name}.manifest %license LICENSE -%attr(644,root,root) %{dotnet_assembly_files} \ No newline at end of file +%attr(644,root,root) %{dotnet_assembly_files} -- 2.7.4 From 658c32a3d4d7fcc4223f1d2efab230c3165d5683 Mon Sep 17 00:00:00 2001 From: Younho Park Date: Wed, 18 Jan 2017 20:00:37 +0900 Subject: [PATCH 05/16] Fixed TCT issues on 64 bit emulator - issue : IsFeatureSupported() always returns true - fix : added [return: MarshalAs(UnmanagedType.I1)] in Interop Change-Id: If31b76eb5b0c1f508212cd0fd6d5170988a37348 Signed-off-by: Younho Park --- Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs | 4 ++-- packaging/csapi-account-manager.spec | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs b/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs index 2f82aa1..0af6c37 100644 --- a/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs +++ b/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs @@ -39,8 +39,8 @@ internal static partial class Interop internal static extern int GetAppId(IntPtr handle, out string appId); [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_supported_feature", CallingConvention = CallingConvention.Cdecl)] - internal static extern bool IsFeatureSupported(string appId, string capabilty); - + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsFeatureSupported(string appId, string capability); [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_service_provider_id", CallingConvention = CallingConvention.Cdecl)] internal static extern int GetServiceProviderId(IntPtr handle, out string providerId); diff --git a/packaging/csapi-account-manager.spec b/packaging/csapi-account-manager.spec index 377358b..424b8f7 100644 --- a/packaging/csapi-account-manager.spec +++ b/packaging/csapi-account-manager.spec @@ -1,6 +1,6 @@ Name: csapi-account-manager Summary: Tizen account manager API for C# -Version: 1.0.3 +Version: 1.0.4 Release: 1 Group: Development/Libraries License: Apache-2.0 -- 2.7.4 From ef8d3a07f8fde5a179877bbcb4469aa22c9e4db3 Mon Sep 17 00:00:00 2001 From: Younho Park Date: Thu, 19 Jan 2017 17:52:17 +0900 Subject: [PATCH 06/16] added initialization for subscribe handle Change-Id: I33d43cb2ab05a943082678b30afdcb9d8eb8b2ad Signed-off-by: Younho Park --- .../Tizen.Account.AccountManager/AccountService.cs | 1 + packaging/csapi-account-manager.spec | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs index 368bb54..55d0080 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs @@ -570,6 +570,7 @@ namespace Tizen.Account.AccountManager { throw AccountErrorFactory.CreateException(ret, "Error in callback handling"); } + s_subscriberHandle = null; } } } diff --git a/packaging/csapi-account-manager.spec b/packaging/csapi-account-manager.spec index 424b8f7..635df20 100644 --- a/packaging/csapi-account-manager.spec +++ b/packaging/csapi-account-manager.spec @@ -1,6 +1,6 @@ Name: csapi-account-manager Summary: Tizen account manager API for C# -Version: 1.0.4 +Version: 1.0.5 Release: 1 Group: Development/Libraries License: Apache-2.0 -- 2.7.4 From a6b82d8c3d10253d57fa83db74261f4792c33313 Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Wed, 1 Feb 2017 10:57:43 +0900 Subject: [PATCH 07/16] Update content of nuspec file Change-Id: Id0561d5e38e96cca38f1cc6d07fe81d0c5cb0291 Signed-off-by: WonYoung Choi --- Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec index af9093d..286704a 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec @@ -3,7 +3,12 @@ Tizen.Account.AccountManager $version$ - Tizen Developers + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + © Samsung Electronics Co., Ltd All Rights Reserved Account Service APIs for Tizen.Account.AccountManager -- 2.7.4 From 8cfd6b1334b11ec012188268be64a9e437ed1661 Mon Sep 17 00:00:00 2001 From: Younho Park Date: Mon, 6 Mar 2017 17:01:16 +0900 Subject: [PATCH 08/16] remove net45 Change-Id: I9d885c0c2e6f646f52996881c5b9a500a1cf0be1 Signed-off-by: Younho Park --- .../Tizen.Account.AccountManager.Net45.csproj | 66 ---------------------- ...Tizen.Account.AccountManager.Net45.project.json | 11 ---- .../Tizen.Account.AccountManager.nuspec | 1 - packaging/csapi-account-manager.spec | 2 +- 4 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.csproj delete mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.project.json diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.csproj b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.csproj deleted file mode 100644 index 787cfc1..0000000 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.csproj +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Debug - AnyCPU - {67948043-E29E-4E57-B77E-26B206043718} - Library - Properties - Tizen.Account.AccountManager - Tizen.Account.AccountManager - v4.5 - 512 - - - true - full - false - bin\Debug\Net45\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\Net45\ - TRACE - prompt - 4 - - - true - - - Tizen.Account.AccountManager.snk - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.project.json b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.project.json deleted file mode 100644 index 5787764..0000000 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.Net45.project.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "dependencies": { - "Tizen": "1.0.0" - }, - "frameworks": { - "net45": {} - }, - "runtimes": { - "win": {} - } -} diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec index 286704a..ddacacd 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec @@ -16,6 +16,5 @@ - diff --git a/packaging/csapi-account-manager.spec b/packaging/csapi-account-manager.spec index 635df20..bc970b3 100644 --- a/packaging/csapi-account-manager.spec +++ b/packaging/csapi-account-manager.spec @@ -1,6 +1,6 @@ Name: csapi-account-manager Summary: Tizen account manager API for C# -Version: 1.0.5 +Version: 1.0.6 Release: 1 Group: Development/Libraries License: Apache-2.0 -- 2.7.4 From 211866b6c82d8cede547a9558af4d73b3a98ab3f Mon Sep 17 00:00:00 2001 From: Jooseok Song Date: Mon, 22 May 2017 15:16:52 +0900 Subject: [PATCH 09/16] Fix TCT Block Issue Change-Id: I5346bb5a9dafd731ba94bb0aad0be40e1ce0dacf --- Tizen.Account.AccountManager/Interop/Interop.AccountService.cs | 1 - Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs | 1 - packaging/csapi-account-manager.spec | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs b/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs index 9804c1c..d418f64 100644 --- a/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs +++ b/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs @@ -108,7 +108,6 @@ internal static partial class Interop protected override bool ReleaseHandle() { - Account.Destroy(this.handle); this.SetHandle(IntPtr.Zero); return true; } diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs index cabe14c..ae1031c 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs @@ -586,7 +586,6 @@ namespace Tizen.Account.AccountManager { if (_handle != IntPtr.Zero) { - Interop.Account.Destroy(_handle); _handle = IntPtr.Zero; } } diff --git a/packaging/csapi-account-manager.spec b/packaging/csapi-account-manager.spec index bc970b3..d844193 100644 --- a/packaging/csapi-account-manager.spec +++ b/packaging/csapi-account-manager.spec @@ -1,6 +1,6 @@ Name: csapi-account-manager Summary: Tizen account manager API for C# -Version: 1.0.6 +Version: 1.0.7 Release: 1 Group: Development/Libraries License: Apache-2.0 -- 2.7.4 From 80aec93fdc1ca2419839f8e97b7551336a605339 Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Thu, 8 Jun 2017 09:15:52 +0900 Subject: [PATCH 10/16] Merge packaging information to csproj Change-Id: Ia963f65f7c5c3892c76b0053da6d09e01e84051d Signed-off-by: WonYoung Choi --- .gitignore | 7 ++ .../Properties/AssemblyInfo.cs | 35 ------ .../Tizen.Account.AccountManager.csproj | 128 +++------------------ .../Tizen.Account.AccountManager.nuspec | 20 ---- .../Tizen.Account.AccountManager.project.json | 14 --- packaging/csapi-account-manager.spec | 2 +- 6 files changed, 27 insertions(+), 179 deletions(-) create mode 100644 .gitignore delete mode 100644 Tizen.Account.AccountManager/Properties/AssemblyInfo.cs delete mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec delete mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager.project.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..46619d5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +bin/ +obj/ +*.exe +*.dll +*.csproj.user +*.lock.json +.vs/ diff --git a/Tizen.Account.AccountManager/Properties/AssemblyInfo.cs b/Tizen.Account.AccountManager/Properties/AssemblyInfo.cs deleted file mode 100644 index eac89fd..0000000 --- a/Tizen.Account.AccountManager/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Tizen.Account.AccountManager")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Tizen.Account.AccountManager")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2548b842-f053-4fb2-a15b-43d95239759b")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj index 69e059f..d1b0495 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj @@ -1,115 +1,25 @@ - - + + - 14.0 - Debug - AnyCPU - 8.0.30703 - 2.0 - {2548B842-F053-4FB2-A15B-43D95239759B} - Library - Properties - Tizen.Account.AccountManager - Tizen.Account.AccountManager - 512 - en-US - - - .NETStandard - v1.6 - .NETStandard,Version=v1.6 - .NETStandard,Version=v1.6 - false - true - $(NoWarn);1701 - false - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - + 1.0.7 + Samsung Electronics + © Samsung Electronics Co., Ltd All Rights Reserved + Account Service APIs for Tizen.Account.AccountManager + https://www.tizen.org/ + https://www.apache.org/licenses/LICENSE-2.0 + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + + + netstandard1.6 + True + True Tizen.Account.AccountManager.snk + true + - - - + - - - - - - - - - - - - - - - - - - - - - <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory) - <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory) - true - - - - $(MSBuildExtensionsPath)\Tizen - $(TizenBuildPath)\bin - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec deleted file mode 100644 index ddacacd..0000000 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.nuspec +++ /dev/null @@ -1,20 +0,0 @@ - - - - Tizen.Account.AccountManager - $version$ - Samsung Electronics - false - https://www.apache.org/licenses/LICENSE-2.0 - https://www.tizen.org/ - https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png - © Samsung Electronics Co., Ltd All Rights Reserved - Account Service APIs for Tizen.Account.AccountManager - - - - - - - - diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.project.json b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.project.json deleted file mode 100644 index 0614e80..0000000 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.project.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "buildOptions": { - "debugType": "portable", - "platform": "AnyCPU", - "preserveCompilationContext": true - }, - "dependencies": { - "NETStandard.Library": "1.6.0", - "Tizen": "1.0.0" - }, - "frameworks": { - "netstandard1.6": {} - } -} diff --git a/packaging/csapi-account-manager.spec b/packaging/csapi-account-manager.spec index d844193..3363fe2 100644 --- a/packaging/csapi-account-manager.spec +++ b/packaging/csapi-account-manager.spec @@ -30,7 +30,7 @@ cp %{SOURCE1} . %build for ASM in %{Assemblies}; do %dotnet_build $ASM -%dotnet_pack $ASM/$ASM.nuspec %{version} +%dotnet_pack $ASM done %install -- 2.7.4 From 472251cabef8e130692d174ff3054ff1cf33a44c Mon Sep 17 00:00:00 2001 From: Jooseok Song Date: Mon, 3 Jul 2017 15:15:24 +0900 Subject: [PATCH 11/16] Add API Level Change-Id: I30d9d82cb8581d36d7cd27e100394fb9fd158db0 --- .../Interop/Interop.Account.cs | 2 ++ .../Interop/Interop.AccountProvider.cs | 2 ++ .../Interop/Interop.AccountService.cs | 2 ++ .../Interop/Interop.Libraries.cs | 2 ++ .../Tizen.Account.AccountManager/Account.cs | 25 ++++++++++++++++++++ .../Tizen.Account.AccountManager/AccountEnums.cs | 23 ++++++++++++++++++ .../AccountErrorFactory.cs | 20 ++++++++++++++++ .../AccountProvider.cs | 14 +++++++++++ .../Tizen.Account.AccountManager/AccountService.cs | 27 ++++++++++++++++++++++ .../AccountSubscriberEventArgs.cs | 3 +++ 10 files changed, 120 insertions(+) diff --git a/Tizen.Account.AccountManager/Interop/Interop.Account.cs b/Tizen.Account.AccountManager/Interop/Interop.Account.cs index f52da1c..9789044 100644 --- a/Tizen.Account.AccountManager/Interop/Interop.Account.cs +++ b/Tizen.Account.AccountManager/Interop/Interop.Account.cs @@ -20,11 +20,13 @@ using Tizen.Account.AccountManager; /// /// Interop for Account class APIs /// +/// 3 internal static partial class Interop { /// /// Interop for Account class APIs /// + /// 3 internal static partial class Account { [DllImport(Libraries.AccountSvc, EntryPoint = "account_create", CallingConvention = CallingConvention.Cdecl)] diff --git a/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs b/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs index 0af6c37..f201061 100644 --- a/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs +++ b/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs @@ -21,11 +21,13 @@ using Tizen.Account.AccountManager; /// /// Interop for AccountProvider class APIs /// +/// 3 internal static partial class Interop { /// /// Interop for AccountProvider class APIs /// + /// 3 internal static partial class AccountProvider { diff --git a/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs b/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs index d418f64..7bb1275 100644 --- a/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs +++ b/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs @@ -20,11 +20,13 @@ using System.Runtime.InteropServices; /// /// Interop for Account class APIs /// +/// 3 internal static partial class Interop { /// /// Interop for Account class APIs /// + /// 3 internal static partial class AccountService { [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_id", CallingConvention = CallingConvention.Cdecl)] diff --git a/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs b/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs index f18aa0d..f1530bd 100644 --- a/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs +++ b/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs @@ -17,11 +17,13 @@ /// /// Interop for Library reference /// +/// 3 internal static partial class Interop { /// /// Interop for Library reference /// + /// 3 internal static partial class Libraries { public const string AccountSvc = "libaccounts-svc.so.0"; diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs index ae1031c..df10a15 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs @@ -22,6 +22,7 @@ namespace Tizen.Account.AccountManager /// /// Represents the Account Information. /// + /// 3 public class Account : IDisposable { private IntPtr _handle = IntPtr.Zero; @@ -37,6 +38,7 @@ namespace Tizen.Account.AccountManager /// /// Creates a new Account instance. /// + /// 3 /// Account Instance. public static Account CreateAccount() { @@ -53,6 +55,7 @@ namespace Tizen.Account.AccountManager /// /// Id of the Account. /// + /// 3 /// Account Id shall be created only when account is added to the database. public int AccountId { @@ -72,6 +75,7 @@ namespace Tizen.Account.AccountManager /// /// UserName of the Account. /// + /// 3 /// User Name of the Account. public string UserName { @@ -100,6 +104,7 @@ namespace Tizen.Account.AccountManager /// /// Display Name of the Account. /// + /// 3 /// DisplayName of the Account. public string DisplayName { @@ -128,6 +133,7 @@ namespace Tizen.Account.AccountManager /// /// Icon path of the Account. /// + /// 3 /// Icon path of the Account. public string IconPath { @@ -156,6 +162,7 @@ namespace Tizen.Account.AccountManager /// /// Domain name of the Account. /// + /// 3 /// Domain name of the Account. public string DomainName { @@ -184,6 +191,7 @@ namespace Tizen.Account.AccountManager /// /// Email Id of the Account. /// + /// 3 /// Email Id of the Account. public string EmailId { @@ -212,6 +220,7 @@ namespace Tizen.Account.AccountManager /// /// Package Name of the Account. /// + /// 3 /// Package Name. public string PackageName { @@ -240,6 +249,7 @@ namespace Tizen.Account.AccountManager /// /// Access Token of the Account. /// + /// 3 /// Access Token. public string AccessToken { @@ -268,6 +278,7 @@ namespace Tizen.Account.AccountManager /// /// Authentication type of the Account. /// + /// 3 /// Authentication type. public AccountAuthType AuthType { @@ -296,6 +307,7 @@ namespace Tizen.Account.AccountManager /// /// Secrecy State of the Account. /// + /// 3 /// Secrecy State. public AccountSecrecyState SecrecyState { @@ -324,6 +336,7 @@ namespace Tizen.Account.AccountManager /// /// Sync State of the Account. /// + /// 3 /// Sync State. public AccountSyncState SyncState { @@ -352,6 +365,7 @@ namespace Tizen.Account.AccountManager /// /// Source of the Account . /// + /// 3 /// Account Source. public string Source { @@ -392,6 +406,7 @@ namespace Tizen.Account.AccountManager /// /// Sets the account capability. /// + /// 3 /// The Account capability type /// The Account capability state /// In case of invalid parameters @@ -406,6 +421,7 @@ namespace Tizen.Account.AccountManager /// /// Gets all the capabilities of an account. /// + /// 3 /// The capability type to get the capability value. /// The capability value (on/off) of the specified CapabilityState . /// In case of invalid parameters @@ -424,6 +440,7 @@ namespace Tizen.Account.AccountManager /// /// Gets all the capabilities of an account. /// + /// 3 /// List of Cpabailities as Dictionary public Dictionary GetAllCapabilities() { @@ -448,6 +465,7 @@ namespace Tizen.Account.AccountManager /// /// Sets the Custom Value to the Account. /// + /// 3 /// key to be added to the Account. /// value to be updated for respective key for the Account. /// In case of invalid parameters @@ -463,6 +481,7 @@ namespace Tizen.Account.AccountManager /// /// Gets the user specific custom text of an account key. /// + /// 3 /// The key to retrieve custom text . /// The text of the given key /// In case of invalid parameters @@ -482,6 +501,7 @@ namespace Tizen.Account.AccountManager /// /// Gets All the custome values. /// + /// 3 /// List of custom key, value pairs as Dictionary. public Dictionary GetAllCustomValues() { @@ -507,6 +527,7 @@ namespace Tizen.Account.AccountManager /// /// Sets the user text. /// + /// 3 /// The index of the user text (must be in range from 0 to 4) /// The text string to set as the user text /// In case of invalid parameters @@ -522,6 +543,7 @@ namespace Tizen.Account.AccountManager /// /// Gets the user text. /// + /// 3 /// The index of the user text (range: 0 ~ 4) /// The user text of the given key /// In case of invalid parameters @@ -541,6 +563,7 @@ namespace Tizen.Account.AccountManager /// /// Gets the user int value. /// + /// 3 /// The index of the user int (range: 0 ~ 4) /// The user int of the given key /// In case of invalid parameters @@ -559,6 +582,7 @@ namespace Tizen.Account.AccountManager /// /// Sets the user integer value. /// + /// 3 /// The index of the user integer (must be in range from 0 to 4) /// The integer to set as the user integer /// In case of invalid parameters @@ -574,6 +598,7 @@ namespace Tizen.Account.AccountManager /// /// Overloaded Dispose API for destroying the Account Handle. /// + /// 3 public void Dispose() { Dispose(true); diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs index 045cac7..b55a458 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs @@ -19,21 +19,25 @@ namespace Tizen.Account.AccountManager /// /// Enumeration for the state of capability /// + /// 3 public enum CapabilityState { /// /// Account capability is invalid /// + /// 3 InvalidState, /// /// Account capability is disabled /// + /// 3 Disabled, /// /// Account capability is enabled /// + /// 3 Enabled } @@ -45,79 +49,94 @@ namespace Tizen.Account.AccountManager /// /// Account secrecy is invalid /// + /// 3 InvalidState, /// /// Account is not visible /// + /// 3 Invisible, /// /// Account is visible /// + /// 3 Visible } /// /// Enumeration for the account sync status. /// + /// 3 public enum AccountSyncState { /// /// Account sync is invalid /// + /// 3 InvalidState, /// /// Account sync not supported /// + /// 3 NotSupported, /// /// Account sync supported but all synchronization functionalities are off /// + /// 3 Off, /// /// Account sync support and sync status is idle /// + /// 3 Idle, /// /// Account sync support and sync status is running /// + /// 3 Running } /// /// Enumeration for the account auth type. /// + /// 3 public enum AccountAuthType { /// /// Auth type is invalid /// + /// 3 Invalid, /// /// XAuth type /// + /// 3 XAuth, /// /// OAuth type /// + /// 3 OAuth, /// /// Client-Login type /// + /// 3 ClientLogin } /// /// Account information change notification type /// + /// 3 /// /// When the account database is changed, You can distinguish one event type from the other which are set for subscribing notification. /// @@ -126,18 +145,22 @@ namespace Tizen.Account.AccountManager /// /// The insert notification type. /// + /// 3 Insert, /// /// The delete notification type. /// + /// 3 Delete, /// /// The update notification type. /// + /// 3 Update, /// /// The sync update notification type. /// + /// 3 syncUpdate } } diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs index 13cd203..48f9164 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs @@ -22,84 +22,104 @@ namespace Tizen.Account.AccountManager /// /// Enum to give the type of error occured, if any. /// + /// 3 public enum AccountError { //TIZEN_ERROR_ACCOUNT = -0x01000000 /// /// Successful. /// + /// 3 None = Tizen.Internals.Errors.ErrorCode.None, /// /// Invalid parameter. /// + /// 3 InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /// /// Out of memory. /// + /// 3 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, /// /// Same user name exists in your application /// + /// 3 Duplcated = -0x01000000 | 0x01, /// /// Empty Data /// + /// 3 NoData = Tizen.Internals.Errors.ErrorCode.NoData, /// /// elated record does not exist /// + /// 3 RecordNotFound = -0x01000000 | 0x03, /// /// Invalid Operation. /// + /// 3 InvalidOperation = Tizen.Internals.Errors.ErrorCode.InvalidOperation, /// /// DB operation failed. /// + /// 3 DBFailed = -0x01000000 | 0x04, /// /// DB is not connected. /// + /// 3 DBNotOpened = -0x01000000 | 0x05, /// /// DB query syntax error /// + /// 3 QuerySyntaxError = -0x01000000 | 0x06, /// /// Iterator has reached the end /// + /// 3 IteratorEnd = -0x01000000 | 0x07, /// /// Notification failed /// + /// 3 NotificationFailed = -0x01000000 | 0x08, /// /// Permission denied. /// + /// 3 PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, /// /// XML parse failed /// + /// 3 XMLParseFailed = -0x01000000 | 0x0a, /// /// XML File not found /// + /// 3 XMLFileNotFound = -0x01000000 | 0x0b, /// /// Subscription failed /// + /// 3 EventSubscriptionFailed = -0x01000000 | 0x0c, /// /// Account provider is not registered /// + /// 3 ProviderNotRegistered = -0x01000000 | 0x0d, /// /// Multiple accounts are not supported. /// + /// 3 MultipleNotAllowed = -0x01000000 | 0x0e, /// /// SQLite busy handler expired /// + /// 3 DBBusy = -0x01000000 | 0x10 }; diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs index 8aa882f..606a286 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs @@ -23,6 +23,7 @@ namespace Tizen.Account.AccountManager /// /// Account Id. /// + /// 3 public class AccountProvider : IDisposable { internal IntPtr _handle; @@ -51,6 +52,7 @@ namespace Tizen.Account.AccountManager /// /// Account Id. /// + /// 3 public string AppId { get @@ -69,6 +71,7 @@ namespace Tizen.Account.AccountManager /// /// Serviceprovider Id of the account provider. /// + /// 3 public string ServiceProviderId { get @@ -87,6 +90,7 @@ namespace Tizen.Account.AccountManager /// /// Icon path of an account provider. /// + /// 3 public string IconPath { get @@ -105,6 +109,7 @@ namespace Tizen.Account.AccountManager /// /// Small icon path of an account provider. /// + /// 3 public string SmallIconPath { get @@ -123,6 +128,7 @@ namespace Tizen.Account.AccountManager /// /// Flag for account provider If supports multiple accounts. /// + /// 3 public bool MultipleAccountSupport { get @@ -141,6 +147,7 @@ namespace Tizen.Account.AccountManager /// /// Retrieves all the capability information of the account provider. /// + /// 3 /// http://tizen.org/privilege/account.read /// /// list of capability information. @@ -169,6 +176,7 @@ namespace Tizen.Account.AccountManager /// /// Gets the specific label information detail of an account provider. /// + /// 3 /// /// The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code. /// For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English. @@ -192,6 +200,7 @@ namespace Tizen.Account.AccountManager /// /// Gets the specific label information detail of an account provider. /// + /// 3 /// /// The application ID to search /// @@ -222,6 +231,7 @@ namespace Tizen.Account.AccountManager /// /// Gets the label information detail of an account provider. /// + /// 3 /// All the labels information for the given account provider. /// http://tizen.org/privilege/account.read /// In case of any DB error @@ -248,6 +258,7 @@ namespace Tizen.Account.AccountManager /// /// Checks whether the given appId exists in the account provider DB. /// + /// 3 /// The application ID to check. /// returns true If App is supported /// http://tizen.org/privilege/account.read @@ -274,6 +285,7 @@ namespace Tizen.Account.AccountManager /// /// Checks whether the given application ID supports the capability. /// + /// 3 /// The application Id /// The capability information /// @@ -303,6 +315,7 @@ namespace Tizen.Account.AccountManager /// /// Retrieves capability information with application ID. /// + /// 3 /// application Id /// Capability information list for the given appId. /// http://tizen.org/privilege/account.read @@ -331,6 +344,7 @@ namespace Tizen.Account.AccountManager /// /// Overloaded Dispose API for destroying the AccountProvider Handle. /// + /// 3 public void Dispose() { Dispose(true); diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs index 55d0080..fc7cbd4 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs @@ -32,57 +32,68 @@ namespace Tizen.Account.AccountManager /// Read an account or account provider with some filter /// /// + /// 3 public static class AccountService { /// /// This is contact capability string. /// + /// 3 public static readonly string ContactCapability = "http://tizen.org/account/capability/contact"; /// /// This is calendar capability string. /// + /// 3 public static readonly string CalendarCapability = "http://tizen.org/account/capability/calendar"; /// /// This is email capability string. /// + /// 3 public static readonly string EmailCapability = "http://tizen.org/account/capability/email"; /// /// This is photo capability string. /// + /// 3 public static readonly string PhotoCapability = "http://tizen.org/account/capability/photo"; /// /// This is video capability string. /// + /// 3 public static readonly string VideoCapability = "http://tizen.org/account/capability/video"; /// /// This is music capability string. /// + /// 3 public static readonly string MusicCapability = "http://tizen.org/account/capability/music"; /// /// This is document capability string. /// + /// 3 public static readonly string DocumentCapability = "http://tizen.org/account/capability/document"; /// /// This is message capability string. /// + /// 3 public static readonly string MessageCapability = "http://tizen.org/account/capability/message"; /// /// This is game capability string. /// + /// 3 public static readonly string GameCapability = "http://tizen.org/account/capability/game"; /// /// Retrieves all accounts details from the account database. /// + /// 3 /// List of Accounts /// http://tizen.org/privilege/account.read /// In case of any DB error. @@ -117,6 +128,7 @@ namespace Tizen.Account.AccountManager /// /// Retrieve an account with the account ID. /// + /// 3 /// The account Id to be searched. /// Account instance with reference to the given id. /// http://tizen.org/privilege/account.read @@ -140,6 +152,7 @@ namespace Tizen.Account.AccountManager /// /// Retrieves all AccountProviders details from the account database. /// + /// 3 /// List of AccountProviders /// http://tizen.org/privilege/account.read /// In case of any DB error @@ -175,6 +188,7 @@ namespace Tizen.Account.AccountManager /// /// Retrieves the account provider information with application Id. /// + /// 3 /// Application Id. /// The AccountProvider instance associated with the given application Id. /// http://tizen.org/privilege/account.read @@ -198,6 +212,7 @@ namespace Tizen.Account.AccountManager /// /// Retrieves all the account providers information with feature. /// + /// 3 /// The capability value to search for account providers. /// Retrieves AccountProviders information with the capability name. /// http://tizen.org/privilege/account.read @@ -234,6 +249,7 @@ namespace Tizen.Account.AccountManager /// /// Inserts into the Database with the new account Infomration. /// + /// 3 /// New Account instance to be added. /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write @@ -261,6 +277,7 @@ namespace Tizen.Account.AccountManager /// /// Updates the account details to the account database. /// + /// 3 /// account instance to be updated. /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write @@ -285,6 +302,7 @@ namespace Tizen.Account.AccountManager /// /// Deletes the account information from the Database. /// + /// 3 /// Account instance to be deleted from the database. /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write @@ -308,6 +326,7 @@ namespace Tizen.Account.AccountManager /// /// Deletes an account from the account database by user name. /// + /// 3 /// The user name of the account to delete. /// The package name of the account to delete. /// http://tizen.org/privilege/account.read @@ -327,6 +346,7 @@ namespace Tizen.Account.AccountManager /// /// Deletes an account from the account database by package name. /// + /// 3 /// The package name of the account to delete. /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write @@ -346,6 +366,7 @@ namespace Tizen.Account.AccountManager /// /// Retrieves all accounts with the given user name. /// + /// 3 /// The user name to search . /// Accounts list matched with the user name /// http://tizen.org/privilege/account.read @@ -382,6 +403,7 @@ namespace Tizen.Account.AccountManager /// /// Retrieves all accounts with the given package name. /// + /// 3 /// The package name to Search /// Accounts list matched with the package name /// http://tizen.org/privilege/account.read @@ -418,6 +440,7 @@ namespace Tizen.Account.AccountManager /// /// Retrieves all accounts with the given cpability type. /// + /// 3 /// Capability type /// Accounts list matched with the capability type /// http://tizen.org/privilege/account.read @@ -454,6 +477,7 @@ namespace Tizen.Account.AccountManager /// /// Retrieves all capabilities with the given account /// + /// 3 /// account instance /// Capabilities list as Dictionary of Capability type and State. /// http://tizen.org/privilege/account.read @@ -481,6 +505,7 @@ namespace Tizen.Account.AccountManager /// /// Gets the count of accounts in the account database. /// + /// 3 /// The number of accounts in the database /// http://tizen.org/privilege/account.read /// In case of any DB error @@ -500,6 +525,7 @@ namespace Tizen.Account.AccountManager /// /// Updates the sync status of the given account. /// + /// 3 /// Account for which sync status needs to be updated /// Sync State /// http://tizen.org/privilege/account.read @@ -529,6 +555,7 @@ namespace Tizen.Account.AccountManager /// /// ContentUpdated event is triggered when the media item info from DB changes. /// + /// 3 /// /// ContentUpdate event is triggered if the MediaInformaion updated/deleted or new Inforamtion is Inserted. /// diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs index 84ee0da..153c427 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs @@ -21,6 +21,7 @@ namespace Tizen.Account.AccountManager /// /// Event arguments passed when Event is triggered to notify that account is updated/removed from the account database. /// + /// 3 public class AccountSubscriberEventArgs : EventArgs { private const string NotiInsert = "insert"; @@ -52,6 +53,7 @@ namespace Tizen.Account.AccountManager /// /// The account event type /// + /// 3 public AccountNotificationType EventType { get; @@ -61,6 +63,7 @@ namespace Tizen.Account.AccountManager /// /// The account ID to update /// + /// 3 public int AccountId { get; -- 2.7.4 From 0da4589e9c1b1e141cb3d4e8b387eec080fa1834 Mon Sep 17 00:00:00 2001 From: Editor Lionbridge Date: Tue, 8 Aug 2017 15:56:38 +0530 Subject: [PATCH 12/16] Review account API cs files Change-Id: I9229392138db7b04a9e15cb21ebbad0e25f474df --- .../Interop/Interop.Account.cs | 4 +- .../Interop/Interop.AccountProvider.cs | 4 +- .../Interop/Interop.AccountService.cs | 4 +- .../Interop/Interop.Libraries.cs | 4 +- .../Tizen.Account.AccountManager/Account.cs | 116 +++++++-------- .../Tizen.Account.AccountManager/AccountEnums.cs | 36 ++--- .../AccountErrorFactory.cs | 24 ++-- .../AccountProvider.cs | 56 ++++---- .../Tizen.Account.AccountManager/AccountService.cs | 158 ++++++++++----------- .../AccountSubscriberEventArgs.cs | 6 +- 10 files changed, 206 insertions(+), 206 deletions(-) diff --git a/Tizen.Account.AccountManager/Interop/Interop.Account.cs b/Tizen.Account.AccountManager/Interop/Interop.Account.cs index 9789044..25b03e2 100644 --- a/Tizen.Account.AccountManager/Interop/Interop.Account.cs +++ b/Tizen.Account.AccountManager/Interop/Interop.Account.cs @@ -18,13 +18,13 @@ using System; using System.Runtime.InteropServices; using Tizen.Account.AccountManager; /// -/// Interop for Account class APIs +/// Interop for Account class APIs. /// /// 3 internal static partial class Interop { /// - /// Interop for Account class APIs + /// Interop for Account class APIs. /// /// 3 internal static partial class Account diff --git a/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs b/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs index f201061..02f6314 100644 --- a/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs +++ b/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs @@ -19,13 +19,13 @@ using System.Runtime.InteropServices; using Tizen.Account.AccountManager; /// -/// Interop for AccountProvider class APIs +/// Interop for AccountProvider class APIs. /// /// 3 internal static partial class Interop { /// - /// Interop for AccountProvider class APIs + /// Interop for AccountProvider class APIs. /// /// 3 internal static partial class AccountProvider diff --git a/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs b/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs index 7bb1275..581a00d 100644 --- a/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs +++ b/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs @@ -18,13 +18,13 @@ using System; using System.Runtime.InteropServices; /// -/// Interop for Account class APIs +/// Interop for Account class APIs. /// /// 3 internal static partial class Interop { /// - /// Interop for Account class APIs + /// Interop for Account class APIs. /// /// 3 internal static partial class AccountService diff --git a/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs b/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs index f1530bd..dba2781 100644 --- a/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs +++ b/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs @@ -15,13 +15,13 @@ */ /// -/// Interop for Library reference +/// Interop for the library reference. /// /// 3 internal static partial class Interop { /// - /// Interop for Library reference + /// Interop for the library reference. /// /// 3 internal static partial class Libraries diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs index df10a15..d51bd33 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs @@ -20,7 +20,7 @@ using System.Collections.Generic; namespace Tizen.Account.AccountManager { /// - /// Represents the Account Information. + /// Represents the account information. /// /// 3 public class Account : IDisposable @@ -36,7 +36,7 @@ namespace Tizen.Account.AccountManager Dispose(false); } /// - /// Creates a new Account instance. + /// Creates a new account instance. /// /// 3 /// Account Instance. @@ -56,7 +56,7 @@ namespace Tizen.Account.AccountManager /// Id of the Account. /// /// 3 - /// Account Id shall be created only when account is added to the database. + /// Account ID shall be created only when the account is added to the database. public int AccountId { get @@ -73,10 +73,10 @@ namespace Tizen.Account.AccountManager } /// - /// UserName of the Account. + /// UserName of the account. /// /// 3 - /// User Name of the Account. + /// User name of the account. public string UserName { get @@ -102,10 +102,10 @@ namespace Tizen.Account.AccountManager } /// - /// Display Name of the Account. + /// Display name of the account. /// /// 3 - /// DisplayName of the Account. + /// Display name of the account. public string DisplayName { get @@ -131,10 +131,10 @@ namespace Tizen.Account.AccountManager } /// - /// Icon path of the Account. + /// Icon path of the account. /// /// 3 - /// Icon path of the Account. + /// Icon path of the account. public string IconPath { get @@ -160,10 +160,10 @@ namespace Tizen.Account.AccountManager } /// - /// Domain name of the Account. + /// Domain name of the account. /// /// 3 - /// Domain name of the Account. + /// Domain name of the account. public string DomainName { get @@ -189,10 +189,10 @@ namespace Tizen.Account.AccountManager } /// - /// Email Id of the Account. + /// Email ID of the account. /// /// 3 - /// Email Id of the Account. + /// Email ID of the account. public string EmailId { get @@ -218,10 +218,10 @@ namespace Tizen.Account.AccountManager } /// - /// Package Name of the Account. + /// Package name of the account. /// /// 3 - /// Package Name. + /// Package name of the account. public string PackageName { get @@ -247,10 +247,10 @@ namespace Tizen.Account.AccountManager } /// - /// Access Token of the Account. + /// Access token of the account. /// /// 3 - /// Access Token. + /// Access token of the account. public string AccessToken { get @@ -276,10 +276,10 @@ namespace Tizen.Account.AccountManager } /// - /// Authentication type of the Account. + /// Authentication type of the account. /// /// 3 - /// Authentication type. + /// Authentication type of the account. public AccountAuthType AuthType { get @@ -305,10 +305,10 @@ namespace Tizen.Account.AccountManager } /// - /// Secrecy State of the Account. + /// Secrecy state of the account. /// /// 3 - /// Secrecy State. + /// Secrecy state of the account. public AccountSecrecyState SecrecyState { get @@ -334,10 +334,10 @@ namespace Tizen.Account.AccountManager } /// - /// Sync State of the Account. + /// Sync state of the account. /// /// 3 - /// Sync State. + /// Sync state of the account. public AccountSyncState SyncState { get @@ -363,10 +363,10 @@ namespace Tizen.Account.AccountManager } /// - /// Source of the Account . + /// Source of the account. /// /// 3 - /// Account Source. + /// Account source. public string Source { get @@ -407,9 +407,9 @@ namespace Tizen.Account.AccountManager /// Sets the account capability. /// /// 3 - /// The Account capability type - /// The Account capability state - /// In case of invalid parameters + /// The account capability type. + /// The account capability state. + /// In case of an invalid parameter. public void SetCapability(string capabilityType, CapabilityState state) { AccountError ret = (AccountError)Interop.Account.SetAccountCapability(_handle, capabilityType, (int)state); @@ -419,12 +419,12 @@ namespace Tizen.Account.AccountManager } } /// - /// Gets all the capabilities of an account. + /// Gets all the capabilities of the account. /// /// 3 /// The capability type to get the capability value. - /// The capability value (on/off) of the specified CapabilityState . - /// In case of invalid parameters + /// The capability value (on/off) of the specified CapabilityState. + /// In case of an invalid parameter. public CapabilityState GetCapability(string capabilityType) { int type; @@ -438,10 +438,10 @@ namespace Tizen.Account.AccountManager } /// - /// Gets all the capabilities of an account. + /// Gets all the capabilities of the account. /// /// 3 - /// List of Cpabailities as Dictionary + /// List of capabilities as dictionary. public Dictionary GetAllCapabilities() { @@ -463,12 +463,12 @@ namespace Tizen.Account.AccountManager } /// - /// Sets the Custom Value to the Account. + /// Sets the custom value to the account. /// /// 3 - /// key to be added to the Account. - /// value to be updated for respective key for the Account. - /// In case of invalid parameters + /// Key to be added to the account. + /// Value to be updated for respective key for the account. + /// In case of an invalid parameter. public void SetCustomValue(string key, string value) { AccountError err = (AccountError)Interop.Account.SetAccountCustomValue(_handle, key, value); @@ -482,10 +482,10 @@ namespace Tizen.Account.AccountManager /// Gets the user specific custom text of an account key. /// /// 3 - /// The key to retrieve custom text . - /// The text of the given key - /// In case of invalid parameters - /// If there is no given capability type in the account + /// The key to retrieve custom text. + /// The text of the given key. + /// In case of an invalid parameter. + /// If there is no given capability type in the account. public string GetCustomValue(string key) { string result = ""; @@ -499,10 +499,10 @@ namespace Tizen.Account.AccountManager } /// - /// Gets All the custome values. + /// Gets all the custom values. /// /// 3 - /// List of custom key, value pairs as Dictionary. + /// List of custom key, value pairs as dictionary. public Dictionary GetAllCustomValues() { AccountError res = AccountError.None; @@ -528,9 +528,9 @@ namespace Tizen.Account.AccountManager /// Sets the user text. /// /// 3 - /// The index of the user text (must be in range from 0 to 4) - /// The text string to set as the user text - /// In case of invalid parameters + /// The index of the user text (must be in range from 0 to 4). + /// The text string to set as the user text. + /// In case of an invalid parameter. public void SetUserText(int index, string text) { AccountError err = (AccountError)Interop.Account.SetAccountUserText(_handle, index, text); @@ -544,10 +544,10 @@ namespace Tizen.Account.AccountManager /// Gets the user text. /// /// 3 - /// The index of the user text (range: 0 ~ 4) - /// The user text of the given key - /// In case of invalid parameters - /// In case of out of memory + /// The index of the user text (must be in range from 0 to 4). + /// The user text of the given key. + /// In case of an invalid parameter. + /// In case of out of memory. public string GetUserText(int index) { string result = ""; @@ -561,12 +561,12 @@ namespace Tizen.Account.AccountManager } /// - /// Gets the user int value. + /// Gets the user integer value. /// /// 3 - /// The index of the user int (range: 0 ~ 4) - /// The user int of the given key - /// In case of invalid parameters + /// The index of the user integer (must be in range from 0 to 4). + /// The user integer of the given key. + /// In case of an invalid parameter. public int GetUserInt(int index) { int result = -1; @@ -583,9 +583,9 @@ namespace Tizen.Account.AccountManager /// Sets the user integer value. /// /// 3 - /// The index of the user integer (must be in range from 0 to 4) - /// The integer to set as the user integer - /// In case of invalid parameters + /// The index of the user integer (must be in range from 0 to 4). + /// The integer to set as the user integer. + /// In case of an invalid parameter. public void SetUserInt(int index, int value) { AccountError err = (AccountError)Interop.Account.SetAccountUserInt(_handle, index, value); @@ -596,7 +596,7 @@ namespace Tizen.Account.AccountManager } /// - /// Overloaded Dispose API for destroying the Account Handle. + /// Overloaded Dispose API for destroying the account handle. /// /// 3 public void Dispose() diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs index b55a458..68a7a65 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs @@ -17,25 +17,25 @@ namespace Tizen.Account.AccountManager { /// - /// Enumeration for the state of capability + /// Enumeration for the state of capability. /// /// 3 public enum CapabilityState { /// - /// Account capability is invalid + /// Account capability is invalid. /// /// 3 InvalidState, /// - /// Account capability is disabled + /// Account capability is disabled. /// /// 3 Disabled, /// - /// Account capability is enabled + /// Account capability is enabled. /// /// 3 Enabled @@ -47,19 +47,19 @@ namespace Tizen.Account.AccountManager public enum AccountSecrecyState { /// - /// Account secrecy is invalid + /// Account secrecy is invalid. /// /// 3 InvalidState, /// - /// Account is not visible + /// Account is not visible. /// /// 3 Invisible, /// - /// Account is visible + /// Account is visible. /// /// 3 Visible @@ -72,31 +72,31 @@ namespace Tizen.Account.AccountManager public enum AccountSyncState { /// - /// Account sync is invalid + /// Account sync is invalid. /// /// 3 InvalidState, /// - /// Account sync not supported + /// Account sync not supported. /// /// 3 NotSupported, /// - /// Account sync supported but all synchronization functionalities are off + /// Account sync supported, but all the synchronization functionalities are off. /// /// 3 Off, /// - /// Account sync support and sync status is idle + /// Account sync supported and sync status is idle. /// /// 3 Idle, /// - /// Account sync support and sync status is running + /// Acount sync supported and sync status is running. /// /// 3 Running @@ -109,36 +109,36 @@ namespace Tizen.Account.AccountManager public enum AccountAuthType { /// - /// Auth type is invalid + /// Auth type is invalid. /// /// 3 Invalid, /// - /// XAuth type + /// XAuth type. /// /// 3 XAuth, /// - /// OAuth type + /// OAuth type. /// /// 3 OAuth, /// - /// Client-Login type + /// ClientLogin type. /// /// 3 ClientLogin } /// - /// Account information change notification type + /// Account information change notification types. /// /// 3 /// - /// When the account database is changed, You can distinguish one event type from the other which are set for subscribing notification. + /// When the account database is changed, you can distinguish one event type from the other which are set for subscribing notification. /// public enum AccountNotificationType { diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs index 48f9164..51c31dd 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs @@ -20,7 +20,7 @@ using Tizen; namespace Tizen.Account.AccountManager { /// - /// Enum to give the type of error occured, if any. + /// Enumeration for the types of error occured, if any. /// /// 3 public enum AccountError @@ -42,22 +42,22 @@ namespace Tizen.Account.AccountManager /// 3 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, /// - /// Same user name exists in your application + /// Same user name exists in your application. /// /// 3 Duplcated = -0x01000000 | 0x01, /// - /// Empty Data + /// Empty data. /// /// 3 NoData = Tizen.Internals.Errors.ErrorCode.NoData, /// - /// elated record does not exist + /// Elated record does not exist. /// /// 3 RecordNotFound = -0x01000000 | 0x03, /// - /// Invalid Operation. + /// Invalid operation. /// /// 3 InvalidOperation = Tizen.Internals.Errors.ErrorCode.InvalidOperation, @@ -72,17 +72,17 @@ namespace Tizen.Account.AccountManager /// 3 DBNotOpened = -0x01000000 | 0x05, /// - /// DB query syntax error + /// DB query syntax error. /// /// 3 QuerySyntaxError = -0x01000000 | 0x06, /// - /// Iterator has reached the end + /// Iterator has reached the end. /// /// 3 IteratorEnd = -0x01000000 | 0x07, /// - /// Notification failed + /// Notification failed. /// /// 3 NotificationFailed = -0x01000000 | 0x08, @@ -92,12 +92,12 @@ namespace Tizen.Account.AccountManager /// 3 PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, /// - /// XML parse failed + /// XML parse failed. /// /// 3 XMLParseFailed = -0x01000000 | 0x0a, /// - /// XML File not found + /// XML file not found. /// /// 3 XMLFileNotFound = -0x01000000 | 0x0b, @@ -107,7 +107,7 @@ namespace Tizen.Account.AccountManager /// 3 EventSubscriptionFailed = -0x01000000 | 0x0c, /// - /// Account provider is not registered + /// Account provider is not registered. /// /// 3 ProviderNotRegistered = -0x01000000 | 0x0d, @@ -117,7 +117,7 @@ namespace Tizen.Account.AccountManager /// 3 MultipleNotAllowed = -0x01000000 | 0x0e, /// - /// SQLite busy handler expired + /// SQLite busy handler expired. /// /// 3 DBBusy = -0x01000000 | 0x10 diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs index 606a286..6ad4401 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs @@ -21,7 +21,7 @@ using Tizen.Internals.Errors; namespace Tizen.Account.AccountManager { /// - /// Account Id. + /// The account ID. /// /// 3 public class AccountProvider : IDisposable @@ -50,7 +50,7 @@ namespace Tizen.Account.AccountManager } } /// - /// Account Id. + /// The account ID. /// /// 3 public string AppId @@ -69,7 +69,7 @@ namespace Tizen.Account.AccountManager } /// - /// Serviceprovider Id of the account provider. + /// Serviceprovider ID of the account provider. /// /// 3 public string ServiceProviderId @@ -88,7 +88,7 @@ namespace Tizen.Account.AccountManager } /// - /// Icon path of an account provider. + /// Icon path of the account provider. /// /// 3 public string IconPath @@ -107,7 +107,7 @@ namespace Tizen.Account.AccountManager } /// - /// Small icon path of an account provider. + /// Small icon path of the account provider. /// /// 3 public string SmallIconPath @@ -126,7 +126,7 @@ namespace Tizen.Account.AccountManager } /// - /// Flag for account provider If supports multiple accounts. + /// Flag for the account provider if it supports multiple accounts. /// /// 3 public bool MultipleAccountSupport @@ -150,9 +150,9 @@ namespace Tizen.Account.AccountManager /// 3 /// http://tizen.org/privilege/account.read /// - /// list of capability information. + /// The list of capability information. /// - /// In case of any DB error + /// In case of any DB error. /// In case of privilege not defined. public IEnumerable GetAllCapabilities() { @@ -174,16 +174,16 @@ namespace Tizen.Account.AccountManager } /// - /// Gets the specific label information detail of an account provider. + /// Gets the specific label information detail of the account provider. /// /// 3 /// /// The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code. /// For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English. /// - /// The label text given for the locale + /// The label text given for the locale. /// http://tizen.org/privilege/account.read - /// In case of any DB error or record not found for given locale + /// In case of any DB error or record not found for given locale. /// In case of privilege not defined. public string GetLabel(string locale) { @@ -198,16 +198,16 @@ namespace Tizen.Account.AccountManager } /// - /// Gets the specific label information detail of an account provider. + /// Gets the specific label information detail of the account provider. /// /// 3 /// - /// The application ID to search + /// The application ID to search. /// - /// All the labels information for the given application Id. + /// All the labels information for the given application ID. /// http://tizen.org/privilege/account.read - /// In case of any DB error or record not found for given appid - /// In case of invalid parameter + /// In case of any DB error or record not found for given the application ID. + /// In case of an invalid parameter. /// In case of privilege not defined. public static Dictionary GetLabelsByAppId(string appId) { @@ -229,12 +229,12 @@ namespace Tizen.Account.AccountManager } /// - /// Gets the label information detail of an account provider. + /// Gets the label information detail of the account provider. /// /// 3 /// All the labels information for the given account provider. /// http://tizen.org/privilege/account.read - /// In case of any DB error + /// In case of any DB error. /// In case of privilege not defined. public Dictionary GetLabels() { @@ -262,8 +262,8 @@ namespace Tizen.Account.AccountManager /// The application ID to check. /// returns true If App is supported /// http://tizen.org/privilege/account.read - /// In case of any DB error or record not found for given appid - /// In case of invalid parameter + /// In case of any DB error or record not found for the given application ID. + /// In case of an invalid parameter. /// In case of privilege not defined. public bool IsAppSupported(string appId) { @@ -286,15 +286,15 @@ namespace Tizen.Account.AccountManager /// Checks whether the given application ID supports the capability. /// /// 3 - /// The application Id - /// The capability information + /// The application ID. + /// The capability information. /// /// TRUE if the application supports the given capability, /// otherwise FALSE if the application does not support the given capability /// /// http://tizen.org/privilege/account.read - /// In case of any DB error - /// In case of invalid parameter + /// In case of any DB error. + /// In case of an invalid parameter. /// In case of privilege not defined. public static bool IsFeatureSupportedByApp(string appId, string capability) { @@ -313,14 +313,14 @@ namespace Tizen.Account.AccountManager } /// - /// Retrieves capability information with application ID. + /// Retrieves capability information with the application ID. /// /// 3 - /// application Id + /// The application ID. /// Capability information list for the given appId. /// http://tizen.org/privilege/account.read - /// In case of any DB error or record not found for given appid - /// In case of invalid parameter + /// In case of any DB error or record not found for the given application ID. + /// In case of an invalid parameter. /// In case of privilege not defined. public static IEnumerable GetFeaturesByAppId(string appId) { diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs index fc7cbd4..2626ed7 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs @@ -20,16 +20,16 @@ using System.Collections.Generic; namespace Tizen.Account.AccountManager { /// - /// The AccountManager APIs is separated into two major sections: + /// The AccountManager APIs are separated into two major sections: /// 1. Registering an account provider while an application is installed. This information will be used for the Add account screen. /// 2. Adding an account information when an application signs in successfully to share the account information to the Tizen system. This information will be shown in the Tizen settings account menu. /// /// The APIs of both of the sections consist of the following functionality: /// - /// Create an account or account provider - /// Update an account or account provider(Only available for the creator) - /// Delete an account or account provider(Only available for the creator) - /// Read an account or account provider with some filter + /// Create an account or account provider. + /// Update an account or account provider (Only available for the creator). + /// Delete an account or account provider (Only available for the creator). + /// Read an account or account provider with some filter. /// /// /// 3 @@ -37,66 +37,66 @@ namespace Tizen.Account.AccountManager public static class AccountService { /// - /// This is contact capability string. + /// This is the contact capability string. /// /// 3 public static readonly string ContactCapability = "http://tizen.org/account/capability/contact"; /// - /// This is calendar capability string. + /// This is the calendar capability string. /// /// 3 public static readonly string CalendarCapability = "http://tizen.org/account/capability/calendar"; /// - /// This is email capability string. + /// This is the email capability string. /// /// 3 public static readonly string EmailCapability = "http://tizen.org/account/capability/email"; /// - /// This is photo capability string. + /// This is the photo capability string. /// /// 3 public static readonly string PhotoCapability = "http://tizen.org/account/capability/photo"; /// - /// This is video capability string. + /// This is the video capability string. /// /// 3 public static readonly string VideoCapability = "http://tizen.org/account/capability/video"; /// - /// This is music capability string. + /// This is the music capability string. /// /// 3 public static readonly string MusicCapability = "http://tizen.org/account/capability/music"; /// - /// This is document capability string. + /// This is the document capability string. /// /// 3 public static readonly string DocumentCapability = "http://tizen.org/account/capability/document"; /// - /// This is message capability string. + /// This is the message capability string. /// /// 3 public static readonly string MessageCapability = "http://tizen.org/account/capability/message"; /// - /// This is game capability string. + /// This is the game capability string. /// /// 3 public static readonly string GameCapability = "http://tizen.org/account/capability/game"; /// - /// Retrieves all accounts details from the account database. + /// Retrieves all the accounts details from the account database. /// /// 3 - /// List of Accounts + /// List of accounts. /// http://tizen.org/privilege/account.read - /// In case of any DB error. + /// In case of any DB error. /// In case of privilege not defined. public static IEnumerable GetAccountsAsync() { @@ -126,14 +126,14 @@ namespace Tizen.Account.AccountManager } /// - /// Retrieve an account with the account ID. + /// Retrieves the account with the account ID. /// /// 3 - /// The account Id to be searched. - /// Account instance with reference to the given id. + /// The account ID to be searched. + /// Account instance with reference to the given ID. /// http://tizen.org/privilege/account.read - /// In case of any DB error or record not found for given account id - /// In case of invalid parameter + /// In case of any DB error or record not found for given account ID. + /// In case of an invalid parameter. /// In case of privilege not defined. public static Account GetAccountById(int accountId) { @@ -150,12 +150,12 @@ namespace Tizen.Account.AccountManager } /// - /// Retrieves all AccountProviders details from the account database. + /// Retrieves all the AccountProviders details from the account database. /// /// 3 - /// List of AccountProviders + /// List of AccountProviders. /// http://tizen.org/privilege/account.read - /// In case of any DB error + /// In case of any DB error. /// In case of privilege not defined. public static IEnumerable GetAccountProviders() { @@ -186,14 +186,14 @@ namespace Tizen.Account.AccountManager } /// - /// Retrieves the account provider information with application Id. + /// Retrieves the account provider information with the application ID. /// /// 3 - /// Application Id. - /// The AccountProvider instance associated with the given application Id. + /// The application ID. + /// The AccountProvider instance associated with the given application ID. /// http://tizen.org/privilege/account.read - /// In case of any DB error or record not found for given appid - /// In case of invalid parameter + /// In case of any DB error or record not found for given appid. + /// In case of an invalid parameter. /// In case of privilege not defined. public static AccountProvider GetAccountProviderByAppId(string appId) { @@ -214,10 +214,10 @@ namespace Tizen.Account.AccountManager /// /// 3 /// The capability value to search for account providers. - /// Retrieves AccountProviders information with the capability name. + /// Retrieves the AccountProviders information with the capability name. /// http://tizen.org/privilege/account.read - /// In case of any DB error or record not found for given feature - /// In case of invalid parameter + /// In case of any DB error or record not found for given feature. + /// In case of invalid parameter. /// In case of privilege not defined. public static IEnumerable GetAccountProvidersByFeature(string feature) { @@ -247,14 +247,14 @@ namespace Tizen.Account.AccountManager } /// - /// Inserts into the Database with the new account Infomration. + /// Inserts into the Database with the new account Information. /// /// 3 /// New Account instance to be added. /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write - /// In case of any DB error - /// In case of invalid parameter + /// In case of any DB error. + /// In case of an invalid parameter. /// In case of privilege not defined. /// In case of OutOfMemory error. public static int AddAccount(Account account) @@ -278,11 +278,11 @@ namespace Tizen.Account.AccountManager /// Updates the account details to the account database. /// /// 3 - /// account instance to be updated. + /// Account instance to be updated. /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write - /// In case of any DB error - /// In case of invalid parameter + /// In case of any DB error. + /// In case of an invalid parameter. /// In case of privilege not defined. /// In case of OutOfMemory error. public static void UpdateAccount(Account account) @@ -300,14 +300,14 @@ namespace Tizen.Account.AccountManager } /// - /// Deletes the account information from the Database. + /// Deletes the account information from the database. /// /// 3 /// Account instance to be deleted from the database. /// http://tizen.org/privilege/account.read - /// http://tizen.org/privilege/account.write - /// In case of any DB error - /// In case of invalid parameter + /// http://tizen.org/privilege/account.write + /// In case of any DB error. + /// In case of an invalid parameter. /// In case of privilege not defined. public static void DeleteAccount(Account account) { @@ -324,15 +324,15 @@ namespace Tizen.Account.AccountManager } /// - /// Deletes an account from the account database by user name. + /// Deletes the account from the account database by user name. /// /// 3 /// The user name of the account to delete. /// The package name of the account to delete. /// http://tizen.org/privilege/account.read - /// http://tizen.org/privilege/account.write - /// In case of any DB error - /// In case of invalid parameter + /// http://tizen.org/privilege/account.write + /// In case of any DB error. + /// In case of an invalid parameter. /// In case of privilege not defined. public static void DeleteAccount(string userName, string packageName) { @@ -344,14 +344,14 @@ namespace Tizen.Account.AccountManager } /// - /// Deletes an account from the account database by package name. + /// Deletes the account from the account database by package name. /// /// 3 /// The package name of the account to delete. /// http://tizen.org/privilege/account.read - /// http://tizen.org/privilege/account.write - /// In case of any DB error - /// In case of invalid parameter + /// http://tizen.org/privilege/account.write + /// In case of any DB error. + /// In case of an invalid parameter. /// In case of privilege not defined. public static void DeleteAccount(string packageName) { @@ -364,14 +364,14 @@ namespace Tizen.Account.AccountManager } /// - /// Retrieves all accounts with the given user name. + /// Retrieves all the accounts with the given user name. /// /// 3 - /// The user name to search . - /// Accounts list matched with the user name + /// The user name to search. + /// Accounts list matched with the user name. /// http://tizen.org/privilege/account.read - /// In case of any DB error or record not found for given username - /// In case of invalid parameter + /// In case of any DB error or record not found for given username. + /// In case of an invalid parameter. /// In case of privilege not defined. public static IEnumerable GetAccountsByUserName(string userName) { @@ -401,14 +401,14 @@ namespace Tizen.Account.AccountManager } /// - /// Retrieves all accounts with the given package name. + /// Retrieves all the accounts with the given package name. /// /// 3 - /// The package name to Search - /// Accounts list matched with the package name + /// The package name to search. + /// Accounts list matched with the package name. /// http://tizen.org/privilege/account.read - /// In case of any DB error or record not found for given package name - /// In case of invalid parameter + /// In case of any DB error or record not found for given package name. + /// In case of an invalid parameter. /// In case of privilege not defined. public static IEnumerable GetAccountsByPackageName(string packageName) { @@ -438,14 +438,14 @@ namespace Tizen.Account.AccountManager } /// - /// Retrieves all accounts with the given cpability type. + /// Retrieves all accounts with the given capability type. /// /// 3 - /// Capability type - /// Accounts list matched with the capability type + /// Capability type. + /// Accounts list matched with the capability type. /// http://tizen.org/privilege/account.read - /// In case of any DB error or record not found for given capability type - /// In case of invalid parameter + /// In case of any DB error or record not found for the given capability type. + /// In case of an invalid parameter. /// In case of privilege not defined. public static IEnumerable GetAccountsByCapabilityType(string type) { @@ -475,14 +475,14 @@ namespace Tizen.Account.AccountManager } /// - /// Retrieves all capabilities with the given account + /// Retrieves all the capabilities with the given account. /// /// 3 - /// account instance - /// Capabilities list as Dictionary of Capability type and State. + /// Account instance. + /// Capabilities list as dictionary of the capability type and state. /// http://tizen.org/privilege/account.read - /// In case of any DB error or record not found for given account id - /// In case of invalid parameter + /// In case of any DB error or record not found for given account ID. + /// In case of an invalid parameter. /// In case of privilege not defined. public static Dictionary GetCapabilitiesById(int accountId) { @@ -506,9 +506,9 @@ namespace Tizen.Account.AccountManager /// Gets the count of accounts in the account database. /// /// 3 - /// The number of accounts in the database + /// The number of accounts in the database. /// http://tizen.org/privilege/account.read - /// In case of any DB error + /// In case of any DB error. /// In case of privilege not defined. public static int GetAccountsCount() { @@ -526,12 +526,12 @@ namespace Tizen.Account.AccountManager /// Updates the sync status of the given account. /// /// 3 - /// Account for which sync status needs to be updated + /// Account for which the sync status needs to be updated. /// Sync State /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write - /// In case of any DB error - /// In case of invalid parameter + /// In case of any DB error. + /// In case of an invalid parameter. /// In case of privilege not defined. public static void UpdateSyncStatusById(Account account, AccountSyncState status) { @@ -557,13 +557,13 @@ namespace Tizen.Account.AccountManager /// /// 3 /// - /// ContentUpdate event is triggered if the MediaInformaion updated/deleted or new Inforamtion is Inserted. + /// ContentUpdate event is triggered if the MediaInformaion updated/deleted or new information is inserted. /// /// /// A ContentUpdatedEventArgs object that contains information about the update operation. /// http://tizen.org/privilege/account.read - /// In case of any DB error - /// In case of invalid parameter + /// In case of any DB error. + /// In case of an invalid parameter. /// In case of privilege not defined. public static event EventHandler AccountUpdated { diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs index 153c427..2df2399 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs @@ -19,7 +19,7 @@ using System; namespace Tizen.Account.AccountManager { /// - /// Event arguments passed when Event is triggered to notify that account is updated/removed from the account database. + /// Event arguments passed when the event is triggered to notify that the account is updated/removed from the account database. /// /// 3 public class AccountSubscriberEventArgs : EventArgs @@ -51,7 +51,7 @@ namespace Tizen.Account.AccountManager } /// - /// The account event type + /// The account event type. /// /// 3 public AccountNotificationType EventType @@ -61,7 +61,7 @@ namespace Tizen.Account.AccountManager } /// - /// The account ID to update + /// The account ID to update. /// /// 3 public int AccountId -- 2.7.4 From e13eab5631366b6d77dd8f541023300f76d50108 Mon Sep 17 00:00:00 2001 From: Jooseok Song Date: Mon, 28 Aug 2017 17:36:11 +0900 Subject: [PATCH 13/16] [TCSACR-81][Add] Added new property to get account handle Change-Id: Ia4e308943c99b851b46e3b4561e40abdf620e8fb --- .../Interop/Interop.Account.cs | 69 +++++++++++----------- .../Interop/Interop.AccountService.cs | 7 ++- .../Tizen.Account.AccountManager.csproj | 2 +- .../Tizen.Account.AccountManager/Account.cs | 32 +++++----- .../AccountProvider.cs | 14 +++++ .../Tizen.Account.AccountManager/AccountService.cs | 57 ++++++++++++++---- .../SafeAccountHandle.cs | 63 ++++++++++++++++++++ packaging/csapi-account-manager.spec | 2 +- 8 files changed, 182 insertions(+), 64 deletions(-) create mode 100644 Tizen.Account.AccountManager/Tizen.Account.AccountManager/SafeAccountHandle.cs diff --git a/Tizen.Account.AccountManager/Interop/Interop.Account.cs b/Tizen.Account.AccountManager/Interop/Interop.Account.cs index 25b03e2..90489bc 100644 --- a/Tizen.Account.AccountManager/Interop/Interop.Account.cs +++ b/Tizen.Account.AccountManager/Interop/Interop.Account.cs @@ -30,115 +30,116 @@ internal static partial class Interop internal static partial class Account { [DllImport(Libraries.AccountSvc, EntryPoint = "account_create", CallingConvention = CallingConvention.Cdecl)] - internal static extern int Create(out IntPtr handle); + internal static extern int Create(out SafeAccountHandle handle); + [DllImport(Libraries.AccountSvc, EntryPoint = "account_destroy", CallingConvention = CallingConvention.Cdecl)] internal static extern int Destroy(IntPtr handle); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_account_id", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountId(IntPtr data, out int accountId); + internal static extern int GetAccountId(SafeAccountHandle data, out int accountId); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_name", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountUserName(IntPtr data, out string userName); + internal static extern int GetAccountUserName(SafeAccountHandle data, out string userName); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_name", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountUserName(IntPtr handle, string userName); + internal static extern int SetAccountUserName(SafeAccountHandle handle, string userName); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_display_name", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountDisplayName(IntPtr handle, out string displayName); + internal static extern int GetAccountDisplayName(SafeAccountHandle handle, out string displayName); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_display_name", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountDisplayName(IntPtr handle, string displayName); + internal static extern int SetAccountDisplayName(SafeAccountHandle handle, string displayName); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountCapability(IntPtr handle, string capabilityType, out int capabilityValue); + internal static extern int GetAccountCapability(SafeAccountHandle handle, string capabilityType, out int capabilityValue); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_capability", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountCapability(IntPtr handle, string capabilityType, int capabilityValue); + internal static extern int SetAccountCapability(SafeAccountHandle handle, string capabilityType, int capabilityValue); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_icon_path", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountIconPath(IntPtr handle, out string iconPath); + internal static extern int GetAccountIconPath(SafeAccountHandle handle, out string iconPath); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_icon_path", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountIconPath(IntPtr handle, string iconPath); + internal static extern int SetAccountIconPath(SafeAccountHandle handle, string iconPath); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_domain_name", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountDomainName(IntPtr handle, out string domainName); + internal static extern int GetAccountDomainName(SafeAccountHandle handle, out string domainName); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_domain_name", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountDomainName(IntPtr handle, string domainName); + internal static extern int SetAccountDomainName(SafeAccountHandle handle, string domainName); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_email_address", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountEmail(IntPtr handle, out string email); + internal static extern int GetAccountEmail(SafeAccountHandle handle, out string email); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_email_address", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountEmail(IntPtr handle, string email); + internal static extern int SetAccountEmail(SafeAccountHandle handle, string email); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_package_name", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountPackageName(IntPtr handle, out string name); + internal static extern int GetAccountPackageName(SafeAccountHandle handle, out string name); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_package_name", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountPackageName(IntPtr handle, string name); + internal static extern int SetAccountPackageName(SafeAccountHandle handle, string name); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_access_token", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountAccessToken(IntPtr handle, out string accessToken); + internal static extern int GetAccountAccessToken(SafeAccountHandle handle, out string accessToken); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_access_token", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountAccessToken(IntPtr handle, string accessToken); + internal static extern int SetAccountAccessToken(SafeAccountHandle handle, string accessToken); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_text", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountUserText(IntPtr handle, int index, out string userText); + internal static extern int GetAccountUserText(SafeAccountHandle handle, int index, out string userText); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_text", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountUserText(IntPtr handle, int index, string userText); + internal static extern int SetAccountUserText(SafeAccountHandle handle, int index, string userText); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_int", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountUserInt(IntPtr handle, int index, out int value); + internal static extern int GetAccountUserInt(SafeAccountHandle handle, int index, out int value); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_int", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountUserInt(IntPtr handle, int index, int value); + internal static extern int SetAccountUserInt(SafeAccountHandle handle, int index, int value); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_auth_type", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountAuthType(IntPtr handle, out int authType); + internal static extern int GetAccountAuthType(SafeAccountHandle handle, out int authType); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_auth_type", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountAuthType(IntPtr handle, int authType); + internal static extern int SetAccountAuthType(SafeAccountHandle handle, int authType); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_secret", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountSercet(IntPtr handle, out int secretType); + internal static extern int GetAccountSercet(SafeAccountHandle handle, out int secretType); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_secret", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountSecret(IntPtr handle, int secretType); + internal static extern int SetAccountSecret(SafeAccountHandle handle, int secretType); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_sync_support", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountSyncSupport(IntPtr handle, out int syncType); + internal static extern int GetAccountSyncSupport(SafeAccountHandle handle, out int syncType); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_sync_support", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountSyncSupport(IntPtr handle, int syncType); + internal static extern int SetAccountSyncSupport(SafeAccountHandle handle, int syncType); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_source", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountSource(IntPtr handle, out string source); + internal static extern int GetAccountSource(SafeAccountHandle handle, out string source); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_source", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountSource(IntPtr handle, string source); + internal static extern int SetAccountSource(SafeAccountHandle handle, string source); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAccountCustomValue(IntPtr handle, string key, out string value); + internal static extern int GetAccountCustomValue(SafeAccountHandle handle, string key, out string value); [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_custom", CallingConvention = CallingConvention.Cdecl)] - internal static extern int SetAccountCustomValue(IntPtr handle, string key, string value); + internal static extern int SetAccountCustomValue(SafeAccountHandle handle, string key, string value); [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_sync_status_by_id", CallingConvention = CallingConvention.Cdecl)] internal static extern int UpdateAccountSyncStatusById(int accountId, int status); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability_all")] - internal static extern int GetAllAccountCapabilities(IntPtr handle, AccountCapabilityCallback callback, IntPtr userData); + internal static extern int GetAllAccountCapabilities(SafeAccountHandle handle, AccountCapabilityCallback callback, IntPtr userData); [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_capability_by_account_id")] internal static extern int QueryAccountCapabilityById(AccountCapabilityCallback callback, int accountId, IntPtr userData); [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom_all")] - internal static extern int GetAllAccountCustomValues(IntPtr handle, AccountCustomCallback callback, IntPtr userData); + internal static extern int GetAllAccountCustomValues(SafeAccountHandle handle, AccountCustomCallback callback, IntPtr userData); //Callbacks [UnmanagedFunctionPointer(CallingConvention.Cdecl)] diff --git a/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs b/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs index 581a00d..1995ce0 100644 --- a/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs +++ b/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs @@ -16,6 +16,7 @@ using System; using System.Runtime.InteropServices; +using Tizen.Account.AccountManager; /// /// Interop for Account class APIs. @@ -30,13 +31,13 @@ internal static partial class Interop internal static partial class AccountService { [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_id", CallingConvention = CallingConvention.Cdecl)] - internal static extern int UpdateAccountToDBById(IntPtr handle, int id); + internal static extern int UpdateAccountToDBById(SafeAccountHandle handle, int id); [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_user_name", CallingConvention = CallingConvention.Cdecl)] internal static extern int UpdateAccountToDBByUserName(IntPtr handle, string userName, string packageName); [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_account_id", CallingConvention = CallingConvention.Cdecl)] - internal static extern int QueryAccountById(int accountId, out IntPtr handle); + internal static extern int QueryAccountById(int accountId, ref SafeAccountHandle handle); [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_user_name", CallingConvention = CallingConvention.Cdecl)] internal static extern int QueryAccountByUserName(Interop.Account.AccountCallback callback, string userName, IntPtr userData); @@ -51,7 +52,7 @@ internal static partial class Interop internal static extern int UpdateAccountSyncStatusById(int accoutId, int status); [DllImport(Libraries.AccountSvc, EntryPoint = "account_insert_to_db", CallingConvention = CallingConvention.Cdecl)] - internal static extern int AddAccount(IntPtr handle, out int accountId); + internal static extern int AddAccount(SafeAccountHandle handle, out int accountId); [DllImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_id", CallingConvention = CallingConvention.Cdecl)] internal static extern int DeleteAccountById(int accountId); diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj index d1b0495..44a636e 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj @@ -1,7 +1,7 @@  - 1.0.7 + 1.0.8 Samsung Electronics © Samsung Electronics Co., Ltd All Rights Reserved Account Service APIs for Tizen.Account.AccountManager diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs index d51bd33..498bb84 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs @@ -25,16 +25,18 @@ namespace Tizen.Account.AccountManager /// 3 public class Account : IDisposable { - private IntPtr _handle = IntPtr.Zero; - internal Account(IntPtr handle) + private readonly SafeAccountHandle _handle; + + public Account(SafeAccountHandle handle) { - Handle = handle; + _handle = handle; } ~Account() { Dispose(false); } + /// /// Creates a new account instance. /// @@ -42,7 +44,7 @@ namespace Tizen.Account.AccountManager /// Account Instance. public static Account CreateAccount() { - IntPtr handle; + SafeAccountHandle handle; AccountError err = (AccountError)Interop.Account.Create(out handle); if (err != AccountError.None) { @@ -391,17 +393,17 @@ namespace Tizen.Account.AccountManager } } - internal IntPtr Handle + /// + /// Handle of the account. + /// + /// 4 + /// Account handle. + public SafeAccountHandle SafeAccountHandle { get { return _handle; } - - set - { - _handle = value; - } } /// /// Sets the account capability. @@ -609,10 +611,12 @@ namespace Tizen.Account.AccountManager { if (!disposing) { - if (_handle != IntPtr.Zero) - { - _handle = IntPtr.Zero; - } + //if (_handle != IntPtr.Zero) + //{ + // _handle = IntPtr.Zero; + //} + //_handle.Dispose(); + GC.SuppressFinalize(this); } } } diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs index 6ad4401..ce34491 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs @@ -149,11 +149,13 @@ namespace Tizen.Account.AccountManager /// /// 3 /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// /// The list of capability information. /// /// In case of any DB error. /// In case of privilege not defined. + /// The required feature is not supported. public IEnumerable GetAllCapabilities() { List capabilities = new List(); @@ -183,8 +185,10 @@ namespace Tizen.Account.AccountManager /// /// The label text given for the locale. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error or record not found for given locale. /// In case of privilege not defined. + /// The required feature is not supported. public string GetLabel(string locale) { string label; @@ -206,9 +210,11 @@ namespace Tizen.Account.AccountManager /// /// All the labels information for the given application ID. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error or record not found for given the application ID. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static Dictionary GetLabelsByAppId(string appId) { @@ -234,8 +240,10 @@ namespace Tizen.Account.AccountManager /// 3 /// All the labels information for the given account provider. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error. /// In case of privilege not defined. + /// The required feature is not supported. public Dictionary GetLabels() { @@ -262,9 +270,11 @@ namespace Tizen.Account.AccountManager /// The application ID to check. /// returns true If App is supported /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error or record not found for the given application ID. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public bool IsAppSupported(string appId) { bool isSupported = false; @@ -293,9 +303,11 @@ namespace Tizen.Account.AccountManager /// otherwise FALSE if the application does not support the given capability /// /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static bool IsFeatureSupportedByApp(string appId, string capability) { bool supported = Interop.AccountProvider.IsFeatureSupported(appId, capability); @@ -319,9 +331,11 @@ namespace Tizen.Account.AccountManager /// The application ID. /// Capability information list for the given appId. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error or record not found for the given application ID. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static IEnumerable GetFeaturesByAppId(string appId) { diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs index 2626ed7..d335a8e 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs @@ -96,15 +96,17 @@ namespace Tizen.Account.AccountManager /// 3 /// List of accounts. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error. /// In case of privilege not defined. + /// The required feature is not supported. public static IEnumerable GetAccountsAsync() { List accounts = new List(); List values = new List(); Interop.Account.AccountCallback accountCallback = (IntPtr data, IntPtr userdata) => { - Account account = new Account(data); + Account account = new Account(new SafeAccountHandle(data, true)); values.Add(account.AccountId); account.Dispose(); return true; @@ -132,21 +134,24 @@ namespace Tizen.Account.AccountManager /// The account ID to be searched. /// Account instance with reference to the given ID. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error or record not found for given account ID. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static Account GetAccountById(int accountId) { Account account = Account.CreateAccount(); - IntPtr handle = account.Handle; - AccountError res = (AccountError)Interop.AccountService.QueryAccountById(accountId, out handle); + SafeAccountHandle handle = account.SafeAccountHandle; + + AccountError res = (AccountError)Interop.AccountService.QueryAccountById(accountId, ref handle); if (res != AccountError.None) { throw AccountErrorFactory.CreateException(res, "Failed to get accounts from the database for account id: " + accountId); } - - account.Handle = handle; - return account; + Account ref_account = new Account(handle); + + return ref_account; } /// @@ -155,8 +160,10 @@ namespace Tizen.Account.AccountManager /// 3 /// List of AccountProviders. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error. /// In case of privilege not defined. + /// The required feature is not supported. public static IEnumerable GetAccountProviders() { List values = new List(); @@ -192,9 +199,11 @@ namespace Tizen.Account.AccountManager /// The application ID. /// The AccountProvider instance associated with the given application ID. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error or record not found for given appid. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static AccountProvider GetAccountProviderByAppId(string appId) { IntPtr handle; @@ -216,9 +225,11 @@ namespace Tizen.Account.AccountManager /// The capability value to search for account providers. /// Retrieves the AccountProviders information with the capability name. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error or record not found for given feature. /// In case of invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static IEnumerable GetAccountProvidersByFeature(string feature) { List values = new List(); @@ -253,10 +264,12 @@ namespace Tizen.Account.AccountManager /// New Account instance to be added. /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write + /// http://tizen.org/feature/account /// In case of any DB error. /// In case of an invalid parameter. /// In case of privilege not defined. /// In case of OutOfMemory error. + /// The required feature is not supported. public static int AddAccount(Account account) { if (account == null) @@ -265,7 +278,7 @@ namespace Tizen.Account.AccountManager } int id = -1; - AccountError err = (AccountError)Interop.AccountService.AddAccount(account.Handle, out id); + AccountError err = (AccountError)Interop.AccountService.AddAccount(account.SafeAccountHandle, out id); if (err != AccountError.None) { throw AccountErrorFactory.CreateException(err, "Failed to AddAccount"); @@ -281,10 +294,12 @@ namespace Tizen.Account.AccountManager /// Account instance to be updated. /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write + /// http://tizen.org/feature/account /// In case of any DB error. /// In case of an invalid parameter. /// In case of privilege not defined. /// In case of OutOfMemory error. + /// The required feature is not supported. public static void UpdateAccount(Account account) { if (account == null) @@ -292,7 +307,7 @@ namespace Tizen.Account.AccountManager throw AccountErrorFactory.CreateException(AccountError.InvalidParameter, "Failed to UpdateAccount"); } - AccountError err = (AccountError)Interop.AccountService.UpdateAccountToDBById(account.Handle, account.AccountId); + AccountError err = (AccountError)Interop.AccountService.UpdateAccountToDBById(account.SafeAccountHandle, account.AccountId); if (err != AccountError.None) { throw AccountErrorFactory.CreateException(err, "Failed to UpdateAccount"); @@ -306,9 +321,11 @@ namespace Tizen.Account.AccountManager /// Account instance to be deleted from the database. /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write + /// http://tizen.org/feature/account /// In case of any DB error. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static void DeleteAccount(Account account) { if (account == null) @@ -331,9 +348,11 @@ namespace Tizen.Account.AccountManager /// The package name of the account to delete. /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write + /// http://tizen.org/feature/account /// In case of any DB error. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static void DeleteAccount(string userName, string packageName) { AccountError err = (AccountError)Interop.AccountService.DeleteAccountByUser(userName, packageName); @@ -350,9 +369,11 @@ namespace Tizen.Account.AccountManager /// The package name of the account to delete. /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write + /// http://tizen.org/feature/account /// In case of any DB error. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static void DeleteAccount(string packageName) { AccountError err = (AccountError)Interop.AccountService.DeleteAccountByPackage(packageName); @@ -370,16 +391,18 @@ namespace Tizen.Account.AccountManager /// The user name to search. /// Accounts list matched with the user name. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error or record not found for given username. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static IEnumerable GetAccountsByUserName(string userName) { List accounts = new List(); List values = new List(); Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) => { - Account account = new Account(handle); + Account account = new Account(new SafeAccountHandle(handle, true)); values.Add(account.AccountId); account.Dispose(); return true; @@ -407,16 +430,18 @@ namespace Tizen.Account.AccountManager /// The package name to search. /// Accounts list matched with the package name. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error or record not found for given package name. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static IEnumerable GetAccountsByPackageName(string packageName) { List accounts = new List(); List values = new List(); Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) => { - Account account = new Account(handle); + Account account = new Account(new SafeAccountHandle(handle, true)); values.Add(account.AccountId); account.Dispose(); return true; @@ -444,16 +469,18 @@ namespace Tizen.Account.AccountManager /// Capability type. /// Accounts list matched with the capability type. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error or record not found for the given capability type. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static IEnumerable GetAccountsByCapabilityType(string type) { List accounts = new List(); List values = new List(); Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) => { - Account account = new Account(handle); + Account account = new Account(new SafeAccountHandle(handle, true)); values.Add(account.AccountId); account.Dispose(); return true; @@ -481,9 +508,11 @@ namespace Tizen.Account.AccountManager /// Account instance. /// Capabilities list as dictionary of the capability type and state. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error or record not found for given account ID. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static Dictionary GetCapabilitiesById(int accountId) { Dictionary capabilities = new Dictionary(); @@ -508,8 +537,10 @@ namespace Tizen.Account.AccountManager /// 3 /// The number of accounts in the database. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error. /// In case of privilege not defined. + /// The required feature is not supported. public static int GetAccountsCount() { int count = 0; @@ -530,9 +561,11 @@ namespace Tizen.Account.AccountManager /// Sync State /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write + /// http://tizen.org/feature/account /// In case of any DB error. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static void UpdateSyncStatusById(Account account, AccountSyncState status) { AccountError err = (AccountError)Interop.AccountService.UpdateAccountSyncStatusById(account.AccountId, (int)status); @@ -562,9 +595,11 @@ namespace Tizen.Account.AccountManager /// /// A ContentUpdatedEventArgs object that contains information about the update operation. /// http://tizen.org/privilege/account.read + /// http://tizen.org/feature/account /// In case of any DB error. /// In case of an invalid parameter. /// In case of privilege not defined. + /// The required feature is not supported. public static event EventHandler AccountUpdated { add diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/SafeAccountHandle.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/SafeAccountHandle.cs new file mode 100644 index 0000000..a27d0ce --- /dev/null +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/SafeAccountHandle.cs @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Account.AccountManager +{ + /// + /// Represents a wrapper class for a unmanaged Account handle. + /// + public sealed class SafeAccountHandle : SafeHandle + { + /// + /// Initializes a new instance of the SafeAppControlHandle class. + /// + public SafeAccountHandle() : base(IntPtr.Zero, true) + { + } + + /// + /// Initializes a new instance of the SafeAccountHandle class. + /// + /// An IntPtr object that represents the pre-existing handle to use. + /// true to reliably release the handle during the finalization phase; false to prevent reliable release. + public SafeAccountHandle(IntPtr existingHandle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle) + { + SetHandle(existingHandle); + } + + /// + /// Gets a value that indicates whether the handle is invalid. + /// + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + /// + /// When overridden in a derived class, executes the code required to free the handle. + /// + /// true if the handle is released successfully + protected override bool ReleaseHandle() + { + this.SetHandle(IntPtr.Zero); + return true; + } + } +} diff --git a/packaging/csapi-account-manager.spec b/packaging/csapi-account-manager.spec index 3363fe2..c744d67 100644 --- a/packaging/csapi-account-manager.spec +++ b/packaging/csapi-account-manager.spec @@ -1,6 +1,6 @@ Name: csapi-account-manager Summary: Tizen account manager API for C# -Version: 1.0.7 +Version: 1.0.8 Release: 1 Group: Development/Libraries License: Apache-2.0 -- 2.7.4 From 3b942349f3d4b553c43ba0ed6335282aa2fb61fc Mon Sep 17 00:00:00 2001 From: Jooseok Song Date: Fri, 1 Sep 2017 14:02:57 +0900 Subject: [PATCH 14/16] Fix dispose and wrong statement in comment Change-Id: Icc78198e2cd841c137e9cfbf6adbe2ebdc726086 --- .../Tizen.Account.AccountManager/Account.cs | 14 +++++++------- .../Tizen.Account.AccountManager/AccountEnums.cs | 2 +- .../Tizen.Account.AccountManager/AccountErrorFactory.cs | 4 ++-- .../Tizen.Account.AccountManager/AccountProvider.cs | 4 ++-- .../Tizen.Account.AccountManager/AccountService.cs | 7 ++++--- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs index 498bb84..2a09e98 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs @@ -27,6 +27,11 @@ namespace Tizen.Account.AccountManager { private readonly SafeAccountHandle _handle; + /// + /// Account constructor. + /// + /// 4 + /// The account handle. public Account(SafeAccountHandle handle) { _handle = handle; @@ -607,16 +612,11 @@ namespace Tizen.Account.AccountManager GC.SuppressFinalize(this); } - private void Dispose(bool disposing) + protected virtual void Dispose(bool disposing) { if (!disposing) { - //if (_handle != IntPtr.Zero) - //{ - // _handle = IntPtr.Zero; - //} - //_handle.Dispose(); - GC.SuppressFinalize(this); + _handle.Dispose(); } } } diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs index 68a7a65..53942e0 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs @@ -96,7 +96,7 @@ namespace Tizen.Account.AccountManager Idle, /// - /// Acount sync supported and sync status is running. + /// Account sync supported and sync status is running. /// /// 3 Running diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs index 51c31dd..f23c792 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs @@ -20,7 +20,7 @@ using Tizen; namespace Tizen.Account.AccountManager { /// - /// Enumeration for the types of error occured, if any. + /// Enumeration for the types of error occurred, if any. /// /// 3 public enum AccountError @@ -45,7 +45,7 @@ namespace Tizen.Account.AccountManager /// Same user name exists in your application. /// /// 3 - Duplcated = -0x01000000 | 0x01, + Duplicated = -0x01000000 | 0x01, /// /// Empty data. /// diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs index ce34491..be9e077 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs @@ -69,7 +69,7 @@ namespace Tizen.Account.AccountManager } /// - /// Serviceprovider ID of the account provider. + /// ServiceProvider ID of the account provider. /// /// 3 public string ServiceProviderId @@ -365,7 +365,7 @@ namespace Tizen.Account.AccountManager GC.SuppressFinalize(this); } - private void Dispose(bool disposing) + protected virtual void Dispose(bool disposing) { if (!disposing) { diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs index d335a8e..8ebab51 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs @@ -200,7 +200,7 @@ namespace Tizen.Account.AccountManager /// The AccountProvider instance associated with the given application ID. /// http://tizen.org/privilege/account.read /// http://tizen.org/feature/account - /// In case of any DB error or record not found for given appid. + /// In case of any DB error or record not found for given appId. /// In case of an invalid parameter. /// In case of privilege not defined. /// The required feature is not supported. @@ -262,6 +262,7 @@ namespace Tizen.Account.AccountManager /// /// 3 /// New Account instance to be added. + /// The account ID of the account instance. /// http://tizen.org/privilege/account.read /// http://tizen.org/privilege/account.write /// http://tizen.org/feature/account @@ -590,9 +591,9 @@ namespace Tizen.Account.AccountManager /// /// 3 /// - /// ContentUpdate event is triggered if the MediaInformaion updated/deleted or new information is inserted. + /// ContentUpdate event is triggered if the MediaInformation updated/deleted or new information is inserted. /// - /// + /// An object that contains information about sender /// A ContentUpdatedEventArgs object that contains information about the update operation. /// http://tizen.org/privilege/account.read /// http://tizen.org/feature/account -- 2.7.4 From 80f6669a2d143bf9938469bdf0a68bf87faf7e70 Mon Sep 17 00:00:00 2001 From: Jooseok Song Date: Tue, 12 Sep 2017 20:46:02 +0900 Subject: [PATCH 15/16] Fix build warning Change-Id: I0da5433d08faeee9d247a6ab8c702430a1cca34b --- Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj | 2 +- .../Tizen.Account.AccountManager/AccountService.cs | 2 -- packaging/csapi-account-manager.spec | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj index 44a636e..77ba091 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj @@ -1,7 +1,7 @@  - 1.0.8 + 1.0.9 Samsung Electronics © Samsung Electronics Co., Ltd All Rights Reserved Account Service APIs for Tizen.Account.AccountManager diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs index 8ebab51..9e5193c 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs @@ -593,8 +593,6 @@ namespace Tizen.Account.AccountManager /// /// ContentUpdate event is triggered if the MediaInformation updated/deleted or new information is inserted. /// - /// An object that contains information about sender - /// A ContentUpdatedEventArgs object that contains information about the update operation. /// http://tizen.org/privilege/account.read /// http://tizen.org/feature/account /// In case of any DB error. diff --git a/packaging/csapi-account-manager.spec b/packaging/csapi-account-manager.spec index c744d67..6fa75fc 100644 --- a/packaging/csapi-account-manager.spec +++ b/packaging/csapi-account-manager.spec @@ -1,6 +1,6 @@ Name: csapi-account-manager Summary: Tizen account manager API for C# -Version: 1.0.8 +Version: 1.0.9 Release: 1 Group: Development/Libraries License: Apache-2.0 -- 2.7.4 From d6bb74154b16eed18c60d8462573238f13382bbb Mon Sep 17 00:00:00 2001 From: Jooseok Song Date: Thu, 28 Sep 2017 14:41:05 +0900 Subject: [PATCH 16/16] Removce warning for xml Change-Id: I72933b886799ed2a0db088bbf3d748462cfa80c2 --- .../Tizen.Account.AccountManager/Account.cs | 9 +++++++++ .../Tizen.Account.AccountManager/AccountProvider.cs | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs index 2a09e98..aba18ba 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs @@ -37,6 +37,10 @@ namespace Tizen.Account.AccountManager _handle = handle; } + /// + /// Account destructor. + /// + /// 4 ~Account() { Dispose(false); @@ -612,6 +616,11 @@ namespace Tizen.Account.AccountManager GC.SuppressFinalize(this); } + /// + /// Dispose API for destroying the account handle. + /// + /// 3 + /// The boolean value for destoying account handle. protected virtual void Dispose(bool disposing) { if (!disposing) diff --git a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs index be9e077..a580322 100644 --- a/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs +++ b/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs @@ -27,11 +27,21 @@ namespace Tizen.Account.AccountManager public class AccountProvider : IDisposable { internal IntPtr _handle; + + /// + /// AccountProvider destructor. + /// + /// 3 + /// The account handle. internal AccountProvider(IntPtr handle) { Handle = handle; } + /// + /// AccountProvider deconstructor. + /// + /// 3 ~AccountProvider() { Dispose(false); @@ -365,6 +375,11 @@ namespace Tizen.Account.AccountManager GC.SuppressFinalize(this); } + /// + /// Dispose API for destroying the AccountProvider handle. + /// + /// 3 + /// The boolean value for destoying AccountProvider handle. protected virtual void Dispose(bool disposing) { if (!disposing) -- 2.7.4