Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from HarryDeKat/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
HarryDeKat authored Jun 18, 2023
2 parents 4073399 + 98be4d0 commit 93ea554
Show file tree
Hide file tree
Showing 26 changed files with 776 additions and 313 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Silvio is een manier om je cijfers uit het [leerlingvolgsysteem Magister](https:

**Nee**, Silvio is een **privé-initiatief** en heeft geen elke connectie met Magister of haar moeder bedrijf. Alle code voor Silvio is openbaar beschikbaar, dus het is mogelijk om zelf te controleren welke en hoe Silvio je gegevens gebruikt.

![screenshots](https://github.com/HarryDeKat/Silvio/assets/96647011/b8a7b276-47f6-4a9d-a9ae-3b0d7920244f)
![screenshots](https://www.harrydekat.dev/Silvio/screenshot.png)

## Contributie

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.8.22'
repositories {
google()
mavenCentral()
Expand Down
10 changes: 8 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ PODS:
- Flutter
- background_fetch (1.1.6):
- Flutter
- cr_file_saver (0.0.1):
- Flutter
- DKImagePickerController/Core (4.3.4):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
Expand Down Expand Up @@ -144,7 +146,7 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- permission_handler_apple (9.0.4):
- permission_handler_apple (9.1.0):
- Flutter
- PromisesObjC (2.2.0)
- SDWebImage (5.15.7):
Expand All @@ -161,6 +163,7 @@ PODS:
DEPENDENCIES:
- app_tracking_transparency (from `.symlinks/plugins/app_tracking_transparency/ios`)
- background_fetch (from `.symlinks/plugins/background_fetch/ios`)
- cr_file_saver (from `.symlinks/plugins/cr_file_saver/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- Flutter (from `Flutter`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
Expand Down Expand Up @@ -201,6 +204,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/app_tracking_transparency/ios"
background_fetch:
:path: ".symlinks/plugins/background_fetch/ios"
cr_file_saver:
:path: ".symlinks/plugins/cr_file_saver/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
Flutter:
Expand Down Expand Up @@ -229,6 +234,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
app_tracking_transparency: 5b1745ef9ade815f7455cb6a0848349589afb7c5
background_fetch: bc9b44b0bf8b434e282a2ac9be8662800a0296ed
cr_file_saver: b2b8ba1ddb30b4040b51a3d6670c7896b45c1f3e
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Expand All @@ -253,7 +259,7 @@ SPEC CHECKSUMS:
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
permission_handler_apple: 8f116445eff3c0e7c65ad60f5fef5490aa94b4e4
PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef
SDWebImage: 25bac438318faf37e35650619ebc288a9061d292
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
Expand Down
1 change: 0 additions & 1 deletion lib/apis/local_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:silvio/apis/abstact_api.dart';
import 'package:silvio/hive/adapters.dart';
import 'package:silvio/main.dart';
import 'package:hive/hive.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class LocalFile implements Api {
Expand Down
2 changes: 1 addition & 1 deletion lib/apis/magister.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:silvio/apis/abstact_api.dart';
import 'package:silvio/apis/account_manager.dart';
import 'package:silvio/hive/adapters.dart';
import 'package:silvio/hive/extentions.dart';
import 'package:silvio/main.dart';
import 'package:silvio/screens/post_login.dart';
import 'package:silvio/widgets/card.dart';
import 'package:silvio/widgets/facts_header.dart';
import 'package:mobile_scanner/mobile_scanner.dart' hide CalendarEvent;
Expand Down
10 changes: 5 additions & 5 deletions lib/apis/magister/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MagisterApi extends Magister {
onError: (e, handler) async {
if (e.response?.data != null &&
e.response?.data["error"] == "invalid_grant") {
return handler.reject(DioError(
return handler.reject(DioException(
requestOptions: e.requestOptions,
error:
"Dit account is uitgelogd, verwijder je account en log opnieuw in. (Spijt me zeer hier is nog geen automatische support voor)",
Expand All @@ -56,7 +56,7 @@ class MagisterApi extends Magister {
account.apiStorage!.expiry!) {
debugPrint("Accestoken expired");
await refreshToken().onError((e, stack) {
handler.reject(e as DioError);
handler.reject(e as DioException);
return;
});
}
Expand Down Expand Up @@ -88,7 +88,7 @@ class MagisterApi extends Magister {
}

return await refreshToken().then((_) => retry()).onError(
(e, stack) => handler.reject(e as DioError),
(e, stack) => handler.reject(e as DioException),
);
}

Expand All @@ -98,8 +98,8 @@ class MagisterApi extends Magister {
QueuedInterceptorsWrapper(
onError: (e, handler) async {
int tries = 0;
if (e.type == DioErrorType.unknown ||
e.type == DioErrorType.connectionTimeout) {
if (e.type == DioExceptionType.unknown ||
e.type == DioExceptionType.connectionTimeout) {
Future<void> retry() async {
await dio.fetch(e.requestOptions).then(
(r) => handler.resolve(r),
Expand Down
2 changes: 1 addition & 1 deletion lib/apis/magister/screens/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class GetGrades extends StatelessWidget {
WidgetsBinding.instance.addPostFrameCallback((_) {
Navigator.of(context).popUntil((r) => r.isFirst);
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => const Start(),
builder: (context) => SettingsReminder(account: account),
));
});
return const Center(child: CircularProgressIndicator());
Expand Down
6 changes: 3 additions & 3 deletions lib/apis/somtoday/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SomToDayApi extends SomToDay {
onError: (e, handler) async {
if (e.response?.data != null &&
e.response?.data["error"] == "invalid_grant") {
return handler.reject(DioError(
return handler.reject(DioException(
requestOptions: e.requestOptions,
error:
"Dit account is uitgelogd, verwijder je account en log opnieuw in. (Spijt me zeer hier is nog geen automatische support voor)",
Expand All @@ -29,7 +29,7 @@ class SomToDayApi extends SomToDay {
account.apiStorage!.expiry!) {
debugPrint("Accestoken expired");
await refreshToken().onError((e, stack) {
handler.reject(e as DioError);
handler.reject(e as DioException);
return;
});
}
Expand Down Expand Up @@ -60,7 +60,7 @@ class SomToDayApi extends SomToDay {
}

return await refreshToken().then((_) => retry()).onError(
(e, stack) => handler.reject(e as DioError),
(e, stack) => handler.reject(e as DioException),
);
}
})
Expand Down
6 changes: 3 additions & 3 deletions lib/background_tasks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ Future<void> backgroundCheck() async {
List<CalendarEvent> afterFetchTests =
List.of(person.calendarEvents.tests).toList();
List<CalendarEvent> difference = afterFetchTests
..removeWhere((event) =>
beforeFetchTests.map((e) => e.id).contains(event.id));
..removeWhere(
(event) => beforeFetchTests.map((e) => e.id).contains(event.id));
if (difference.isNotEmpty) {
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
Expand All @@ -118,7 +118,7 @@ Future<void> backgroundCheck() async {
difference.map((e) => e.subjectsNames).every(
(subject) => subject == difference.first.subjectsNames)
? 'Er is een nieuw toets van ${difference.first.subjectsNames.join(" ")} beschikbaar${showPersonName ? " voor ${person.firstName}" : ""} '
: 'Er zijn ${difference.length} nieuwe cijfers beschikbaar${showPersonName ? " voor ${person.firstName}" : ""}',
: 'Er zijn ${difference.length} nieuwe toetsen beschikbaar${showPersonName ? " voor ${person.firstName}" : ""}',
const NotificationDetails(
android: AndroidNotificationDetails(
"SilvioTests", "Nieuwe toetsen",
Expand Down
3 changes: 2 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,6 @@
"showChangeInAverage": "Show change in average",
"showChangeInSubjectAverage": "Show change in subject average",
"bugReport": "Suggestions and bugs",
"bugReportExpl": "Make a suggestion or report a bug"
"bugReportExpl": "Make a suggestion or report a bug",
"monthlyAverage": "Monthly average"
}
3 changes: 2 additions & 1 deletion lib/l10n/app_nl.arb
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,6 @@
"showChangeInAverage": "Toon verandering in het gemiddelde",
"showChangeInSubjectAverage": "Toon verandering in het vak gemiddelde",
"bugReport": "Suggesties en fouten",
"bugReportExpl": "Maak een suggestie of rapporteer een fout"
"bugReportExpl": "Maak een suggestie of rapporteer een fout",
"monthlyAverage": "Maandelijks gemiddelde"
}
2 changes: 0 additions & 2 deletions lib/screens/career.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:silvio/apis/account_manager.dart';
import 'package:silvio/hive/adapters.dart';
import 'package:silvio/hive/extentions.dart';
import 'package:silvio/apis/abstact_api.dart';

import 'package:silvio/widgets/card.dart';
import 'package:silvio/widgets/facts_header.dart';
Expand Down Expand Up @@ -63,7 +62,6 @@ class _CareerOverview extends State<CareerOverview> {
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
child: BarChartFrequency(
context: context,
grades: grades,
),
))),
Expand Down
90 changes: 90 additions & 0 deletions lib/screens/post_login.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:silvio/hive/adapters.dart' hide PersonConfig;
import 'package:silvio/main.dart';
import 'package:silvio/screens/settings.dart';

class SettingsReminder extends StatefulWidget {
const SettingsReminder({super.key, required this.account});

final Account account;

@override
State<StatefulWidget> createState() => _SettingsReminder();
}

class _SettingsReminder extends State<SettingsReminder> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.settings),
),
body: Center(
child: SafeArea(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 640),
child: SingleChildScrollView(
padding: const EdgeInsets.only(bottom: 8),
child: Column(children: [
SwitchListTile(
title: Text(AppLocalizations.of(context)!.notifications),
secondary: const Icon(Icons.notifications_active),
subtitle:
Text(AppLocalizations.of(context)!.notificationsExpl),
value: config.enableNotifications,
onChanged: (bool value) async {
config.enableNotifications = value;
config.save();
FlutterLocalNotificationsPlugin
flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
final bool? androidResult =
await flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.requestPermission();
final bool? iOSResult =
await flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
IOSFlutterLocalNotificationsPlugin>()
?.requestPermissions(
alert: true,
badge: true,
sound: true,
);
if (androidResult == true || iOSResult == true) {
if (!(await Permission
.ignoreBatteryOptimizations.isGranted)) {
Permission.ignoreBatteryOptimizations.request();
}
setState(() {});
WidgetsBinding.instance.addPostFrameCallback((_) {
Silvio.of(context).update();
});
}
},
),
PersonConfigCarousel(
profiles: widget.account.profiles,
simpleView: true,
widgetsNextToIndicator: [
FilledButton.icon(
icon: const Icon(Icons.navigate_next),
onPressed: () => Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => const Start(),
)),
label: Text(AppLocalizations.of(context)!.gContinue)),
],
),
])),
),
),
),
);
}
}
Loading

0 comments on commit 93ea554

Please sign in to comment.