From 64c932de495944782a29ce9c190a4ec3dd46644c Mon Sep 17 00:00:00 2001 From: "seungha.son" Date: Tue, 1 Nov 2016 19:27:41 +0900 Subject: Delete notification_setting_set_package_name API() - It is dangerous that package_name is changed. If package name is changed, unexpected problems may arise. Signed-off-by: seungha.son Change-Id: Ic2939c8385cc5b639a14a8ee45e3e1f89f83798c --- include/notification_setting_internal.h | 35 --------------------------------- src/notification_setting.c | 16 --------------- 2 files changed, 51 deletions(-) diff --git a/include/notification_setting_internal.h b/include/notification_setting_internal.h index 9320bb7..f3bd201 100644 --- a/include/notification_setting_internal.h +++ b/include/notification_setting_internal.h @@ -224,41 +224,6 @@ int notification_setting_get_setting_by_package_name_for_uid(const char *package */ int notification_setting_get_package_name(notification_setting_h setting, char **value); -/* - * @internal - * @brief Sets package name to notification setting handle. - * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif - * @param[in] setting The notification setting handle - * @param[in] value The package name - * @return #NOTIFICATION_ERROR_NONE on success, - * otherwise any other value on failure - * @retval #NOTIFICATION_ERROR_NONE Success - * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter - * @par sample code: - * @code -#include -... -{ - int noti_err = 0; - char *package_name = "org.tizen.example"; - notification_setting_h setting = NULL; - - ... - - noti_err = notification_setting_set_package_name(setting, package_name); - if (noti_err != NOTIFICATION_ERROR_NONE) { - return; - } - - notification_setting_free_notification(setting); - - return 0; - -} - * @endcode - */ -int notification_setting_set_package_name(notification_setting_h setting, char *value); - /* * @internal * @brief Gets value which whether allow notification from individual applications. diff --git a/src/notification_setting.c b/src/notification_setting.c index 013efdd..6116e7b 100755 --- a/src/notification_setting.c +++ b/src/notification_setting.c @@ -117,22 +117,6 @@ EXPORT_API int notification_setting_get_package_name(notification_setting_h sett return NOTIFICATION_ERROR_NONE; } -EXPORT_API int notification_setting_set_package_name(notification_setting_h setting, char *value) -{ - - if (setting == NULL || value == NULL) { - NOTIFICATION_ERR("Invalid parameter"); - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - if (setting->package_name != NULL) - free(setting->package_name); - - setting->package_name = SAFE_STRDUP(value); - - return NOTIFICATION_ERROR_NONE; -} - EXPORT_API int notification_setting_get_allow_to_notify(notification_setting_h setting, bool *value) { if (setting == NULL || value == NULL) { -- cgit v1.2.3 From c09c242d385164139866230ae994ed2b3bb2f154 Mon Sep 17 00:00:00 2001 From: Myungki Lee Date: Tue, 1 Nov 2016 15:32:44 +0900 Subject: Updates the guide codes in set_text_input() - guides two options 1. Show text input box directly 2. Show when pressing the button Change-Id: I50f3c05d1e67628080c936038bea7a53f3a78b55 Signed-off-by: Myungki Lee --- include/notification.h | 111 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 104 insertions(+), 7 deletions(-) diff --git a/include/notification.h b/include/notification.h index 0f42558..0b5b60a 100755 --- a/include/notification.h +++ b/include/notification.h @@ -1566,11 +1566,16 @@ int notification_get_noti_block_state(notification_block_state_e *state); * For setting just a text to the button, you can set the text using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON type. * If you want to show image button, you can set an image for the button using notification_set_image() with #NOTIFICATION_IMAGE_TYPE_TEXT_INPUT_BUTTON type. * - * Note that You should set an app_control for handling the event for user input using notification_set_event_handler(). + * Note that you should set an app_control for handling the event for user input using notification_set_event_handler(). * #NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON is the event type for the text input. * You can get the text the user enters in the app_control handle that is passed as a result of the event. * The app_control will contain APP_CONTROL_DATA_TEXT key, so you can get the text using app_control_get_extra_data() using APP_CONTROL_DATA_TEXT key. * The value will contain the text user enters. + * + * Note that you are able to make the switching button to the text input box. + * You have to set the app_control which you will set in a text input box to the switching button. + * Refer to the second sample code. + * @since_tizen 3.0 * @return #NOTIFICATION_ERROR_NONE on success, * otherwise any other value on failure @@ -1581,15 +1586,14 @@ int notification_get_noti_block_state(notification_block_state_e *state); #include ... { - notification_h noti = NULL; int noti_err = NOTIFICATION_ERROR_NONE; + notification_h noti = NULL; app_control = NULL; noti = notification_create(NOTIFICATION_TYPE_NOTI); if (noti == NULL) { return; } - ... noti_err = notification_set_text_input(noti, 160); if (noti_err != NOTIFICATION_ERROR_NONE) { @@ -1614,15 +1618,13 @@ int notification_get_noti_block_state(notification_block_state_e *state); return; } - noti_err = notification_set_image(noti, - NOTIFICATION_IMAGE_TYPE_TEXT_INPUT_BUTTON, - TEXT_INPUT_BUTTON_PATH); + noti_err = notification_set_display_applist(noti, + NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE); if (noti_err != NOTIFICATION_ERROR_NONE) { return; } ... - noti_err = app_control_create(&app_control); if (noti_err != APP_CONTROL_ERROR_NONE) { return; @@ -1654,7 +1656,102 @@ int notification_get_noti_block_state(notification_block_state_e *state); if(noti_err != NOTIFICATION_ERROR_NONE) { return; } +} + +... + +{ + int noti_err = NOTIFICATION_ERROR_NONE; + notification_h noti = NULL; + app_control = NULL; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_set_text_input(noti, 160); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + noti_err = notification_set_text(noti, + NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER, + "Text message", + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = notification_set_text(noti, + NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON, + "SEND", + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = notification_add_button(notification, NOTIFICATION_BUTTON_1); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = notification_set_text(notification, + NOTIFICATION_TEXT_TYPE_BUTTON_1, + "reply", + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = notification_set_display_applist(noti, + NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + ... + + noti_err = app_control_create(&app_control); + if (noti_err != APP_CONTROL_ERROR_NONE) { + return; + } + + noti_err = app_control_set_app_id(app_control, appid); + if (noti_err != APP_CONTROL_ERROR_NONE) { + return; + } + + noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT); + if (noti_err != APP_CONTROL_ERROR_NONE) { + return; + } + + noti_err = notification_set_event_handler(notification, + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, + app_control); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = notification_set_event_handler(noti, + NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON, + app_control); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = app_control_destroy(app_control); + if (noti_err != APP_CONTROL_ERROR_NONE) { + return; + } + + noti_err = notification_post(noti); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } } * @endcode */ -- cgit v1.2.3