From: nazib.ullah Date: Fri, 21 Oct 2016 13:15:41 +0000 (+0600) Subject: [TBT][tizen_3.0_wearable][push appID and appSecret moved to seperate file] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f61a1ea644eda740dc2f39df1665a949264014d;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][tizen_3.0_wearable][push appID and appSecret moved to seperate file] Change-Id: Ia001fce080fccbeba7816aabe8f0d9426ea6ac5f --- diff --git a/release/binary-arm/install.sh b/release/binary-arm/install.sh index 1662e95..f949e77 100644 --- a/release/binary-arm/install.sh +++ b/release/binary-arm/install.sh @@ -40,6 +40,7 @@ sdb push org.tizen.tbtcoreapp-1.0.0-arm.tpk /tmp sdb push dog_1024_960.gif /opt/home/owner/media/Images sdb push SampleMP3.mp3 /opt/home/owner/media/Sounds sdb push sampleH263.3gp /opt/home/owner/media/Videos +sdb push tbt_push_auth.xml /home/owner/media/Others sdb shell pkgcmd -i -t tpk -p /tmp/org.tizen.coretbt_dataprovider-1.0.0-arm.tpk sdb shell pkgcmd -i -t tpk -p /tmp/org.tizen.coretbt_serviceapp-1.0.0-arm.tpk diff --git a/release/binary-arm/org.tizen.tbtcoreapp-1.0.0-arm.tpk b/release/binary-arm/org.tizen.tbtcoreapp-1.0.0-arm.tpk index ad3595e..c905926 100644 Binary files a/release/binary-arm/org.tizen.tbtcoreapp-1.0.0-arm.tpk and b/release/binary-arm/org.tizen.tbtcoreapp-1.0.0-arm.tpk differ diff --git a/release/binary-arm/tbt_push_auth.xml b/release/binary-arm/tbt_push_auth.xml new file mode 100644 index 0000000..0ef94a4 --- /dev/null +++ b/release/binary-arm/tbt_push_auth.xml @@ -0,0 +1,5 @@ + + + da58f09b7dcd898f + E55A746761233098DDD1114F652AFE51 + diff --git a/release/binary-x86/install.sh b/release/binary-x86/install.sh index ca4a2a6..524176a 100644 --- a/release/binary-x86/install.sh +++ b/release/binary-x86/install.sh @@ -40,6 +40,7 @@ sdb push org.tizen.tbtcoreapp-1.0.0-i386.tpk /tmp sdb push dog_1024_960.gif /opt/home/owner/media/Images sdb push SampleMP3.mp3 /opt/home/owner/media/Sounds sdb push sampleH263.3gp /opt/home/owner/media/Videos +sdb push tbt_push_auth.xml /home/owner/media/Others sdb shell pkgcmd -i -t tpk -p /tmp/org.tizen.coretbt_dataprovider-1.0.0-i386.tpk sdb shell pkgcmd -i -t tpk -p /tmp/org.tizen.coretbt_serviceapp-1.0.0-i386.tpk diff --git a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk index 7009eea..dfe87a6 100644 Binary files a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk differ diff --git a/release/binary-x86/tbt_push_auth.xml b/release/binary-x86/tbt_push_auth.xml new file mode 100644 index 0000000..0ef94a4 --- /dev/null +++ b/release/binary-x86/tbt_push_auth.xml @@ -0,0 +1,5 @@ + + + da58f09b7dcd898f + E55A746761233098DDD1114F652AFE51 + diff --git a/tbtcoreapp/inc/utils/config.h b/tbtcoreapp/inc/utils/config.h index 56525e0..bec1b41 100644 --- a/tbtcoreapp/inc/utils/config.h +++ b/tbtcoreapp/inc/utils/config.h @@ -51,11 +51,6 @@ static int device_height = -1; extern bool __is_efl_test_running; -//Push: -#define PUSH_APP_ID "da58f09b7dcd898f" -#define PUSH_APP_SECRET "E55A746761233098DDD1114F652AFE51" - - // *_X_POS, *_Y_POS, *_WIDTH, *_HEIGHT are virtual (relative) coords of grid widget #define MAX_WIDTH 100 #define MAX_HEIGHT 100 diff --git a/tbtcoreapp/src/view/tbt-push-view.c b/tbtcoreapp/src/view/tbt-push-view.c index 19ba02d..7b78f73 100644 --- a/tbtcoreapp/src/view/tbt-push-view.c +++ b/tbtcoreapp/src/view/tbt-push-view.c @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include "utils/logger.h" #include "utils/config.h" @@ -91,7 +93,7 @@ static char* push_service_get_server_address(char* reg_id); static size_t _curl_response_cb(char *ptr, size_t size, size_t nmemb, void *userdata); static void push_service_update_btn_state(void* user_data); static char* push_service_get_error(int error_code); - +static char* get_xml_element_value (xmlDocPtr doc, xmlNodePtr cur, const char* tag); /** * @function push_view_add @@ -121,8 +123,31 @@ push_view *push_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item RETVM_IF(NULL == this->view, NULL, "navi is null"); - this->push_app_id_text = PUSH_APP_ID; - this->push_app_secret_text = PUSH_APP_SECRET; + //get appID and appSecret from file + char auth_file_path[256]={'\0',}; + + snprintf(auth_file_path, sizeof(auth_file_path), "%s/%s",TBT_LOGGING_DIR,"tbt_push_auth.xml"); + DBG("auth_file_path file set = %s", auth_file_path); + + xmlDoc *doc = NULL; + xmlNode *root_element = NULL; + + doc = xmlReadFile(auth_file_path, NULL, 0); + + if (doc == NULL) { + DBG("error: could not parse file %s\n",auth_file_path); + } + root_element = xmlDocGetRootElement(doc); + + this->push_app_id_text = get_xml_element_value(doc, root_element, "appID"); + this->push_app_secret_text = get_xml_element_value(doc, root_element, "appSecret"); + + DBG("appID : %s\n",this->push_app_id_text); + DBG("appSecret : %s\n",this->push_app_secret_text); + + xmlFreeDoc(doc); + xmlCleanupParser(); + this->push_label = ui_utils_label_add(this->view->layout, "Push"); elm_object_part_content_set(this->view->layout, "1txt", this->push_label); @@ -216,6 +241,24 @@ static void _app_destroy_cb(void* this) } +static char* get_xml_element_value (xmlDocPtr doc, xmlNodePtr cur, const char* tag) +{ + + xmlChar *key; + char* str; + cur = cur->xmlChildrenNode; + while (cur != NULL) { + if ((!xmlStrcmp(cur->name, (const xmlChar *)tag))) { + key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + str = strdup((char*)key); + xmlFree(key); + } + cur = cur->next; + } + return str; +} + + /** * @function _control_button_push_service_start_pressed_cb * @since_tizen 2.3 @@ -466,11 +509,11 @@ static void send_push_data_to_server(void* user_data) // Creating header char appID[1024]; - snprintf(appID, 1024, "appID:%s", PUSH_APP_ID); + snprintf(appID, 1024, "appID:%s", this->push_app_id_text); header_list = curl_slist_append(header_list, appID); char appSecret[1024]; - snprintf(appSecret, 1024, "appSecret:%s", PUSH_APP_SECRET); + snprintf(appSecret, 1024, "appSecret:%s", this->push_app_secret_text); header_list = curl_slist_append(header_list, appSecret);