diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 4f9a79d..4060fc1 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"geolocator","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-6.1.6/","dependencies":[]},{"name":"shared_preferences","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/","dependencies":[]}],"android":[{"name":"geolocator","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-6.1.6/","dependencies":[]},{"name":"shared_preferences","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/","dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+11/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+4/","dependencies":["path_provider_linux"]}],"windows":[{"name":"path_provider_windows","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.4+3/","dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-0.0.1+3/","dependencies":["path_provider_windows"]}],"web":[{"name":"shared_preferences_web","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]}]},"dependencyGraph":[{"name":"geolocator","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2020-11-29 12:54:29.441319","version":"1.22.0"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"geolocator","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-6.1.6/","dependencies":[]},{"name":"shared_preferences","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/","dependencies":[]}],"android":[{"name":"geolocator","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-6.1.6/","dependencies":[]},{"name":"shared_preferences","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/","dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+11/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+4/","dependencies":["path_provider_linux"]}],"windows":[{"name":"path_provider_windows","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.4+3/","dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-0.0.1+3/","dependencies":["path_provider_windows"]}],"web":[{"name":"shared_preferences_web","path":"/Users/kekland/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]}]},"dependencyGraph":[{"name":"geolocator","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2021-03-04 10:23:20.355440","version":"2.0.0"} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/kekland/almetro_app/MainActivity.kt b/android/app/src/main/kotlin/com/kekland/almetro_app/MainActivity.kt new file mode 100644 index 0000000..e749de2 --- /dev/null +++ b/android/app/src/main/kotlin/com/kekland/almetro_app/MainActivity.kt @@ -0,0 +1,6 @@ +package com.kekland.almetro_app + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..449a9f9 --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/assets/icon-raster.png b/assets/icon-raster.png new file mode 100644 index 0000000..3c0b8f5 Binary files /dev/null and b/assets/icon-raster.png differ diff --git a/assets/l10n/de.json b/assets/l10n/de.json new file mode 100644 index 0000000..5e13f5d --- /dev/null +++ b/assets/l10n/de.json @@ -0,0 +1,30 @@ +{ + "featureDiscoveryGpsDescription": "Tippen Sie, um mit GPS die nächstliegende Station zu finden", + "featureDiscoveryGpsTitle": "Nächstliegende Station", + "featureDiscoveryStationInfoDescription": "Hier können Sie die Zeit sehen, bevor die nächste Bahn ankommt", + "featureDiscoveryStationInfoTitle": "Bahnfahrplan", + "featureDiscoveryStationPickerDescription": "Tippen Sie, um alle Stationen anzuzeigen", + "featureDiscoveryStationPickerTitle": "Wählen Sie eine Station", + "labelAppVersion": "Almetro Version", + "labelAutoupdate": "Automatisch aktualisieren", + "labelChangeBrightness": "Thema wechseln", + "labelChangeSettings": "Sie können den Fahrplan in Einstellungen wechseln", + "labelDateTimeIn": "in", + "labelDateTimeNow": "jetzt", + "labelLastCacheRefresh": "Wurde aktualisiert", + "labelLoadingError": "Ein Fehler ist aufgetreten", + "labelLoadingErrorTooltip": "Wenn Sie die App zum ersten Mal benutzen, prüfen Sie bitte Ihre Internetverbindung über", + "labelRefreshCache": "Cache aktualisieren", + "labelShortHour": "St.", + "labelShortMinute": "Min.", + "labelShortSecond": "Sek.", + "labelShowHolidaySchedule": "Wochenendefahrplan anzeigen", + "labelShowingHolidaySchedule": "Wochenendefahrplan wird angezeigt", + "labelStation": "Station", + "labelToday": "Heute", + "labelToStation": "Zu Station", + "labelTryAgain": "Versuchen Sie nochmal", + "snackbarCacheRefreshResultFailure": "Fehler beim Aktualisieren des Fahrplans", + "snackbarCacheRefreshResultSuccess": "Der Fahrplan wurde erfolgreich aktualisiert", + "snackbarGpsResultSuccess": "Die nächstliegende Station wird gewählt" +} \ No newline at end of file diff --git a/lib/api/api.dart b/lib/api/api.dart index ed9d5a3..a41c1f9 100644 --- a/lib/api/api.dart +++ b/lib/api/api.dart @@ -24,6 +24,102 @@ abstract class Api { } class AlmetroApi implements Api { + @override + Future> downloadSubwayData() async { + final response = await http.get('http://209.182.216.197:5134/data/'); + return jsonDecode(response.body); + } + + Time _parseTime(String line) { + final data = line.split(':'); + return Time( + hour: int.parse(data[0]), + minute: int.parse(data[1]), + second: int.parse(data[2]), + ); + } + + SubwayData _getSubwayDataFromResponse( + Map response, + ScheduleType type, + ) { + final scheduleData = response['schedules'] + [type == ScheduleType.normal ? 'normal' : 'holiday']; + + final stations = response['stations'] + .map( + (v) => SubwayStation( + id: int.parse(v['id']), + order: v['order'], + latitude: v['position']['latitude'], + longitude: v['position']['longitude'], + name: SubwayStationName( + en: v['name']['name_en'], + ru: v['name']['name_ru'], + kk: v['name']['name_kz'], + ), + connections: {}, + schedule: {}, + ), + ) + .cast() + .toList(); + + for (final station in stations) { + for (final connection in scheduleData[station.id.toString()]) { + if (connection['to'].isEmpty) continue; + + final to = int.parse(connection['to']); + final schedule = (connection['schedule']) + .cast() + .map(_parseTime) + .cast