summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishek Sansanwal <abhishek.s94@samsung.com>2017-11-28 16:43:23 +0530
committerAbhishek Sansanwal <abhishek.s94@samsung.com>2017-11-28 16:45:52 +0530
commitc74bdc72fa54f53f01a9c55c2319abf56308a8e6 (patch)
treebf9e461c1bee0a5c4914ae399b86a6e30bf72dc5
parente0a5b8ca78ce674a508fa2839bd748d8b637154e (diff)
downloadnet-popup-accepted/tizen/unified/20171204.072227.tar.gz
net-popup-accepted/tizen/unified/20171204.072227.tar.bz2
net-popup-accepted/tizen/unified/20171204.072227.zip
IP conflict show and remove notification handlingsubmit/tizen/20171130.074734accepted/tizen/unified/20171204.072227
Signed-off-by: Abhishek Sansanwal <abhishek.s94@samsung.com> Change-Id: I1b6299d2bf410eb72b753f46a26e6914e4f8a891
-rwxr-xr-xpo/en_US.po3
-rwxr-xr-xsrc/net-popup.c162
2 files changed, 165 insertions, 0 deletions
diff --git a/po/en_US.po b/po/en_US.po
index 4534b37..dff0e6c 100755
--- a/po/en_US.po
+++ b/po/en_US.po
@@ -43,6 +43,9 @@ msgstr "Tap here to connect."
msgid "IDS_WIFI_HEADER_SIGN_IN_TO_WI_FI_NETWORK_ABB"
msgstr "Sign in to Wi-Fi network"
+msgid "IDS_IP_CONFLICT"
+msgstr "IP conflict detected"
+
msgid "IDS_WIFI_BUTTON_DONT_ASK_AGAIN"
msgstr "Don't ask again"
diff --git a/src/net-popup.c b/src/net-popup.c
index 77ff1c2..0c2ecf2 100755
--- a/src/net-popup.c
+++ b/src/net-popup.c
@@ -46,6 +46,7 @@
#define NET_WIFIQS_APPID "net.wifi-qs"
#define DATA_USAGE_APPID "org.tizen.setting"
+#define WIFI_EFL_UG "wifi-efl-ug"
#define LOCALEDIR "/usr/share/locale"
#define NETPOPUP_EDJ tzplatform_mkpath(TZ_SYS_RO_UG, "/res/edje/net-popup/netpopup-custom.edj")
@@ -70,6 +71,8 @@
dgettext(PACKAGE, "IDS_WIFI_SBODY_TAP_HERE_TO_CONNECT")
#define NETCONFIG_NOTIFICATION_WIFI_PORTAL_TITLE \
dgettext(PACKAGE, "IDS_WIFI_HEADER_SIGN_IN_TO_WI_FI_NETWORK_ABB")
+#define NETCONFIG_NOTIFICATION_IP_CONFLICT_TITLE \
+ dgettext(PACKAGE, "IDS_IP_CONFLICT")
#define NETCONFIG_NOTIFICATION_WIFI_PORTAL_CONTENT "\"%s\""
#define STC_NOTIFICATION_WARNING_TITLE \
@@ -133,6 +136,8 @@ static void __net_popup_show_popup_with_user_resp(app_control_h request, void *d
static void __net_popup_show_vpn_popup(app_control_h request, void *data);
static int _net_popup_send_user_resp(char *resp, Eina_Bool state);
static int __net_popup_show_network_error_popup(app_control_h request, void *data);
+static void __net_popup_add_ip_conflict_noti(app_control_h request);
+static void __net_popup_del_ip_conflict_noti(void);
GDBusProxy *__net_popup_init_dbus(void)
{
@@ -411,6 +416,12 @@ static void __net_popup_service_cb(app_control_h request, void *data)
} else if (g_str_equal(type, "del_portal_noti")) {
__net_popup_del_portal_noti();
elm_exit();
+ } else if (g_str_equal(type, "add_ip_conflict_noti")) {
+ __net_popup_add_ip_conflict_noti(request);
+ elm_exit();
+ } else if (g_str_equal(type, "del_ip_conflict_noti")) {
+ __net_popup_del_ip_conflict_noti();
+ elm_exit();
} else if (g_str_equal(type, "popup_user_resp")) {
app_control_clone(&g_req_handle, request);
__net_popup_show_popup_with_user_resp(request, data);
@@ -1836,6 +1847,142 @@ static void __net_popup_del_found_ap_noti(void)
log_print(NET_POPUP, "Successfully deleted notification");
}
+static void __net_popup_add_ip_conflict_noti(app_control_h request)
+{
+ log_print(NET_POPUP, "__net_popup_add_portal_noti()\n");
+
+ int ret = 0;
+ int noti_flags = 0;
+ char *mac = NULL;
+ char icon_path[ICON_PATH_LEN];
+ notification_h noti = NULL;
+ app_control_h service_handle = NULL;
+ notification_list_h noti_list = NULL;
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+ ret = app_control_get_extra_data(request, "_MAC_ADDRESS_", &mac);
+
+ if (mac == NULL || ret != APP_CONTROL_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to retrieve mac address!!");
+ g_free(mac);
+ return;
+ }
+
+ log_print(NET_POPUP, "Successfully added notification");
+
+ notification_get_detail_list("net.netpopup", NOTIFICATION_GROUP_ID_NONE,
+ NOTIFICATION_PRIV_ID_NONE, -1, &noti_list);
+ if (noti_list != NULL) {
+ notification_free_list(noti_list);
+ g_free(mac);
+ return;
+ }
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if (noti == NULL) {
+ log_print(NET_POPUP, "fail to create notification");
+ g_free(mac);
+ return;
+ }
+
+ noti_err = notification_set_time(noti, time(NULL));
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_time : %d", noti_err);
+ goto error;
+ }
+
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
+ NETCONFIG_NOTIFICATION_WIFI_ICON_LITE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_image : %d", noti_err);
+ goto error;
+ }
+
+ g_snprintf(icon_path, sizeof(icon_path), "%s%s", QP_PRELOAD_NOTI_ICON_PATH, "/noti_wifi_in_range_ongoing.png");
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, icon_path);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_image : %d", noti_err);
+ goto error;
+ }
+
+ noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_MULTIPLE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_layout : %d", noti_err);
+ goto error;
+ }
+
+ noti_err = notification_set_text_domain(noti, PACKAGE,
+ LOCALEDIR);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_text_domain : %d", noti_err);
+ goto error;
+ }
+
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+ NETCONFIG_NOTIFICATION_IP_CONFLICT_TITLE,
+ "IDS_IP_CONFLICT",
+ NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_title : %d", noti_err);
+ goto error;
+ }
+
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
+ NETCONFIG_NOTIFICATION_WIFI_PORTAL_CONTENT,
+ NETCONFIG_NOTIFICATION_WIFI_PORTAL_CONTENT,
+ NOTIFICATION_VARIABLE_TYPE_STRING, mac,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_content : %d", noti_err);
+ goto error;
+ }
+
+ noti_flags = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_INDICATOR;
+ noti_err = notification_set_display_applist(noti, noti_flags);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_display_applist : %d", noti_err);
+ goto error;
+ }
+
+ ret = app_control_create(&service_handle);
+ log_print(NET_POPUP, "service create ret[%d]", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ ret = app_control_set_app_id(service_handle, WIFI_EFL_UG);
+ log_print(NET_POPUP, "Service set app id ret = %d", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ ret = app_control_add_extra_data(service_handle, "caller", "notification");
+ log_print(NET_POPUP, "Service data addition ret = %d", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ noti_err = notification_set_launch_option(noti,
+ NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, service_handle);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_launch_option");
+ goto error;
+ }
+
+ noti_err = notification_post(noti);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_post");
+ goto error;
+ }
+
+ log_print(NET_POPUP, "Successfully added notification");
+
+error:
+ g_free(mac);
+ if (noti != NULL)
+ notification_free(noti);
+
+ if (service_handle != NULL)
+ app_control_destroy(service_handle);
+}
+
static void __net_popup_add_portal_noti(app_control_h request)
{
log_print(NET_POPUP, "__net_popup_add_portal_noti()\n");
@@ -1972,6 +2119,21 @@ error:
app_control_destroy(service_handle);
}
+static void __net_popup_del_ip_conflict_noti(void)
+{
+ log_print(NET_POPUP, "__net_popup_del_ip_conflict_noti()\n");
+
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_delete_all");
+ return;
+ }
+
+ log_print(NET_POPUP, "Successfully deleted notification");
+}
+
static void __net_popup_del_portal_noti(void)
{
log_print(NET_POPUP, "__net_popup_del_portal_noti()\n");