bug fix 1.0 (android logo, old device, firstname, exercise save)
This commit is contained in:
+24
-1
@@ -2,7 +2,8 @@ import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/service/api.dart';
|
||||
import 'package:aitrainer_app/service/customer_service.dart';
|
||||
import 'package:aitrainer_app/service/exercisetype_service.dart';
|
||||
import 'package:aitrainer_app/viewmodel/exercise_type_changing_view_model.dart';
|
||||
import 'package:devicelocale/devicelocale.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:aitrainer_app/model/auth.dart';
|
||||
|
||||
@@ -19,11 +20,33 @@ class Session {
|
||||
|
||||
if ( _auth.firstLoad ) {
|
||||
_fetchToken(_sharedPreferences, callback);
|
||||
initDeviceLocale();
|
||||
appLanguage.fetchLocale();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Future<void> initDeviceLocale() async {
|
||||
List languages;
|
||||
String currentLocale;
|
||||
|
||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
||||
try {
|
||||
languages = await Devicelocale.preferredLanguages;
|
||||
Auth().deviceLanguages = languages;
|
||||
print("device langs " + languages.toString());
|
||||
|
||||
} on PlatformException {
|
||||
print("Error obtaining preferred languages");
|
||||
}
|
||||
try {
|
||||
currentLocale = await Devicelocale.currentLocale;
|
||||
print("Device currentlocale " + currentLocale);
|
||||
} on PlatformException {
|
||||
print("Error obtaining current locale");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Auth flow of the user, see auth.dart
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user