return true;
}
+size_t PrivaciesSequence::size() {
+ return m_privacies.size();
+}
+
} // namespace Notification
} // namespace AskUser
*/
void rewind();
+ /*
+ * Returns Privacies count
+ */
+ size_t size();
+
virtual ~PrivaciesSequence() {}
private:
typedef std::vector<Privacy> PrivacyVector;
/*
- * Copyright (c) 2017 Samsung Electronics Co.
+ * Copyright (c) 2017 - 2018 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @file src/agent/notification-daemon/event/Event.h
* @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @author Ernest Borowski <e.borowski@partner.samsung.com>
* @brief Declaration of main loop Event classes
*/
class EventPopupCheck : public IUIEvent {
public:
EventPopupCheck(Popupper *popupper, const std::string &pkgId, const std::string &privacy)
- : IUIEvent(popupper), m_pkgId(pkgId), m_privacy(privacy)
- {}
+ : IUIEvent(popupper), m_pkgId(pkgId)
+ {
+ //TODO: change in final commit to m_privacy(privacy)
+ m_privacy.push_back(privacy);
+ }
virtual void process() {
m_popupper->popupCheck(m_pkgId, m_privacy);
}
private:
std::string m_pkgId;
- std::string m_privacy;
+ std::vector<std::string> m_privacy;
};
} //namespace AskUser
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2018 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.
*
*/
+ #define DBG(name, r, g, b, a) \
+ part { \
+ scale: 1; \
+ type: RECT; \
+ desc { state: "default" 0.0; \
+ color: r g b a; \
+ visible: 1; \
+ rel1.relative: 0.0 0.0; \
+ rel1.to: name; \
+ rel2.relative: 1.0 1.0; \
+ rel2.to: name; \
+ } \
+ } \
+
collections {
base_scale: 1.3;
-//Height = 480 - (2 + 83 + 68)
-group { name: "popup_checkview_internal";
- parts {
- part { name: "label";
- scale: 1;
- type: SWALLOW;
- description { state: "default" 0.0;
- fixed: 1 0;
- rel2 {
- relative: 1.0 0.0;
- to_y: "end_field";
- }
- }
- }
- part { name: "bottom_pad";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- align: 0.0 1.0;
- min: 0 4;
- fixed: 0 1;
- rel1.relative: 0.0 1.0;
- }
- }
- part { name: "pad_b";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- align: 0.0 1.0;
- min: 0 90;
- fixed: 0 1;
- rel1 {
- relative: 0.0 0.0;
- to: "bottom_pad";
- }
- rel2 {
- relative: 1.0 0.0;
- to: "bottom_pad";
- }
- }
- }
- part { name: "left_pad";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- fixed: 1 0;
- min: 16 0;
- rel1 {
- relative: 0.0 0.0;
+//Height = 480 - (2 + 83 + 68) font_size=20
+styles {
+ style {
+ name: "small_text_style";
+ base: "font=default color=#ffffffff font_size=20 align=center valign=center wrap=mixed";
+ }
+}
+
+group { name: "popup_checkview_internal"; //wearable
+ parts {
+ part { name: "label"; // text: Allow ... priv_name
+ scale: 1;
+ type: TEXTBLOCK;
+ desc { state: "default" 0.0;
+ visible: 1;
+ align: 0.5 0.5;
+ rel1.relative: 1.0 0.0;
+ rel1.to_x: "left_pad";
+ rel2.relative: 0.0 0.0;
+ rel2.to_x: "right_pad";
+ rel2.to_y: "elm.swallow.end";
+ rel2.offset: 0 0;
+ max: -1 210;
+ text {
+ style: "small_text_style";
+ fit: 0 1;
+ }
}
- rel2 {
- relative: 0.0 1.0;
+ }
+
+ part { name: "elm.swallow.end"; //checkbox
+ scale: 1;
+ type: SWALLOW;
+ desc { state: "default" 0.0;
+ align: 0.5 0.5;
+ rel1.relative: 1.0 0.0;
+ rel1.to_x: "left_pad";
+ rel2.relative: 0.0 0.0;
+ rel2.to_x: "right_pad";
+ rel2.to_y: "elm.privilege_counter";
+ rel2.offset: 0 150;
+ max: -1 10;
}
- }
- }
- part { name: "right_pad";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- fixed: 1 0;
- min: 16 0;
- rel1 {
- relative: 1.0 0.0;
+ }
+
+ part { name: "elm.privilege_counter";
+ scale: 1;
+ type: TEXT;
+ desc { state: "default" 0.0;
+ visible: 1;
+ align: 0.0 1.0;
+ rel1.relative: 1.0 1.0;
+ rel1.to_x: "left_pad";
+ rel1.to_y: "elm.swallow.end";
+ rel2.relative: 0.0 0.0;
+ rel2.to_x: "right_pad";
+ rel2.to_y: "bottom_pad";
+ rel2.offset: 0 80;
+ max: -1 25;
+ text {
+ size: 20;
+ }
}
- rel2 {
- relative: 1.0 1.0;
+ }
+ part { name: "bottom_pad";
+ scale: 1;
+ type: SPACER;
+ desc { state: "default" 0.0;
+ align: 0.0 1.0;
+ min: 0 4;
+ rel1.relative: 0.0 1.0;
+ rel1.offset: 0 50;
}
- }
- }
- part { name: "end_field";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- align: 0.0 1.0;
- min: 0 90;
- fixed: 1 1;
- rel1 {
- relative: 1.0 1.0;
- to_x: "left_pad";
- to_y: "pad_b";
+ }
+ part { name: "left_pad";
+ scale: 1;
+ type: SPACER;
+ desc { state: "default" 0.0;
+ min: 16 0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 0.0 1.0;
}
- rel2 {
- relative: 0.0 1.0;
- to_x: "right_pad";
- to_y: "pad_b";
+ }
+ part { name: "right_pad";
+ scale: 1;
+ type: SPACER;
+ desc { state: "default" 0.0;
+ min: 16 0;
+ rel1.relative: 1.0 0.0;
+ rel2.relative: 1.0 1.0;
}
- }
- }
- part { name: "elm.swallow.end";
- type: SWALLOW;
- scale: 1;
- description { state: "default" 0.0;
- rel.to: "end_field";
- fixed: 1 1;
- }
- }
- }
+ }
+ }
}
group { "popup_checkview_layout_mobile";
parts {
rel2.relative: 1.00 1.00;
}
}
- spacer { "spacer_l";
+ spacer { "spacer_r";
scale: 1;
desc { "default";
align: 0.5 0.5;
rel2.relative: 1.00 0.00;
}
}
- spacer { "spacer_r";
+ spacer { "spacer_l";
scale: 1;
desc { "default";
align: 0.5 0.5;
rel2.relative: 0.09 0.00;
}
}
- swallow { "elm.swallow.content";
+ swallow { "elm.swallow.content"; // message between spacer_t and checkbox
scale: 1;
- desc { "default";
- visible: 1;
+ desc { //visible
align: 0.5 0.5;
- rel1.to_x: "spacer_rr";
+ state: "default" 0.0;
+ visible: 1;
+ rel1.to_x: "spacer_ll";
rel1.to_y: "spacer_t";
- rel2.to_x: "spacer_ll";
+ rel2.to_x: "spacer_rr";
rel1.relative: 1.00 1.00;
rel2.relative: 0.00 0.64;
}
}
- swallow { "elm.swallow.end";
+ swallow { "elm.swallow.end"; //checkbox
scale: 1;
desc { "default";
visible: 1;
align: 0.5 0.5;
fixed: 0 1;
- rel1.to_x: "spacer_r";
+ rel1.to_x: "spacer_l";
rel1.to_y: "elm.swallow.content";
- rel2.to_x: "spacer_l";
- rel2.to_y: "spacer_b";
+ rel2.to_x: "spacer_r";
+ rel2.to_y: "elm.privilege_counter";
rel1.relative: 1.00 1.00;
rel2.relative: 0.00 0.00;
}
}
- spacer { "spacer_rr";
- scale: 1;
- desc { "default";
- align: 0.5 0.5;
- fixed: 1 0;
- rel1.to_y: "spacer_t";
- rel2.to_y: "spacer_b";
- rel1.relative: 0.00 1.00;
- rel2.relative: 0.05 0.00;
- }
- }
- spacer { "spacer_ll";
- scale: 1;
- desc { "default";
- align: 0.5 0.5;
- fixed: 1 0;
- rel1.to_y: "spacer_t";
- rel2.to_y: "spacer_b";
- rel1.relative: 0.95 1.00;
- rel2.relative: 1.00 0.00;
- }
- }
- }
-}
-
-group { "popup_layout_mobile";
- parts {
- spacer { "spacer_t";
- scale: 1;
- desc { "default";
- align: 0.5 0.5;
- fixed: 0 1;
- rel1.relative: 0.00 0.00;
- rel2.relative: 1.00 0.04;
- }
- }
- spacer { "spacer_b";
- scale: 1;
- desc { "default";
+ part { name: "elm.privilege_counter";
+ scale: 1;
+ type: TEXT;
+ desc { "default"
+ visible: 1;
align: 0.5 0.5;
fixed: 0 1;
- rel1.relative: 0.00 0.94;
+ rel1.relative: 0.00 0.80;
rel2.relative: 1.00 1.00;
- }
- }
- spacer { "spacer_l";
- scale: 1;
- desc { "default";
- align: 0.5 0.5;
- fixed: 1 0;
- rel1.to_y: "spacer_t";
- rel2.to_y: "spacer_b";
- rel1.relative: 0.91 1.00;
- rel2.relative: 1.00 0.00;
- }
- }
- spacer { "spacer_r";
- scale: 1;
- desc { "default";
- align: 0.5 0.5;
- fixed: 1 0;
- rel1.to_y: "spacer_t";
- rel2.to_y: "spacer_b";
- rel1.relative: 0.00 1.00;
- rel2.relative: 0.09 0.00;
- }
- }
- swallow { "elm.swallow.content";
- scale: 1;
- desc { "default";
- visible: 1;
- align: 0.5 0.5;
- rel1.to_x: "spacer_rr";
- rel1.to_y: "spacer_t";
- rel2.to_x: "spacer_ll";
- rel2.to_y: "spacer_b";
- rel1.relative: 1.00 1.00;
- rel2.relative: 0.00 0.64;
- }
+ color: 0 0 0 255;
+ text {
+ size: 26;
+ }
+ }
}
- spacer { "spacer_rr";
+ spacer { "spacer_ll";
scale: 1;
desc { "default";
align: 0.5 0.5;
rel2.relative: 0.05 0.00;
}
}
- spacer { "spacer_ll";
+ spacer { "spacer_rr";
scale: 1;
desc { "default";
align: 0.5 0.5;
/*
- * Copyright (c) 2017 Samsung Electronics Co.
+ * Copyright (c) 2017 -2018 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @file src/agent/notification-daemon/ui/Popup.h
* @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @author Ernest Borowski <e.borowski@partner.samsung.com>
* @brief Declaration of Popup class
*/
class Popup : public UIElement {
public:
- Popup(Evas_Object *parent, const std::string &msg)
- : UIElement(parent), m_msg(msg)
+ Popup(Evas_Object *parent, const std::string &msg, size_t privilegeCount)
+ : UIElement(parent), m_msg(msg), m_privilegeIndex(1), m_privilegeCount(privilegeCount)
{
m_popup = elm_popup_add(m_parent);
if (m_popup == nullptr) {
Evas_Object *m_denyButton = nullptr;
std::string m_msg;
+ size_t m_privilegeIndex;
+ size_t m_privilegeCount;
};
} /* namespace Notification */
/*
- * Copyright (c) 2017 Samsung Electronics Co.
+ * Copyright (c) 2017 - 2018 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @file src/agent/notification-daemon/ui/PopupCheck.h
* @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @author Ernest Borowski <e.borowski@partner.samsung.com>
* @brief Declaration of PopupCheck class
*/
#pragma once
+#include <sstream>
#include <string>
#include <Elementary.h>
class PopupCheck : public Popup {
public:
- PopupCheck(Evas_Object *parent, const std::string &msg)
- : Popup(parent, msg)
+ PopupCheck(Evas_Object *parent, const std::string &msg, size_t privilegeCount)
+ : Popup(parent, msg, privilegeCount)
{}
Evas_Object *getCheckBox() const { return m_checkBox; }
return elm_check_state_get(m_checkBox);
}
+ void changePopupCounter() {
+ if (m_privilegeCount == 1)
+ return;
+ Evas_Object* obj = getAnimatedLayout();
+ if (!obj) {
+ ALOGE("Unable to get Evas_Object for changing privilege counter");
+ return;
+ }
+
+ std::stringstream ss;
+ ss << m_privilegeIndex << " / " << m_privilegeCount;
+ elm_object_part_text_set(obj, "elm.privilege_counter", ss.str().c_str());
+ }
+
+ void changePopupMessage() {
+ changePopupTitle();
+ changePopupCounter();
+ }
+
+ virtual void changePopupTitle() = 0;
+
+ static void changePopupMessageCallback(void* data, Elm_Transit*) {
+ PopupCheck *popupCheck = static_cast<PopupCheck*>(data);
+ popupCheck->changePopupMessage();
+ }
+
+ static void enableButtonsAfterTransitionCallback(void* data, Elm_Transit*) {
+ PopupCheck *popupCheck = static_cast<PopupCheck*>(data);
+ elm_object_disabled_set(popupCheck->m_denyButton, EINA_FALSE);
+ elm_object_disabled_set(popupCheck->m_allowButton, EINA_FALSE);
+ }
+
+ virtual Evas_Object* getAnimatedLayout() = 0;
+
+ bool showNext(const std::string &msg) {
+ if (++m_privilegeIndex > m_privilegeCount) {
+ return false;
+ }
+
+ Evas_Object* layout = getAnimatedLayout();
+ if (!layout) {
+ ALOGE("Unable to get Evas_Object for animation");
+ return false;
+ }
+
+ m_msg = msg;
+ double animation_length_in_sec = 0.075 * 2;
+ Elm_Transit *transitOut = elm_transit_add();// fade out
+ Elm_Transit *transitBetween = elm_transit_add();// slightly delay for changing message
+ Elm_Transit *transit = elm_transit_add();// fade in
+ if (!transitOut || !transitBetween || !transit) { // just change text without transitions
+ changePopupMessageCallback(this, NULL);
+ return true;
+ }
+
+ elm_object_disabled_set(m_denyButton, EINA_TRUE);
+ elm_object_disabled_set(m_allowButton, EINA_TRUE);
+
+ elm_transit_effect_wipe_add(transitOut,
+ ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE,
+ ELM_TRANSIT_EFFECT_WIPE_DIR_LEFT);
+ elm_transit_duration_set(transitOut, animation_length_in_sec);
+ elm_transit_tween_mode_set(transitOut, ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL);
+
+ elm_transit_object_add(transitBetween, layout);
+ elm_transit_effect_translation_add(transitBetween, -10000, -10000, -10000, -10000);
+ elm_transit_duration_set(transitBetween, animation_length_in_sec);
+
+ elm_transit_object_add(transit, layout);
+ elm_transit_effect_wipe_add(transit,
+ ELM_TRANSIT_EFFECT_WIPE_TYPE_SHOW,
+ ELM_TRANSIT_EFFECT_WIPE_DIR_LEFT);
+
+
+ elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL);
+ elm_transit_duration_set(transit, animation_length_in_sec);
+
+ elm_transit_chain_transit_add(transitOut, transitBetween);
+ elm_transit_chain_transit_add(transitBetween, transit);
+ elm_transit_del_cb_set(transitOut, changePopupMessageCallback, this);
+ elm_transit_del_cb_set(transit, enableButtonsAfterTransitionCallback, this);
+ elm_transit_go(transitOut);
+ return true;
+ }
+
virtual ~PopupCheck() {}
protected:
/*
- * Copyright (c) 2017 Samsung Electronics Co.
+ * Copyright (c) 2017 - 2018 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @file src/agent/notification-daemon/ui/PopupCheckMobile.h
* @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @author Ernest Borowski <e.borowski@partner.samsung.com>
* @brief Declaration of PopupCheckMobile class
*/
class PopupCheckMobile : public PopupCheck {
public:
- PopupCheckMobile(Evas_Object *parent, const std::string &msg)
- : PopupCheck(parent, msg)
+ PopupCheckMobile(Evas_Object *parent, const std::string &msg, size_t privilegeCount)
+ : PopupCheck(parent, msg, privilegeCount)
{}
virtual void create() {
// popup
}
elm_layout_file_set(m_layout, RES_DIR"/popup_custom.edj", "popup_checkview_layout_mobile");
evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
+ evas_object_size_hint_align_set(m_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
// content
m_content = elm_label_add(m_layout);
if (!m_content) {
}
elm_object_style_set(m_content, "popup/default");
elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
- elm_object_text_set(m_content, m_msg.c_str());
evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_part_content_set(m_layout, "elm.swallow.content", m_content);
}
elm_object_part_content_set(m_popup, "button2", m_allowButton);
elm_object_text_set(m_allowButton, Po::getAllowButtonMsg().c_str());
+
+ changePopupMessage();
+
elm_object_content_set(m_popup, m_layout);
evas_object_show(m_popup);
}
+ virtual void changePopupTitle() {
+ // change content to next msg
+ elm_object_text_set(m_content, m_msg.c_str());
+ }
+ virtual Evas_Object* getAnimatedLayout() {
+ return m_layout;
+ }
+
virtual ~PopupCheckMobile() {
}
/*
- * Copyright (c) 2017 Samsung Electronics Co.
+ * Copyright (c) 2017 - 2018 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @file src/agent/notification-daemon/ui/PopupCheckWearable.h
* @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @author Ernest Borowski <e.borowski@partner.samsung.com>
* @brief Declaration of PopupCheckWearable class
*/
class PopupCheckWearable : public PopupCheck {
public:
- PopupCheckWearable(Evas_Object *parent, const std::string &msg, const std::string &pkgId, const std::string &privacy)
- : PopupCheck(parent, msg), m_pkgId(pkgId), m_privacy(privacy)
+ PopupCheckWearable(Evas_Object *parent, const std::string &msg, const std::string &pkgId,
+ const std::string &privacy, size_t privilegeCount)
+ : PopupCheck(parent, msg, privilegeCount), m_pkgId(pkgId), m_privacy(privacy)
{}
~PopupCheckWearable() {}
static Eina_Bool rotaryChangedCb(void *data, Evas_Object *, Eext_Rotary_Event_Info *info) {
elm_object_text_set(m_content, m_msg.c_str());
elm_atspi_accessible_reading_info_type_set(m_content, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_part_content_set(m_layoutInner, "label", m_content);
+ evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
m_checkBox = elm_check_add(m_popup);
if (m_checkBox == nullptr) {
throw Exception("Enlightenment failed");
}
elm_object_style_set(m_checkBox, "popup");
- elm_object_text_set(m_checkBox, Po::getCheckBoxMsg().c_str());
+ elm_object_text_set(m_checkBox, ("<font_size='20' valign='center'>" + Po::getCheckBoxMsg() + "</font_size>").c_str());
elm_check_state_set(m_checkBox, EINA_FALSE);
evas_object_size_hint_align_set(m_checkBox, EVAS_HINT_FILL, 0.0);
elm_object_part_content_set(m_layoutInner, "elm.swallow.end", m_checkBox);
/* language changed callback */
vconf_notify_key_changed(VCONFKEY_LANGSET, &PopupCheckWearable::langChangedCb, this);
+ changePopupMessage();
evas_object_show(m_popup);
}
+
+ virtual void changePopupTitle() {
+ // change content to next msg
+ elm_object_part_text_set(m_layoutInner, "label", m_msg.c_str());
+ }
+
+ virtual Evas_Object* getAnimatedLayout() {
+ return m_layoutInner;
+ }
+
private:
Evas_Object *m_content = nullptr;
Evas_Object *m_layout = nullptr;
/*
- * Copyright (c) 2017 Samsung Electronics Co.
+ * Copyright (c) 2017 - 2018 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @file src/agent/notification-daemon/Popupper.cpp
* @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @author Ernest Borowski <e.borowski@partner.samsung.com>
* @brief Definition of Popupper class
*/
m_elementPtr.reset(nullptr);
m_answerablePtr.reset(nullptr);
+ m_responses.clear();
+ m_privaciesSequence.setPrivacies({});
evas_object_hide(m_win);
}
void Popupper::buttonAnswer(IAnswerable::Button button) {
NResponseType answer = m_answerablePtr->getAnswer(button);
- m_popupResponseHandler(answer);
+ m_responses.push_back(answer);
+
+ if (m_responses.size() == m_privaciesSequence.size()) {
+ //TODO: change to m_responses in final commit
+ m_popupResponseHandler(m_responses[0]);
+ return;
+ }
+
+ Privacy privacy;
+ if (!m_privaciesSequence.getNextPrivacy(privacy)) {
+ ALOGE("Unable to get next privacy");
+ respondToRest(NResponseType::None);
+ return;
+ }
+
+ if (!m_elementPtr->showNext(Po::createPopupCheckMsg(m_pkgId, privacy))) {
+ ALOGE("unable to show next popup");
+ respondToRest(NResponseType::None);
+ }
}
void Popupper::allowPressedCb(void *data, Evas_Object *, void *)
ecore_timer_add(delay,
[](void *data) -> Eina_Bool {
Popupper *runner = static_cast<Popupper *>(data);
- runner->m_popupResponseHandler(NResponseType::None);
+ runner->respondToRest(NResponseType::None);
return ECORE_CALLBACK_CANCEL;
},
runner);
evas_object_show(m_win);
}
-void Popupper::popupCheck(const std::string &pkgId, const std::string &privacy) {
+void Popupper::popupCheck(const std::string &pkgId, const std::vector<Privacy> &privacies) {
std::string profileName = getProfileName();
PopupCheck *popup;
+ m_responses.clear();
+ m_privaciesSequence.setPrivacies(privacies);
+ m_pkgId = pkgId;
try {
+ Privacy currentPrivacy;
+ if (!m_privaciesSequence.getNextPrivacy(currentPrivacy)) {
+ ALOGE("Unable to get next privacy");
+ respondToRest(NResponseType::None);
+ return;
+ }
if (profileName[0] != 'w' && profileName[0] != 'W') {
// Not wearable
- popup = new PopupCheckMobile(m_win, Po::createPopupCheckMsg(pkgId, privacy));
+ popup = new PopupCheckMobile(m_win, Po::createPopupCheckMsg(pkgId, currentPrivacy), m_privaciesSequence.size());
} else {
// Wearable
- popup = new PopupCheckWearable(m_win, Po::createPopupCheckMsg(pkgId, privacy), pkgId, privacy);
+ popup = new PopupCheckWearable(m_win, Po::createPopupCheckMsg(pkgId, currentPrivacy),
+ pkgId, currentPrivacy, m_privaciesSequence.size());
}
popup->create();
} catch (const std::exception &e) {
ALOGE("Failed to create popup check : " << e.what());
- m_popupResponseHandler(NResponseType::Error);
+ respondToRest(NResponseType::None);
return;
}
}
+void Popupper::respondToRest(NResponseType response)
+{
+ size_t alreadyRespondedCount = m_responses.size();
+ while (alreadyRespondedCount < m_privaciesSequence.size()) {
+ m_responses.push_back(response);
+ alreadyRespondedCount++;
+ }
+ //TODO: CHANGE TO m_responses in final commit
+ m_popupResponseHandler(m_responses[0]);
+}
+
void Popupper::start()
{
elm_run();
elm_win_keygrab_unset(m_win, "XF86Back", 0, 0);
m_elementPtr.reset(nullptr);
m_answerablePtr.reset(nullptr);
+ m_responses.clear();
evas_object_del(m_win);
m_win = nullptr;
elm_exit();
/*
- * Copyright (c) 2017 Samsung Electronics Co.
+ * Copyright (c) 2017 - 2018 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @file src/agent/notification-daemon/Popupper.h
* @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @author Ernest Borowski <e.borowski@partner.samsung.com>
* @brief Declaration of Popupper class
*/
#include "Answerable.h"
#include "Popup.h"
+#include "PrivaciesSequence.h"
#include <types/NotificationResponse.h>
+#include <types/PolicyTypes.h>
#include <log/alog.h>
namespace AskUser {
void registerPopupResponseHandler(PopupHandler handler);
void start();
- void popupCheck(const std::string &pkgId, const std::string &privacy);
+ void popupCheck(const std::string &pkgId, const std::vector<std::string> &privacies);
void popupClose();
void stop();
static Eina_Bool hwKeyClickedCb(void *data, int type, void *event);
void buttonAnswer(IAnswerable::Button button);
+ void respondToRest(NResponseType response);
void show();
PopupHandler m_popupResponseHandler;
Evas_Object *m_win = nullptr;
std::unique_ptr<UIElement> m_elementPtr;
std::unique_ptr<IAnswerable> m_answerablePtr;
+ std::vector<NResponseType> m_responses;
+ PrivaciesSequence m_privaciesSequence;
+ std::string m_pkgId;
bool m_shouldRaise = false;
};
/*
- * Copyright (c) 2017 Samsung Electronics Co.
+ * Copyright (c) 2017 - 2018 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @file src/agent/notification-daemon/UIElement.h
* @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @author Ernest Borowski <e.borowski@partner.samsung.com>
* @brief Declaration of UIElement class
*/
public:
explicit UIElement(Evas_Object *parent) : m_parent(parent) {}
virtual void create() = 0;
+ virtual bool showNext(const std::string &msg) = 0;
virtual ~UIElement() {}
protected:
Evas_Object *m_parent;