diff options
author | Yunjin Lee <yunjin-.lee@samsung.com> | 2020-03-18 12:17:38 +0900 |
---|---|---|
committer | Yunjin Lee <yunjin-.lee@samsung.com> | 2020-03-18 14:42:43 +0900 |
commit | 699834ec2412328665885a53e105e5a033192553 (patch) | |
tree | 281d98b64ff7a5b6ee27828bbd3665474156cb96 | |
parent | 9774d3d767c1019264313146022cee82a59e2d76 (diff) | |
download | askuser-popup-699834ec2412328665885a53e105e5a033192553.tar.gz askuser-popup-699834ec2412328665885a53e105e5a033192553.tar.bz2 askuser-popup-699834ec2412328665885a53e105e5a033192553.zip |
Handle unresponded request as 'Deny Once'
- Fill unresponded requested privacies' response as 'Deny Once' and
pass it to ppm_popup_send_response()
Change-Id: I66e77cd7144c919cf4bbed62e6e42852dbdf1b47
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
-rw-r--r-- | common/include/common_utils.h | 1 | ||||
-rw-r--r-- | common/src/common_utils.c | 1 | ||||
-rw-r--r-- | ui/src/app_main.c | 31 | ||||
-rw-r--r-- | ui/src/popup.c | 1 |
4 files changed, 13 insertions, 21 deletions
diff --git a/common/include/common_utils.h b/common/include/common_utils.h index f8ff9c2..77e7752 100644 --- a/common/include/common_utils.h +++ b/common/include/common_utils.h @@ -60,7 +60,6 @@ extern "C" { typedef struct { char* privacy; - bool user_responsed; ppm_popup_response_e response; } privacy_data_s; diff --git a/common/src/common_utils.c b/common/src/common_utils.c index 27b6e73..e62b145 100644 --- a/common/src/common_utils.c +++ b/common/src/common_utils.c @@ -30,7 +30,6 @@ privacy_data_s* new_privacy_data() return NULL; } pd->privacy = NULL; - pd->user_responsed = false; pd->response = PRIVACY_PRIVILEGE_MANAGER_POPUP_RESPONSE_DENY_ONCE; return pd; } diff --git a/ui/src/app_main.c b/ui/src/app_main.c index 142e6f6..f6571fe 100644 --- a/ui/src/app_main.c +++ b/ui/src/app_main.c @@ -183,24 +183,19 @@ static void app_terminate(void *data) app_data_s *ad = (app_data_s*)data; int ret = 0; - if (ad->privacy_idx == 0) { - LOGD("no responses"); - ret = ppm_popup_send_response(ad->popup_id, NULL, NULL, 0); - } else { - char *privacies[ad->privacy_idx]; - ppm_popup_response_e responses[ad->privacy_idx]; - - int i = 0; - for (i = 0; i < ad->privacy_idx; ++i) { - privacy_data_s *pd = (privacy_data_s*)g_list_nth_data(ad->privacy_list, i); - if (pd->user_responsed) { - privacies[i] = strdup(pd->privacy); - responses[i] = pd->response; - } else { - break; - } - } - ret = ppm_popup_send_response(ad->popup_id, (const char**)privacies, responses, i); + char *privacies[ad->privacy_num]; + ppm_popup_response_e responses[ad->privacy_num]; + + int i = 0; + for (i = 0; i < ad->privacy_num; ++i) { + privacy_data_s *pd = (privacy_data_s*)g_list_nth_data(ad->privacy_list, i); + privacies[i] = strdup(pd->privacy); + responses[i] = pd->response; + } + ret = ppm_popup_send_response(ad->popup_id, (const char**)privacies, responses, ad->privacy_num); + + for (i = 0; i < ad->privacy_num; ++i) { + free(privacies[i]); } if (ret != PRIVACY_PRIVILEGE_MANAGER_ERROR_NONE) diff --git a/ui/src/popup.c b/ui/src/popup.c index 3037e49..64c76ab 100644 --- a/ui/src/popup.c +++ b/ui/src/popup.c @@ -50,7 +50,6 @@ void save_response(ppm_popup_response_e response, app_data_s *ad) { privacy_data_s *pd = (privacy_data_s *)g_list_nth_data(ad->privacy_list, ad->privacy_idx); pd->response = response; - pd->user_responsed = true; } static char* __get_privacy_display(const char* privacy) |