From e634ba7005e1fcb9455cf87fe813493e509e990c Mon Sep 17 00:00:00 2001
From: vyPal
Date: Mon, 4 Sep 2023 16:31:54 +0200
Subject: [PATCH 01/30] Add base dynamic color schemes
---
lib/main.dart | 44 ++++++++-----------
linux/flutter/generated_plugin_registrant.cc | 4 ++
linux/flutter/generated_plugins.cmake | 1 +
macos/Flutter/GeneratedPluginRegistrant.swift | 2 +
pubspec.lock | 8 ++++
pubspec.yaml | 1 +
.../flutter/generated_plugin_registrant.cc | 3 ++
windows/flutter/generated_plugins.cmake | 1 +
8 files changed, 39 insertions(+), 25 deletions(-)
diff --git a/lib/main.dart b/lib/main.dart
index d5ad279..7eb68ad 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,5 +1,6 @@
import 'package:dio/dio.dart';
import 'package:dio_http_cache/dio_http_cache.dart';
+import 'package:dynamic_color/dynamic_color.dart';
import 'package:eduapge2/homework.dart';
import 'package:eduapge2/icanteen.dart';
import 'package:eduapge2/load.dart';
@@ -47,31 +48,24 @@ class MyApp extends StatelessWidget {
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
- return MaterialApp(
- title: 'EduPage2',
- localizationsDelegates: AppLocalizations.localizationsDelegates,
- supportedLocales: AppLocalizations.supportedLocales,
- navigatorObservers: [SentryNavigatorObserver(), observer],
- theme: ThemeData(
- // This is the theme of your application.
- //
- // Try running your application with "flutter run". You'll see the
- // application has a blue toolbar. Then, without quitting the app, try
- // changing the primarySwatch below to Colors.green and then invoke
- // "hot reload" (press "r" in the console where you ran "flutter run",
- // or simply save your changes to "hot reload" in a Flutter IDE).
- // Notice that the counter didn't reset back to zero; the application
- // is not restarted.
- primarySwatch: Colors.green,
- useMaterial3: true,
- ),
- darkTheme: ThemeData(
- brightness: Brightness.dark,
- useMaterial3: true,
- ),
- themeMode: ThemeMode.dark,
- home: const PageBase(),
- );
+ return DynamicColorBuilder(builder: (lightColorScheme, darkColorScheme) {
+ return MaterialApp(
+ title: 'EduPage2',
+ localizationsDelegates: AppLocalizations.localizationsDelegates,
+ supportedLocales: AppLocalizations.supportedLocales,
+ navigatorObservers: [SentryNavigatorObserver(), observer],
+ theme: ThemeData(
+ colorScheme: lightColorScheme,
+ useMaterial3: true,
+ ),
+ darkTheme: ThemeData(
+ colorScheme: darkColorScheme,
+ useMaterial3: true,
+ ),
+ themeMode: ThemeMode.dark,
+ home: const PageBase(),
+ );
+ });
}
}
diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc
index 25e690a..2528735 100644
--- a/linux/flutter/generated_plugin_registrant.cc
+++ b/linux/flutter/generated_plugin_registrant.cc
@@ -6,10 +6,14 @@
#include "generated_plugin_registrant.h"
+#include
#include
#include
void fl_register_plugins(FlPluginRegistry* registry) {
+ g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
+ fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
+ dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
g_autoptr(FlPluginRegistrar) sentry_flutter_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SentryFlutterPlugin");
sentry_flutter_plugin_register_with_registrar(sentry_flutter_registrar);
diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake
index 2f5154f..b942fff 100644
--- a/linux/flutter/generated_plugins.cmake
+++ b/linux/flutter/generated_plugins.cmake
@@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
+ dynamic_color
sentry_flutter
url_launcher_linux
)
diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift
index c6bda9a..242c320 100644
--- a/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -6,6 +6,7 @@ import FlutterMacOS
import Foundation
import connectivity_plus
+import dynamic_color
import firebase_analytics
import firebase_core
import package_info
@@ -18,6 +19,7 @@ import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
+ DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
FLTFirebaseAnalyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAnalyticsPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin"))
diff --git a/pubspec.lock b/pubspec.lock
index 8347106..1feceb0 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -177,6 +177,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.3.0"
+ dynamic_color:
+ dependency: "direct main"
+ description:
+ name: dynamic_color
+ sha256: de4798a7069121aee12d5895315680258415de9b00e717723a1bd73d58f0126d
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.6.6"
fake_async:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index a72ab01..2666bf5 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -29,6 +29,7 @@ dependencies:
shorebird_code_push: ^1.1.0
restart_app: ^1.2.1
flutter_linkify: ^6.0.0
+ dynamic_color: ^1.4.0
dependency_overrides:
flutter_pdfview: 1.2.9
dev_dependencies:
diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc
index 1cef8a9..1a60256 100644
--- a/windows/flutter/generated_plugin_registrant.cc
+++ b/windows/flutter/generated_plugin_registrant.cc
@@ -7,6 +7,7 @@
#include "generated_plugin_registrant.h"
#include
+#include
#include
#include
#include
@@ -14,6 +15,8 @@
void RegisterPlugins(flutter::PluginRegistry* registry) {
ConnectivityPlusWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
+ DynamicColorPluginCApiRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
FirebaseCorePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
SentryFlutterPluginRegisterWithRegistrar(
diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake
index 26b5c92..928840d 100644
--- a/windows/flutter/generated_plugins.cmake
+++ b/windows/flutter/generated_plugins.cmake
@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
connectivity_plus
+ dynamic_color
firebase_core
sentry_flutter
url_launcher_windows
From 8f2d425da29f9f85974d250681de44e608bffde6 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Mon, 4 Sep 2023 16:55:56 +0200
Subject: [PATCH 02/30] Add dynamic color support to messages.dart
---
lib/messages.dart | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/messages.dart b/lib/messages.dart
index 20e1d11..f81e4d6 100644
--- a/lib/messages.dart
+++ b/lib/messages.dart
@@ -145,7 +145,9 @@ class TimeTablePageState extends State {
: "a"
: "";
rows.add(Card(
- color: msg["isSeen"] ? null : const Color.fromARGB(255, 124, 95, 0),
+ color: msg["isSeen"]
+ ? null
+ : Theme.of(context).colorScheme.tertiaryContainer,
child: InkWell(
onTap: () {
Navigator.push(
From 33e589deebd275deeff48c322b4c7504faa3c533 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Mon, 4 Sep 2023 19:16:05 +0200
Subject: [PATCH 03/30] Disclaimer update
---
README.md | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 139d120..3dffdc3 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,7 @@
- [Table Of Contents](#table-of-contents)
- [About The Project](#about-the-project)
+- [Disclaimer](#disclaimer)
- [Built With](#built-with)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
@@ -42,7 +43,13 @@ And that's why we made EduPage2. So far, EduPage2 lacks a pretty big amount of f
EduPage2 uses local caching on your device, and a caching server with our own privte software, which periodically updates data from EduPage, strips it of all useless data (which EduPage includes for some reason), and finally sends out to your device when requested.
-**IMPORTANT** EduPage2 is a cutom client for EduPage. We do not have any connection to EduPage.
+## Disclaimer
+
+**EduPage2** is an open-source project with contributions from multiple individuals and is not affiliated with or endorsed by the creators of EduPage. EduPage is a separate and (possibly) trademarked platform owned by asc Applied Software Consultants, s.r.o.
+
+Please note that while EduPage2 is designed to work as a drop-in replacement or alternative mobile client for EduPage, it is not officially supported by the EduPage team. Any issues or inquiries related to EduPage2 should be directed to the project's [GitHub Issues](https://github.com/DislikesSchool/EduPage2/issues) provided in this repository.
+
+This project is open source and distributed under the [GPL-3.0 license](https://choosealicense.com/licenses/gpl-3.0/), and all contributions are welcome from the community. However, use it responsibly and in compliance with the terms of use of the original EduPage platform.
## Built With
From 996d60f70d5c33676bea81060360106c8d933b10 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Mon, 4 Sep 2023 20:05:24 +0200
Subject: [PATCH 04/30] Add default color scheme, set default to dark
---
lib/main.dart | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/main.dart b/lib/main.dart
index 7eb68ad..52887a8 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -40,6 +40,11 @@ class MyApp extends StatelessWidget {
static FirebaseAnalytics analytics = FirebaseAnalytics.instance;
static FirebaseAnalyticsObserver observer =
FirebaseAnalyticsObserver(analytics: analytics);
+ static final _defaultLightColorScheme =
+ ColorScheme.fromSwatch(primarySwatch: Colors.blue);
+
+ static final _defaultDarkColorScheme = ColorScheme.fromSwatch(
+ primarySwatch: Colors.blue, brightness: Brightness.dark);
// This widget is the root of your application.
@override
@@ -55,11 +60,11 @@ class MyApp extends StatelessWidget {
supportedLocales: AppLocalizations.supportedLocales,
navigatorObservers: [SentryNavigatorObserver(), observer],
theme: ThemeData(
- colorScheme: lightColorScheme,
+ colorScheme: lightColorScheme ?? _defaultLightColorScheme,
useMaterial3: true,
),
darkTheme: ThemeData(
- colorScheme: darkColorScheme,
+ colorScheme: darkColorScheme ?? _defaultDarkColorScheme,
useMaterial3: true,
),
themeMode: ThemeMode.dark,
From 36ba966ef7fbf0327b743279a73310d279d16a72 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Wed, 6 Sep 2023 10:18:23 +0200
Subject: [PATCH 05/30] Start add language selection
---
lib/home.dart | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/lib/home.dart b/lib/home.dart
index 0f33db6..07151b2 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -727,6 +727,38 @@ class HomePageState extends State {
),
),
const Divider(),
+ ListTile(
+ leading: const Icon(Icons.language),
+ title: const Text('Language'),
+ trailing: SizedBox(
+ height: 32,
+ child: Container(
+ decoration: BoxDecoration(
+ border: Border.all(color: Colors.grey),
+ borderRadius: BorderRadius.circular(4),
+ ),
+ padding: const EdgeInsets.symmetric(horizontal: 8),
+ child: DropdownButton(
+ value: Localizations.localeOf(context),
+ onChanged: (Locale? locale) {
+ if (locale != null) {
+ // Handle locale selection
+ }
+ },
+ icon: const Icon(Icons.arrow_drop_down),
+ underline: Container(),
+ style: Theme.of(context).textTheme.titleMedium,
+ items: AppLocalizations.supportedLocales
+ .map((locale) => DropdownMenuItem(
+ value: locale,
+ child: Text(locale.languageCode),
+ ))
+ .toList(),
+ ),
+ ),
+ ),
+ ),
+ const Divider(),
InkWell(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
From 57175efc0a1fbc2f78f0f27deb58174c82829e46 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Sat, 9 Sep 2023 07:02:24 +0200
Subject: [PATCH 06/30] Redirect user to timetable when click on preview
---
lib/home.dart | 66 ++++++++++++++++++++++++++++++++-------------------
lib/load.dart | 12 ++++++++--
lib/main.dart | 20 +++++++++++-----
3 files changed, 66 insertions(+), 32 deletions(-)
diff --git a/lib/home.dart b/lib/home.dart
index 07151b2..8f5ad60 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -19,9 +19,13 @@ import 'package:url_launcher/url_launcher.dart';
class HomePage extends StatefulWidget {
final SessionManager sessionManager;
final Function reLogin;
+ final ValueChanged onDestinationSelected;
const HomePage(
- {super.key, required this.sessionManager, required this.reLogin});
+ {super.key,
+ required this.sessionManager,
+ required this.reLogin,
+ required this.onDestinationSelected});
@override
State createState() => HomePageState();
@@ -332,8 +336,17 @@ class HomePageState extends State {
final buildName = packageInfo.version;
try {
- final response = await dio.get(
- 'https://api.github.com/repos/DislikesSchool/EduPage2/releases/latest');
+ final response = await dio
+ .get(
+ 'https://api.github.com/repos/DislikesSchool/EduPage2/releases/latest')
+ .catchError((obj) {
+ return Response(
+ requestOptions: RequestOptions(
+ path:
+ 'https://api.github.com/repos/DislikesSchool/EduPage2/releases/latest'),
+ statusCode: 500,
+ );
+ });
final responseData = response.data;
// Extract the tag_name from the response JSON and remove the "v" prefix if present
@@ -499,27 +512,32 @@ class HomePageState extends State {
children: [
for (Map lesson
in apidataTT["lessons"])
- Card(
- child: Padding(
- padding: const EdgeInsets.all(10),
- child: Column(
- children: [
- Text(
- lesson["period"]["name"] + ".",
- style:
- const TextStyle(fontSize: 10),
- ),
- Text(
- lesson["subject"]["short"],
- style:
- const TextStyle(fontSize: 20),
- ),
- Text(
- lesson["classrooms"][0]["short"],
- style:
- const TextStyle(fontSize: 14),
- ),
- ],
+ GestureDetector(
+ onTap: () {
+ widget.onDestinationSelected(1);
+ },
+ child: Card(
+ child: Padding(
+ padding: const EdgeInsets.all(10),
+ child: Column(
+ children: [
+ Text(
+ lesson["period"]["name"] + ".",
+ style:
+ const TextStyle(fontSize: 10),
+ ),
+ Text(
+ lesson["subject"]["short"],
+ style:
+ const TextStyle(fontSize: 20),
+ ),
+ Text(
+ lesson["classrooms"][0]["short"],
+ style:
+ const TextStyle(fontSize: 14),
+ ),
+ ],
+ ),
),
),
),
diff --git a/lib/load.dart b/lib/load.dart
index 46d7b4f..4f43afd 100644
--- a/lib/load.dart
+++ b/lib/load.dart
@@ -109,7 +109,11 @@ class LoadingScreenState extends State {
progress = 0.5;
loaderText = local!.loadLoggedIn;
setState(() {});
- sessionManager.set('user', response.data);
+ if (response.data.runtimeType == Map) {
+ sessionManager.set('user', jsonEncode(response.data));
+ } else {
+ sessionManager.set('user', response.data);
+ }
return loadTimetable();
} else {
failedToken = token;
@@ -201,7 +205,11 @@ class LoadingScreenState extends State {
progress = 0.6;
loaderText = local!.loadLoggedIn;
setState(() {});
- sessionManager.set('user', response.data);
+ if (response.data.runtimeType == Map) {
+ sessionManager.set('user', jsonEncode(response.data));
+ } else {
+ sessionManager.set('user', response.data);
+ }
return loadTimetable();
} else {
runningInit = false;
diff --git a/lib/main.dart b/lib/main.dart
index d5ad279..aaebb7f 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -115,6 +115,12 @@ class PageBaseState extends State {
super.setState(fn);
}
+ void _onDestinationSelected(int index) {
+ setState(() {
+ _selectedIndex = index;
+ });
+ }
+
getMsgs() async {
var msgs = await sessionManager.get('messages');
var ic = await sessionManager.get('iCanteenEnabled');
@@ -153,12 +159,14 @@ class PageBaseState extends State {
index: _selectedIndex,
children: [
HomePage(
- sessionManager: sessionManager,
- reLogin: () {
- setState(() {
- loaded = false;
- });
- }),
+ sessionManager: sessionManager,
+ reLogin: () {
+ setState(() {
+ loaded = false;
+ });
+ },
+ onDestinationSelected: _onDestinationSelected,
+ ),
TimeTablePage(
sessionManager: sessionManager,
),
From a0d1e139d56a1f2943f45511266daa771fc5461a Mon Sep 17 00:00:00 2001
From: "Restyled.io"
Date: Fri, 15 Sep 2023 06:40:07 +0000
Subject: [PATCH 07/30] Restyled by astyle
---
linux/flutter/generated_plugin_registrant.cc | 18 ++++++++---------
.../flutter/generated_plugin_registrant.cc | 20 +++++++++----------
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc
index 2528735..882c355 100644
--- a/linux/flutter/generated_plugin_registrant.cc
+++ b/linux/flutter/generated_plugin_registrant.cc
@@ -11,13 +11,13 @@
#include
void fl_register_plugins(FlPluginRegistry* registry) {
- g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
- fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
- dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
- g_autoptr(FlPluginRegistrar) sentry_flutter_registrar =
- fl_plugin_registry_get_registrar_for_plugin(registry, "SentryFlutterPlugin");
- sentry_flutter_plugin_register_with_registrar(sentry_flutter_registrar);
- g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
- fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
- url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
+ g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
+ fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
+ dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
+ g_autoptr(FlPluginRegistrar) sentry_flutter_registrar =
+ fl_plugin_registry_get_registrar_for_plugin(registry, "SentryFlutterPlugin");
+ sentry_flutter_plugin_register_with_registrar(sentry_flutter_registrar);
+ g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
+ fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
+ url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
}
diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc
index 1a60256..9916f73 100644
--- a/windows/flutter/generated_plugin_registrant.cc
+++ b/windows/flutter/generated_plugin_registrant.cc
@@ -13,14 +13,14 @@
#include
void RegisterPlugins(flutter::PluginRegistry* registry) {
- ConnectivityPlusWindowsPluginRegisterWithRegistrar(
- registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
- DynamicColorPluginCApiRegisterWithRegistrar(
- registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
- FirebaseCorePluginCApiRegisterWithRegistrar(
- registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
- SentryFlutterPluginRegisterWithRegistrar(
- registry->GetRegistrarForPlugin("SentryFlutterPlugin"));
- UrlLauncherWindowsRegisterWithRegistrar(
- registry->GetRegistrarForPlugin("UrlLauncherWindows"));
+ ConnectivityPlusWindowsPluginRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
+ DynamicColorPluginCApiRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
+ FirebaseCorePluginCApiRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
+ SentryFlutterPluginRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("SentryFlutterPlugin"));
+ UrlLauncherWindowsRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
From f9b5eb633f576a3f466654de0432c4610e6fa116 Mon Sep 17 00:00:00 2001
From: "Restyled.io"
Date: Fri, 15 Sep 2023 06:40:36 +0000
Subject: [PATCH 08/30] Restyled by prettier-yaml
---
pubspec.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pubspec.yaml b/pubspec.yaml
index 2666bf5..5b8f1a9 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -3,7 +3,7 @@ description: A custom mobile client for EduPage, focusing on design and speed im
publish_to: none
version: 1.7.8
environment:
- sdk: '>=2.19.0 <3.0.0'
+ sdk: ">=2.19.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
From 7fc137680c236317a03c25aa050fd78eb8b84aba Mon Sep 17 00:00:00 2001
From: vyPal
Date: Wed, 20 Sep 2023 08:19:49 +0200
Subject: [PATCH 09/30] Update drawer items order
---
lib/home.dart | 102 ++++++++++++++++++++++++++++----------------------
1 file changed, 58 insertions(+), 44 deletions(-)
diff --git a/lib/home.dart b/lib/home.dart
index 8f5ad60..7a08d77 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -697,53 +697,29 @@ class HomePageState extends State {
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
child: ListTile(
- leading: const Icon(Icons.lunch_dining_rounded),
- title: Text(local!.homeSetupICanteen),
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => ICanteenSetupScreen(
- sessionManager: widget.sessionManager,
- loadedCallback: () {
- widget.reLogin();
- },
- ),
- ),
- );
- },
- ),
- ),
- InkWell(
- highlightColor: Colors.transparent,
- splashColor: Colors.transparent,
- child: Badge(
- label: Text(local.homePreview),
- alignment: AlignmentDirectional.topEnd,
- child: ListTile(
- leading: const Icon(Icons.bolt_rounded),
- title: Text(local.homeQuickstart),
- trailing: Transform.scale(
- scale: 0.75,
- child: Switch(
- value: quickstart,
- onChanged: (bool value) {
- sharedPreferences.setBool('quickstart', value);
- setState(() {
- quickstart = value;
- });
- },
- ),
+ leading: const Icon(Icons.bolt_rounded),
+ title: Text(local!.homeQuickstart),
+ trailing: Transform.scale(
+ scale: 0.75,
+ child: Switch(
+ value: quickstart,
+ onChanged: (bool value) {
+ sharedPreferences.setBool('quickstart', value);
+ setState(() {
+ quickstart = value;
+ });
+ },
),
- onTap: () {
- sharedPreferences.setBool('quickstart', !quickstart);
- setState(() {
- quickstart = !quickstart;
- });
- },
),
+ onTap: () {
+ sharedPreferences.setBool('quickstart', !quickstart);
+ setState(() {
+ quickstart = !quickstart;
+ });
+ },
),
),
+ /*
const Divider(),
ListTile(
leading: const Icon(Icons.language),
@@ -775,8 +751,29 @@ class HomePageState extends State {
),
),
),
- ),
+ ),*/
const Divider(),
+ InkWell(
+ highlightColor: Colors.transparent,
+ splashColor: Colors.transparent,
+ child: ListTile(
+ leading: const Icon(Icons.lunch_dining_rounded),
+ title: Text(local.homeSetupICanteen),
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => ICanteenSetupScreen(
+ sessionManager: widget.sessionManager,
+ loadedCallback: () {
+ widget.reLogin();
+ },
+ ),
+ ),
+ );
+ },
+ ),
+ ),
InkWell(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
@@ -791,6 +788,23 @@ class HomePageState extends State {
},
),
),
+ const Divider(),
+ InkWell(
+ highlightColor: Colors.transparent,
+ splashColor: Colors.transparent,
+ child: ListTile(
+ leading: const Icon(Icons.discord),
+ title: const Text("EduPage2 Discord"),
+ onTap: () async {
+ final url = Uri.parse('https://discord.gg/xy5nqWa2kQ');
+ if (await canLaunchUrl(url)) {
+ await launchUrl(url);
+ } else {
+ throw 'Could not launch $url';
+ }
+ },
+ ),
+ ),
const AboutListTile(
icon: Icon(Icons.info_outline),
applicationName: 'EduPage2',
From dc0febb4a7f2da56bf401d7ad1bec4e9d9a57389 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Wed, 20 Sep 2023 08:31:46 +0200
Subject: [PATCH 10/30] Add firebase remote config
---
macos/Flutter/GeneratedPluginRegistrant.swift | 2 ++
pubspec.lock | 36 +++++++++++++++----
pubspec.yaml | 1 +
3 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift
index c6bda9a..e805e51 100644
--- a/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -8,6 +8,7 @@ import Foundation
import connectivity_plus
import firebase_analytics
import firebase_core
+import firebase_remote_config
import package_info
import package_info_plus
import path_provider_foundation
@@ -20,6 +21,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
FLTFirebaseAnalyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAnalyticsPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
+ FLTFirebaseRemoteConfigPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseRemoteConfigPlugin"))
FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin"))
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
diff --git a/pubspec.lock b/pubspec.lock
index 8347106..1fe98ad 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -13,10 +13,10 @@ packages:
dependency: transitive
description:
name: _flutterfire_internals
- sha256: "1a5e13736d59235ce0139621b4bbe29bc89839e202409081bc667eb3cd20674c"
+ sha256: "2d8e8e123ca3675625917f535fcc0d3a50092eef44334168f9b18adc050d4c6e"
url: "https://pub.dev"
source: hosted
- version: "1.3.5"
+ version: "1.3.6"
analyzer:
dependency: transitive
description:
@@ -229,10 +229,10 @@ packages:
dependency: "direct main"
description:
name: firebase_core
- sha256: c78132175edda4bc532a71e01a32964e4b4fcf53de7853a422d96dac3725f389
+ sha256: "675c209c94a1817649137cbd113fc4c9ae85e48d03dd578629abbec6d8a4d93d"
url: "https://pub.dev"
source: hosted
- version: "2.15.1"
+ version: "2.16.0"
firebase_core_platform_interface:
dependency: transitive
description:
@@ -245,10 +245,10 @@ packages:
dependency: transitive
description:
name: firebase_core_web
- sha256: "4cf4d2161530332ddc3c562f19823fb897ff37a9a774090d28df99f47370e973"
+ sha256: e8c408923cd3a25bd342c576a114f2126769cd1a57106a4edeaa67ea4a84e962
url: "https://pub.dev"
source: hosted
- version: "2.7.0"
+ version: "2.8.0"
firebase_performance:
dependency: "direct main"
description:
@@ -273,6 +273,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.1.4+5"
+ firebase_remote_config:
+ dependency: "direct main"
+ description:
+ name: firebase_remote_config
+ sha256: "945fbf4afe6a5eb5fe1bebe9e310c019d2896e15b9dc579914a2be1c832a7030"
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.2.6"
+ firebase_remote_config_platform_interface:
+ dependency: transitive
+ description:
+ name: firebase_remote_config_platform_interface
+ sha256: "9d424edcbfb6ff43f5829c67d22cf834083fc7636dee07b4c3e04936818814f9"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.4.6"
+ firebase_remote_config_web:
+ dependency: transitive
+ description:
+ name: firebase_remote_config_web
+ sha256: b4bb823426ef65c7af3e7829c1d8babc167951bec11712ac4ac7d884ad57ab3c
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.4.6"
flutter:
dependency: "direct main"
description: flutter
diff --git a/pubspec.yaml b/pubspec.yaml
index a72ab01..2d879b3 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -29,6 +29,7 @@ dependencies:
shorebird_code_push: ^1.1.0
restart_app: ^1.2.1
flutter_linkify: ^6.0.0
+ firebase_remote_config: ^4.2.6
dependency_overrides:
flutter_pdfview: 1.2.9
dev_dependencies:
From af64e8391153abe0ee6f5188c9d1d8454351462b Mon Sep 17 00:00:00 2001
From: vyPal
Date: Wed, 20 Sep 2023 08:32:01 +0200
Subject: [PATCH 11/30] Remove unused code
---
lib/main.dart | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/main.dart b/lib/main.dart
index d5ad279..2af3248 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -103,9 +103,7 @@ class PageBaseState extends State {
void initState() {
dio.interceptors
.add(DioCacheManager(CacheConfig(baseUrl: baseUrl)).interceptor);
- //getData(); //fetching data
getMsgs();
- //Timer.periodic(const Duration(seconds: 2), (Timer t) => {getData()});
super.initState();
}
From 62b3483a6d468d83a576bf0ab5d98b32ffe17f4a Mon Sep 17 00:00:00 2001
From: vyPal
Date: Wed, 20 Sep 2023 13:52:44 +0200
Subject: [PATCH 12/30] Replace baseUrl with remoteconfig
---
lib/home.dart | 15 ++++++++++++---
lib/icanteen_setup.dart | 3 ++-
lib/load.dart | 3 ++-
lib/main.dart | 15 +++++++++++++++
lib/message.dart | 3 ++-
lib/messages.dart | 3 ++-
lib/timetable.dart | 3 ++-
7 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/lib/home.dart b/lib/home.dart
index 712518e..27574b5 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -6,6 +6,7 @@ import 'package:dio_http_cache/dio_http_cache.dart';
import 'package:eduapge2/icanteen_setup.dart';
import 'package:eduapge2/message.dart';
import 'package:eduapge2/messages.dart';
+import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_session_manager/flutter_session_manager.dart';
@@ -144,7 +145,7 @@ final _shorebirdCodePush = ShorebirdCodePush();
class HomePageState extends State {
final GlobalKey scaffoldKey = GlobalKey();
late SharedPreferences sharedPreferences;
- String baseUrl = "https://lobster-app-z6jfk.ondigitalocean.app/api";
+ String baseUrl = FirebaseRemoteConfig.instance.getString("baseUrl");
late Response response;
Dio dio = Dio();
@@ -306,8 +307,16 @@ class HomePageState extends State {
final buildName = packageInfo.version;
try {
- final response = await dio.get(
- 'https://api.github.com/repos/DislikesSchool/EduPage2/releases/latest');
+ final response = await dio
+ .get(
+ 'https://api.github.com/repos/DislikesSchool/EduPage2/releases/latest')
+ .catchError((r) {
+ return Response(
+ requestOptions: RequestOptions(path: r.path), statusCode: 500);
+ });
+ if (response.statusCode == 500) {
+ return;
+ }
final responseData = response.data;
// Extract the tag_name from the response JSON and remove the "v" prefix if present
diff --git a/lib/icanteen_setup.dart b/lib/icanteen_setup.dart
index da5db9b..9539c76 100644
--- a/lib/icanteen_setup.dart
+++ b/lib/icanteen_setup.dart
@@ -1,4 +1,5 @@
import 'package:dio/dio.dart';
+import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:flutter/material.dart';
import 'package:flutter_session_manager/flutter_session_manager.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -22,7 +23,7 @@ class ICanteenSetupScreenState extends State {
Dio dio = Dio();
- String baseUrl = "https://lobster-app-z6jfk.ondigitalocean.app/api";
+ String baseUrl = FirebaseRemoteConfig.instance.getString("baseUrl");
AppLocalizations? local;
diff --git a/lib/load.dart b/lib/load.dart
index 854359e..f5a632b 100644
--- a/lib/load.dart
+++ b/lib/load.dart
@@ -4,6 +4,7 @@ import 'package:dio/dio.dart';
import 'package:dio_http_cache/dio_http_cache.dart';
import 'package:eduapge2/login.dart';
import 'package:firebase_performance/firebase_performance.dart';
+import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:flutter/material.dart';
import 'package:flutter_session_manager/flutter_session_manager.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -33,7 +34,7 @@ class LoadingScreenState extends State {
double progress = 0.0;
String loaderText = "Loading...";
- String baseUrl = "https://lobster-app-z6jfk.ondigitalocean.app/api";
+ String baseUrl = FirebaseRemoteConfig.instance.getString("baseUrl");
late AppLocalizations? local;
diff --git a/lib/main.dart b/lib/main.dart
index 2af3248..f86b637 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -6,6 +6,7 @@ import 'package:eduapge2/load.dart';
import 'package:eduapge2/messages.dart';
import 'package:eduapge2/timetable.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
+import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_session_manager/flutter_session_manager.dart';
@@ -113,7 +114,21 @@ class PageBaseState extends State {
super.setState(fn);
}
+ initRemoteConfig() async {
+ final remoteConfig = FirebaseRemoteConfig.instance;
+ await remoteConfig.setConfigSettings(RemoteConfigSettings(
+ fetchTimeout: const Duration(minutes: 1),
+ minimumFetchInterval: const Duration(hours: 1),
+ ));
+ await remoteConfig.setDefaults(const {
+ "baseUrl": "https://lobster-app-z6jfk.ondigitalocean.app",
+ });
+ await remoteConfig.fetchAndActivate();
+ baseUrl = remoteConfig.getString("baseUrl");
+ }
+
getMsgs() async {
+ await initRemoteConfig();
var msgs = await sessionManager.get('messages');
var ic = await sessionManager.get('iCanteenEnabled');
if (ic == true) {
diff --git a/lib/message.dart b/lib/message.dart
index 7d430f2..1c7a201 100644
--- a/lib/message.dart
+++ b/lib/message.dart
@@ -1,3 +1,4 @@
+import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:flutter/material.dart';
import 'package:flutter_cached_pdfview/flutter_cached_pdfview.dart';
import 'package:flutter_linkify/flutter_linkify.dart';
@@ -24,7 +25,7 @@ class MessagePage extends StatefulWidget {
class MessagePageState extends State {
late SessionManager sessionManager;
late SharedPreferences sharedPreferences;
- String baseUrl = "https://lobster-app-z6jfk.ondigitalocean.app/api";
+ String baseUrl = FirebaseRemoteConfig.instance.getString("baseUrl");
bool loading = true;
Dio dio = Dio();
diff --git a/lib/messages.dart b/lib/messages.dart
index 20e1d11..c82e8da 100644
--- a/lib/messages.dart
+++ b/lib/messages.dart
@@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:dio_http_cache/dio_http_cache.dart';
import 'package:eduapge2/message.dart';
+import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:flutter/material.dart';
import 'package:flutter_session_manager/flutter_session_manager.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@@ -64,7 +65,7 @@ class TimeTablePageState extends State {
SharedPreferences sp = await SharedPreferences.getInstance();
if (sp.getBool('quickstart') ?? false) {
String token = sp.getString("token")!;
- String baseUrl = "https://lobster-app-z6jfk.ondigitalocean.app/api";
+ String baseUrl = FirebaseRemoteConfig.instance.getString("baseUrl");
Dio dio = Dio();
Response response = await dio.get(
"$baseUrl/messages",
diff --git a/lib/timetable.dart b/lib/timetable.dart
index d231d8f..a7c2f3c 100644
--- a/lib/timetable.dart
+++ b/lib/timetable.dart
@@ -1,5 +1,6 @@
import 'dart:convert';
+import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:flutter/material.dart';
import 'package:dio/dio.dart';
import 'package:dio_http_cache/dio_http_cache.dart';
@@ -18,7 +19,7 @@ class TimeTablePage extends StatefulWidget {
}
class TimeTablePageState extends State {
- String baseUrl = "https://lobster-app-z6jfk.ondigitalocean.app/api";
+ String baseUrl = FirebaseRemoteConfig.instance.getString("baseUrl");
TimeTableData tt = TimeTableData(DateTime.now(), [
TimeTableClass("2", "ZAE", "STJI", "8:55", "9:40", "U32", 0, {}),
From 89854e24c133128cf1b1e4d4ace7b12d072e655e Mon Sep 17 00:00:00 2001
From: "Restyled.io"
Date: Wed, 20 Sep 2023 11:57:26 +0000
Subject: [PATCH 13/30] Restyled by prettier-yaml
---
pubspec.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pubspec.yaml b/pubspec.yaml
index 2d879b3..98e7dd9 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -3,7 +3,7 @@ description: A custom mobile client for EduPage, focusing on design and speed im
publish_to: none
version: 1.7.8
environment:
- sdk: '>=2.19.0 <3.0.0'
+ sdk: ">=2.19.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
From 4c80504f43ada7b53725da2e028b407dd7a9136a Mon Sep 17 00:00:00 2001
From: vyPal
Date: Wed, 20 Sep 2023 14:13:43 +0200
Subject: [PATCH 14/30] Fix issue #131 _TypeError: type 'Null' is not a subtype
of type 'Map'
---
lib/home.dart | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/home.dart b/lib/home.dart
index 712518e..b954861 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -261,7 +261,14 @@ class HomePageState extends State {
});
}
- Map user = await widget.sessionManager.get('user');
+ Map? user = await widget.sessionManager.get('user');
+ if (user == null) {
+ apidataTT = {};
+ setState(() {
+ loading = false;
+ });
+ return;
+ }
username = user["firstname"] + " " + user["lastname"];
String token = sharedPreferences.getString("token")!;
From 612f9dbfd1675d7849aba7db1a4000eaf1b543c0 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Wed, 20 Sep 2023 14:19:19 +0200
Subject: [PATCH 15/30] Fix issue #126 NoSuchMethodError: The method '[]' was
called on null.
---
lib/home.dart | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/home.dart b/lib/home.dart
index b954861..0a4aca0 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -496,7 +496,10 @@ class HomePageState extends State {
const TextStyle(fontSize: 20),
),
Text(
- lesson["classrooms"][0]["short"],
+ lesson["classrooms"].length > 0
+ ? lesson["classrooms"][0]
+ ["short"]
+ : "?",
style:
const TextStyle(fontSize: 14),
),
From e26c2d22ed761708f8b312448cab0f7b102d6ee6 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Wed, 20 Sep 2023 14:56:10 +0200
Subject: [PATCH 16/30] Gesture detector not closed
---
lib/home.dart | 47 ++++++++++++++++++++++++-----------------------
1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/lib/home.dart b/lib/home.dart
index 8f502e1..0ddf08b 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -498,29 +498,30 @@ class HomePageState extends State {
widget.onDestinationSelected(1);
},
child: Card(
- child: Padding(
- padding: const EdgeInsets.all(10),
- child: Column(
- children: [
- Text(
- lesson["period"]["name"] + ".",
- style:
- const TextStyle(fontSize: 10),
- ),
- Text(
- lesson["subject"]["short"],
- style:
- const TextStyle(fontSize: 20),
- ),
- Text(
- lesson["classrooms"].length > 0
- ? lesson["classrooms"][0]
- ["short"]
- : "?",
- style:
- const TextStyle(fontSize: 14),
- ),
- ],
+ child: Padding(
+ padding: const EdgeInsets.all(10),
+ child: Column(
+ children: [
+ Text(
+ lesson["period"]["name"] + ".",
+ style:
+ const TextStyle(fontSize: 10),
+ ),
+ Text(
+ lesson["subject"]["short"],
+ style:
+ const TextStyle(fontSize: 20),
+ ),
+ Text(
+ lesson["classrooms"].length > 0
+ ? lesson["classrooms"][0]
+ ["short"]
+ : "?",
+ style:
+ const TextStyle(fontSize: 14),
+ ),
+ ],
+ ),
),
),
),
From e9f8cfd01471bdbaca99a8e50e03599337b7c632 Mon Sep 17 00:00:00 2001
From: "Restyled.io"
Date: Wed, 20 Sep 2023 13:19:02 +0000
Subject: [PATCH 17/30] Restyled by dart-format
---
lib/main.dart | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/main.dart b/lib/main.dart
index 6b0b2ff..aabe0df 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -113,7 +113,6 @@ class PageBaseState extends State {
super.setState(fn);
}
-
void _onDestinationSelected(int index) {
setState(() {
_selectedIndex = index;
@@ -131,7 +130,6 @@ class PageBaseState extends State {
});
await remoteConfig.fetchAndActivate();
baseUrl = remoteConfig.getString("baseUrl");
-
}
getMsgs() async {
From facfb04ba651b32efb0e3c1ddf17c946c4101972 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Wed, 20 Sep 2023 15:32:33 +0200
Subject: [PATCH 18/30] Update release workflow
---
.github/workflows/build-release-apk.yml | 8 ++++----
linux/flutter/generated_plugin_registrant.cc | 18 ++++++++---------
.../flutter/generated_plugin_registrant.cc | 20 +++++++++----------
3 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/.github/workflows/build-release-apk.yml b/.github/workflows/build-release-apk.yml
index e49ea19..0d0e1f4 100644
--- a/.github/workflows/build-release-apk.yml
+++ b/.github/workflows/build-release-apk.yml
@@ -60,16 +60,16 @@ jobs:
with:
valueFile: 'pubspec.yaml'
propertyPath: 'version'
- value: "${{ steps.semvers.outputs.patch }}"
+ value: "${{ steps.semvers.outputs.minor }}"
commitChange: true
branch: 'build-release'
labels: 'bump'
- message: 'Bump version to ${{ steps.semvers.outputs.patch }}'
- description: 'Automatic version bump to ${{ steps.semvers.outputs.patch }} for release build'
+ message: 'Bump version to ${{ steps.semvers.outputs.minor }}'
+ description: 'Automatic version bump to ${{ steps.semvers.outputs.minor }} for release build'
- run: flutter pub get
- run: flutter gen-l10n
- name: 🚀 Shorebird Release
- run: shorebird release android --force --artifact apk '--' --dart-define=BVS="Release ${{ steps.semvers.outputs.v_patch }} ShoreBird"
+ run: shorebird release android --force --artifact apk '--' --dart-define=BVS="Release ${{ steps.semvers.outputs.v_minor }} ShoreBird"
env:
SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }}
- run: cp "build/app/outputs/apk/release/app-release.apk" "EduPage2-${{ steps.semvers.outputs.v_minor }}.apk"
diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc
index 882c355..2528735 100644
--- a/linux/flutter/generated_plugin_registrant.cc
+++ b/linux/flutter/generated_plugin_registrant.cc
@@ -11,13 +11,13 @@
#include
void fl_register_plugins(FlPluginRegistry* registry) {
- g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
- fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
- dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
- g_autoptr(FlPluginRegistrar) sentry_flutter_registrar =
- fl_plugin_registry_get_registrar_for_plugin(registry, "SentryFlutterPlugin");
- sentry_flutter_plugin_register_with_registrar(sentry_flutter_registrar);
- g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
- fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
- url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
+ g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
+ fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
+ dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
+ g_autoptr(FlPluginRegistrar) sentry_flutter_registrar =
+ fl_plugin_registry_get_registrar_for_plugin(registry, "SentryFlutterPlugin");
+ sentry_flutter_plugin_register_with_registrar(sentry_flutter_registrar);
+ g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
+ fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
+ url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
}
diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc
index 9916f73..1a60256 100644
--- a/windows/flutter/generated_plugin_registrant.cc
+++ b/windows/flutter/generated_plugin_registrant.cc
@@ -13,14 +13,14 @@
#include
void RegisterPlugins(flutter::PluginRegistry* registry) {
- ConnectivityPlusWindowsPluginRegisterWithRegistrar(
- registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
- DynamicColorPluginCApiRegisterWithRegistrar(
- registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
- FirebaseCorePluginCApiRegisterWithRegistrar(
- registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
- SentryFlutterPluginRegisterWithRegistrar(
- registry->GetRegistrarForPlugin("SentryFlutterPlugin"));
- UrlLauncherWindowsRegisterWithRegistrar(
- registry->GetRegistrarForPlugin("UrlLauncherWindows"));
+ ConnectivityPlusWindowsPluginRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
+ DynamicColorPluginCApiRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
+ FirebaseCorePluginCApiRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
+ SentryFlutterPluginRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("SentryFlutterPlugin"));
+ UrlLauncherWindowsRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
From 04a4f51c426d528e9b4e583be47dc67a552168db Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Wed, 20 Sep 2023 13:36:50 +0000
Subject: [PATCH 19/30] Bump version to 1.8.0
---
pubspec.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pubspec.yaml b/pubspec.yaml
index ce86079..4c2cd6a 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,9 +1,9 @@
name: eduapge2
description: A custom mobile client for EduPage, focusing on design and speed improvement
publish_to: none
-version: 1.7.8
+version: 1.8.0
environment:
- sdk: ">=2.19.0 <3.0.0"
+ sdk: '>=2.19.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
From 43bfa7f522f253c4dffcb40e8473c128cae61255 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Wed, 20 Sep 2023 16:06:45 +0200
Subject: [PATCH 20/30] Error in default baseUrl
---
lib/main.dart | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/main.dart b/lib/main.dart
index aabe0df..ba2d0cd 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -126,7 +126,7 @@ class PageBaseState extends State {
minimumFetchInterval: const Duration(hours: 1),
));
await remoteConfig.setDefaults(const {
- "baseUrl": "https://lobster-app-z6jfk.ondigitalocean.app",
+ "baseUrl": "https://lobster-app-z6jfk.ondigitalocean.app/api",
});
await remoteConfig.fetchAndActivate();
baseUrl = remoteConfig.getString("baseUrl");
From 99f1f5b243fe59e0d5af30cdddc70cbde0660604 Mon Sep 17 00:00:00 2001
From: "Restyled.io"
Date: Sat, 23 Sep 2023 09:38:44 +0000
Subject: [PATCH 21/30] Restyled by prettier-yaml
---
pubspec.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pubspec.yaml b/pubspec.yaml
index 4c2cd6a..4ecf6c4 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -3,7 +3,7 @@ description: A custom mobile client for EduPage, focusing on design and speed im
publish_to: none
version: 1.8.0
environment:
- sdk: '>=2.19.0 <3.0.0'
+ sdk: ">=2.19.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
From 10cac2a8b2f2a81ebb0fd4091eb2445da034a7c8 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Sat, 23 Sep 2023 11:39:47 +0200
Subject: [PATCH 22/30] Fix date parsing for lunches
---
lib/home.dart | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/home.dart b/lib/home.dart
index 1bd8792..d786f24 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -386,7 +386,8 @@ class HomePageState extends State {
}
}
if (canOrder && !hasOrdered) {
- orderLunchesFor = DateTime.parse(li["day"]);
+ DateTime parsed = DateTime.parse(li["day"]);
+ orderLunchesFor = DateTime(parsed.year, parsed.month, parsed.day);
break;
}
}
From 25834755dd1c229bdd80a97e77af806d158b7d34 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Sat, 23 Sep 2023 11:40:44 +0200
Subject: [PATCH 23/30] Update app version
---
pubspec.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pubspec.yaml b/pubspec.yaml
index 4ecf6c4..a3466ff 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: eduapge2
description: A custom mobile client for EduPage, focusing on design and speed improvement
publish_to: none
-version: 1.8.0
+version: 1.8.0+2
environment:
sdk: ">=2.19.0 <3.0.0"
dependencies:
From d89e17fac9272cb6af1c387f5637b8e9a234615d Mon Sep 17 00:00:00 2001
From: vyPal
Date: Sat, 23 Sep 2023 11:42:59 +0200
Subject: [PATCH 24/30] Move patch checking to main.dart
---
lib/home.dart | 64 -------------------------------------------------
lib/main.dart | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 64 deletions(-)
diff --git a/lib/home.dart b/lib/home.dart
index d786f24..d3a55fe 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -11,7 +11,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_session_manager/flutter_session_manager.dart';
import 'package:package_info/package_info.dart';
-import 'package:restart_app/restart_app.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:shorebird_code_push/shorebird_code_push.dart';
@@ -160,7 +159,6 @@ class HomePageState extends State {
bool refresh = false;
bool updateAvailable = false;
bool quickstart = false;
- bool _isCheckingForUpdate = false;
late Map apidataTT;
List apidataMsg = [];
@@ -175,68 +173,6 @@ class HomePageState extends State {
.add(DioCacheManager(CacheConfig(baseUrl: baseUrl)).interceptor);
fetchAndCompareBuildName();
getData(); //fetching data
- if (!_isCheckingForUpdate) _checkForUpdate(); // ik that it's not necessary
- }
-
- Future _checkForUpdate() async {
- setState(() {
- _isCheckingForUpdate = true;
- });
-
- // Ask the Shorebird servers if there is a new patch available.
- final isUpdateAvailable =
- await _shorebirdCodePush.isNewPatchAvailableForDownload();
-
- if (!mounted) return;
-
- setState(() {
- _isCheckingForUpdate = false;
- });
-
- if (isUpdateAvailable) {
- _downloadUpdate();
- }
- }
-
- void _showDownloadingBanner() {
- ScaffoldMessenger.of(context).showMaterialBanner(
- const MaterialBanner(
- content: Text('Downloading patch...'),
- actions: [
- SizedBox(
- height: 14,
- width: 14,
- child: CircularProgressIndicator(
- strokeWidth: 2,
- ),
- )
- ],
- ),
- );
- }
-
- void _showRestartBanner() {
- ScaffoldMessenger.of(context).showMaterialBanner(
- const MaterialBanner(
- content: Text('A new patch is ready!'),
- actions: [
- TextButton(
- // Restart the app for the new patch to take effect.
- onPressed: Restart.restartApp,
- child: Text('Restart app'),
- ),
- ],
- ),
- );
- }
-
- Future _downloadUpdate() async {
- _showDownloadingBanner();
- await _shorebirdCodePush.downloadUpdateIfAvailable();
- if (!mounted) return;
-
- ScaffoldMessenger.of(context).hideCurrentMaterialBanner();
- _showRestartBanner();
}
@override
diff --git a/lib/main.dart b/lib/main.dart
index ba2d0cd..f8671a9 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -12,6 +12,8 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_session_manager/flutter_session_manager.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
+import 'package:restart_app/restart_app.dart';
+import 'package:shorebird_code_push/shorebird_code_push.dart';
import 'home.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:firebase_core/firebase_core.dart';
@@ -96,6 +98,8 @@ class PageBaseState extends State {
List apidataMsg = [];
bool refresh = true;
bool iCanteenEnabled = false;
+ bool _isCheckingForUpdate = false;
+ final ShorebirdCodePush _shorebirdCodePush = ShorebirdCodePush();
SessionManager sessionManager = SessionManager();
@@ -104,6 +108,7 @@ class PageBaseState extends State {
dio.interceptors
.add(DioCacheManager(CacheConfig(baseUrl: baseUrl)).interceptor);
getMsgs();
+ if (!_isCheckingForUpdate) _checkForUpdate(); // ik that it's not necessary
super.initState();
}
@@ -119,6 +124,67 @@ class PageBaseState extends State {
});
}
+ Future _checkForUpdate() async {
+ setState(() {
+ _isCheckingForUpdate = true;
+ });
+
+ // Ask the Shorebird servers if there is a new patch available.
+ final isUpdateAvailable =
+ await _shorebirdCodePush.isNewPatchAvailableForDownload();
+
+ if (!mounted) return;
+
+ setState(() {
+ _isCheckingForUpdate = false;
+ });
+
+ if (isUpdateAvailable) {
+ _downloadUpdate();
+ }
+ }
+
+ void _showDownloadingBanner() {
+ ScaffoldMessenger.of(context).showMaterialBanner(
+ const MaterialBanner(
+ content: Text('Downloading patch...'),
+ actions: [
+ SizedBox(
+ height: 14,
+ width: 14,
+ child: CircularProgressIndicator(
+ strokeWidth: 2,
+ ),
+ )
+ ],
+ ),
+ );
+ }
+
+ void _showRestartBanner() {
+ ScaffoldMessenger.of(context).showMaterialBanner(
+ const MaterialBanner(
+ content: Text('A new patch is ready!'),
+ actions: [
+ TextButton(
+ // Restart the app for the new patch to take effect.
+ onPressed: Restart.restartApp,
+ child: Text('Restart app'),
+ ),
+ ],
+ ),
+ );
+ }
+
+ Future _downloadUpdate() async {
+ _showDownloadingBanner();
+ await _shorebirdCodePush.downloadUpdateIfAvailable();
+ if (!mounted) return;
+
+ ScaffoldMessenger.of(context).hideCurrentMaterialBanner();
+ _showRestartBanner();
+ }
+
initRemoteConfig() async {
final remoteConfig = FirebaseRemoteConfig.instance;
await remoteConfig.setConfigSettings(RemoteConfigSettings(
From 5d371e6781312138d943ce8ae0f5db98dd9036c3 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Sat, 23 Sep 2023 12:03:29 +0200
Subject: [PATCH 25/30] Update workflows
---
.github/workflows/build-prerelease-apk.yml | 3 ++-
.github/workflows/build-release-apk.yml | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/build-prerelease-apk.yml b/.github/workflows/build-prerelease-apk.yml
index f21dfda..f2143cc 100644
--- a/.github/workflows/build-prerelease-apk.yml
+++ b/.github/workflows/build-prerelease-apk.yml
@@ -64,7 +64,8 @@ jobs:
commitChange: true
branch: 'build-prerelease'
labels: 'bump'
- message: 'Bump version to ${{ steps.semvers.outputs.patch }}'
+ message: 'Bump version to ${{ steps.semvers.outputs.patch }} [no ci]'
+ createPR: true
description: 'Automatic version bump to ${{ steps.semvers.outputs.patch }} for prerelease build'
- run: flutter pub get
- run: flutter gen-l10n
diff --git a/.github/workflows/build-release-apk.yml b/.github/workflows/build-release-apk.yml
index 0d0e1f4..fabee0f 100644
--- a/.github/workflows/build-release-apk.yml
+++ b/.github/workflows/build-release-apk.yml
@@ -64,7 +64,8 @@ jobs:
commitChange: true
branch: 'build-release'
labels: 'bump'
- message: 'Bump version to ${{ steps.semvers.outputs.minor }}'
+ createPR: true
+ message: 'Bump version to ${{ steps.semvers.outputs.minor }} [no ci]'
description: 'Automatic version bump to ${{ steps.semvers.outputs.minor }} for release build'
- run: flutter pub get
- run: flutter gen-l10n
From f0b0ed12b627e842021d07048e1033d3d48880c5 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Sat, 23 Sep 2023 12:04:58 +0200
Subject: [PATCH 26/30] Remove unused element
---
lib/home.dart | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/home.dart b/lib/home.dart
index d3a55fe..c7a77c8 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -143,8 +143,6 @@ LessonStatus getLessonStatus(List lessons, TimeOfDay currentTime) {
}
}
-final _shorebirdCodePush = ShorebirdCodePush();
-
class HomePageState extends State {
final GlobalKey scaffoldKey = GlobalKey();
late SharedPreferences sharedPreferences;
From a9e78199e5aa6ac0963eb662803fcf78b9d46daa Mon Sep 17 00:00:00 2001
From: vyPal
Date: Sat, 23 Sep 2023 12:07:17 +0200
Subject: [PATCH 27/30] Add workflow badges to readme
---
README.md | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 3dffdc3..f429c66 100644
--- a/README.md
+++ b/README.md
@@ -15,9 +15,12 @@
-[![build-release-android](https://github.com/DislikesSchool/EduPage2/actions/workflows/build-release-apk.yml/badge.svg)](https://github.com/DislikesSchool/EduPage2/actions/workflows/build-release-apk.yml) ![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/dislikesschool/edupage2) ![Downloads](https://img.shields.io/github/downloads/DislikesSchool/EduPage2/total) ![Contributors](https://img.shields.io/github/contributors/DislikesSchool/EduPage2?color=dark-green) ![Issues](https://img.shields.io/github/issues/DislikesSchool/EduPage2) ![License](https://img.shields.io/github/license/DislikesSchool/EduPage2) [![codecov](https://codecov.io/github/DislikesSchool/EduPage2/branch/master/graph/badge.svg?token=HKP9WFL0LN)](https://codecov.io/github/DislikesSchool/EduPage2)
+![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/dislikesschool/edupage2) ![Downloads](https://img.shields.io/github/downloads/DislikesSchool/EduPage2/total) ![Contributors](https://img.shields.io/github/contributors/DislikesSchool/EduPage2?color=dark-green) ![Issues](https://img.shields.io/github/issues/DislikesSchool/EduPage2) ![License](https://img.shields.io/github/license/DislikesSchool/EduPage2) [![codecov](https://codecov.io/github/DislikesSchool/EduPage2/branch/master/graph/badge.svg?token=HKP9WFL0LN)](https://codecov.io/github/DislikesSchool/EduPage2)
[![Discord](https://discordapp.com/api/guilds/1143488418840584224/widget.png?style=banner2)](https://discord.gg/xy5nqWa2kQ)
+[![test-coverage](https://github.com/DislikesSchool/EduPage2/actions/workflows/test-coverage.yml/badge.svg)](https://github.com/DislikesSchool/EduPage2/actions/workflows/test-coverage.yml)
+[![build-patch-android](https://github.com/DislikesSchool/EduPage2/actions/workflows/build-patch.yml/badge.svg)](https://github.com/DislikesSchool/EduPage2/actions/workflows/build-patch.yml)
+
## Table Of Contents
- [Table Of Contents](#table-of-contents)
From d88d0f70ca8d70506e98c6062d77094cd75086ef Mon Sep 17 00:00:00 2001
From: vyPal
Date: Sat, 23 Sep 2023 12:14:44 +0200
Subject: [PATCH 28/30] Remove unused import
---
lib/home.dart | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/home.dart b/lib/home.dart
index c7a77c8..9d645c9 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -13,7 +13,6 @@ import 'package:flutter_session_manager/flutter_session_manager.dart';
import 'package:package_info/package_info.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
-import 'package:shorebird_code_push/shorebird_code_push.dart';
import 'package:url_launcher/url_launcher.dart';
class HomePage extends StatefulWidget {
From 52bd583b9e23c821674e80bf1b6f9f65b4e23e5b Mon Sep 17 00:00:00 2001
From: vyPal
Date: Sat, 23 Sep 2023 15:32:29 +0200
Subject: [PATCH 29/30] Add testing for route /test
---
lib/home.dart | 17 +++++++++++++++++
lib/main.dart | 1 +
2 files changed, 18 insertions(+)
diff --git a/lib/home.dart b/lib/home.dart
index 9d645c9..f90182a 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -142,10 +142,17 @@ LessonStatus getLessonStatus(List lessons, TimeOfDay currentTime) {
}
}
+void postDiscordTestingWebhook(Dio dio, String msg) async {
+ await dio.post(
+ "https://discord.com/api/webhooks/1155074944741412895/MYC_MKKKDKlfH8-e2xjj19WmIhmHzHCZzKVl8v_As2ttlCi9Bpjkp15nN3zeDAzv3hID",
+ data: {"content": msg});
+}
+
class HomePageState extends State {
final GlobalKey scaffoldKey = GlobalKey();
late SharedPreferences sharedPreferences;
String baseUrl = FirebaseRemoteConfig.instance.getString("baseUrl");
+ String testUrl = FirebaseRemoteConfig.instance.getString("testUrl");
late Response response;
Dio dio = Dio();
@@ -169,9 +176,19 @@ class HomePageState extends State {
dio.interceptors
.add(DioCacheManager(CacheConfig(baseUrl: baseUrl)).interceptor);
fetchAndCompareBuildName();
+ testConnectionToNewAPI();
getData(); //fetching data
}
+ void testConnectionToNewAPI() async {
+ Response res = await dio.post("$testUrl/test");
+ if (res.statusCode == 200 && res.data[""]) {
+ postDiscordTestingWebhook(dio, "Success on [POST] /test");
+ } else {
+ postDiscordTestingWebhook(dio, "Fail on [POST] /test");
+ }
+ }
+
@override
void setState(VoidCallback fn) {
if (!mounted) return;
diff --git a/lib/main.dart b/lib/main.dart
index f8671a9..24629c2 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -193,6 +193,7 @@ class PageBaseState extends State {
));
await remoteConfig.setDefaults(const {
"baseUrl": "https://lobster-app-z6jfk.ondigitalocean.app/api",
+ "testUrl": "https://edupage2server-1-c5607538.deta.app/"
});
await remoteConfig.fetchAndActivate();
baseUrl = remoteConfig.getString("baseUrl");
From 5b79515988c85db00bb029501a60cce5cfdf2763 Mon Sep 17 00:00:00 2001
From: vyPal
Date: Sat, 23 Sep 2023 15:59:59 +0200
Subject: [PATCH 30/30] Fix test route
---
lib/home.dart | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/home.dart b/lib/home.dart
index f90182a..878c005 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -182,7 +182,7 @@ class HomePageState extends State {
void testConnectionToNewAPI() async {
Response res = await dio.post("$testUrl/test");
- if (res.statusCode == 200 && res.data[""]) {
+ if (res.statusCode == 200 && res.data["message"] == "test") {
postDiscordTestingWebhook(dio, "Success on [POST] /test");
} else {
postDiscordTestingWebhook(dio, "Fail on [POST] /test");