diff options
author | Alexander <akutsan@luxoft.com> | 2018-06-16 20:44:20 +0300 |
---|---|---|
committer | Ira Lytvynenko (GitHub) <ILytvynenko@luxoft.com> | 2018-06-26 12:01:48 +0300 |
commit | fb5f5edd793ebe353c91df91950f76816b5f200c (patch) | |
tree | 019ec1e7db4e983a613e07ba308d6d3870195367 /src/components/application_manager/src | |
parent | f86f1829ed1fc41d6bf1fc9a5203d637b80255cb (diff) | |
download | sdl_core-fb5f5edd793ebe353c91df91950f76816b5f200c.tar.gz |
Move using functions for clear subscriptions to plugin
Diffstat (limited to 'src/components/application_manager/src')
-rw-r--r-- | src/components/application_manager/src/helpers/application_helper.cc | 20 | ||||
-rw-r--r-- | src/components/application_manager/src/message_helper/message_helper.cc | 34 |
2 files changed, 5 insertions, 49 deletions
diff --git a/src/components/application_manager/src/helpers/application_helper.cc b/src/components/application_manager/src/helpers/application_helper.cc index 16b49faa2a..bfe6b15930 100644 --- a/src/components/application_manager/src/helpers/application_helper.cc +++ b/src/components/application_manager/src/helpers/application_helper.cc @@ -87,20 +87,6 @@ void DeleteButtonSubscriptions(ApplicationSharedPtr app, } } -void DeleteVISubscriptions(ApplicationSharedPtr app, - ApplicationManager& app_manager) { - VehicleInfoSubscriptions ivi = app->SubscribedIVI().GetData(); - - for (auto i : ivi) { - app->UnsubscribeFromIVI(i); - SubscribedToIVIPredicate p(i); - auto app = FindApp(app_manager.applications(), p); - if (!app) { - MessageHelper::SendUnsubscribeIVIRequest(i, app, app_manager); - } - } -} - void CleanupAppFiles(ApplicationSharedPtr app) { const auto icon_file = app->app_icon_path(); @@ -139,8 +125,12 @@ void DeleteApplicationData(ApplicationSharedPtr app, DeleteChoiceSets(app, app_manager); DeleteGlobalProperties(app, app_manager); DeleteButtonSubscriptions(app, app_manager); - DeleteVISubscriptions(app, app_manager); CleanupAppFiles(app); + app_manager.GetPluginManager().ForEachPlugin( + [&app](plugin_manager::RPCPlugin& plugin) { + plugin.OnApplicationEvent( + plugin_manager::ApplicationEvent::kDeleteApplicationData, app); + }); } } // namespace application_manager diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 42a235a991..972ca812d0 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -637,40 +637,6 @@ void MessageHelper::SendUnsubscribeButtonNotification( app_mngr.GetRPCService().ManageHMICommand(message); } -void MessageHelper::SendUnsubscribeIVIRequest(int32_t ivi_id, - ApplicationSharedPtr application, - ApplicationManager& app_mngr) { - using namespace smart_objects; - - std::string key_name; - for (auto item : vehicle_data_) { - if (ivi_id == item.second) { - key_name = item.first; - break; - } - } - - if (key_name.empty()) { - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[key_name] = true; - - SmartObjectSPtr message = CreateMessageForHMI( - hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); - DCHECK(message); - - SmartObject& object = *message; - object[strings::params][strings::function_id] = - hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData; - - object[strings::msg_params] = msg_params; - - app_mngr.GetRPCService().ManageHMICommand(message); -} - const VehicleData& MessageHelper::vehicle_data() { return vehicle_data_; } |