Made changes as per UX guidelines. 98/51198/1
authorpolu.sandeep <polu.sandeep@samsung.com>
Thu, 5 Nov 2015 07:45:54 +0000 (16:45 +0900)
committerpolu.sandeep <polu.sandeep@samsung.com>
Thu, 5 Nov 2015 07:45:54 +0000 (16:45 +0900)
Change-Id: Idd09005978de7c63a8cb62095ad689697b52d0dd

TelegramTizen/res/edje/telegram_init_screen.edc
TelegramTizen/src/telegramtizen.c
TelegramTizen/src/tg_login.c
TelegramTizen/src/tg_messaging_view.c
TelegramTizen/src/tg_user_main_view.c
TelegramTizen/tg_utils/tg_common.h
tg-engine-service/tg_engine/tg_engine.c

index 67c1cc0..2b59c7b 100644 (file)
@@ -1251,7 +1251,7 @@ group
                        type: IMAGE;
                        description{
                                state: "default" 0.0;
-                                       rel1 { relative: 0.0 0.97; to, "swallow.text_entry"; }
+                                       rel1 { relative: 0.0 0.93; to, "swallow.text_entry"; }
                                        rel2 { relative: 1.0 1.0; to, "swallow.text_entry"; }
                                max: 800 2;
                                image {
index 786558a..9f746ce 100644 (file)
@@ -3287,6 +3287,55 @@ Eina_Bool on_load_main_view_requested(void *data)
     return ECORE_CALLBACK_CANCEL;
 }
 
+
+Eina_Bool on_init_view_requested(void *data)
+{
+       appdata_s *ad = data;
+       if (ad) {
+               Eina_List* user_info = get_registered_user_info();
+               if (!user_info) {
+                       elm_naviframe_item_pop(ad->nf);
+                       ad->current_app_state = TG_REGISTRATION_STATE;
+                       launch_init_screen(ad);
+               } else {
+                       //show_toast(ad, "user already registered");
+                       load_registered_user_data(ad);
+                       load_buddy_list_data(ad);
+                       load_unknown_buddy_list_data(ad);
+                       load_peer_data(ad);
+                       load_main_list_data(ad);
+                       eina_list_free(user_info);
+                       ecore_timer_add(2, on_load_main_view_requested, ad);
+               }
+       }
+    return ECORE_CALLBACK_CANCEL;
+}
+
+void on_tg_service_result_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
+{
+       appdata_s *ad = user_data;
+       if (result == APP_CONTROL_RESULT_SUCCEEDED) {
+               if (ad) {
+                       show_toast(ad, "Server launched successfully.");
+               } else {
+                       show_toast(ad, "Server not launched.");
+               }
+       }
+}
+
+static void launch_tg_server(void *data)
+{
+       appdata_s *ad = data;
+       app_control_h app_control;
+       int ret = app_control_create(&app_control);
+/*     ret = app_control_set_operation(app_control, "http://tizen.org/appcontrol/operation/launch_on_event");
+       ret = app_control_set_mime(app_control, "application/telegram");
+       ret = app_control_set_uri(app_control, "http://tizen.org/appcontrol/operation/telegram_start");*/
+       ret = app_control_set_app_id(app_control, "org.tizen.tg-engine-service");
+       ret = app_control_send_launch_request(app_control, &on_tg_service_result_cb, ad);
+       ret = app_control_destroy(app_control);
+}
+
 static void create_base_gui(appdata_s *ad)
 {
 
@@ -3352,53 +3401,9 @@ static void create_base_gui(appdata_s *ad)
                ad->chat_background = strdup(ui_utils_get_resource(TG_CHAT_DEFAULT_BG));
                preference_set_string(TG_CHAT_BG_PREFERENCE, ad->chat_background);
        }
-
-       Eina_List* user_info = get_registered_user_info();
-
-       if (!user_info) {
-               elm_naviframe_item_pop(ad->nf);
-               ad->current_app_state = TG_REGISTRATION_STATE;
-               launch_init_screen(ad);
-               //launch_user_main_view_cb(ad);
-       } else {
-               //show_toast(ad, "user already registered");
-               load_registered_user_data(ad);
-               load_buddy_list_data(ad);
-               load_unknown_buddy_list_data(ad);
-               load_peer_data(ad);
-               load_main_list_data(ad);
-
-               ecore_timer_add(2, on_load_main_view_requested, ad);
-
-       }
-
+       launch_tg_server(ad);
+       ecore_timer_add(5, on_init_view_requested, ad);
        ucol_init();
-       //eina_list_free(user_info);
-}
-
-void on_tg_service_result_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
-{
-       appdata_s *ad = user_data;
-       if (result == APP_CONTROL_RESULT_SUCCEEDED) {
-               if (ad) {
-                       show_toast(ad, "Server launched successfully.");
-               } else {
-                       show_toast(ad, "Server not launched.");
-               }
-       }
-}
-
-static void launch_tg_server(void *data)
-{
-       appdata_s *ad = data;
-       app_control_h app_control;
-       int ret = app_control_create(&app_control);
-/*     ret = app_control_set_operation(app_control, "http://tizen.org/appcontrol/operation/launch_on_event");
-       ret = app_control_set_mime(app_control, "application/telegram");
-       ret = app_control_set_uri(app_control, "http://tizen.org/appcontrol/operation/telegram_start");*/
-       ret = app_control_set_app_id(app_control, "org.tizen.tg-engine-service");
-       ret = app_control_send_launch_request(app_control, &on_tg_service_result_cb, ad);
-       ret = app_control_destroy(app_control);
 }
 
 static bool app_create(void *data)
@@ -3440,7 +3445,7 @@ static bool app_create(void *data)
 
        }
        init_service(ad);
-       launch_tg_server(data);
+
        return true;
 }
 
index 06a863a..74f1296 100644 (file)
@@ -96,7 +96,8 @@ static Eina_Bool on_code_timer_cb(void* data)
 
                char temp_txt[512] = {0,};
                snprintf(temp_txt, sizeof(temp_txt), i18n_get_text("IDS_TGRAM_BODY_TELEGRAM_WILL_CALL_IN_P1SD_CP2SD"), 0, 0);
-
+               Evas_Object *layout = evas_object_data_get(ad->nf, "layout");
+               elm_object_part_text_set(layout, "timer_text", temp_txt);
                // send request to get phone call
                send_request_for_registration(ad, ad->service_client, ad->phone_number, EINA_FALSE);
                return ECORE_CALLBACK_CANCEL;
index 0912c7d..c9ef41f 100644 (file)
@@ -1851,8 +1851,7 @@ static void on_text_message_send_clicked(void *data, Evas_Object *obj, void *eve
        Evas_Object* text_entry = evas_object_data_get(chat_list, "text_entry");
 
        peer_with_pic_s *sel_item =  eina_list_nth(ad->peer_list, user_id);
-
-       const char* text_to_send = elm_entry_entry_get(text_entry);
+       const char* text_to_send = elm_entry_markup_to_utf8(elm_object_text_get(text_entry));
        if (!text_to_send || (strlen(text_to_send) == 0))
                return;
 
@@ -3387,6 +3386,9 @@ void launch_messaging_view_cb(appdata_s* ad, int user_id)
        evas_object_size_hint_weight_set(text_entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_show(text_entry);
        elm_entry_scrollable_set(text_entry, EINA_TRUE);
+       elm_entry_end_visible_set(text_entry, EINA_TRUE);
+       elm_entry_icon_visible_set(text_entry, EINA_TRUE);
+       elm_entry_line_wrap_set(text_entry, ELM_WRAP_MIXED);
        evas_object_smart_callback_add(text_entry, "clicked", on_message_text_entry_clicked, ad);
        elm_object_part_content_set(entry_box_layout, "swallow.text_entry", text_entry);
 
index 4400035..363bfdb 100644 (file)
@@ -764,9 +764,9 @@ Evas_Object* on_chat_item_load_requested(void *data, Evas_Object *obj, const cha
 
                char* org_msg = NULL;
                if (item->last_message) {
-                       org_msg = item->last_message;
+                       org_msg = str_replace(item->last_message, "<br/>", " ");
                } else {
-                       org_msg = "";
+                       org_msg = strdup("");
                }
 
                int len_org_str = strlen(org_msg);
@@ -787,6 +787,7 @@ Evas_Object* on_chat_item_load_requested(void *data, Evas_Object *obj, const cha
                                sprintf(status_buf, "<font=Tizen:style=Bold color=#A4A4A4 align=left><font_size=28>%s</font_size></font>", org_msg);
                        }
                }
+               free(org_msg);
 
                Evas_Object*  status_lbl = elm_label_add(ad->nf);
                elm_object_text_set(status_lbl, status_buf);
index 8a23458..57ccce3 100644 (file)
 #define TGL_PEER_ENCR_CHAT 4
 #define TGL_PEER_UNKNOWN 0
 
-#define SIZE_CODE 10
+#define SIZE_CODE 11
 static char *phone_codes[SIZE_CODE][2] = { {"Argentina (+54)", "+54"},
                                                                                {"Brazil (+55)", "+55"},
                                                                                {"China (+86)", "+86"},
@@ -187,7 +187,8 @@ static char *phone_codes[SIZE_CODE][2] = { {"Argentina (+54)", "+54"},
                                                                                {"Russia (+7)", "+7"},
                                                                                {"Singapore (+65)", "+65"},
                                                                                {"South Korea (+82)", "+82"},
-                                                                               {"United States (+1)" , "+1"}
+                                                                               {"United States (+1)" , "+1"},
+                                                                               {"Vietnam (+84)" , "+84"}
                                                                             };
 
 
index faa9208..857f8a7 100644 (file)
@@ -500,7 +500,9 @@ void request_for_code_via_call(struct tgl_state *TLS, char* phone_no, Eina_Bool
 {
        tg_engine_data_s *tg_data;
        tg_data = TLS->callback_data;
-       tgl_do_phone_call(TLS, tg_data->phone_number, tg_data->mhash, on_code_via_phone_result, TLS);
+       if (tg_data && tg_data->phone_number && tg_data->mhash) {
+               tgl_do_phone_call(TLS, tg_data->phone_number, tg_data->mhash, on_code_via_phone_result, TLS);
+       }
 }
 
 void tg_get_string(struct tgl_state *TLS, const char *prompt, int flags, void(*callback)(struct tgl_state *TLS, char *string, void *arg), void *arg)
@@ -531,7 +533,7 @@ void tg_get_string(struct tgl_state *TLS, const char *prompt, int flags, void(*c
                }
 
                void **T = arg;
-               tg_data->mhash = T[1];
+               tg_data->mhash = strdup(T[1]);
 
                if (tg_data->tg_state == TG_ENGINE_STATE_CODE_REQUEST) {
                        send_request_code_again(tg_data);
@@ -1848,6 +1850,9 @@ void on_buddy_info_loaded(struct tgl_state *TLS, void *callback_extra, int succe
 void on_chat_history_received(struct tgl_state *TLS, void *callback_extra, int success, int size, struct tgl_message *list[])
 {
        tg_engine_data_s *tg_data = TLS->callback_data;
+       if (!tg_data)
+               return;
+
        for (int i = 0; i < size; i++) {
                struct tgl_message* message = list[i];
                if (message->service || message->from_id.id == tg_data->id.id) {
@@ -1859,7 +1864,7 @@ void on_chat_history_received(struct tgl_state *TLS, void *callback_extra, int s
                }
        }
        tg_data->current_chat_index = tg_data->current_chat_index + 1;
-       if (tg_data->current_chat_index < eina_list_count(tg_data->chat_list)) {
+       if (tg_data->chat_list && (tg_data->current_chat_index < eina_list_count(tg_data->chat_list))) {
                tgl_peer_t* UC = eina_list_nth(tg_data->chat_list, tg_data->current_chat_index);
                tgl_do_get_history(s_info.TLS, UC->id, 20, 0, on_chat_history_received, UC);
        } else {
@@ -1870,11 +1875,13 @@ void on_chat_history_received(struct tgl_state *TLS, void *callback_extra, int s
 static Eina_Bool on_load_chat_history_requested(void *data)
 {
        struct tgl_state *TLS = data;
-       if (TLS) {
-               tg_engine_data_s *tg_data = TLS->callback_data;
+       tg_engine_data_s *tg_data = TLS->callback_data;
+       if (TLS && tg_data && tg_data->chat_list && eina_list_count(tg_data->chat_list) > 0) {
                tg_data->current_chat_index = 0;
                tgl_peer_t* UC = eina_list_nth(tg_data->chat_list, tg_data->current_chat_index);
-               tgl_do_get_history(s_info.TLS, UC->id, 20, 0, on_chat_history_received, UC);
+               if (UC) {
+                       tgl_do_get_history(s_info.TLS, UC->id, 20, 0, on_chat_history_received, UC);
+               }
        }
        return ECORE_CALLBACK_CANCEL;
 }
@@ -1893,7 +1900,7 @@ void on_buddy_history_received(struct tgl_state *TLS, void *callback_extra, int
                }
        }
        tg_data->current_buddy_index = tg_data->current_buddy_index + 1;
-       if (tg_data->current_buddy_index < eina_list_count(tg_data->buddy_list)) {
+       if (tg_data->buddy_list && (tg_data->current_buddy_index < eina_list_count(tg_data->buddy_list))) {
                tgl_peer_t* UC = eina_list_nth(tg_data->buddy_list, tg_data->current_buddy_index);
                tgl_do_get_history(s_info.TLS, UC->id, 20, 0, on_buddy_history_received, UC);
        } else {
@@ -1905,8 +1912,8 @@ void on_buddy_history_received(struct tgl_state *TLS, void *callback_extra, int
 static Eina_Bool on_load_buddy_history_requested(void *data)
 {
        struct tgl_state *TLS = data;
-       if (TLS) {
-               tg_engine_data_s *tg_data = TLS->callback_data;
+       tg_engine_data_s *tg_data = TLS->callback_data;
+       if (TLS && tg_data && tg_data->buddy_list && eina_list_count(tg_data->buddy_list) > 0) {
                tg_data->current_buddy_index = 0;
                tgl_peer_t* UC = eina_list_nth(tg_data->buddy_list, tg_data->current_buddy_index);
                tgl_do_get_history(s_info.TLS, UC->id, 20, 0, on_buddy_history_received, UC);
@@ -1964,7 +1971,7 @@ void on_contacts_received(struct tgl_state *TLS, void *callback_extra, int succe
                struct tgl_user *buddy = contacts[i];
                tgl_do_get_user_info(TLS, buddy->id, 0, on_buddy_info_loaded, NULL);
        }
-       send_response_for_server_connection_status(tg_data, tg_data->is_login_activated);
+       //send_response_for_server_connection_status(tg_data, tg_data->is_login_activated);
        ecore_timer_add(3, on_send_unsent_messages_requested, TLS);
        ecore_timer_add(6, on_load_buddy_history_requested, TLS);
        //ecore_timer_add(12, send_chat_loading_is_done_response, TLS);