Add multiple privacy privileges in single popup 34/180334/34
authorErnest Borowski <e.borowski@partner.samsung.com>
Mon, 28 May 2018 10:59:09 +0000 (12:59 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Tue, 28 Aug 2018 04:59:20 +0000 (04:59 +0000)
Change-Id: Iae82df5c47c91b7fa03c516b8352a7eb69aba6c8
Signed-off-by: Ernest Borowski <e.borowski@partner.samsung.com>
src/notification-daemon/PrivaciesSequence.cpp
src/notification-daemon/PrivaciesSequence.h
src/notification-daemon/event/Event.h
src/notification-daemon/res/popup_custom.edc
src/notification-daemon/ui/Popup.h
src/notification-daemon/ui/PopupCheck.h
src/notification-daemon/ui/PopupCheckMobile.h
src/notification-daemon/ui/PopupCheckWearable.h
src/notification-daemon/ui/Popupper.cpp
src/notification-daemon/ui/Popupper.h
src/notification-daemon/ui/UIElement.h

index 8a4badd..7b859d3 100644 (file)
@@ -56,6 +56,10 @@ bool PrivaciesSequence::getNextPrivacy(Privacy &privacy) {
     return true;
 }
 
+size_t PrivaciesSequence::size() {
+    return m_privacies.size();
+}
+
 } // namespace Notification
 
 } // namespace AskUser
index 3782bc2..a566db1 100644 (file)
@@ -52,6 +52,11 @@ public:
      */
     void rewind();
 
+    /*
+     * Returns Privacies count
+     */
+    size_t size();
+
     virtual ~PrivaciesSequence() {}
 private:
     typedef std::vector<Privacy> PrivacyVector;
index a56f523..95e43a0 100644 (file)
@@ -1,5 +1,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.
@@ -16,6 +16,7 @@
 /**
  * @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
  */
 
@@ -41,15 +42,18 @@ protected:
 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
index aebbfd7..954f259 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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 {
@@ -135,7 +145,7 @@ group { "popup_checkview_layout_mobile";
             rel2.relative: 1.00 1.00;
          }
       }
-      spacer { "spacer_l";
+      spacer { "spacer_r";
          scale: 1;
          desc { "default";
             align: 0.5 0.5;
@@ -146,7 +156,7 @@ group { "popup_checkview_layout_mobile";
             rel2.relative: 1.00 0.00;
          }
       }
-      spacer { "spacer_r";
+      spacer { "spacer_l";
          scale: 1;
          desc { "default";
             align: 0.5 0.5;
@@ -157,113 +167,49 @@ group { "popup_checkview_layout_mobile";
             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;
@@ -274,7 +220,7 @@ group { "popup_layout_mobile";
             rel2.relative: 0.05 0.00;
          }
       }
-      spacer { "spacer_ll";
+      spacer { "spacer_rr";
          scale: 1;
          desc { "default";
             align: 0.5 0.5;
index 72baada..1584906 100644 (file)
@@ -1,5 +1,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.
@@ -16,6 +16,7 @@
 /**
  * @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
  */
 
@@ -34,8 +35,8 @@ namespace Notification {
 
 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) {
@@ -59,6 +60,8 @@ protected:
     Evas_Object *m_denyButton = nullptr;
 
     std::string m_msg;
+    size_t m_privilegeIndex;
+    size_t m_privilegeCount;
 };
 
 } /* namespace Notification */
index 936fd5e..f9e0fa7 100644 (file)
@@ -1,5 +1,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/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>
@@ -32,8 +34,8 @@ namespace Notification {
 
 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; }
@@ -43,6 +45,91 @@ public:
         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:
index 5b24725..cf1028d 100644 (file)
@@ -1,5 +1,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.
@@ -16,6 +16,7 @@
 /**
  * @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
  */
 
@@ -32,8 +33,8 @@ namespace Notification {
 
 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
@@ -49,7 +50,7 @@ public:
         }
         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) {
@@ -58,7 +59,6 @@ public:
         }
         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);
@@ -90,9 +90,20 @@ public:
         }
         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() {
 
     }
index 86f1252..4e1720a 100644 (file)
@@ -1,5 +1,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.
@@ -16,6 +16,7 @@
 /**
  * @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
  */
 
@@ -33,8 +34,9 @@ namespace Notification {
 
 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) {
@@ -108,8 +110,8 @@ public:
         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) {
@@ -117,7 +119,7 @@ public:
             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);
@@ -164,8 +166,19 @@ public:
         /* 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;
index cf182a3..d731cc6 100644 (file)
@@ -1,5 +1,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.
@@ -16,6 +16,7 @@
 /**
  * @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
  */
 
@@ -86,12 +87,32 @@ void Popupper::popupClose()
 
     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 *)
@@ -119,7 +140,7 @@ Eina_Bool Popupper::hwKeyClickedCb(void *data, int type, void *event)
         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);
@@ -163,21 +184,31 @@ void Popupper::show() {
     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;
     }
 
@@ -192,6 +223,17 @@ void Popupper::popupCheck(const std::string &pkgId, const std::string &privacy)
 
 }
 
+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();
@@ -204,6 +246,7 @@ void Popupper::stop()
     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();
index 711721b..d6bd959 100644 (file)
@@ -1,5 +1,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.
@@ -16,6 +16,7 @@
 /**
  * @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
  */
 
@@ -31,7 +32,9 @@
 
 #include "Answerable.h"
 #include "Popup.h"
+#include "PrivaciesSequence.h"
 #include <types/NotificationResponse.h>
+#include <types/PolicyTypes.h>
 #include <log/alog.h>
 
 namespace AskUser {
@@ -47,7 +50,7 @@ public:
     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();
@@ -61,6 +64,7 @@ private:
     static Eina_Bool hwKeyClickedCb(void *data, int type, void *event);
 
     void buttonAnswer(IAnswerable::Button button);
+    void respondToRest(NResponseType response);
     void show();
 
     PopupHandler m_popupResponseHandler;
@@ -68,6 +72,9 @@ private:
     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;
 };
index c59ad01..fc70d5b 100644 (file)
@@ -1,5 +1,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.
@@ -16,6 +16,7 @@
 /**
  * @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
  */
 
@@ -30,6 +31,7 @@ class UIElement {
 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;