Merge branch 'master' into notifications
This commit is contained in:
@@ -95,6 +95,46 @@ class NavigationScreenState extends State<NavigationScreen>
|
||||
}
|
||||
}
|
||||
|
||||
// Platform messages are asynchronous, so we initialize in an async method.
|
||||
Future<void> initPlatformState() async {
|
||||
// Configure BackgroundFetch.
|
||||
int status = await BackgroundFetch.configure(
|
||||
BackgroundFetchConfig(
|
||||
minimumFetchInterval: 15,
|
||||
stopOnTerminate: false,
|
||||
enableHeadless: true,
|
||||
requiresBatteryNotLow: false,
|
||||
requiresCharging: false,
|
||||
requiresStorageNotLow: false,
|
||||
requiresDeviceIdle: false,
|
||||
requiredNetworkType: NetworkType.ANY), (String taskId) async {
|
||||
// <-- Event handler
|
||||
// This is the fetch-event callback.
|
||||
if (kDebugMode) {
|
||||
print("[BackgroundFetch] Event received $taskId");
|
||||
}
|
||||
|
||||
// IMPORTANT: You must signal completion of your task or the OS can punish your app
|
||||
// for taking too long in the background.
|
||||
BackgroundFetch.finish(taskId);
|
||||
}, (String taskId) async {
|
||||
// <-- Task timeout handler.
|
||||
// This task has exceeded its allowed running-time. You must stop what you're doing and immediately .finish(taskId)
|
||||
if (kDebugMode) {
|
||||
print("[BackgroundFetch] TASK TIMEOUT taskId: $taskId");
|
||||
}
|
||||
BackgroundFetch.finish(taskId);
|
||||
});
|
||||
if (kDebugMode) {
|
||||
print('[BackgroundFetch] configure success: $status');
|
||||
}
|
||||
|
||||
// If the widget was removed from the tree while the asynchronous platform
|
||||
// message was in flight, we want to discard the reply rather than calling
|
||||
// setState to update our non-existent appearance.
|
||||
if (!mounted) return;
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -138,7 +178,10 @@ class NavigationScreenState extends State<NavigationScreen>
|
||||
@override
|
||||
void didChangePlatformBrightness() {
|
||||
if (settings.theme == ThemeMode.system) {
|
||||
Brightness? brightness = WidgetsBinding.instance.window.platformBrightness;
|
||||
// ignore: deprecated_member_use
|
||||
Brightness? brightness =
|
||||
// ignore: deprecated_member_use
|
||||
WidgetsBinding.instance.window.platformBrightness;
|
||||
Provider.of<ThemeModeObserver>(context, listen: false).changeTheme(
|
||||
brightness == Brightness.light ? ThemeMode.light : ThemeMode.dark);
|
||||
}
|
||||
|
||||
@@ -484,8 +484,9 @@ class _BellDelaySettingState extends State<BellDelaySetting>
|
||||
Duration sdiff = lesson.start.difference(now);
|
||||
Duration ediff = lesson.end.difference(now);
|
||||
|
||||
if (closest == null || sdiff.abs() < closest.abs())
|
||||
if (closest == null || sdiff.abs() < closest.abs()) {
|
||||
closest = sdiff;
|
||||
}
|
||||
if (ediff.abs() < closest.abs()) closest = ediff;
|
||||
}
|
||||
if (closest != null) {
|
||||
|
||||
@@ -84,34 +84,37 @@ class _SettingsScreenState extends State<SettingsScreen>
|
||||
|
||||
String _firstName;
|
||||
|
||||
List<String> _nameParts = user.displayName?.split(" ") ?? ["?"];
|
||||
List<String> _nameParts = account.displayName.split(" ");
|
||||
if (!settings.presentationMode) {
|
||||
_firstName = _nameParts.length > 1 ? _nameParts[1] : _nameParts[0];
|
||||
} else {
|
||||
_firstName = "János";
|
||||
}
|
||||
|
||||
accountTiles.add(AccountTile(
|
||||
name: Text(!settings.presentationMode ? account.name : "János",
|
||||
style: const TextStyle(fontWeight: FontWeight.w500)),
|
||||
username:
|
||||
Text(!settings.presentationMode ? account.username : "01234567890"),
|
||||
profileImage: ProfileImage(
|
||||
name: _firstName,
|
||||
backgroundColor: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary, //!settings.presentationMode
|
||||
//? ColorUtils.stringToColor(account.name)
|
||||
//: Theme.of(context).colorScheme.secondary,
|
||||
role: account.role,
|
||||
accountTiles.add(
|
||||
AccountTile(
|
||||
name: Text(!settings.presentationMode ? account.name : "János",
|
||||
style: const TextStyle(fontWeight: FontWeight.w500)),
|
||||
username: Text(
|
||||
!settings.presentationMode ? account.username : "01234567890"),
|
||||
profileImage: ProfileImage(
|
||||
name: _firstName,
|
||||
role: account.role,
|
||||
profilePictureString: account.picture,
|
||||
backgroundColor: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary, //!settings.presentationMode
|
||||
//? ColorUtils.stringToColor(account.name)
|
||||
//: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
onTap: () {
|
||||
user.setUser(account.id);
|
||||
restore().then((_) => user.setUser(account.id));
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
onTapMenu: () => _showBottomSheet(account),
|
||||
),
|
||||
onTap: () {
|
||||
user.setUser(account.id);
|
||||
restore().then((_) => user.setUser(account.id));
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
onTapMenu: () => _showBottomSheet(account),
|
||||
));
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -973,7 +976,9 @@ class _SettingsScreenState extends State<SettingsScreen>
|
||||
child: Text("v${release.data!['version']}"),
|
||||
);
|
||||
} else {
|
||||
String envAppVer = const String.fromEnvironment("APPVER", defaultValue: "?");
|
||||
String envAppVer = const String.fromEnvironment(
|
||||
"APPVER",
|
||||
defaultValue: "?");
|
||||
return DefaultTextStyle(
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
|
||||
@@ -5,6 +5,6 @@ class GradesBody extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column();
|
||||
return const Column();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@ class PersonalityBody extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column();
|
||||
return const Column();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user