fixed assign logic for SyncJobName
[platform/core/csapi/tizenfx.git] / src / Tizen.Account.SyncManager / Tizen.Account.SyncManager / SyncAdapter.cs
index 8a59593..01d45a6 100755 (executable)
@@ -21,31 +21,35 @@ using Tizen.Account.AccountManager;
 namespace Tizen.Account.SyncManager
 {
     /// <summary>
-    /// The class contains the delegates to be called upon scheduling a sync operation
+    /// This class contains the delegates to be called upon scheduling a sync operation.
     /// </summary>
+    /// <since_tizen> 4 </since_tizen>
     public class SyncAdapter
     {
         Interop.Adapter.SyncAdapterStartSyncCallback _startSyncCallback;
         Interop.Adapter.SyncAdapterCancelSyncCallback _cancelSyncCallback;
 
         /// <summary>
-        /// Callback function for Sync Adapter's start sync request
+        /// The callback function for the sync adapter's start sync request.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="syncParameters"> The sync job parameters corresponding to the sync request. </param>
-        /// <returns> true if sync operation is success, @c false otherwise. </returns>
+        /// <returns> true if the sync operation is success, @c false otherwise. </returns>
         public delegate bool StartSyncCallback(SyncJobData syncParameters);
 
         /// <summary>
-        /// Callback function for Sync Adapter's cancel sync request.
+        /// The callback function for the sync adapter's cancel sync request.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="syncParameters"> The sync job parameters corresponding to the sync request. </param>
         public delegate void CancelSyncCallback(SyncJobData syncParameters);
 
         /// <summary>
-        /// Sets client (Sync Adapter) callback functions
+        /// Sets the client (sync adapter) callback functions.
         /// </summary>
-        /// <param name="startSyncCb"> A callback function to be called by Sync Manager for performing sync operation. </param>
-        /// <param name="cancelSyncCb"> A callback function to be called by Sync Manager for cancelling sync operation. </param>
+        /// <since_tizen> 4 </since_tizen>
+        /// <param name="startSyncCb"> A callback function to be called by the sync manager for performing the sync operation. </param>
+        /// <param name="cancelSyncCb"> A callback function to be called by the sync manager for cancelling the sync operation. </param>
         /// <exception cref="ArgumentNullException"> Thrown when any of the arguments are null. </exception>
         /// <exception cref="InvalidOperationException"> Thrown when the application calling this API cannot be a sync adapter. </exception>
         public void SetSyncEventCallbacks(StartSyncCallback startSyncCb, CancelSyncCallback cancelSyncCb)
@@ -62,12 +66,14 @@ namespace Tizen.Account.SyncManager
                 AccountManager.Account account = new AccountManager.Account(new SafeAccountHandle(accountHandle, true));
                 Bundle bundle = new Bundle(new SafeBundleHandle(syncJobUserData, true));
 
-                SyncJobData syncJobData = new SyncJobData()
-                {
-                    Account = account,
-                    SyncJobName = syncJobName,
-                    UserData = bundle
-                };
+                SyncJobData syncJobData = new SyncJobData();
+                syncJobData.Account = account;
+                if (syncJobName == null)
+                    syncJobData.SyncJobName = syncCapability;
+                else
+                    syncJobData.SyncJobName = syncJobName;
+                syncJobData.UserData = bundle;
+
 
                 return startSyncCb(syncJobData);
             };
@@ -79,12 +85,13 @@ namespace Tizen.Account.SyncManager
                 AccountManager.Account account = new AccountManager.Account(new SafeAccountHandle(accountHandle, true));
                 Bundle bundle = new Bundle(new SafeBundleHandle(syncJobUserData, true));
 
-                SyncJobData syncJobData = new SyncJobData()
-                {
-                    Account = account,
-                    SyncJobName = syncJobName,
-                    UserData = bundle
-                };
+                SyncJobData syncJobData = new SyncJobData();
+                syncJobData.Account = account;
+                if (syncJobName == null)
+                    syncJobData.SyncJobName = syncCapability;
+                else
+                    syncJobData.SyncJobName = syncJobName;
+                syncJobData.UserData = bundle;
 
                 cancelSyncCb(syncJobData);
             };
@@ -98,8 +105,9 @@ namespace Tizen.Account.SyncManager
         }
 
         /// <summary>
-        /// Unsets client (Sync Adapter) callback functions
+        /// Unsets the client (sync adapter) callback functions.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <exception cref="System.Exception"> Thrown when sync manager internal error occurs. </exception>
         public void UnsetSyncEventCallbacks()
         {