diff options
author | JackLivio <jack@livio.io> | 2018-05-03 15:15:08 -0400 |
---|---|---|
committer | JackLivio <jack@livio.io> | 2018-05-03 15:15:08 -0400 |
commit | 6d5271c700975ed5bdeda486844356cb03aaedc5 (patch) | |
tree | 1744bf4a202314fd8502093c3bf0f8d2f60d498e /src | |
parent | c1b4b3ac89d94c2d623f7df4b016aa2bab5f24ff (diff) | |
download | sdl_core-6d5271c700975ed5bdeda486844356cb03aaedc5.tar.gz |
Style & Review Commentsfeature/0147_template_color_schemes
Diffstat (limited to 'src')
3 files changed, 24 insertions, 36 deletions
diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc index ba6bba8054..648a531e92 100644 --- a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc @@ -61,7 +61,6 @@ void SetDisplayLayoutRequest::Run() { std::string old_layout = app->display_layout(); std::string new_layout = ""; - bool allow_color_change = true; if (msg_params.keyExists(strings::display_layout)) { new_layout = msg_params[strings::display_layout].asString(); @@ -76,46 +75,37 @@ void SetDisplayLayoutRequest::Run() { LOG4CXX_DEBUG(logger_, "SetDisplayLayoutRequest No Layout Change"); // Template layout is the same as previous layout // Reject message if colors are set - if ((msg_params.keyExists(strings::day_color_scheme) && - app->day_color_scheme() != NULL)) { - if (!(msg_params[strings::day_color_scheme] == - *(app->day_color_scheme()))) { - // Color scheme param exists and has been previously set, do not allow - // color change - LOG4CXX_DEBUG(logger_, "Reject Day Color Scheme Change"); - allow_color_change = false; - } + if (msg_params.keyExists(strings::day_color_scheme) && + app->day_color_scheme() != NULL && + !(msg_params[strings::day_color_scheme] == + *(app->day_color_scheme()))) { + // Color scheme param exists and has been previously set, do not allow + // color change + LOG4CXX_DEBUG(logger_, "Reject Day Color Scheme Change"); + SendResponse(false, mobile_apis::Result::REJECTED); + return; } - if ((msg_params.keyExists(strings::night_color_scheme) && - app->night_color_scheme() != NULL)) { - if (!(msg_params[strings::night_color_scheme] == - *(app->night_color_scheme()))) { - // Color scheme param exists and has been previously set, do not allow - // color change - LOG4CXX_DEBUG(logger_, "Reject Night Color Scheme Change"); - allow_color_change = false; - } + if (msg_params.keyExists(strings::night_color_scheme) && + app->night_color_scheme() != NULL && + !(msg_params[strings::night_color_scheme] == + *(app->night_color_scheme()))) { + // Color scheme param exists and has been previously set, do not allow + // color change + LOG4CXX_DEBUG(logger_, "Reject Night Color Scheme Change"); + SendResponse(false, mobile_apis::Result::REJECTED); + return; } } if (msg_params.keyExists(strings::day_color_scheme)) { - if (allow_color_change) { - LOG4CXX_DEBUG(logger_, "Allow Day Color Scheme Change"); - app->set_day_color_scheme(msg_params[strings::day_color_scheme]); - } + LOG4CXX_DEBUG(logger_, "Allow Day Color Scheme Change"); + app->set_day_color_scheme(msg_params[strings::day_color_scheme]); } if (msg_params.keyExists(strings::night_color_scheme)) { - if (allow_color_change) { - LOG4CXX_DEBUG(logger_, "Allow Night Color Scheme Change"); - app->set_night_color_scheme(msg_params[strings::night_color_scheme]); - } - } - - if (!allow_color_change) { - SendResponse(false, mobile_apis::Result::REJECTED); - return; + LOG4CXX_DEBUG(logger_, "Allow Night Color Scheme Change"); + app->set_night_color_scheme(msg_params[strings::night_color_scheme]); } (*message_)[strings::msg_params][strings::app_id] = app->app_id(); diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h index 65c2057476..c46a0b994f 100644 --- a/src/components/application_manager/test/include/application_manager/mock_application.h +++ b/src/components/application_manager/test/include/application_manager/mock_application.h @@ -239,8 +239,7 @@ class MockApplication : public ::application_manager::Application { void(const smart_objects::SmartObject& color_scheme)); MOCK_METHOD1(set_night_color_scheme, void(const smart_objects::SmartObject& color_scheme)); - MOCK_METHOD1(set_display_layout, - void(const std::string& layout)); + MOCK_METHOD1(set_display_layout, void(const std::string& layout)); MOCK_CONST_METHOD0(audio_stream_retry_number, uint32_t()); MOCK_METHOD1(set_audio_stream_retry_number, void(const uint32_t& audio_stream_retry_number)); diff --git a/src/components/remote_control/test/include/mock_application.h b/src/components/remote_control/test/include/mock_application.h index 0eef0edbf9..ef7c1d63a7 100644 --- a/src/components/remote_control/test/include/mock_application.h +++ b/src/components/remote_control/test/include/mock_application.h @@ -246,8 +246,7 @@ class MockApplication : public ::application_manager::Application { void(const smart_objects::SmartObject& color_scheme)); MOCK_METHOD1(set_night_color_scheme, void(const smart_objects::SmartObject& color_scheme)); - MOCK_METHOD1(set_display_layout, - void(const std::string& layout)); + MOCK_METHOD1(set_display_layout, void(const std::string& layout)); MOCK_CONST_METHOD0(audio_stream_retry_number, uint32_t()); MOCK_METHOD1(set_audio_stream_retry_number, void(const uint32_t& audio_stream_retry_number)); |