Skip to content

Commit

Permalink
don't use await when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
hatch01 committed Oct 30, 2023
1 parent 8b1a9fc commit 008fa06
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions apps/onyx/lib/core/initialisations/cache_service_init.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:izlyclient/izlyclient.dart';
import 'package:lyon1agendaclient/lyon1agendaclient.dart';
import 'package:lyon1casclient/lyon1casclient.dart';
Expand All @@ -7,7 +9,7 @@ import 'package:onyx/core/cache_service.dart';
import 'package:onyx/screens/settings/settings_export.dart';
import 'package:path_provider/path_provider.dart';

Future<void> cacheInit({String? cachePath, String? permanentPath}) async {
void cacheInit({String? cachePath, String? permanentPath}) {
CacheService.registerAdapter<SettingsModel>(SettingsModelMapper.fromJson);

CacheService.registerAdapter<IzlyCredential>(IzlyCredentialMapper.fromJson);
Expand All @@ -21,7 +23,6 @@ Future<void> cacheInit({String? cachePath, String? permanentPath}) async {
CacheService.registerAdapter<Enumeration>(EnumerationMapper.fromJson);
CacheService.registerAdapter<Grade>(GradeMapper.fromJson);
CacheService.registerAdapter<Presence>(PresenceMapper.fromJson);
// CacheService.registerAdapter<>( ,PresenceColorMapper.);
CacheService.registerAdapter<Semester>(SemesterMapper.fromJson);
CacheService.registerAdapter<StageCode>(StageCodeMapper.fromJson);
CacheService.registerAdapter<Teacher>(TeacherMapper.fromJson);
Expand Down
2 changes: 1 addition & 1 deletion apps/onyx/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void main() async {

await FlutterMapTileCaching.initialise();
await FMTC.instance('mapStore').manage.createAsync();
await cacheInit();
cacheInit();

SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
Expand Down
2 changes: 1 addition & 1 deletion apps/onyx/lib/screens/agenda/logic/agenda_logic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AgendaLogic {
if (Res.mock) {
return dayListMock;
}
await cacheInit(cachePath: paths.cachePath, permanentPath: paths.permanentPath);
cacheInit(cachePath: paths.cachePath, permanentPath: paths.permanentPath);
if (CacheService.exist<Agenda>()) {
return (CacheService.get<Agenda>())!.days;
} else {
Expand Down
2 changes: 1 addition & 1 deletion apps/onyx/lib/screens/mails/logic/email_logic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MailLogic {
if (Res.mock) {
return mailboxesMock;
}
await cacheInit(cachePath: paths.cachePath, permanentPath: paths.permanentPath);
cacheInit(cachePath: paths.cachePath, permanentPath: paths.permanentPath);
if (CacheService.exist<List<MailBox>>()) {
return (CacheService.get<List<MailBox>>())!;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void workmanagerHandler() {

Future<bool> backgroundLogic({bool init = true}) async {
if (init) {
await cacheInit();
cacheInit();
await NotificationLogic.init();
}
SettingsModel settings = await SettingsLogic.load();
Expand Down
2 changes: 1 addition & 1 deletion apps/onyx/lib/screens/tomuss/logic/tomuss_logic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class TomussLogic {
if (Res.mock) {
return teachingUnitsModelListMock;
}
await cacheInit(cachePath: paths.cachePath, permanentPath: paths.permanentPath);
cacheInit(cachePath: paths.cachePath, permanentPath: paths.permanentPath);
if (CacheService.exist<List<Semester>>()) {
return (CacheService.get<List<Semester>>())!;
} else {
Expand Down

0 comments on commit 008fa06

Please sign in to comment.