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 {
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)
{
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)
}
init_service(ad);
- launch_tg_server(data);
+
return true;
}
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;
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;
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);
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);
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);
#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"},
{"Russia (+7)", "+7"},
{"Singapore (+65)", "+65"},
{"South Korea (+82)", "+82"},
- {"United States (+1)" , "+1"}
+ {"United States (+1)" , "+1"},
+ {"Vietnam (+84)" , "+84"}
};
{
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)
}
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);
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) {
}
}
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 {
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;
}
}
}
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 {
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);
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);