Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Localization & delete account & login & learning statistics #226

Merged
merged 4 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions source/EduCATS/Helpers/Forms/Pages/AppPages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ public async Task ClosePage(bool modal, bool animated = true)
/// <summary>
/// Open group finding page.
/// </summary>
public void OpenFindGroup() =>
switchMainPage(new FindGroupPageView());
/// <param name="title"></param>
/// <returns></returns>
public async Task OpenFindGroup(string title) =>
await pushPage(new FindGroupPageView(),title);

public async Task OpenParentalStats(GroupInfo group, string title) =>
await pushPage(new ParentalStatsPageView(group), title);
Expand Down
10 changes: 6 additions & 4 deletions source/EduCATS/Helpers/Forms/Pages/Interfaces/IPages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ public interface IPages
/// </summary>
void OpenMain();

/// <summary>
/// Open finding group page.
/// <summary>
/// Open finding group page.
/// </summary>
public void OpenFindGroup();

/// <param name="title">Title.</param>
/// <returns></returns>
public Task OpenFindGroup(string title);

/// <summary>
/// Open parental control statistics
/// </summary>
Expand Down
11 changes: 11 additions & 0 deletions source/EduCATS/Localization/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"base_error": "Памылка",
"base_cancel": "Адмена",
"base_success": "Поспех",
"base_completed": "Дзеянне завершана",
"base_warning": "Увага",
"base_loading": "Пампаванне...",
"base_unexpected_error": "Адбылася неспадзяваная памылка. Калі ласка, паспрабуйце яшчэ раз ці звярніцеся ў службу падтрымкі. Магчыма тэрмін дзеяння токена скончыўся, калі ласка перезайдите ў дадатак.",
Expand Down Expand Up @@ -34,6 +35,7 @@
"login_empty_credentials_error": "Патрэбныя імя карыстальніка і пароль",
"login_error": "Не атрымалася ўвайсці ў сістэму. Калі ласка праверце ўведзеныя даныя.",
"login_user_profile_error": "Здарылася памылка падчас атрымання даных профіля. Калі ласка паспрабуйце яшчэ раз альбо звярніцеся ў службу падтрымкі.",
"login_user_profile_not_verify": "Ваш акаўнт не пацверджаны. Звяжыцеся са сваім настаўнікам, каб пацвердзіць свой уліковы запіс.",

"main_today": "Сёння",
"main_learning": "Навучанне",
Expand Down Expand Up @@ -137,6 +139,7 @@

"settings_delete_message": "Вы сапраўды жадаеце выдаліць акаўнт?",
"settings_delete_success": "Ваш акаўнт выдалены",
"settings_delete_process": "Выдаленне дадзеных профілю...",

"settings_about_app_version": "Версія",
"settings_about_app_build": "Зборка",
Expand All @@ -148,6 +151,14 @@
"settings_about_send_logs_error": "Здарылася памылка падчас адпраўкі логаў. Калі ласка паспрабуйце зноў альбо звярніцеся ў службу падтрымкі.",
"settings_about_contributors": "Аўтары",

"parental_login": "Статыстыка паспяховасці",
"parental_enter_group_number": "Увядзіце нумар групы",
"parental_enter_full_name": "Увядзіце Прозвішча, імя,",
"parental_error_empty_group_number": "Калі ласка, увядзіце нумар гурта",
"parental_group_not_found": "Гэты гурт не знойдзены",
"parental_connection_error": "Не атрымалася падлучыцца да сервера",
"parental_get_statistics": "Атрымаць статыстыку",

"pets_name": "Мянушка любімага жывёльнага?",
"hobby": "Ваша хобі?",
"mother_last_name": "Дзявочае прозвішча маці?",
Expand Down
11 changes: 11 additions & 0 deletions source/EduCATS/Localization/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"base_error": "Fehler",
"base_cancel": "Abbruch",
"base_success": "Erfolg",
"base_completed": "Aktion abgeschlossen",
"base_warning": "Achtung",
"base_loading": "Laden...",
"base_unexpected_error": "Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es erneut oder Kontaktieren Sie den Support. Der Token ist möglicherweise abgelaufen, bitte geben Sie die Anwendung erneut ein.",
Expand Down Expand Up @@ -34,6 +35,7 @@
"login_empty_credentials_error": "Benutzername und Passwort sind erforderlich.",
"login_error": "Anmeldung fehlschlagen. Bitte, uberprufen Sie die eingegebenen Daten.",
"login_user_profile_error": "Fehler beim abrufen von Profildaten. Bitte versuchen Sie es erneut oder Kontaktieren Sie den Support.",
"login_user_profile_not_verify": "Ihr Konto wurde nicht verifiziert. Wenden Sie sich an Ihren Lehrer, um Ihr Konto zu verifizieren.",

"main_today": "Heute",
"main_learning": "Ausbildung",
Expand Down Expand Up @@ -139,6 +141,7 @@

"settings_delete_message": "Möchten Sie Ihr Konto wirklich löschen?",
"settings_delete_success": "Dein Account wurde gelöscht",
"settings_delete_process": "Profildaten werden gelöscht...",

"settings_about_app_version": "Version",
"settings_about_app_build": "Assembling ",
Expand All @@ -150,6 +153,14 @@
"settings_about_send_logs_error": "Fehler beim senden von Protokollen. Bitte versuchen Sie es erneut oder Kontaktieren Sie den Support.",
"settings_about_contributors": "Autoren",

"parental_login": "Fortschrittsstatistik",
"parental_enter_group_number": "Gruppennummer eingeben",
"parental_enter_full_name": "Vollständigen Namen eingeben",
"parental_error_empty_group_number": "Bitte geben Sie eine Gruppennummer ein",
"parental_group_not_found": "Die angegebene Gruppe wurde nicht gefunden",
"parental_connection_error": "Verbindung zum Server nicht möglich",
"parental_get_statistics": "Statistik abrufen",

"pets_name": "Wie heißt Ihr Lieblingstier?",
"hobby": "Was ist dein Hobby?",
"mother_last_name": "Mädchenname der Mutter?",
Expand Down
5 changes: 4 additions & 1 deletion source/EduCATS/Localization/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"base_error": "Error",
"base_cancel": "Cancel",
"base_success": "Success",
"base_completed": "Action completed",
"base_warning": "Warning",
"base_loading": "Loading...",
"base_unexpected_error": "Unexpected error occurred. Please try again or contact support. May be the token has expired, please re-enter the application.",
Expand Down Expand Up @@ -34,6 +35,7 @@
"login_empty_credentials_error": "Username and password are required.",
"login_error": "Invalid login attempt. Please check your credentials.",
"login_user_profile_error": "Error occurred during retrieving profile data. Please try again or contact support.",
"login_user_profile_not_verify": "Your account has not been verified. Contact your teacher to verify your account.",

"main_today": "Today",
"main_learning": "Learning",
Expand Down Expand Up @@ -139,6 +141,7 @@

"settings_delete_message": "Are you sure you want to delete your account?",
"settings_delete_success": "Your account has been deleted",
"settings_delete_process": "Deleting profile data...",

"settings_about_app_version": "Version",
"settings_about_app_build": "Build",
Expand All @@ -150,7 +153,7 @@
"settings_about_send_logs_error": "Error occurred during sending logs. Please try again or contact support.",
"settings_about_contributors": "Contributors",

"parental_login": "Parental control",
"parental_login": "Learning statistics",
"parental_error_empty_group_number": "Please enter the group number",
"parental_group_not_found": "The specified group was not found",
"parental_connection_error": "Failed to connect to server",
Expand Down
11 changes: 11 additions & 0 deletions source/EduCATS/Localization/lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"base_error": "Klaida",
"base_cancel": "Atšaukimas",
"base_success": "Successo",
"base_completed": "Azione completata",
"base_warning": "Dėmesio",
"base_loading": "Pakrovimas...",
"base_unexpected_error": "Įvyko netikėta klaida. Bandykite dar kartą arba susisiekite su palaikymo tarnyba. Gali būti, kad prieigos raktas nebegalioja. Įveskite programą iš naujo.",
Expand Down Expand Up @@ -34,6 +35,7 @@
"login_empty_credentials_error": "Reikalingas vartotojo vardas ir slaptažodis.",
"login_error": "Prisijungimas nepavyko. Patikrinkite įvestus duomenis.",
"login_user_profile_error": "Gaunant profilio duomenis įvyko klaida. Bandykite dar kartą arba susisiekite su palaikymo tarnyba.",
"login_user_profile_not_verify": "Il tuo account non è stato verificato. Contatta il tuo insegnante per verificare il tuo account.",

"main_today": "Šiandien",
"main_learning": "Mokymai",
Expand Down Expand Up @@ -139,6 +141,7 @@

"settings_delete_message": "Sei sicuro di voler eliminare il tuo account?",
"settings_delete_success": "Il tuo account è stato eliminato",
"settings_delete_process": "Eliminazione dei dati del profilo...",

"settings_about_app_version": "Versija",
"settings_about_app_build": "Programos sudarymas",
Expand All @@ -150,6 +153,14 @@
"settings_about_send_logs_error": "Siunčiant žurnalus įvyko klaida. Bandykite dar kartą arba susisiekite su palaikymo tarnyba.",
"settings_about_contributors": "Autoriai",

"parental_login": "Statistiche di avanzamento",
"parental_enter_group_number": "Inserisci il numero del gruppo",
"parental_enter_full_name": "Inserisci il nome completo",
"parental_error_empty_group_number": "Inserisci un numero di gruppo",
"parental_group_not_found": "Il gruppo specificato non è stato trovato",
"parental_connection_error": "Impossibile connettersi al server",
"parental_get_statistics": "Ottieni statistiche",

"pets_name": "Koks jūsų mėgstamiausio gyvūno vardas?",
"hobby": "koks tavo hobis?",
"mother_last_name": "Motinos mergautinė pavardė?",
Expand Down
12 changes: 11 additions & 1 deletion source/EduCATS/Localization/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"base_error": "Błąd",
"base_cancel": "Anuluj",
"base_success": "Powodzenie",
"base_completed": "Akcja zakończona",
"base_warning": "Uwaga",
"base_loading": "Ładowanie...",
"base_unexpected_error": "Wystąpił nieoczekiwany błąd. Spróbuj ponownie lub skontaktuj się z obsługą klienta. Token mógł wygasnąć, prosimy o ponowne wypełnienie wniosku.",
Expand Down Expand Up @@ -34,7 +35,7 @@
"login_empty_credentials_error": "Wymagana nazwa użytkownika i hasło.",
"login_error": "Nie można się zalogować. Proszę sprawdzić wprowadzone dane.",
"login_user_profile_error": "Wystąpił błąd podczas pobierania danych profilu. Spróbuj ponownie lub skontaktuj się z obsługą klienta.",

"login_user_profile_not_verify": "Twoje konto nie zostało zweryfikowane. Skontaktuj się ze swoim nauczycielem, aby zweryfikować konto.",
"main_today": "Dzisiaj",
"main_learning": "Uczenie",
"main_statistics": "Statystyk",
Expand Down Expand Up @@ -139,6 +140,7 @@

"settings_delete_message": "Czy na pewno chcesz usunąć swoje konto?",
"settings_delete_success": "Twoje konto zostało usunięte",
"settings_delete_process": "Usuwanie danych profilu...",

"settings_about_app_version": "Wersja",
"settings_about_app_build": "Kompilacja",
Expand All @@ -150,6 +152,14 @@
"settings_about_send_logs_error": "Wystąpił błąd podczas wysyłania logów. Spróbuj ponownie lub skontaktuj się z obsługą klienta.",
"settings_about_contributors": "Autorzy",

"parental_login": "Statystyki postępu",
"parental_enter_group_number": "Wprowadź numer grupy",
"parental_enter_full_name": "Wprowadź pełne imię i nazwisko",
"parental_error_empty_group_number": "Wprowadź numer grupy",
"parental_group_not_found": "Podana grupa nie została znaleziona",
"parental_connection_error": "Nie można połączyć się z serwerem",
"parental_get_statistics": "Pobierz statystyki",

"pets_name": "Jak nazywa się twoje ulubione zwierzę?",
"hobby": "Jakie jest Twoje hobby?",
"mother_last_name": "Nazwisko panieńskie matki?",
Expand Down
5 changes: 4 additions & 1 deletion source/EduCATS/Localization/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"base_error": "Ошибка",
"base_cancel": "Отмена",
"base_success": "Успех",
"base_completed": "Действие завершено",
"base_warning": "Внимание",
"base_loading": "Загрузка...",
"base_unexpected_error": "Произошла непредвиденная ошибка. Пожалуйста, попробуйте еще раз или обратитесь в службу поддержки. Возможно срок действия токена истек, перезайдите в приложение.",
Expand Down Expand Up @@ -36,6 +37,7 @@
"login_empty_credentials_error": "Требуются имя пользователя и пароль.",
"login_error": "Не удалось войти в систему. Пожалуйста, проверьте введенные данные.",
"login_user_profile_error": "Произошла ошибка во время получения данных профиля. Пожалуйста, попробуйте еще раз или обратитесь в службу поддержки.",
"login_user_profile_not_verify": "Ваш аккаунт не подтвержден. Свяжитесь со своим учителем, чтобы подтвердить свою учетную запись.",

"main_today": "Сегодня",
"main_learning": "Обучение",
Expand Down Expand Up @@ -142,6 +144,7 @@

"settings_delete_message": "Вы действительно хотите удалить аккаунт?",
"settings_delete_success": "Ваш аккаунт удалён",
"settings_delete_process": "Удаление данных профиля...",

"settings_about_app_version": "Версия",
"settings_about_app_build": "Сборка",
Expand All @@ -153,7 +156,7 @@
"settings_about_send_logs_error": "Произошла ошибка во время отправки логов. Пожалуйста, попробуйте снова или обратитесь в службу поддержки.",
"settings_about_contributors": "Авторы",

"parental_login": "Контроль успеваемости",
"parental_login": "Статистика успеваемости",
"parental_enter_group_number": "Введите номер группы",
"parental_enter_full_name": "Введите ФИО",
"parental_error_empty_group_number": "Пожалуйста введите номер группы",
Expand Down
14 changes: 14 additions & 0 deletions source/EduCATS/Networking/Models/Login/ServerError.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Newtonsoft.Json;

namespace EduCATS.Networking.Models.Login
{
public class ServerError
{
[JsonProperty("error")]
public int Error { get; set; }

[JsonProperty("description")]
public string Descriprion { get; set; }

}
}
26 changes: 25 additions & 1 deletion source/EduCATS/Pages/Login/ViewModels/LoginPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ protected async Task openRegistration()

protected async Task openParental()
{
_services.Navigation.OpenFindGroup();
await _services.Navigation.OpenFindGroup(CrossLocalization.Translate("parental_login"));
}


Expand Down Expand Up @@ -371,6 +371,30 @@ async Task<UserModel> loginRequest()
userLogin.UserId = userLoginTest.Id;
userLogin.Username = userLoginTest.Username;
}
catch (WebException ex)
{
HttpWebResponse httpResponse = (HttpWebResponse)ex.Response;
string answer = "";
if (ex.Response != null)
{
using (Stream stream = ex.Response.GetResponseStream())
{
StreamReader reader = new StreamReader(stream, Encoding.UTF8);
answer = reader.ReadToEnd();
}

var serverError = JsonConvert.DeserializeObject<ServerError>(answer);

if (serverError.Error == 1)
{
DataAccess.SetError(CrossLocalization.Translate("login_user_profile_not_verify"), false);
}
else
{
DataAccess.SetError(CrossLocalization.Translate("login_error"), false);
}
}
}
catch (Exception) { }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,6 @@ public Command ParentalCommand
async () => await openParental()));
}
}

Command _backCommand;
/// <summary>
/// Open Main Statistic page
/// </summary>
public Command BackCommand
{
get
{
return _backCommand ?? (_backCommand = new Command(() => _service.Navigation.OpenLogin()));
}
}

protected async Task openParental()
{
if (string.IsNullOrEmpty(GroupNumber))
Expand Down
19 changes: 0 additions & 19 deletions source/EduCATS/Pages/Parental/FindGroup/Views/FindGroupPageView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ StackLayout createDataForm()
var groupNumberEntry = createGroupNumberEntry(entryStyle);
var fIOEntry = createFIOEntry(entryStyle);
var findButton = createFindButton();
var backButton = createBackButton();

var mainStackLayout = new StackLayout
{
Expand All @@ -99,7 +98,6 @@ StackLayout createDataForm()
groupNumberEntry,
fIOEntry,
findButton,
backButton,
}
};

Expand Down Expand Up @@ -177,23 +175,6 @@ Button createFindButton()
return findButton;
}

Button createBackButton()
{
var backButton = new Button
{
Text = CrossLocalization.Translate("eemc_back_text"),
FontAttributes = FontAttributes.Bold,
TextColor = Color.FromHex(Theme.Current.LoginButtonTextColor),
BackgroundColor = Color.FromHex(Theme.Current.LoginButtonBackgroundColor),
Margin = _baseSpacing,
HeightRequest = _controlHeight,
Style = AppStyles.GetButtonStyle(bold: true)
};

backButton.SetBinding(Button.CommandProperty, "BackCommand");
return backButton;
}

Style getEntryStyle()
{
var style = AppStyles.GetEntryStyle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Xamarin.Forms;
using EduCATS.Pages.Parental.FindGroup.Models;
using EduCATS.Pages.Statistics.Base.ViewModels;
using Nyxbull.Plugins.CrossLocalization;

namespace EduCATS.Pages.Parental.Statistics
{
Expand Down Expand Up @@ -166,7 +167,7 @@ protected override void openPage(object selectedObject)
/// </summary>
protected void openParental()
{
_service.Navigation.OpenFindGroup();
_service.Navigation.OpenFindGroup(CrossLocalization.Translate("parental_login"));
}

}
Expand Down
Loading