1

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1 @@
extensions:

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

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

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

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

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

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

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

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

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

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

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

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

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