return result;
} else if (strcmp(rec_key_val, "server_restart_notification") == 0) {
hide_loading_popup(app);
- show_toast(app, i18n_get_text("IDS_NFC_POP_INITIALISING_PLEASE_WAIT_ING"));
+ if (!app->is_waiting_for_phone_num)
+ show_toast(app, "Network error. Please try again");
+
ecore_timer_add(1, on_start_server_requested, app);
} else if (strcmp(rec_key_val, "registration_done") == 0) {
char* is_success_val = NULL;
result = bundle_get_str(rec_msg, "is_success", &is_success_val);
-
+ if (app->login_timer)
+ ecore_timer_del(app->login_timer);
+ app->login_timer = NULL;
+
if (strncmp("true", is_success_val, strlen("true")) == 0) {
//show_toast(app, is_success_val);
// Launch login view
} else if (strcmp(rec_key_val, "request_phone_num_again") == 0) {
show_toast(app, "Please enter a valid phone number.");
hide_loading_popup(app);
+ } else if (strcmp(rec_key_val, "request_phone_new_num") == 0) {
+ app->is_waiting_for_phone_num = EINA_TRUE;
} else if (strcmp(rec_key_val, "server_connection_failed") == 0) {
show_toast(app, "Server connection failed. please check network connection");
hide_loading_popup(app);
app->s_notififcation = NULL;
app->panel = NULL;
app->is_server_ready = EINA_FALSE;
+ app->is_waiting_for_phone_num = EINA_FALSE;
+ app->login_timer = NULL;
app->contact_list = NULL;
char *chat_bg = NULL;
ad->s_notififcation = NULL;
ad->panel = NULL;
ad->is_server_ready = EINA_FALSE;
+ ad->is_waiting_for_phone_num = EINA_FALSE;
+ ad->login_timer = NULL;
ad->contact_list = NULL;
ad->main_item = NULL;
ad->country_codes_list = NULL;
elm_object_disabled_set(done_btn, EINA_TRUE);
}
+Eina_Bool on_login_timer_expired(void *data)
+{
+ appdata_s *ad = data;
+ if (!ad)
+ return ECORE_CALLBACK_CANCEL;
+
+ hide_loading_popup(ad);
+ send_request_for_restart_server(ad, ad->service_client);
+ return ECORE_CALLBACK_CANCEL;
+}
+
+
static void on_naviframe_done_clicked(void *data, Evas_Object *obj, void *event_info)
{
appdata_s* ad = data;
char phone_number[256];
snprintf(phone_number, sizeof(phone_number), "%s%s", cunt_code, phone_num);
ad->phone_number = strdup(phone_number);
- show_loading_popup(ad);
send_request_for_registration(ad, ad->service_client, ad->phone_number, EINA_TRUE);
+
+ if (!ad->is_waiting_for_phone_num)
+ ad->login_timer = ecore_timer_add(60, on_login_timer_expired, ad);
+ show_loading_popup(ad);
} else {
launch_tg_server(ad);
show_toast(ad, i18n_get_text("IDS_NFC_POP_INITIALISING_PLEASE_WAIT_ING"));
app_visible_state s_app_visible_state;
notification_h s_notififcation;
Eina_Bool is_server_ready;
+ Eina_Bool is_waiting_for_phone_num;
+ Ecore_Timer *login_timer;
TelegramAppDirection target_direction;
Evas_Object *floating_btn;
Elm_Theme *theme;
extern void send_registration_response(tg_engine_data_s *tg_data, Eina_Bool is_success);
extern void send_request_code_again(tg_engine_data_s *tg_data);
extern void send_request_phone_num_again(tg_engine_data_s *tg_data);
+extern void send_request_phone_new_num(tg_engine_data_s *tg_data);
extern void send_name_registration_response(tg_engine_data_s *tg_data);
extern void send_contacts_load_done_response(tg_engine_data_s *tg_data, Eina_Bool is_success);
extern void send_self_profile_picture_updated_response(tg_engine_data_s *tg_data, char *file_path, Eina_Bool is_success);
make_arg1_response(tg_data, "request_phone_num_again", "phone_number", tg_data->phone_number);
}
+void send_request_phone_new_num(tg_engine_data_s *tg_data)
+{
+ make_base_response(tg_data, "request_phone_new_num");
+}
+
void send_request_code_again(tg_engine_data_s *tg_data)
{
make_arg1_response(tg_data, "request_reg_code_again", "phone_number", tg_data->phone_number);
if (tg_data->tg_state == TG_ENGINE_STATE_REGISTRATION) {
send_request_phone_num_again(tg_data);
} else {
- //tg_data->is_first_time_registration = EINA_TRUE;
tg_data->tg_state = TG_ENGINE_STATE_REGISTRATION;
- if (tg_data && tg_data->phone_number) {
+ if (tg_data && tg_data->phone_number)
tg_data->get_string(TLS, tg_data->phone_number, tg_data->callback_arg);
- //tg_data->code_response_timer = ecore_timer_add(60, on_code_request_timer_expired, tg_data);
- }
+ else
+ send_request_phone_new_num(tg_data);
}
- } else if (strcmp(prompt, "code('call' for phone call):") == 0) {
-/* if (tg_data->code_response_timer) {
- ecore_timer_del(tg_data->code_response_timer);
- tg_data->code_response_timer = NULL;
- }*/
+ } else if (strcmp(prompt, "code('call' for phone call):") == 0) {
void **T = arg;
tg_data->mhash = strdup(T[1]);