diff --git a/README.md b/README.md
index 51aec24..822d204 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,15 @@
# Racego
-A cross-platform race-management tool.
+A cross-platform race-management tool for Desktop and web.
+
+
+
+
Home screen with dark an light theme: quick access to user-management and ranking list
+
+## Languages
+
+English and German languages are supported.
## Supported Platforms
@@ -18,8 +26,19 @@ Every idea is welcome. Feel free to contribute via pull request or opening a iss
## Some backgrounds about Racego
-Racego was first released as a native Windows application in 2020. Later on, Neofix further increased the capabilities and refactored everythin up to a new release in 2021. Racego did served well on it's first tests and as it grows in popularity, Neofix decided to bring Racego to cross-platform with further possibilities of extensions.
+Racego was first released as a native Windows application in 2020. Later on, Neofix further increased the capabilities and refactored everything up to a new release in 2021. Racego did served well on it's first tests and as it grows in popularity, Neofix decided to bring Racego to cross-platform with further possibilities of extensions.
## License & copyright
-
+
Licensed under the [GPLv3 License](LICENSE).
+
+## Screenshots
+
+
Edit profile of every participant
+
+
+
+
+
+
+
diff --git a/lib/business_logic/login/login_bloc.dart b/lib/business_logic/login/login_bloc.dart
index fc9a497..48fb6f3 100644
--- a/lib/business_logic/login/login_bloc.dart
+++ b/lib/business_logic/login/login_bloc.dart
@@ -2,6 +2,7 @@ import 'package:bloc/bloc.dart';
import 'package:meta/meta.dart';
import 'package:racego/data/api/racego_api.dart';
import 'package:racego/data/exceptions/racego_exception.dart';
+import 'package:racego/generated/l10n.dart';
part 'login_event.dart';
part 'login_state.dart';
@@ -24,7 +25,7 @@ class LoginBloc extends Bloc {
emit(LoggedOut());
}
} on RacegoException catch (_) {
- emit(LoginError('Melden Sie sich erneut an'));
+ emit(LoginError(S.current.retry_login));
}
}
@@ -35,7 +36,7 @@ class LoginBloc extends Bloc {
if (isLoggedIn) {
emit(LoggedIn(username: _api.username));
} else {
- emit(LoginError('Email oder Passwort ist ungültig'));
+ emit(LoginError(S.current.login_invalid));
}
} on RacegoException catch (racegoException) {
emit(LoginError(racegoException.errorMessage));
diff --git a/lib/business_logic/ranking_cubit/ranking_cubit.dart b/lib/business_logic/ranking_cubit/ranking_cubit.dart
new file mode 100644
index 0000000..fff7660
--- /dev/null
+++ b/lib/business_logic/ranking_cubit/ranking_cubit.dart
@@ -0,0 +1,60 @@
+import 'package:bloc/bloc.dart';
+import 'package:meta/meta.dart';
+import 'package:racego/data/models/rankinglist.dart';
+
+import '../../data/api/racego_api.dart';
+import '../../data/exceptions/racego_exception.dart';
+import '../../generated/l10n.dart';
+
+part 'rankingcubit_state.dart';
+
+class RankingCubit extends Cubit {
+ RankingCubit(RacegoApi api)
+ : _api = api,
+ super(const RankingLoading(currentClass: '', classList: [])) {
+ loadClasses();
+ }
+ final RacegoApi _api;
+
+ List _classes = [];
+ String _currentClass = '';
+ RankingList _currentRanking = RankingList(null);
+
+ Future loadClasses() async {
+ try {
+ _classes = await _api.getCategories();
+ // if (!_classes.contains(_currentClass)) {
+ // _currentClass = '';
+ // _classes.clear();
+ // }
+ emit(RankingLoaded(_currentRanking,
+ currentClass: _currentClass, classList: _classes));
+ } catch (e) {
+ if (e is RacegoException) {
+ emit(RankingError(e, currentClass: _currentClass, classList: _classes));
+ } else {
+ UnknownException error = UnknownException(
+ S.current.unknown_error, e.toString(), e.runtimeType.toString());
+ emit(RankingError(error,
+ currentClass: _currentClass, classList: _classes));
+ }
+ }
+ }
+
+ Future loadRanking(String? raceClass) async {
+ try {
+ _currentRanking = await _api.getRankig(raceClass);
+ emit(RankingLoaded(_currentRanking,
+ currentClass: _currentClass, classList: _classes));
+ } catch (e) {
+ if (e is RacegoException) {
+ emit(RankingError(e, currentClass: _currentClass, classList: _classes));
+ } else {
+ UnknownException error = UnknownException(
+ S.current.unknown_error, e.toString(), e.runtimeType.toString());
+ emit(RankingError(error,
+ currentClass: _currentClass, classList: _classes));
+ }
+ }
+ }
+}
diff --git a/lib/business_logic/ranking_cubit/rankingcubit_state.dart b/lib/business_logic/ranking_cubit/rankingcubit_state.dart
new file mode 100644
index 0000000..9f2d959
--- /dev/null
+++ b/lib/business_logic/ranking_cubit/rankingcubit_state.dart
@@ -0,0 +1,29 @@
+part of 'ranking_cubit.dart';
+
+@immutable
+abstract class RankingcubitState {
+ const RankingcubitState(
+ {required this.currentClass, required this.classList});
+ final String currentClass;
+ final List classList;
+}
+
+class RankingLoading extends RankingcubitState {
+ const RankingLoading(
+ {required String currentClass, required List classList})
+ : super(currentClass: currentClass, classList: classList);
+}
+
+class RankingLoaded extends RankingcubitState {
+ const RankingLoaded(this.ranking,
+ {required String currentClass, required List classList})
+ : super(currentClass: currentClass, classList: classList);
+ final RankingList ranking;
+}
+
+class RankingError extends RankingcubitState {
+ const RankingError(this.exception,
+ {required String currentClass, required List classList})
+ : super(currentClass: currentClass, classList: classList);
+ final RacegoException exception;
+}
diff --git a/lib/business_logic/tracklist_cubit/tracklist_cubit.dart b/lib/business_logic/tracklist_cubit/tracklist_cubit.dart
index 8155bae..f4c1754 100644
--- a/lib/business_logic/tracklist_cubit/tracklist_cubit.dart
+++ b/lib/business_logic/tracklist_cubit/tracklist_cubit.dart
@@ -5,6 +5,8 @@ import 'package:racego/data/exceptions/racego_exception.dart';
import 'package:racego/data/models/time.dart';
import 'package:racego/data/models/user.dart';
+import '../../generated/l10n.dart';
+
part 'tracklist_state.dart';
class TracklistCubit extends Cubit {
@@ -52,7 +54,7 @@ class TracklistCubit extends Cubit {
));
} else {
UnknownException error = UnknownException(
- 'Unbekannter Fehler', e.toString(), e.runtimeType.toString());
+ S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(Error(
error,
_filter.isNotEmpty ? _filterList(_newestList, _filter) : _newestList,
@@ -81,8 +83,7 @@ class TracklistCubit extends Cubit {
try {
bool successful = await _api.cancelLap(userId);
if (!successful) {
- throw DataException(
- 'Benutzer konnte nicht von der Rennstrecke entfernt werden: Id ungültig.');
+ throw DataException(S.current.failed_cancelling_lap_invalid_id);
}
reload();
} catch (e) {
@@ -94,7 +95,7 @@ class TracklistCubit extends Cubit {
: _newestList));
} else {
UnknownException error = UnknownException(
- 'Unbekannter Fehler', e.toString(), e.runtimeType.toString());
+ S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(Error(
error,
_filter.isNotEmpty
@@ -110,8 +111,7 @@ class TracklistCubit extends Cubit {
try {
bool successful = await _api.finishLap(userId, time);
if (!successful) {
- throw DataException(
- 'Rundenzeit konnte nicht erfasst werden: Id oder Zeit ungültig.');
+ throw DataException(S.current.failed_finishing_lap_invalid_id);
}
reload();
} catch (e) {
@@ -123,7 +123,7 @@ class TracklistCubit extends Cubit {
: _newestList));
} else {
UnknownException error = UnknownException(
- 'Unbekannter Fehler', e.toString(), e.runtimeType.toString());
+ S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(Error(
error,
_filter.isNotEmpty
diff --git a/lib/business_logic/tracklist_cubit/tracklist_state.dart b/lib/business_logic/tracklist_cubit/tracklist_state.dart
index 6b27e98..f32d604 100644
--- a/lib/business_logic/tracklist_cubit/tracklist_state.dart
+++ b/lib/business_logic/tracklist_cubit/tracklist_state.dart
@@ -1,14 +1,3 @@
-// part of 'tracklist_cubit.dart';
-
-// @immutable
-// abstract class TracklistState {}
-
-// class Loading extends TracklistState {}
-
-// class Loaded extends TracklistState {}
-
-// class Error extends TracklistState {}
-
part of 'tracklist_cubit.dart';
@immutable
diff --git a/lib/business_logic/userlist_cubit/userlist_cubit.dart b/lib/business_logic/userlist_cubit/userlist_cubit.dart
index c8e69a3..59dac27 100644
--- a/lib/business_logic/userlist_cubit/userlist_cubit.dart
+++ b/lib/business_logic/userlist_cubit/userlist_cubit.dart
@@ -4,6 +4,8 @@ import 'package:racego/data/api/racego_api.dart';
import 'package:racego/data/exceptions/racego_exception.dart';
import 'package:racego/data/models/user.dart';
+import '../../generated/l10n.dart';
+
part 'userlist_state.dart';
class UserlistCubit extends Cubit {
@@ -51,7 +53,7 @@ class UserlistCubit extends Cubit {
));
} else {
UnknownException error = UnknownException(
- 'Unbekannter Fehler', e.toString(), e.runtimeType.toString());
+ S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(Error(
error,
_filter.isNotEmpty ? _filterList(_newestList, _filter) : _newestList,
@@ -67,8 +69,7 @@ class UserlistCubit extends Cubit {
try {
bool successful = await _api.deleteUser(userId);
if (!successful) {
- throw DataException(
- 'Benutzer konnte nicht entfernt werden: Id ungültig.');
+ throw DataException(S.current.failed_removing_user_invalid_id);
}
reload();
} catch (e) {
@@ -80,7 +81,7 @@ class UserlistCubit extends Cubit {
: _newestList));
} else {
UnknownException error = UnknownException(
- 'Unbekannter Fehler', e.toString(), e.runtimeType.toString());
+ S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(Error(
error,
_filter.isNotEmpty
@@ -96,8 +97,7 @@ class UserlistCubit extends Cubit {
try {
bool successful = await _api.addOnTrack(userId);
if (!successful) {
- throw DataException(
- 'Benutzer konnte nicht auf die Rennstrecke gestellt werden: Id ungültig.');
+ throw DataException(S.current.failed_adding_user_on_track_invalid_id);
}
reload();
} catch (e) {
@@ -109,7 +109,7 @@ class UserlistCubit extends Cubit {
: _newestList));
} else {
UnknownException error = UnknownException(
- 'Unbekannter Fehler', e.toString(), e.runtimeType.toString());
+ S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(Error(
error,
_filter.isNotEmpty
diff --git a/lib/business_logic/userscreen_cubit/userscreen_cubit.dart b/lib/business_logic/userscreen_cubit/userscreen_cubit.dart
index fdf69c6..175e0a3 100644
--- a/lib/business_logic/userscreen_cubit/userscreen_cubit.dart
+++ b/lib/business_logic/userscreen_cubit/userscreen_cubit.dart
@@ -4,6 +4,8 @@ import 'package:racego/data/api/racego_api.dart';
import 'package:racego/data/exceptions/racego_exception.dart';
import 'package:racego/data/models/userdetails.dart';
+import '../../generated/l10n.dart';
+
part 'userscreen_state.dart';
class UserscreenCubit extends Cubit {
@@ -27,14 +29,13 @@ class UserscreenCubit extends Cubit {
if (id > 0) {
loadEditUser(id);
} else {
- throw UnknownException(
- 'Benutzer konnte nicht erstellt werden: Datenbank Id ist ungültig');
+ throw UnknownException(S.current.failed_adding_user_invalid_id);
}
} on RacegoException catch (e) {
emit(UserScreenAddError(e));
} catch (error) {
- UnknownException e = UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ UnknownException e = UnknownException(S.current.unknown_error,
+ error.toString(), error.runtimeType.toString());
emit(UserScreenAddError(e));
}
}
@@ -51,8 +52,8 @@ class UserscreenCubit extends Cubit {
} on RacegoException catch (e) {
emit(UserScreenEditError(e));
} catch (error) {
- UnknownException e = UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ UnknownException e = UnknownException(S.current.unknown_error,
+ error.toString(), error.runtimeType.toString());
emit(UserScreenEditError(e));
}
}
@@ -68,13 +69,13 @@ class UserscreenCubit extends Cubit {
emit(UserScreenStored());
} else {
throw UnknownException(
- 'Benutzer konnte nicht aktualisiert werden: Unerwartete Serverantwort');
+ S.current.failed_updating_user_unexpected_response);
}
} on RacegoException catch (e) {
emit(UserScreenEditError(e));
} catch (error) {
- UnknownException e = UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ UnknownException e = UnknownException(S.current.unknown_error,
+ error.toString(), error.runtimeType.toString());
emit(UserScreenEditError(e));
}
}
diff --git a/lib/data/api/racego_api.dart b/lib/data/api/racego_api.dart
index a98ac46..a967e2c 100644
--- a/lib/data/api/racego_api.dart
+++ b/lib/data/api/racego_api.dart
@@ -5,10 +5,13 @@ import 'package:http/http.dart' as http;
import 'package:racego/data/exceptions/racego_exception.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
+import 'package:racego/data/models/rankinglist.dart';
import 'package:racego/data/models/time.dart';
import 'package:racego/data/models/user.dart';
import 'package:racego/data/models/userdetails.dart';
+import '../../generated/l10n.dart';
+
class RacegoApi {
String? _username;
bool _isLoggedIn = false;
@@ -43,12 +46,12 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
- throw UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
}
}
@@ -67,7 +70,7 @@ class RacegoApi {
}
return false;
} on AuthException catch (authError) {
- if (authError.errorMessage.contains('Login fehlgeschlagen')) {
+ if (authError.errorMessage.contains(S.current.failed_login)) {
return false;
} else {
rethrow;
@@ -75,12 +78,12 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
- throw UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
}
}
@@ -99,12 +102,12 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
- throw UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
}
}
@@ -119,12 +122,12 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
- throw UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
}
}
@@ -139,12 +142,12 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
throw UnknownException(
- 'Unbekannter Fehler',
+ S.current.unknown_error,
error.toString(),
error.runtimeType.toString(),
);
@@ -161,19 +164,19 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
- throw UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
}
}
Future setUserDetails(UserDetails user) async {
try {
if (user.id <= 0 || user.firstName.isEmpty || user.lastName.isEmpty) {
- throw DataException('Die Benutzerangaben sind ungenügend');
+ throw DataException(S.current.failed_updating_user_invalid_data);
}
String response = await _putRequest(
@@ -189,19 +192,19 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
- throw UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
}
}
Future addUser(UserDetails user) async {
try {
if (user.firstName.isEmpty || user.lastName.isEmpty) {
- throw DataException('Die Benutzerangaben sind ungenügend');
+ throw DataException(S.current.failed_updating_user_invalid_data);
}
String response = await _postRequest(
@@ -216,12 +219,12 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
- throw UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
}
}
@@ -242,12 +245,12 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
throw UnknownException(
- 'Unbekannter Fehler',
+ S.current.unknown_error,
error.toString(),
error.runtimeType.toString(),
);
@@ -270,12 +273,12 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
throw UnknownException(
- 'Unbekannter Fehler',
+ S.current.unknown_error,
error.toString(),
error.runtimeType.toString(),
);
@@ -298,12 +301,12 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
throw UnknownException(
- 'Unbekannter Fehler',
+ S.current.unknown_error,
error.toString(),
error.runtimeType.toString(),
);
@@ -327,12 +330,12 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
throw UnknownException(
- 'Unbekannter Fehler',
+ S.current.unknown_error,
error.toString(),
error.runtimeType.toString(),
);
@@ -349,12 +352,38 @@ class RacegoApi {
} on RacegoException catch (_) {
rethrow;
} on TypeError catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} on FormatException catch (_) {
- throw DataException('Fehler beim Parsen der Serverantwort');
+ throw DataException(S.current.failed_parsing_response);
} catch (error) {
- throw UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
+ }
+ }
+
+ Future getRankig(String? className) async {
+ try {
+ String response = '';
+ if (className != null && className.isNotEmpty) {
+ // escape space to generate api url
+ className.replaceAll(' ', '%');
+ response = await _getRequest(_apiBaseUrl + 'v1/ranking/' + className);
+ } else {
+ response = await _getRequest(_apiBaseUrl + 'v1/ranking/all');
+ }
+ List ranks = jsonDecode(response);
+ return RankingList.fromJson(ranks);
+ } on AuthException catch (_) {
+ rethrow;
+ } on RacegoException catch (_) {
+ rethrow;
+ } on TypeError catch (_) {
+ throw DataException(S.current.failed_parsing_response);
+ } on FormatException catch (_) {
+ throw DataException(S.current.failed_parsing_response);
+ } catch (error) {
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
}
}
@@ -370,32 +399,30 @@ class RacegoApi {
case 401:
_isLoggedIn = false;
_username = null;
- throw AuthException('Keine Berechtigung');
+ throw AuthException(S.current.no_permission);
case 403:
_isLoggedIn = false;
_username = null;
- throw AuthException('Login Fehlgeschlagen');
+ throw AuthException(S.current.failed_login);
case 404:
- throw ServerException(
- 'Fehler: Fehlerhafte Quelle für den Datenaustausch.');
+ throw ServerException(S.current.requestet_entity_not_found);
case 409:
- throw DataException('Konflikt bei den gesendeten Daten');
+ throw DataException(S.current.failed_send_conflicting_data);
case 422:
- throw DataException('Eingabe konnte nicht verarbeitet werden');
+ throw DataException(S.current.unprocessable_entity);
default:
throw ServerException(
- 'Serverantwort ungültig. Statuscode ${response.statusCode}');
+ S.current.invalid_server_response(response.statusCode));
}
} on RacegoException catch (_) {
rethrow;
} on SocketException catch (_) {
- throw InternetException('Der Server kann nicht erreicht werden.');
+ throw InternetException(S.current.failed_server_timeout);
} on TimeoutException catch (_) {
- throw InternetException(
- 'Der Server kann nicht erreicht werden: Timeout.');
+ throw InternetException(S.current.failed_server_timeout);
} catch (error) {
- throw UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
}
}
@@ -411,32 +438,30 @@ class RacegoApi {
case 401:
_isLoggedIn = false;
_username = null;
- throw AuthException('Keine Berechtigung');
+ throw AuthException(S.current.no_permission);
case 403:
_isLoggedIn = false;
_username = null;
- throw AuthException('Login fehlgeschlagen');
+ throw AuthException(S.current.failed_login);
case 404:
- throw ServerException(
- 'Fehler: Fehlerhafte Quelle für den Datenaustausch.');
+ throw ServerException(S.current.requestet_entity_not_found);
case 409:
- throw DataException('Konflikt bei den gesendeten Daten');
+ throw DataException(S.current.failed_send_conflicting_data);
case 422:
- throw DataException('Eingabe konnte nicht verarbeitet werden');
+ throw DataException(S.current.unprocessable_entity);
default:
throw ServerException(
- 'Serverantwort ungültig. Statuscode ${response.statusCode}');
+ S.current.invalid_server_response(response.statusCode));
}
} on RacegoException catch (_) {
rethrow;
} on SocketException catch (_) {
- throw InternetException('Der Server kann nicht erreicht werden.');
+ throw InternetException(S.current.failed_server_timeout);
} on TimeoutException catch (_) {
- throw InternetException(
- 'Der Server kann nicht erreicht werden: Timeout.');
+ throw InternetException(S.current.failed_server_timeout);
} catch (error) {
- throw UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
}
}
@@ -452,32 +477,30 @@ class RacegoApi {
case 401:
_isLoggedIn = false;
_username = null;
- throw AuthException('Keine Berechtigung');
+ throw AuthException(S.current.no_permission);
case 403:
_isLoggedIn = false;
_username = null;
- throw AuthException('Login fehlgeschlagen');
+ throw AuthException(S.current.failed_login);
case 404:
- throw ServerException(
- 'Fehler: Fehlerhafte Quelle für den Datenaustausch.');
+ throw ServerException(S.current.requestet_entity_not_found);
case 409:
- throw DataException('Konflikt bei den gesendeten Daten');
+ throw DataException(S.current.failed_send_conflicting_data);
case 422:
- throw DataException('Eingabe konnte nicht verarbeitet werden');
+ throw DataException(S.current.unprocessable_entity);
default:
throw ServerException(
- 'Serverantwort ungültig. Statuscode ${response.statusCode}');
+ S.current.invalid_server_response(response.statusCode));
}
} on RacegoException catch (_) {
rethrow;
} on SocketException catch (_) {
- throw InternetException('Der Server kann nicht erreicht werden.');
+ throw InternetException(S.current.failed_server_timeout);
} on TimeoutException catch (_) {
- throw InternetException(
- 'Der Server kann nicht erreicht werden: Timeout.');
+ throw InternetException(S.current.failed_server_timeout);
} catch (error) {
- throw UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
}
}
@@ -493,32 +516,30 @@ class RacegoApi {
case 401:
_isLoggedIn = false;
_username = null;
- throw AuthException('Keine Berechtigung');
+ throw AuthException(S.current.no_permission);
case 403:
_isLoggedIn = false;
_username = null;
- throw AuthException('Login fehlgeschlagen');
+ throw AuthException(S.current.failed_login);
case 404:
- throw ServerException(
- 'Fehler: Fehlerhafte Quelle für den Datenaustausch.');
+ throw ServerException(S.current.requestet_entity_not_found);
case 409:
- throw DataException('Konflikt bei den gesendeten Daten');
+ throw DataException(S.current.failed_send_conflicting_data);
case 422:
- throw DataException('Eingabe konnte nicht verarbeitet werden');
+ throw DataException(S.current.unprocessable_entity);
default:
throw ServerException(
- 'Serverantwort ungültig. Statuscode ${response.statusCode}');
+ S.current.invalid_server_response(response.statusCode));
}
} on RacegoException catch (_) {
rethrow;
} on SocketException catch (_) {
- throw InternetException('Der Server kann nicht erreicht werden.');
+ throw InternetException(S.current.failed_server_timeout);
} on TimeoutException catch (_) {
- throw InternetException(
- 'Der Server kann nicht erreicht werden: Timeout.');
+ throw InternetException(S.current.failed_server_timeout);
} catch (error) {
- throw UnknownException(
- 'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
+ throw UnknownException(S.current.unknown_error, error.toString(),
+ error.runtimeType.toString());
}
}
diff --git a/lib/data/models/rankinglist.dart b/lib/data/models/rankinglist.dart
new file mode 100644
index 0000000..e055335
--- /dev/null
+++ b/lib/data/models/rankinglist.dart
@@ -0,0 +1,22 @@
+class RankingList {
+ RankingList(List