[messaging] Remove MessageFolder(json) constructor. 51/219751/4
authorMichal Michalski <m.michalski2@partner.samsung.com>
Mon, 9 Dec 2019 14:14:07 +0000 (15:14 +0100)
committerMichal Michalski <m.michalski2@partner.samsung.com>
Tue, 10 Dec 2019 13:50:42 +0000 (14:50 +0100)
Last step before removing MessageFolder class completely.

[Verification] tct-messaging-*-tizen-tests 100% pass.

Signed-off-by: Michal Michalski <m.michalski2@partner.samsung.com>
Change-Id: I2fc451d80c1cdc2b9b1d0fc2e77d020eb1870e36

src/messaging/DBus/MessageProxy.cpp
src/messaging/message_folder.cc
src/messaging/message_folder.h
src/messaging/messaging_instance.cc
src/messaging/messaging_native.cc

index eb6ac72..25fe9e6 100644 (file)
@@ -252,8 +252,8 @@ PlatformResult MessageProxy::handleMailboxEvent(int account_id, int mailbox_id,
   eventFolder->service_type = MessageType::EMAIL;
   eventFolder->service_id = account_id;
 
-  auto jsonFolder = createMessageFolder(std::to_string(mailbox_id));
-  auto folder = std::make_shared<MessageFolder>(jsonFolder);
+  auto folder = std::make_shared<MessageFolder>();
+  folder->attributes = createMessageFolder(std::to_string(mailbox_id)).get<picojson::object>();
 
   if (event != NOTI_MAILBOX_DELETE) {
     auto ret = native::EmailGetMailboxById(mailbox_id, *folder);
index 8f19ea1..b2e7cc7 100644 (file)
@@ -53,11 +53,6 @@ picojson::value createMessageFolder(const std::string& id, const std::string& na
   return json;
 }
 
-MessageFolder::MessageFolder(const picojson::value& json) {
-  ScopeLogger("from json");
-  attributes = json.get<picojson::object>();
-}
-
 FolderPtrVector filterFolders(tizen::AbstractFilterPtr filter,
                               const FolderPtrVector& source_folders) {
   ScopeLogger();
index 5dda3a6..5932617 100644 (file)
@@ -46,7 +46,6 @@ picojson::value createMessageFolder(const std::string& id, const std::string& na
                                     const std::string& parent_id = "");
 
 struct MessageFolder {
-  MessageFolder(const picojson::value& json);
   picojson::object attributes;
 };
 
index 1b4c291..cbc3be2 100644 (file)
@@ -345,7 +345,9 @@ void MessagingInstance::MessageServiceSyncFolder(const picojson::value& args,
 
   SyncFolderCallbackData* callback = new SyncFolderCallbackData(queue_, callbackId, *this);
   callback->setAccountId(id);
-  callback->setMessageFolder(std::make_shared<MessageFolder>(v_folder));
+  auto folder_ptr = std::make_shared<MessageFolder>();
+  folder_ptr->attributes = v_folder.get<picojson::object>();
+  callback->setMessageFolder(folder_ptr);
   callback->setLimit(limit);
 
   callback->AddToQueue();
index d8aeebf..25c455c 100644 (file)
@@ -87,8 +87,9 @@ PlatformResult EmailGetMailboxList(int account_id, std::vector<MessageFolder>& f
   }
 
   for (int i = 0; i < count; ++i) {
-    auto json = ConvertMailboxToJson(mailboxes[i]);
-    folders.push_back(MessageFolder(json));
+    MessageFolder folder;
+    folder.attributes = ConvertMailboxToJson(mailboxes[i]).get<picojson::object>();
+    folders.push_back(folder);
   }
 
   return PlatformResult();
@@ -103,7 +104,7 @@ PlatformResult EmailGetMailboxById(int mailbox_id, MessageFolder& folder) {
     return PlatformResult(ErrorCode::UNKNOWN_ERR, "email_get_mailbox_by_mailbox_id() failed.");
   }
 
-  folder = MessageFolder(ConvertMailboxToJson(*mailbox));
+  folder.attributes = ConvertMailboxToJson(*mailbox).get<picojson::object>();
   if (EMAIL_ERROR_NONE != email_free_mailbox(&mailbox, 1)) {
     LoggerW("Calling email_free_mailbox() failed.");
   }