From 9dfe4a31a494436325ce024c3b168a5a1e1abbf3 Mon Sep 17 00:00:00 2001 From: hyunuktak Date: Thu, 13 Jul 2017 16:39:14 +0900 Subject: [PATCH] Notified when it's just total usage by interface Change-Id: I47955cdb44433a0dc1fa9fac4d520f053c2ab9cb Signed-off-by: hyunuktak --- packaging/net.netpopup.spec | 2 +- src/net-popup.c | 41 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/packaging/net.netpopup.spec b/packaging/net.netpopup.spec index a786e83..5b4e817 100755 --- a/packaging/net.netpopup.spec +++ b/packaging/net.netpopup.spec @@ -1,6 +1,6 @@ Name: net.netpopup Summary: Network Notification Popup applicationa -Version: 0.2.86 +Version: 0.2.87 Release: 1 Group: App/Network License: Flora-1.1 diff --git a/src/net-popup.c b/src/net-popup.c index d70c10a..ae48355 100755 --- a/src/net-popup.c +++ b/src/net-popup.c @@ -83,6 +83,10 @@ #define STC_NOTIFICATION_RESTRICTION_ON_TITLE \ dgettext(PACKAGE, "IDS_SM_TMBODY_MOBILE_DATA_LIMIT_EXCEEDED_ABB") +#define STC_TOTAL_DATACALL "TOTAL_DATACALL" +#define STC_TOTAL_WIFI "TOTAL_WIFI" +#define STC_TOTAL_BLUETOOTH "TOTAL_BLUETOOTH" + #define USER_RESP_LEN 30 #define ICON_PATH_LEN 128 #define RESP_REMAIN_CONNECTED "RESP_REMAIN_CONNECTED" @@ -119,7 +123,7 @@ static char *data_usage_iftype = NULL; static int __net_popup_show_notification(app_control_h request, void *data); static int __toast_popup_show(app_control_h request, void *data); static int __net_popup_show_popup(app_control_h request, void *data); -static void __net_popup_show_warning_noti(void); +static void __net_popup_show_warning_noti(app_control_h request, void *data); static void __net_popup_show_restriction_noti(app_control_h request, void *data); static void __net_popup_add_found_ap_noti(void); static void __net_popup_del_found_ap_noti(void); @@ -391,7 +395,7 @@ static void __net_popup_service_cb(app_control_h request, void *data) } else if (g_str_equal(type, "popup")) { __net_popup_show_popup(request, data); } else if (g_str_equal(type, "warning_noti")) { - __net_popup_show_warning_noti(); + __net_popup_show_warning_noti(request, data); elm_exit(); } else if (g_str_equal(type, "restriction_noti")) { __net_popup_show_restriction_noti(request, data); @@ -1350,6 +1354,9 @@ static void __data_usage_btn_ok_cb(void *data, Evas_Object *obj, void *event_inf if (obj) evas_object_del(obj); + g_free(data_usage_app_id); + g_free(data_usage_iftype); + elm_exit(); } @@ -1506,10 +1513,26 @@ static void __net_popup_show_vpn_popup(app_control_h request, void *data) return; } -static void __net_popup_show_warning_noti(void) +static void __net_popup_show_warning_noti(app_control_h request, void *data) { log_print(NET_POPUP, "__net_popup_show_warning_noti()\n"); + int ret = app_control_get_extra_data(request, "_APP_ID_", &data_usage_app_id); + if (APP_CONTROL_ERROR_NONE != ret) { + log_print(NET_POPUP, "Failed to get _APP_ID_ ret = %d", ret); + elm_exit(); + return; + } + + if (strcmp(data_usage_app_id, STC_TOTAL_DATACALL) && + strcmp(data_usage_app_id, STC_TOTAL_WIFI) && + strcmp(data_usage_app_id, STC_TOTAL_BLUETOOTH)) { + log_print(NET_POPUP, "It's not total data usage [%s]", data_usage_app_id); + g_free(data_usage_app_id); + elm_exit(); + return; + } + __data_usage_notification(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_LY_ONGOING_EVENT, STC_NOTIFICATION_WARNING_TITLE, @@ -1541,9 +1564,19 @@ static void __net_popup_show_restriction_noti(app_control_h request, void *data) return; } + if (strcmp(data_usage_app_id, STC_TOTAL_DATACALL) && + strcmp(data_usage_app_id, STC_TOTAL_WIFI) && + strcmp(data_usage_app_id, STC_TOTAL_BLUETOOTH)) { + log_print(NET_POPUP, "It's not total data usage [%s]", data_usage_app_id); + g_free(data_usage_app_id); + elm_exit(); + return; + } + ret = app_control_get_extra_data(request, "_IF_TYPE_", &data_usage_iftype); if (APP_CONTROL_ERROR_NONE != ret) { log_print(NET_POPUP, "Failed to get _IF_TYPE_ ret = %d", ret); + g_free(data_usage_app_id); elm_exit(); return; } @@ -1551,6 +1584,8 @@ static void __net_popup_show_restriction_noti(app_control_h request, void *data) ret = app_control_get_extra_data(request, "_RESTRICTION_LIMIT_", &limit); if (APP_CONTROL_ERROR_NONE != ret) { log_print(NET_POPUP, "Failed to get _RESTRICTION_LIMIT_ ret = %d", ret); + g_free(data_usage_app_id); + g_free(data_usage_iftype); elm_exit(); return; } -- 2.7.4