Merge branch 'dev' of github.com:refilc/naplo into dev

This commit is contained in:
Kima 2024-03-03 23:33:11 +01:00
commit 6eff27d4d8
34 changed files with 57 additions and 46 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
extensions:

View File

@ -16,7 +16,7 @@ import 'package:flutter/material.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:connectivity_plus/connectivity_plus.dart';
class FilcAPI { class reFilcAPI {
// API base // API base
static const baseUrl = "https://api.refilc.hu"; static const baseUrl = "https://api.refilc.hu";

View File

@ -18,7 +18,7 @@ class AdProvider extends ChangeNotifier {
} }
Future<void> fetch() async { Future<void> fetch() async {
_ads = await FilcAPI.getAds() ?? []; _ads = await reFilcAPI.getAds() ?? [];
_ads.sort((a, b) => -a.date.compareTo(b.date)); _ads.sort((a, b) => -a.date.compareTo(b.date));
// check for new ads // check for new ads

View File

@ -30,7 +30,7 @@ class NewsProvider extends ChangeNotifier {
var seen_ = Provider.of<SettingsProvider>(_context, listen: false).seenNews; var seen_ = Provider.of<SettingsProvider>(_context, listen: false).seenNews;
if (seen_.isEmpty) { if (seen_.isEmpty) {
var news_ = await FilcAPI.getNews(); var news_ = await reFilcAPI.getNews();
if (news_ != null) { if (news_ != null) {
_news = news_; _news = news_;
show = true; show = true;
@ -43,7 +43,7 @@ class NewsProvider extends ChangeNotifier {
} }
Future<void> fetch() async { Future<void> fetch() async {
var news_ = await FilcAPI.getNews(); var news_ = await reFilcAPI.getNews();
if (news_ == null) return; if (news_ == null) return;
show = false; show = false;

View File

@ -28,7 +28,7 @@ class UpdateProvider extends ChangeNotifier {
if (!Platform.isAndroid) return; if (!Platform.isAndroid) return;
_releases = await FilcAPI.getReleases() ?? []; _releases = await reFilcAPI.getReleases() ?? [];
_releases.sort((a, b) => -a.version.compareTo(b.version)); _releases.sort((a, b) => -a.version.compareTo(b.version));
// Check for new releases // Check for new releases

View File

@ -86,7 +86,7 @@ class App extends StatelessWidget {
final premium = PremiumProvider(settings: settings); final premium = PremiumProvider(settings: settings);
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
FilcAPI.getConfig(settings).then((Config? config) { reFilcAPI.getConfig(settings).then((Config? config) {
if (config != null) settings.update(config: config); if (config != null) settings.update(config: config);
}); });
premium.activate(); premium.activate();

View File

@ -50,7 +50,7 @@ extension UpdateHelper on Release {
} }
Future<Uint8List> download({UpdateCallback? updateCallback}) async { Future<Uint8List> download({UpdateCallback? updateCallback}) async {
var response = await FilcAPI.downloadRelease(downloads.first); var response = await reFilcAPI.downloadRelease(downloads.first);
List<List<int>> chunks = []; List<List<int>> chunks = [];
int downloaded = 0; int downloaded = 0;

View File

@ -160,6 +160,11 @@ flutter:
- asset: assets/fonts/SpaceMono/SpaceMono-BoldItalic.ttf - asset: assets/fonts/SpaceMono/SpaceMono-BoldItalic.ttf
weight: 700 weight: 700
style: italic style: italic
- family: GeistMono
fonts:
- asset: assets/fonts/GeistMono/GeistMono-Regular.otf
weight: 500
flutter_launcher_icons: flutter_launcher_icons:
image_path: assets/icons/ic_android.png image_path: assets/icons/ic_android.png

View File

@ -55,7 +55,7 @@ class _LoginScreenState extends State<LoginScreen> {
systemNavigationBarIconBrightness: Brightness.dark, systemNavigationBarIconBrightness: Brightness.dark,
)); ));
FilcAPI.getSchools().then((schools) { reFilcAPI.getSchools().then((schools) {
if (schools != null) { if (schools != null) {
schoolController.update(() { schoolController.update(() {
schoolController.schools = schools; schoolController.schools = schools;

View File

@ -54,18 +54,18 @@ class ShareProvider extends ChangeNotifier {
}; };
SharedTheme theme = SharedTheme.fromJson(themeJson, gradeColors); SharedTheme theme = SharedTheme.fromJson(themeJson, gradeColors);
FilcAPI.addSharedTheme(theme); reFilcAPI.addSharedTheme(theme);
return theme; return theme;
} }
Future<SharedTheme?> getThemeById(BuildContext context, Future<SharedTheme?> getThemeById(BuildContext context,
{required String id}) async { {required String id}) async {
Map? themeJson = await FilcAPI.getSharedTheme(id); Map? themeJson = await reFilcAPI.getSharedTheme(id);
if (themeJson != null) { if (themeJson != null) {
Map? gradeColorsJson = Map? gradeColorsJson =
await FilcAPI.getSharedGradeColors(themeJson['grade_colors_id']); await reFilcAPI.getSharedGradeColors(themeJson['grade_colors_id']);
if (gradeColorsJson != null) { if (gradeColorsJson != null) {
SharedTheme theme = SharedTheme.fromJson( SharedTheme theme = SharedTheme.fromJson(
@ -79,7 +79,7 @@ class ShareProvider extends ChangeNotifier {
Future<List<SharedTheme>> getAllPublicThemes(BuildContext context, Future<List<SharedTheme>> getAllPublicThemes(BuildContext context,
{int count = 0}) async { {int count = 0}) async {
List? themesJson = await FilcAPI.getAllSharedThemes(count); List? themesJson = await reFilcAPI.getAllSharedThemes(count);
List<SharedTheme> themes = []; List<SharedTheme> themes = [];
@ -89,7 +89,7 @@ class ShareProvider extends ChangeNotifier {
if (t['grade_colors_id'].toString().replaceAll(' ', '') == '') continue; if (t['grade_colors_id'].toString().replaceAll(' ', '') == '') continue;
Map? gradeColorsJson = Map? gradeColorsJson =
await FilcAPI.getSharedGradeColors(t['grade_colors_id']); await reFilcAPI.getSharedGradeColors(t['grade_colors_id']);
if (gradeColorsJson != null) { if (gradeColorsJson != null) {
SharedTheme theme = SharedTheme.fromJson( SharedTheme theme = SharedTheme.fromJson(
@ -124,14 +124,14 @@ class ShareProvider extends ChangeNotifier {
}; };
SharedGradeColors gradeColors = SharedGradeColors.fromJson(gradeColorsJson); SharedGradeColors gradeColors = SharedGradeColors.fromJson(gradeColorsJson);
FilcAPI.addSharedGradeColors(gradeColors); reFilcAPI.addSharedGradeColors(gradeColors);
return gradeColors; return gradeColors;
} }
Future<SharedGradeColors?> getGradeColorsById(BuildContext context, Future<SharedGradeColors?> getGradeColorsById(BuildContext context,
{required String id}) async { {required String id}) async {
Map? gradeColorsJson = await FilcAPI.getSharedGradeColors(id); Map? gradeColorsJson = await reFilcAPI.getSharedGradeColors(id);
if (gradeColorsJson != null) { if (gradeColorsJson != null) {
SharedGradeColors gradeColors = SharedGradeColors gradeColors =

View File

@ -21,26 +21,24 @@ class ErrorReportScreen extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
const Spacer(), const Spacer(),
const Icon( Image.asset('assets/icons/ic_rounded.png', height: 40),
FeatherIcons.alertTriangle, const SizedBox(height: 16),
size: 100,
),
const Spacer(),
Padding( Padding(
padding: const EdgeInsets.only(bottom: 4.0), padding: const EdgeInsets.only(bottom: 4.0),
child: Text( child: Text(
"uhoh".i18n, "ekretaYou".i18n,
style: const TextStyle( style: TextStyle(
color: Colors.white, color: Color(0xFF011234).withOpacity(0.7),
fontSize: 32.0, fontSize: 24.0,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w700,
), ),
), ),
), ),
Text( Text(
"description".i18n, "description".i18n, //TODO: randomize using DirtyWords.xml
style: TextStyle( textAlign: TextAlign.center,
color: Colors.white.withOpacity(.95), style: const TextStyle(
color: Color(0xFF011234),
fontSize: 24.0, fontSize: 24.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@ -50,7 +48,7 @@ class ErrorReportScreen extends StatelessWidget {
alignment: Alignment.topRight, alignment: Alignment.topRight,
children: [ children: [
Container( Container(
height: 110.0, height: 244.0,
width: double.infinity, width: double.infinity,
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -86,13 +84,14 @@ class ErrorReportScreen extends StatelessWidget {
) )
], ],
), ),
const Spacer(), const SizedBox(height: 16),
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: 48,
child: TextButton( child: TextButton(
style: ButtonStyle( style: ButtonStyle(
padding: MaterialStateProperty.all( padding: MaterialStateProperty.all(
const EdgeInsets.symmetric(vertical: 14.0)), const EdgeInsets.symmetric(vertical: 10.0)),
backgroundColor: backgroundColor:
MaterialStateProperty.all(const Color(0xFF0E275A)), MaterialStateProperty.all(const Color(0xFF0E275A)),
shape: MaterialStateProperty.all( shape: MaterialStateProperty.all(
@ -114,17 +113,22 @@ class ErrorReportScreen extends StatelessWidget {
const SizedBox(height: 8), const SizedBox(height: 8),
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: 48,
child: OutlinedButton( child: OutlinedButton(
style: ButtonStyle( style: ButtonStyle(
padding: MaterialStateProperty.all( padding: MaterialStateProperty.all(
const EdgeInsets.symmetric(vertical: 14.0)), const EdgeInsets.symmetric(vertical: 14.0),
backgroundColor: ),
MaterialStateProperty.all(Color(0xFFF3F7FE)), backgroundColor: MaterialStateProperty.all(
foregroundColor: Color(0xFFF3F7FE),
MaterialStateProperty.all(const Color(0xFFC7D3EB)), ),
shape: MaterialStateProperty.all( shape: MaterialStateProperty.all(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0)), borderRadius: BorderRadius.circular(12.0),
),
),
side: MaterialStateProperty.all(
BorderSide(width: 1.0, color: Color(0xFFC7D3EB)),
), ),
), ),
child: Text( child: Text(
@ -154,7 +158,7 @@ class ErrorReportScreen extends StatelessWidget {
version: const String.fromEnvironment("APPVER", defaultValue: "?"), version: const String.fromEnvironment("APPVER", defaultValue: "?"),
stack: details.stack.toString(), stack: details.stack.toString(),
); );
FilcAPI.sendReport(report); reFilcAPI.sendReport(report);
Navigator.pop(context); Navigator.pop(context);
} }
} }
@ -240,12 +244,13 @@ class ErrorDetail extends StatelessWidget {
const EdgeInsets.symmetric(horizontal: 6.5, vertical: 4.0), const EdgeInsets.symmetric(horizontal: 6.5, vertical: 4.0),
margin: const EdgeInsets.only(top: 4.0), margin: const EdgeInsets.only(top: 4.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.black26, color: Color.fromARGB(255, 218, 218, 218),
borderRadius: BorderRadius.circular(4.0)), borderRadius: BorderRadius.circular(4.0)),
child: Text( child: Text(
content, content,
style: const TextStyle( style: const TextStyle(
fontFamily: 'SpaceMono', color: Colors.white), fontFamily: 'GeistMono',
color: Color.fromARGB(255, 0, 0, 0)),
)) ))
], ],
), ),

View File

@ -4,7 +4,7 @@ extension SettingsLocalization on String {
static final _t = Translations.byLocale("hu_hu") + static final _t = Translations.byLocale("hu_hu") +
{ {
"en_en": { "en_en": {
"uhoh": "Uh Oh!", "ekretaYou": "eKréta, you",
"description": "An error occurred!", "description": "An error occurred!",
"submit": "Submit", "submit": "Submit",
"goback": "Go back", "goback": "Go back",
@ -16,8 +16,8 @@ extension SettingsLocalization on String {
"done": "Done", "done": "Done",
}, },
"hu_hu": { "hu_hu": {
"uhoh": "Ajajj!", "ekretaYou": "eKréta, te",
"description": "Hiba történt!", "description": "Fasz-emulátor hivatásos balfasz!",
"submit": "Hiba jelentése", "submit": "Hiba jelentése",
"goback": "Vissza", "goback": "Vissza",
"details": "Részletek", "details": "Részletek",
@ -28,7 +28,7 @@ extension SettingsLocalization on String {
"done": "Kész", "done": "Kész",
}, },
"de_de": { "de_de": {
"uhoh": "Uh Oh!", "ekretaYou": "eKréta, du",
"description": "Ein Fehler ist aufgetreten!", "description": "Ein Fehler ist aufgetreten!",
"submit": "Abschicken", "submit": "Abschicken",
"goback": "Zurück", "goback": "Zurück",

View File

@ -57,7 +57,7 @@ class LoginScreenState extends State<LoginScreen> {
systemNavigationBarIconBrightness: Brightness.dark, systemNavigationBarIconBrightness: Brightness.dark,
)); ));
FilcAPI.getSchools().then((schools) { reFilcAPI.getSchools().then((schools) {
if (schools != null) { if (schools != null) {
schoolController.update(() { schoolController.update(() {
schoolController.schools = schools; schoolController.schools = schools;

@ -1 +1 @@
Subproject commit 146ff9251c421f1982e90e07d36027c4d5d3342a Subproject commit 2a1b68c545fb01720a3b1f25230f800ad4b0bf20