diff options
author | jh8801.jung <jh8801.jung@samsung.com> | 2017-10-12 11:46:48 +0900 |
---|---|---|
committer | Jihoon Jung <jh8801.jung@samsung.com> | 2017-10-12 04:00:50 +0000 |
commit | aac25b1caf84312cc40f8dde9d3c6e0bd5f25524 (patch) | |
tree | 73f72981cee2980dd31f0ada4e881c833c2d04a0 /wearable/app | |
parent | abb0bbbedb7988e064685e948fa99c192ceb4d77 (diff) | |
download | ug-nfc-efl-aac25b1caf84312cc40f8dde9d3c6e0bd5f25524.tar.gz ug-nfc-efl-aac25b1caf84312cc40f8dde9d3c6e0bd5f25524.tar.bz2 ug-nfc-efl-aac25b1caf84312cc40f8dde9d3c6e0bd5f25524.zip |
Sync with 3.0 branch : Apply for Appcontrol implementationsubmit/tizen/20171015.234740submit/tizen/20171013.045632accepted/tizen/unified/20171016.144021
Signed-off-by: jh8801.jung <jh8801.jung@samsung.com>
Change-Id: I53690e131c3fbbf0dccdce9db3834a71de40badc
Diffstat (limited to 'wearable/app')
-rw-r--r-- | wearable/app/include/nsa-debug.h | 3 | ||||
-rwxr-xr-x | wearable/app/include/nsa-main.h | 1 | ||||
-rwxr-xr-x | wearable/app/src/nsa-main.c | 16 | ||||
-rwxr-xr-x | wearable/app/src/nsa-ui-widget.c | 2 | ||||
-rwxr-xr-x | wearable/app/src/nsa-view-main.c | 38 | ||||
-rwxr-xr-x | wearable/app/src/nsa-view-tap-n-pay.c | 16 |
6 files changed, 44 insertions, 32 deletions
diff --git a/wearable/app/include/nsa-debug.h b/wearable/app/include/nsa-debug.h index 39e13e0..4ca1040 100644 --- a/wearable/app/include/nsa-debug.h +++ b/wearable/app/include/nsa-debug.h @@ -141,4 +141,5 @@ extern "C" #ifdef __cplusplus } #endif -#endif /* __NFC_SETTING_APP_DEBUG_H__ */
\ No newline at end of file + +#endif /* __NFC_SETTING_APP_DEBUG_H__ */ diff --git a/wearable/app/include/nsa-main.h b/wearable/app/include/nsa-main.h index 8b2c1ef..93cbca0 100755 --- a/wearable/app/include/nsa-main.h +++ b/wearable/app/include/nsa-main.h @@ -80,6 +80,7 @@ typedef struct { Evas_Object *radio_main; nsa_operation_type op_type; + app_control_h service; } appdata; #ifdef __cplusplus diff --git a/wearable/app/src/nsa-main.c b/wearable/app/src/nsa-main.c index 482cf04..57c0845 100755 --- a/wearable/app/src/nsa-main.c +++ b/wearable/app/src/nsa-main.c @@ -115,22 +115,17 @@ static void __parse_service(app_control_h service, void *user_data) NSA_DEBUG("extra data [%s] >>>>> ", GET_SAFE_STRING(ex_data)); ad->op_type = NSA_OP_NFC; - if (!ex_data) { - NSA_DEBUG_ERR("extra data is NULL"); - goto end; - } if (strncmp(operation, APP_CONTROL_OPERATION_SETTING_NFC, strlen(APP_CONTROL_OPERATION_SETTING_NFC)) == 0) { /* launched by app-control */ - if (strncmp(ex_data, "nfc", strlen("nfc")) == 0) { + app_control_clone(&(ad->service), service); + if (!ex_data || strncmp(ex_data, "nfc", strlen("nfc")) == 0) ad->op_type = NSA_OP_NFC; - } else if (strncmp(ex_data, "tap_n_pay", strlen("tap_n_pay")) == 0) { + else if (strncmp(ex_data, "tap_n_pay", strlen("tap_n_pay")) == 0) ad->op_type = NSA_OP_TAP_N_PAY; - } } -end: NSA_MEM_FREE(operation); NSA_MEM_FREE(app_id); NSA_MEM_FREE(ex_data); @@ -177,11 +172,10 @@ void _nsa_main_app_service(app_control_h service, void *user_data) __parse_service(service, ad); /* launch nss */ - if (ad->op_type == NSA_OP_TAP_N_PAY){ + if (ad->op_type == NSA_OP_TAP_N_PAY) _nsa_view_tap_n_pay_create(ad); - } else { + else _nsa_view_main_create(ad); - } elm_win_activate(ad->main_win); diff --git a/wearable/app/src/nsa-ui-widget.c b/wearable/app/src/nsa-ui-widget.c index 1e8e677..4033c0f 100755 --- a/wearable/app/src/nsa-ui-widget.c +++ b/wearable/app/src/nsa-ui-widget.c @@ -139,7 +139,7 @@ Evas_Object* nsa_create_edj_layout(Evas_Object* parent, elm_object_focus_set(layout, EINA_FALSE); - if(edc_path != NULL) + if (edc_path != NULL) elm_layout_file_set(layout, EDJ_FILE, edc_path); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, diff --git a/wearable/app/src/nsa-view-main.c b/wearable/app/src/nsa-view-main.c index b2cb7ff..55e5172 100755 --- a/wearable/app/src/nsa-view-main.c +++ b/wearable/app/src/nsa-view-main.c @@ -30,6 +30,25 @@ #include "nsa-popup.h" #include "nsa-string.h" +static bool __reply_to_launch_request(app_control_h service, app_control_result_e result) +{ + app_control_h reply; + bool ret = false; + + LOGD("BEGIN >>>>"); + + if (service != NULL) { + LOGD("launched by NFC appcontrol"); + app_control_create(&reply); + app_control_reply_to_launch_request(reply, service, result); + app_control_destroy(reply); + ret = true; + } + + LOGD("END >>>>"); + return ret; +} + static void __get_payment_handler(char **handler) { char *appid; @@ -44,9 +63,8 @@ static void __get_payment_handler(char **handler) int ret; ret = pkgmgrinfo_pkginfo_get_pkginfo(appid, &pkginfo); - if (ret != 0) { + if (ret != 0) return; - } ret = pkgmgrinfo_pkginfo_get_label(pkginfo, &label); if (ret != 0) { @@ -98,6 +116,9 @@ static void __nfc_activation_completed_cb(nfc_error_e error, /* update ui after activation is completed */ __update_onoff_obj(ad); __update_tap_and_pay_obj(ad); + + if (__reply_to_launch_request(ad->service, APP_CONTROL_RESULT_SUCCEEDED) == true) + ui_app_exit(); } static void __change_nfc_onoff_setting(void *data) @@ -110,7 +131,7 @@ static void __change_nfc_onoff_setting(void *data) NSA_BEGIN(); /* V1.9 : instead of toast popup, disable item during operation */ - if(ad->on_off != NULL) + if (ad->on_off != NULL) elm_object_item_disabled_set(ad->on_off, true); result = nfc_manager_set_activation(!nfc_manager_is_activated(), @@ -175,11 +196,10 @@ static Evas_Object *__gl_content_get_on_off(void *data, Evas_Object *obj, static char *__gl_text_get_nfc(void *data, Evas_Object *obj, const char *part) { - if (!strcmp(part, "elm.text")) { + if (!strcmp(part, "elm.text")) return strdup(IDS_NFC_NFC); - } else { + else return NULL; - } } static char *__gl_text_get_tap_n_pay(void *data, Evas_Object *obj, @@ -193,9 +213,9 @@ static char *__gl_text_get_tap_n_pay(void *data, Evas_Object *obj, if (ad->payment_handler != NULL) { NSA_DEBUG("ad->payment_handler : %s", ad->payment_handler); return strdup(ad->payment_handler); - } - else + } else { return NULL; + } } else { return NULL; } @@ -271,7 +291,7 @@ static Evas_Object *__create_nfc_setting_list(void *data) return genlist; } -static void __payment_handler_vconf_key_changed (keynode_t *key, +static void __payment_handler_vconf_key_changed(keynode_t *key, void *data) { appdata *ad = data; diff --git a/wearable/app/src/nsa-view-tap-n-pay.c b/wearable/app/src/nsa-view-tap-n-pay.c index d144887..cb1050c 100755 --- a/wearable/app/src/nsa-view-tap-n-pay.c +++ b/wearable/app/src/nsa-view-tap-n-pay.c @@ -188,16 +188,14 @@ static char *__get_launch_app_id(char *pkgid) NSA_DEBUG("__get_launch_app_id [%s]", pkgid); ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &pkginfo); - if (ret != 0) { + if (ret != 0) return strdup(pkgid); - } ret = pkgmgrinfo_pkginfo_get_mainappid(pkginfo, &main_appid); - if (ret == 0) { + if (ret == 0) return strdup(main_appid); - } else { + else return strdup(pkgid); - } } static void __launch_application(char *appid) @@ -225,9 +223,8 @@ static void __launch_application(char *appid) } ret = app_control_send_launch_request(service, NULL, NULL); - if(ret != APP_CONTROL_ERROR_NONE) { + if (ret != APP_CONTROL_ERROR_NONE) NSA_DEBUG_ERR("app_control_send_launch_request failed[%d]", ret); - } END: app_control_destroy(service); @@ -321,11 +318,10 @@ static void __gl_list_clicked_cb(void *data, Evas_Object *obj, static char *__gl_text_get_title(void *data, Evas_Object *obj, const char *part) { - if (!strcmp(part, "elm.text")) { + if (!strcmp(part, "elm.text")) return strdup(IDS_TAP_AND_PAY); - } else { + else return NULL; - } } static char *__gl_text_get(void *data, Evas_Object *obj, |