forked from firka/firka
Compare commits
15 Commits
dev
...
notificati
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7242437231 | ||
|
|
50f0332842 | ||
|
|
54d792eb01 | ||
|
|
c8b402118c | ||
|
|
c0f3e61b90 | ||
|
|
9aaf43892f | ||
|
|
a64a7f7509 | ||
|
|
1225e6763f | ||
|
|
b159530de9 | ||
|
|
5fb1f6cc30 | ||
|
|
670968247a | ||
| 5847301e70 | |||
|
|
6342f16d80 | ||
|
|
7167bf8da4 | ||
|
|
7747e5d90b |
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -1,8 +1,8 @@
|
||||
[submodule "firka/lib/l10n"]
|
||||
path = firka/lib/l10n
|
||||
url = https://git.firka.app/firka/firka-localization
|
||||
branch = main
|
||||
branch = weblate
|
||||
[submodule "firka_wear/lib/l10n"]
|
||||
path = firka_wear/lib/l10n
|
||||
url = https://git.firka.app/firka/firka-localization
|
||||
branch = main
|
||||
branch = weblate
|
||||
|
||||
50
README_de.md
50
README_de.md
@@ -1,13 +1,51 @@
|
||||
# Firka
|
||||
# <img src="https://git.firka.app/firka/readme-files/raw/branch/main/dave.png" height="40" /> Firka
|
||||
|
||||
| <sub>HU</sub> [Magyar](README.md) | <sub>EN</sub> [English](README_en.md) | <sub>DE</sub> [Deutsch](README_de.md) |
|
||||
|-----------------------------------|---------------------------------------|---------------------------------------|
|
||||
|
||||
[](https://crowdin.com/project/firka)
|
||||
<a href="https://translate.firka.app/engage/firka-naplo/"><img src="https://translate.firka.app/widget/firka-naplo/firka-app/en/svg-badge.svg" alt="Translation status"></a>
|
||||
<a href="https://status.firka.app/"><img src="https://status.firka.app/api/badge/1/uptime/24?label=Uptime&suffix=%" alt="Uptime"></a>
|
||||
<a href="https://builds.firka.app/job/Firka%20Beta/"><img src="https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fbuilds.firka.app%2Fjob%2FFirka%2520Beta%2F&label=Build" alt="Build status"></a>
|
||||
|
||||
## Das Projekt
|
||||
### Wir haben diese App entwickelt, weil die offizielle App viel zu wünschen übrig ließ. Firka ist eine vollständig open-source, von der Community gepflegte Alternative, und wir stehen erst am Anfang. Mit jedem Release wird sie schneller, anpassbarer und benutzerfreundlicher.
|
||||
|
||||
Firka ist ein alternativer Client für [eine noch zu benennende Applikation]. Das Ziel der App ist es, eine moderne
|
||||
und benutzerfreundliche App für das [noch zu benennende] System zu sein.
|
||||
|
||||
[Leitfaden für Mitwirkende](CONTRIBUTING_de.md)
|
||||
|
||||
<img src="https://git.firka.app/firka/readme-files/raw/branch/main/firka_features.png" width="100%" />
|
||||
|
||||
<br />
|
||||
|
||||
## Was sind überhaupt die Funktionen der App?
|
||||
### Sieh, was ansteht
|
||||
|
||||
Der Startbildschirm zeigt deine anstehenden Lektionen an, damit du nie unvorbereitet bist. Filtere nach Fach, Prüfungen oder was auch immer dir gerade wichtig ist. Die untere Leiste ist vollständig anpassbar: Zeige an was du nutzt und verstecke was du nicht brauchst.
|
||||
|
||||
|
||||
### Noten, ganz nach deinen Vorstellungen
|
||||
|
||||
Emotional nicht bereit für deine eigenen Noten? Diese Einstellung hält sie verborgen, bis du jede einzelne antippst, damit du deine Misserfolge in einem angenehmen Tempo verarbeiten kannst.
|
||||
|
||||
|
||||
### Wie schlecht bist du eigentlich in Mathe?
|
||||
|
||||
Die Noten-Seite enthält ein Diagramm deines Gesamtdurchschnitts, sodass du beobachten kannst, wie er im Laufe des Semesters langsam sinkt. Jedes Fach hat zudem ein eigenes Diagramm, falls du genau wissen möchtest, welches dafür verantwortlich ist.
|
||||
|
||||
|
||||
### Alles anpassen
|
||||
|
||||
Der Einstellungsbildschirm bietet Optionen, von denen du nicht wusstest, dass du sie brauchst. Passe die Glockenverzögerung an, damit du auf die Sekunde genau weißt, wann der Unterricht endet. Es gibt auch einen Linkshänder-Modus, denn anscheinend benutzen manche Leute ihr Handy falsch.
|
||||
|
||||
|
||||
## Was wird unterstützt?
|
||||
|
||||
Derzeit unterstützen wir **Android** und **iOS**.
|
||||
<br />
|
||||
Wir planen, auch deinen Browser zu unterstützen!
|
||||
|
||||
## Mitwirken
|
||||
Wir würden uns sehr über deine Hilfe freuen.
|
||||
Du kannst im [Leitfaden zum unterstützen](CONTRIBUTING_de.md) loslegen.
|
||||
|
||||
## Community
|
||||
|
||||
[Discord](https://discord.gg/xTspd3zzRZ)
|
||||
@@ -1,27 +1,24 @@
|
||||
import java.io.FileInputStream
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||
id("dev.flutter.flutter-gradle-plugin")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "app.firka.naplo"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
compose = true
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "app.firka.naplo"
|
||||
// You can update the following values to match your application needs.
|
||||
@@ -31,14 +28,11 @@ android {
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
}
|
||||
|
||||
val secretsDir = File(projectDir.absolutePath, "../../../secrets/")
|
||||
val propsFile = File(secretsDir, "keystore.properties")
|
||||
|
||||
if (propsFile.exists()) {
|
||||
val props = Properties().apply { FileInputStream(propsFile).use { load(it) } }
|
||||
val store = File(secretsDir, props["storeFile"].toString())
|
||||
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
storeFile = store
|
||||
@@ -52,7 +46,6 @@ android {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
getByName("debug") {
|
||||
applicationIdSuffix = ".debug"
|
||||
@@ -60,27 +53,29 @@ android {
|
||||
}
|
||||
release {
|
||||
val config = signingConfigs.findByName("release")
|
||||
|
||||
if (config != null) {
|
||||
signingConfig = config
|
||||
}
|
||||
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
compilerOptions {
|
||||
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
|
||||
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
|
||||
}
|
||||
}
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force("androidx.test.espresso:espresso-core:3.6.1")
|
||||
force("androidx.test.espresso:espresso-idling-resource:3.6.1")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
|
||||
implementation("androidx.glance:glance-appwidget:1.1.1")
|
||||
implementation("com.google.android.gms:play-services-wearable:18.1.0")
|
||||
}
|
||||
|
||||
// Ensure .env exists before Flutter bundles assets (copy from .env.example if missing)
|
||||
val envFile = file("${project.projectDir}/../../.env")
|
||||
val envExampleFile = file("${project.projectDir}/../../.env.example")
|
||||
@@ -95,7 +90,6 @@ tasks.register("ensureEnv") {
|
||||
tasks.matching { it.name.startsWith("compileFlutterBuild") }.configureEach {
|
||||
dependsOn("ensureEnv")
|
||||
}
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application android:label="Firka Debug"
|
||||
<application android:name="app.firka.naplo.AppMain"
|
||||
android:label="Firka Debug"
|
||||
android:usesCleartextTraffic="true" />
|
||||
</manifest>
|
||||
</manifest>
|
||||
@@ -1,5 +1,5 @@
|
||||
import com.android.build.gradle.BaseExtension
|
||||
import org.jetbrains.kotlin.gradle.plugin.extraProperties
|
||||
import com.android.build.api.dsl.ApplicationExtension
|
||||
import com.android.build.api.dsl.LibraryExtension
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
@@ -14,33 +14,26 @@ rootProject.layout.buildDirectory.value(newBuildDir)
|
||||
subprojects {
|
||||
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
|
||||
|
||||
// fix for verifyReleaseResources
|
||||
|
||||
// note(4831c0): taken from https://github.com/isar/isar/issues/1662
|
||||
// note(4831c0): and adapted to kotlin
|
||||
afterEvaluate {
|
||||
if (plugins.hasPlugin("com.android.application") || plugins.hasPlugin("com.android.library")) {
|
||||
val androidExtension = extensions.getByName("android") as BaseExtension
|
||||
androidExtension.apply {
|
||||
compileSdkVersion(37)
|
||||
buildToolsVersion = "36.1.0"
|
||||
}
|
||||
}
|
||||
if (hasProperty("android")) {
|
||||
val androidExtension = extensions.getByName("android") as BaseExtension
|
||||
androidExtension.apply {
|
||||
// Set namespace if it's not already set
|
||||
if (!extraProperties.has("namespace")) {
|
||||
extraProperties["namespace"] = project.group.toString()
|
||||
if (plugins.hasPlugin("com.android.application")) {
|
||||
extensions.configure<ApplicationExtension> {
|
||||
compileSdk = 37
|
||||
defaultConfig {
|
||||
// buildToolsVersion can be set here if needed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugins.hasPlugin("com.android.library")) {
|
||||
extensions.configure<LibraryExtension> {
|
||||
compileSdk = 37
|
||||
}
|
||||
}
|
||||
}
|
||||
// ===============================
|
||||
|
||||
project.layout.buildDirectory.value(newSubprojectBuildDir)
|
||||
}
|
||||
|
||||
tasks.register<Delete>("clean") {
|
||||
delete(rootProject.layout.buildDirectory)
|
||||
}
|
||||
}
|
||||
3
firka/assets/majesticons/check.svg
Normal file
3
firka/assets/majesticons/check.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.7069 7.70643C19.8891 7.51783 19.9899 7.26523 19.9876 7.00303C19.9853 6.74083 19.8801 6.49002 19.6947 6.30461C19.5093 6.1192 19.2585 6.01403 18.9963 6.01176C18.7341 6.00948 18.4815 6.11027 18.2929 6.29243L8.99992 15.5854L5.70692 12.2924C5.51832 12.1103 5.26571 12.0095 5.00352 12.0118C4.74132 12.014 4.49051 12.1192 4.3051 12.3046C4.11969 12.49 4.01452 12.7408 4.01224 13.003C4.00997 13.2652 4.11076 13.5178 4.29292 13.7064L8.29292 17.7064C8.48045 17.8939 8.73476 17.9992 8.99992 17.9992C9.26508 17.9992 9.51939 17.8939 9.70692 17.7064L19.7069 7.70643Z" fill="#A7DC22"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 726 B |
10
firka/assets/majesticons/checkSolid.svg
Normal file
10
firka/assets/majesticons/checkSolid.svg
Normal file
@@ -0,0 +1,10 @@
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_2679_4048)">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.5 0.5C1.96957 0.5 1.46086 0.710714 1.08579 1.08579C0.710714 1.46086 0.5 1.96957 0.5 2.5V9.5C0.5 10.0304 0.710714 10.5391 1.08579 10.9142C1.46086 11.2893 1.96957 11.5 2.5 11.5H9.5C10.0304 11.5 10.5391 11.2893 10.9142 10.9142C11.2893 10.5391 11.5 10.0304 11.5 9.5V2.5C11.5 1.96957 11.2893 1.46086 10.9142 1.08579C10.5391 0.710714 10.0304 0.5 9.5 0.5H2.5ZM9.8535 3.8535C9.94458 3.7592 9.99498 3.6329 9.99384 3.5018C9.9927 3.3707 9.94011 3.24529 9.84741 3.15259C9.75471 3.05989 9.6293 3.0073 9.4982 3.00616C9.3671 3.00502 9.2408 3.05542 9.1465 3.1465L4.5 7.793L2.8535 6.1465C2.7592 6.05542 2.6329 6.00502 2.5018 6.00616C2.3707 6.0073 2.24529 6.05989 2.15259 6.15259C2.05989 6.24529 2.0073 6.3707 2.00616 6.5018C2.00502 6.6329 2.05542 6.7592 2.1465 6.8535L4.1465 8.8535C4.24026 8.94724 4.36742 8.99989 4.5 8.99989C4.63258 8.99989 4.75974 8.94724 4.8535 8.8535L9.8535 3.8535Z" fill="#A7DC22"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_2679_4048">
|
||||
<rect width="12" height="12" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -7,15 +7,15 @@ icons:
|
||||
"assets/images/logos/colored_logo_only_mustache.png": "bad6220c11bdfb1dfe04e5173bd2ebedd3999689d4b3a68fc63dc520c96dd33b"
|
||||
l10n:
|
||||
"l10n.yml": "a57bc304cac4a2b0235593586f17f400a5165d67fc9aadeaa11893cfa36ee082"
|
||||
"lib/l10n/app_de.arb": "ecfbf13bd33be9d27a2b54bfd8fb61e46c1a1dce905869d3f30cd05b4aecf258"
|
||||
"lib/l10n/app_en.arb": "7c43928f67b5b735283da04e3741f1afa2e9d41cdeb2e91c740e77fc84e7f046"
|
||||
"lib/l10n/app_hu.arb": "696a1ea2e86be364e9c815e5f739d3a2f5f3da9c05066084d9d26defe5018e2c"
|
||||
"lib/l10n/app_de.arb": "c6a12eaadf03b012a6a377b3efa4e606bd985355e76e6351956a017f4cfdadc1"
|
||||
"lib/l10n/app_hu.arb": "a63aace8d129dbc054c4996dd9ef7d54aad96888241ce1310518b10a9a7b561d"
|
||||
"lib/l10n/app_en.arb": "b2d72778fedb46155f41eb210906ed8ffba8b12744a2800b039951e0a2a88133"
|
||||
isar:
|
||||
"lib/data/models/app_settings_model.dart": "5eb5af345f1347f104257f0999763650fe2673f9da1754bd12d3f756fe5c9723"
|
||||
"lib/data/models/generic_cache_model.dart": "79151d0467fb5d40c532eaaa08ad7c7e24a34304199280fbf49cf6e5adcce6bc"
|
||||
"lib/data/models/homework_cache_model.dart": "45789970b27d5790cdc54c292ef2f5feaa5f4e293b8a8862fd676d5eb3e25d29"
|
||||
"lib/data/models/timetable_cache_model.dart": "b972bf51e399f8d20d4f9ad660082d4cc4a9798df9ac9d6ec9ef6ac640205572"
|
||||
"lib/data/models/token_model.dart": "8c957cd07e473827d78fd8fd4fb6c1336b636a69c25c93618e1e7f94b7cf0683"
|
||||
"lib/data/models/homework_cache_model.dart": "45789970b27d5790cdc54c292ef2f5feaa5f4e293b8a8862fd676d5eb3e25d29"
|
||||
"lib/data/models/generic_cache_model.dart": "62003ec1fd73a0fa6786d337acdef42b9a6eb9efaa78d17eaf4fe091504b8490"
|
||||
"lib/data/models/timetable_cache_model.dart": "b972bf51e399f8d20d4f9ad660082d4cc4a9798df9ac9d6ec9ef6ac640205572"
|
||||
splash:
|
||||
"flutter_native_splash.yaml": "0fd4a85d6f950d97298e99916927649940ffcfdadfc136ceee126fed0dbaa9f2"
|
||||
"assets/images/logos/splash.png": "88fbebc3d686cb9095bcce362029b69978b1b14270e465e91d962b1425db1152"
|
||||
|
||||
@@ -3,7 +3,9 @@ import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:firka/core/extensions.dart';
|
||||
import 'package:firka/core/settings.dart';
|
||||
import 'package:firka/data/models/generic_cache_model.dart';
|
||||
import 'package:firka/data/models/timetable_cache_model.dart';
|
||||
import 'package:isar_community/isar.dart';
|
||||
@@ -39,6 +41,65 @@ class KretaClient {
|
||||
|
||||
bool get needsReauth => _reauthCubit.state.needsReauth;
|
||||
|
||||
Future<Response<dynamic>> sendNotifReq(
|
||||
String method,
|
||||
TokenModel model,
|
||||
String? fcmToken, {
|
||||
bool auth = true,
|
||||
}) async {
|
||||
var isGuardian = model.studentId!.contains("G0");
|
||||
|
||||
return await dio.request(
|
||||
"https://kretaglobalmobileapi2.ekreta.hu/api/v3/Registration",
|
||||
options: Options(
|
||||
method: method,
|
||||
headers: {
|
||||
"accept": "*/*",
|
||||
"user-agent": Constants.userAgent,
|
||||
if (auth) "Authorization": "Bearer ${model.accessToken}",
|
||||
"apiKey": "7856d350-1fda-45f5-822d-e1a2f3f1acf0",
|
||||
},
|
||||
),
|
||||
queryParameters: <String, String>{
|
||||
"RegistrationId": ?model.registrationId,
|
||||
"Handle": ?fcmToken,
|
||||
"NotificationRole": isGuardian ? "2" : "1",
|
||||
"NotificationEnvironment": isGuardian
|
||||
? "Gondviselo_Native"
|
||||
: "Tanulo_Native",
|
||||
"NotificationType": "1",
|
||||
if (method == "POST") "Platform": "fcmv1",
|
||||
"NotificationSource": "Kreta",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> updateFCMToken({String? fcmToken}) async {
|
||||
fcmToken = fcmToken ?? (await FirebaseMessaging.instance.getToken())!;
|
||||
|
||||
Response<dynamic> resp;
|
||||
|
||||
if (model.registrationId == null) {
|
||||
resp = await sendNotifReq("POST", model, fcmToken, auth: true);
|
||||
|
||||
if (resp.statusCode == 200) {
|
||||
model.registrationId = resp.data["registrationId"];
|
||||
model.fcmToken = fcmToken;
|
||||
logger.info("New registr: ${model.registrationId}");
|
||||
} else {
|
||||
logger.info("POST RESP");
|
||||
logger.info(resp.statusCode);
|
||||
logger.info(resp);
|
||||
}
|
||||
} else if (fcmToken != model.fcmToken) {
|
||||
logger.info("FCM mismatch!");
|
||||
model.registrationId = null;
|
||||
await updateFCMToken(fcmToken: fcmToken);
|
||||
} else {
|
||||
logger.info("FCM already registered!");
|
||||
}
|
||||
}
|
||||
|
||||
void clearReauthFlag() {
|
||||
_reauthCubit.clear();
|
||||
debugPrint('[KretaClient] Reauth flag cleared');
|
||||
@@ -83,7 +144,9 @@ class KretaClient {
|
||||
}
|
||||
|
||||
final extended = await extendToken(sourceToken);
|
||||
return TokenModel.fromResp(extended);
|
||||
return TokenModel.fromResp(extended)
|
||||
..registrationId ??= sourceToken.registrationId
|
||||
..fcmToken ??= sourceToken.fcmToken;
|
||||
} finally {
|
||||
if (Platform.isIOS && studentIdNorm != null && leaseOperationId != null) {
|
||||
await WatchSyncHelper.releaseIPhoneRefreshLease(
|
||||
@@ -169,11 +232,13 @@ class KretaClient {
|
||||
try {
|
||||
var tokenModel = await _refreshModelWithCrossDeviceLease(model);
|
||||
|
||||
model = tokenModel;
|
||||
await updateFCMToken();
|
||||
|
||||
await isar.writeTxn(() async {
|
||||
await isar.tokenModels.put(tokenModel);
|
||||
});
|
||||
|
||||
model = tokenModel;
|
||||
await _syncTokenToAppleTargets(model);
|
||||
clearReauthFlag();
|
||||
logger.info("[Recovery] Step 1 SUCCESS: Local refresh succeeded");
|
||||
@@ -304,7 +369,7 @@ class KretaClient {
|
||||
return true;
|
||||
}
|
||||
|
||||
Future<T> _mutexCallback<T>(Future<T> Function() callback) async {
|
||||
Future<T> mutexCallback<T>(Future<T> Function() callback) async {
|
||||
const maxWaitTime = Duration(seconds: 30);
|
||||
|
||||
if (_tokenMutexCompleter != null) {
|
||||
@@ -337,7 +402,7 @@ class KretaClient {
|
||||
}
|
||||
|
||||
Future<Response> _authReq(String method, String url, [Object? data]) async {
|
||||
var localToken = await _mutexCallback<String>(() async {
|
||||
var localToken = await mutexCallback<String>(() async {
|
||||
var now = timeNow();
|
||||
|
||||
if (now.millisecondsSinceEpoch >=
|
||||
@@ -366,7 +431,11 @@ class KretaClient {
|
||||
|
||||
return await dio.get(
|
||||
url,
|
||||
options: Options(method: method, headers: headers),
|
||||
options: Options(
|
||||
method: method,
|
||||
headers: headers,
|
||||
receiveTimeout: Duration(seconds: 20),
|
||||
),
|
||||
data: data,
|
||||
);
|
||||
}
|
||||
@@ -381,7 +450,7 @@ class KretaClient {
|
||||
try {
|
||||
logger.finest("Sending authenticated request to: $url");
|
||||
resp = await _authReq(method, url, data);
|
||||
if (!url.endsWith("TanuloAdatlap")) {
|
||||
if (!isDebug() && !url.endsWith("TanuloAdatlap")) {
|
||||
logger.finest("Response: ${resp.statusCode} ${resp.data}");
|
||||
}
|
||||
|
||||
@@ -404,6 +473,9 @@ class KretaClient {
|
||||
);
|
||||
} else {
|
||||
logger.shout("Request to url: $url failed", ex.toString());
|
||||
if (ex is Exception) {
|
||||
logger.shout(ex);
|
||||
}
|
||||
}
|
||||
|
||||
rethrow;
|
||||
@@ -733,8 +805,10 @@ class KretaClient {
|
||||
}) async {
|
||||
if (from == null && to == null) {
|
||||
DateTime now = timeNow();
|
||||
/* you are taking too long °w°
|
||||
DateTime start = now.copyWith(month: 9, day: 1);
|
||||
from = now.isBefore(start) ? start.subtract(Duration(days: 365)) : start;
|
||||
from = now.isBefore(start) ? start.subtract(Duration(days: 365)) : start;*/
|
||||
from = now.subtract(Duration(days: 14));
|
||||
}
|
||||
return await _genericListedCachingGet(
|
||||
CacheId.getHomework,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:typed_data';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:firka/api/client/kreta_client.dart';
|
||||
import 'package:firka/core/bloc/home_refresh_cubit.dart';
|
||||
@@ -17,6 +18,7 @@ import 'package:isar_community/isar.dart';
|
||||
import 'dart:io';
|
||||
|
||||
late final Logger logger;
|
||||
late final FlutterLocalNotificationsPlugin flnp;
|
||||
|
||||
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
||||
late AppInitialization initData;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'dart:ui' as ui;
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:firka/api/consts.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -25,7 +28,9 @@ import 'package:firka/l10n/app_localizations_en.dart';
|
||||
import 'package:firka/l10n/app_localizations_hu.dart';
|
||||
import 'package:firka/core/swear_generator.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:kreta_api/kreta_api.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:isar_community/isar.dart';
|
||||
@@ -299,6 +304,49 @@ Future<AppInitialization> initializeApp() async {
|
||||
|
||||
await _initData(init);
|
||||
|
||||
initData = init;
|
||||
initDone = true;
|
||||
|
||||
flnp = FlutterLocalNotificationsPlugin();
|
||||
const DarwinInitializationSettings initializationSettingsDarwin =
|
||||
DarwinInitializationSettings(
|
||||
requestSoundPermission: true,
|
||||
requestBadgePermission: true,
|
||||
requestAlertPermission: false,
|
||||
);
|
||||
const AndroidInitializationSettings initializationSettingsAndroid =
|
||||
AndroidInitializationSettings('ic_notification');
|
||||
const InitializationSettings initializationSettings = InitializationSettings(
|
||||
android: initializationSettingsAndroid,
|
||||
iOS: initializationSettingsDarwin,
|
||||
macOS: initializationSettingsDarwin,
|
||||
);
|
||||
await flnp.initialize(settings: initializationSettings);
|
||||
|
||||
Future<void> updateToken([String? fcm]) async {
|
||||
TokenModel? token = pickActiveToken(
|
||||
tokens: initData.tokens,
|
||||
settings: initData.settings,
|
||||
);
|
||||
|
||||
if (token == null) return;
|
||||
try {
|
||||
await initData.client.mutexCallback(() async {
|
||||
if (!await initData.client.refreshTokenProactively()) {
|
||||
throw TokenExpiredException();
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FirebaseMessaging.instance.onTokenRefresh.listen(
|
||||
(token) => unawaited(updateToken(token)),
|
||||
);
|
||||
|
||||
await updateToken();
|
||||
|
||||
return init;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ import 'package:firka/data/models/app_settings_model.dart';
|
||||
import 'package:firka/services/live_activity_service.dart';
|
||||
import 'package:firka/l10n/app_localizations.dart';
|
||||
import 'package:firka/ui/shared/firka_icon.dart';
|
||||
import 'package:firka_common/firka_common.dart' as common;
|
||||
import 'package:firka_common/ui/theme/style.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:isar_community/isar.dart';
|
||||
@@ -715,6 +717,34 @@ class SettingsStore {
|
||||
await item.load(model);
|
||||
}
|
||||
}
|
||||
|
||||
int roundGrade(num grade) {
|
||||
final rounding = group(
|
||||
"settings",
|
||||
).subGroup("application").subGroup("rounding");
|
||||
return common.roundGrade(
|
||||
grade,
|
||||
t1: rounding.dbl("1"),
|
||||
t2: rounding.dbl("2"),
|
||||
t3: rounding.dbl("3"),
|
||||
t4: rounding.dbl("4"),
|
||||
);
|
||||
}
|
||||
|
||||
Color getGradeColor(num grade) {
|
||||
switch (roundGrade(grade)) {
|
||||
case 2:
|
||||
return appStyle.colors.grade2;
|
||||
case 3:
|
||||
return appStyle.colors.grade3;
|
||||
case 4:
|
||||
return appStyle.colors.grade4;
|
||||
case 5:
|
||||
return appStyle.colors.grade5;
|
||||
default:
|
||||
return appStyle.colors.grade1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension SettingExt on LinkedHashMap<String, SettingsItem> {
|
||||
|
||||
@@ -17,6 +17,8 @@ class TokenModel {
|
||||
String? idToken; // Unique identifier for the token if needed
|
||||
String? accessToken; // The main auth token
|
||||
String? refreshToken; // Token used to refresh the access token
|
||||
String? registrationId;
|
||||
String? fcmToken;
|
||||
DateTime? expiryDate;
|
||||
int? tokenVersion;
|
||||
int? updatedAtMs;
|
||||
|
||||
Submodule firka/lib/l10n updated: ae86f4fe2d...32bea9c6be
@@ -1,5 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:flutter_native_splash/flutter_native_splash.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
@@ -7,8 +10,34 @@ import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/app/initialization.dart';
|
||||
import 'package:firka/app/initialization_screen.dart';
|
||||
|
||||
Future<void> ertesites(String title, String message) async {
|
||||
logger.info("REMOTE Title: $title");
|
||||
logger.info("REMOTE Message: $message");
|
||||
const NotificationDetails notificationDetails = NotificationDetails(
|
||||
android: AndroidNotificationDetails(
|
||||
'teszt',
|
||||
'Értesítés',
|
||||
channelDescription: 'Értesítés a Krétától.',
|
||||
importance: Importance.max,
|
||||
ticker: 'ticker',
|
||||
),
|
||||
);
|
||||
await flnp.show(
|
||||
id: 0,
|
||||
title: title,
|
||||
body: message,
|
||||
notificationDetails: notificationDetails,
|
||||
payload: "szia",
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
|
||||
await ertesites(message.data["Title"], message.data["Message"]);
|
||||
}
|
||||
|
||||
void main() async {
|
||||
logger = Logger("Firka");
|
||||
|
||||
dio.options.connectTimeout = Duration(seconds: 5);
|
||||
dio.options.receiveTimeout = Duration(seconds: 3);
|
||||
dio.options.validateStatus = (status) => status != null && status < 500;
|
||||
@@ -28,6 +57,26 @@ void main() async {
|
||||
|
||||
await setupLogging();
|
||||
|
||||
await Firebase.initializeApp(
|
||||
name: defaultFirebaseAppName,
|
||||
options: FirebaseOptions(
|
||||
apiKey: "AIzaSyA_SnXigQkSvFuB5ECpgz8pZ1SjKzuKiFo",
|
||||
appId: "1:694136934013:android:2d6873f63e005250",
|
||||
androidClientId:
|
||||
"694136934013-6e2jmrbqume6lt92d2ceb5se6uru4uvm.apps.googleusercontent.com",
|
||||
projectId: "ellenorzo-v2",
|
||||
messagingSenderId: "694136934013",
|
||||
storageBucket: "ellenorzo-v2.appspot.com",
|
||||
databaseURL: "https://ellenorzo-v2.firebaseio.com",
|
||||
),
|
||||
);
|
||||
|
||||
FirebaseMessaging.instance.setAutoInitEnabled(true);
|
||||
|
||||
FirebaseMessaging.onBackgroundMessage(
|
||||
_firebaseMessagingBackgroundHandler,
|
||||
);
|
||||
|
||||
runApp(InitializationScreen());
|
||||
},
|
||||
(error, stackTrace) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:firka/ui/phone/pages/home/home_omissions.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:firka/core/firka_bundle.dart';
|
||||
import 'package:firka/app/app_state.dart';
|
||||
@@ -177,6 +178,20 @@ GoRouter createAppRouter() {
|
||||
),
|
||||
],
|
||||
),
|
||||
StatefulShellBranch(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/omissions',
|
||||
pageBuilder: (context, state) => NoTransitionPage(
|
||||
key: state.pageKey,
|
||||
child: DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: HomeOmissionsScreen(initData),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -57,6 +57,11 @@ class ShellWithNavBar extends StatelessWidget {
|
||||
Majesticon.calendarSolid,
|
||||
Majesticon.calendarLine,
|
||||
),
|
||||
(
|
||||
initData.l10n.omissions,
|
||||
Majesticon.timerSolid,
|
||||
Majesticon.timerLine,
|
||||
),
|
||||
].indexed.map(
|
||||
(nav) => BottomNavIconWidget(
|
||||
() {
|
||||
|
||||
@@ -245,6 +245,119 @@ Future<void> showLessonBottomSheet(
|
||||
]);
|
||||
}
|
||||
|
||||
Future<void> showOmissionBottomSheet(
|
||||
BuildContext context,
|
||||
AppInitialization data,
|
||||
String description,
|
||||
List<Omission> omissions,
|
||||
) async {
|
||||
showFirkaBottomSheet(context, [
|
||||
Text(
|
||||
omissions.first.date.format(data.l10n, FormatMode.yyyymmdd),
|
||||
style: appStyle.fonts.H_18px.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
description,
|
||||
style: appStyle.fonts.B_16R.apply(color: appStyle.colors.textSecondary),
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
LimitedBox(
|
||||
maxHeight: 336,
|
||||
child: ListView.builder(
|
||||
itemCount: omissions.length,
|
||||
itemBuilder: (b, i) {
|
||||
final o = omissions[i];
|
||||
return FirkaCard.single(
|
||||
height: 64,
|
||||
margin: EdgeInsets.only(bottom: 10),
|
||||
padding: EdgeInsets.only(left: 14, right: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
"assets/icons/subtract.svg",
|
||||
color: appStyle.colors.a15p,
|
||||
width: 18,
|
||||
height: 18,
|
||||
),
|
||||
Text(
|
||||
o.lesson!.classNo?.toString() ?? "-",
|
||||
style: appStyle.fonts.B_14SB.apply(
|
||||
color: appStyle.colors.secondary,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
FilledCircle(
|
||||
diameter: 36,
|
||||
color: appStyle.colors.a15p,
|
||||
child: ClassIconWidget(
|
||||
uid: o.subject.uid,
|
||||
className: o.subject.name,
|
||||
category: o.subject.name,
|
||||
color: appStyle.colors.accent,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
o.subject.name,
|
||||
style: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
o.teacher,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
o.lesson!.start.format(data.l10n, FormatMode.hmm),
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
o.lesson!.end.format(data.l10n, FormatMode.hmm),
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
Future<void> showTestBottomSheet(
|
||||
BuildContext context,
|
||||
AppInitialization data,
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:firka/core/image_preloader.dart';
|
||||
import 'package:firka/core/firka_bundle.dart';
|
||||
import 'package:firka/core/swear_generator.dart';
|
||||
|
||||
class ErrorPage extends StatelessWidget {
|
||||
final String exception;
|
||||
|
||||
const ErrorPage({super.key, required this.exception});
|
||||
|
||||
@override
|
||||
@@ -51,7 +52,6 @@ class ErrorPage extends StatelessWidget {
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Text(
|
||||
//'a,',
|
||||
generateSwearSentence(),
|
||||
style: appStyle.fonts.H_H2.copyWith(
|
||||
color: appStyle.colors.textPrimary,
|
||||
@@ -86,14 +86,21 @@ class ErrorPage extends StatelessWidget {
|
||||
color: appStyle.colors.card,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
exception,
|
||||
style: appStyle.fonts.B_14R.copyWith(
|
||||
color: appStyle.colors.textPrimary,
|
||||
fontFamily: 'RobotoMono',
|
||||
child: SingleChildScrollView(
|
||||
child: Text(
|
||||
exception,
|
||||
style: appStyle.fonts.B_14R.copyWith(
|
||||
color: appStyle.colors.textPrimary,
|
||||
fontFamily: 'RobotoMono',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 4,
|
||||
right: 4,
|
||||
child: _CopyButton(exception: exception),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
right: 16,
|
||||
@@ -160,3 +167,34 @@ class ErrorPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _CopyButton extends StatefulWidget {
|
||||
final String exception;
|
||||
const _CopyButton({required this.exception});
|
||||
|
||||
@override
|
||||
State<_CopyButton> createState() => _CopyButtonState();
|
||||
}
|
||||
|
||||
class _CopyButtonState extends State<_CopyButton> {
|
||||
final _tooltipKey = GlobalKey<TooltipState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Tooltip(
|
||||
key: _tooltipKey,
|
||||
message: initData.l10n.copied,
|
||||
triggerMode: TooltipTriggerMode.manual,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.copy, size: 18),
|
||||
color: appStyle.colors.textSecondary,
|
||||
onPressed: () async {
|
||||
await Clipboard.setData(ClipboardData(text: widget.exception));
|
||||
_tooltipKey.currentState?.ensureTooltipVisible();
|
||||
await Future.delayed(const Duration(seconds: 2));
|
||||
_tooltipKey.currentState?.deactivate();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ import 'dart:async';
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:firka/api/client/kreta_stream.dart';
|
||||
import 'package:firka/ui/phone/widgets/info_card.dart';
|
||||
import 'package:firka/ui/phone/widgets/lesson.dart';
|
||||
@@ -41,10 +43,12 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
|
||||
|
||||
List<Lesson>? lessons;
|
||||
List<NoticeBoardItem>? noticeBoard;
|
||||
List<RemoteMessage> notifications = [];
|
||||
List<InfoBoardItem>? infoBoard;
|
||||
List<Test>? tests;
|
||||
List<Grade>? grades;
|
||||
List<Homework>? homework;
|
||||
List<Omission>? omissions;
|
||||
Student? student;
|
||||
Timer? timer;
|
||||
|
||||
@@ -66,6 +70,7 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
|
||||
var testsFetched = 0;
|
||||
var gradesFetched = 0;
|
||||
var homeworkFetched = 0;
|
||||
var omissionFetched = 0;
|
||||
|
||||
widget.data.client
|
||||
.getTimeTableStream(
|
||||
@@ -139,6 +144,18 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
|
||||
}
|
||||
});
|
||||
|
||||
widget.data.client.getOmissionsStream(cacheOnly: cacheOnly).forEach((
|
||||
omission,
|
||||
) {
|
||||
omissionFetched++;
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
this.omissions = omission.response;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
widget.data.client.getHomeworkStream(cacheOnly: cacheOnly).forEach((
|
||||
homework,
|
||||
) {
|
||||
@@ -161,7 +178,8 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
|
||||
studentFetched < r ||
|
||||
testsFetched < r ||
|
||||
gradesFetched < r ||
|
||||
homeworkFetched < r) {
|
||||
homeworkFetched < r ||
|
||||
omissionFetched < r) {
|
||||
if (DateTime.now().difference(startTime) > maxWaitTime) {
|
||||
debugPrint('[HomeMain] Data fetch timed out after 30s');
|
||||
break;
|
||||
@@ -174,6 +192,10 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
FirebaseMessaging.onMessage.listen((event) {
|
||||
notifications.add(event);
|
||||
}, onError: (e) => logger.info(e));
|
||||
|
||||
(() async {
|
||||
await fetchData();
|
||||
})();
|
||||
@@ -198,8 +220,32 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
|
||||
final gradeItems = grades ?? [];
|
||||
final testItems = tests ?? [];
|
||||
final homeworkItems = homework ?? [];
|
||||
final omissionItems = omissions?.groupList((o) => o.date).values ?? [];
|
||||
final noticeBoardWidgets = <(Widget, DateTime)>[];
|
||||
|
||||
for (final n in notifications) {
|
||||
noticeBoardWidgets.add((
|
||||
InfoCard.messageItem(
|
||||
InfoBoardItem(
|
||||
uid: "",
|
||||
title: "Értesítés",
|
||||
author: "Kréta",
|
||||
type: NameUidDesc(
|
||||
uid: "notificaiton",
|
||||
name: "notification",
|
||||
description: "notification",
|
||||
),
|
||||
contentHTML:
|
||||
"<code>${n.data}</code><code>${n.notification}<br/>${n.notification?.title}<br/>${n.notification?.body}<br/>${n.notification?.android}",
|
||||
contentText: "",
|
||||
date: now,
|
||||
createdAt: now,
|
||||
),
|
||||
),
|
||||
now,
|
||||
));
|
||||
}
|
||||
|
||||
for (final item in infoItems) {
|
||||
noticeBoardWidgets.add((InfoCard.messageItem(item), item.date));
|
||||
}
|
||||
@@ -216,6 +262,13 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
|
||||
noticeBoardWidgets.add((InfoCard.homework(entry), entry.creationDate));
|
||||
}
|
||||
|
||||
for (final omission in omissionItems) {
|
||||
noticeBoardWidgets.add((
|
||||
InfoCard.omission(omission),
|
||||
omission.first.date,
|
||||
));
|
||||
}
|
||||
|
||||
noticeBoardWidgets.sort(
|
||||
(item1, item2) => item2.$2.difference(item1.$2).inMilliseconds,
|
||||
);
|
||||
|
||||
324
firka/lib/ui/phone/pages/home/home_omissions.dart
Normal file
324
firka/lib/ui/phone/pages/home/home_omissions.dart
Normal file
@@ -0,0 +1,324 @@
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:firka/core/extensions.dart';
|
||||
import 'package:firka/ui/phone/widgets/info_card.dart';
|
||||
import 'package:firka/ui/phone/widgets/omission_bar.dart';
|
||||
import 'package:firka_common/firka_common.dart';
|
||||
import 'package:kreta_api/kreta_api.dart';
|
||||
import 'package:firka/ui/components/firka_card.dart';
|
||||
import 'package:firka/ui/components/grade_helpers.dart';
|
||||
import 'package:firka/ui/phone/widgets/grade_chart.dart';
|
||||
import 'package:firka/ui/phone/widgets/grade_summary_bar.dart';
|
||||
import 'package:firka/ui/shared/grade_small_card.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'package:firka/api/consts.dart';
|
||||
import 'package:firka/core/debug_helper.dart';
|
||||
import 'package:firka/core/state/firka_state.dart';
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/core/bloc/home_refresh_cubit.dart';
|
||||
import 'package:firka/core/settings.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:firka/ui/shared/delayed_spinner.dart';
|
||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||
|
||||
class HomeOmissionsScreen extends StatefulWidget {
|
||||
final AppInitialization data;
|
||||
|
||||
const HomeOmissionsScreen(this.data, {super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _HomeOmissionsScreen();
|
||||
}
|
||||
|
||||
class _HomeOmissionsScreen extends FirkaState<HomeOmissionsScreen> {
|
||||
ApiResponse<List<Omission>>? omissions;
|
||||
|
||||
void _onRefreshRequested(BuildContext context) async {
|
||||
final cubit = context.read<HomeRefreshCubit>();
|
||||
omissions = await widget.data.client.getOmissions(forceCache: false);
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
cubit.onRefreshComplete();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
(() async {
|
||||
omissions = await widget.data.client.getOmissions(forceCache: false);
|
||||
if (mounted) setState(() {});
|
||||
})();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocListener<HomeRefreshCubit, HomeRefreshState>(
|
||||
listenWhen: (previous, current) =>
|
||||
current.refreshTrigger != previous.refreshTrigger,
|
||||
listener: (context, state) {
|
||||
_onRefreshRequested(context);
|
||||
},
|
||||
child: _buildContent(context),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildContent(BuildContext context) {
|
||||
if (omissions == null) {
|
||||
return Center(child: DelayedSpinnerWidget());
|
||||
}
|
||||
|
||||
final omissionItems = omissions!.response ?? [];
|
||||
|
||||
final overallExcused = omissionItems
|
||||
.where((o) => o.state == OmissionState.excused)
|
||||
.length;
|
||||
|
||||
final overallUnexcused = omissionItems
|
||||
.where((o) => o.state == OmissionState.unexcused)
|
||||
.length;
|
||||
|
||||
final overallPending = omissionItems
|
||||
.where((o) => o.state == OmissionState.pending)
|
||||
.length;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20.0, top: 12.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
widget.data.l10n.omissions,
|
||||
style: appStyle.fonts.H_H2.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
Expanded(
|
||||
child: FirkaCard.single(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticonsLocal,
|
||||
"checkSolid",
|
||||
size: 12.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
Text(
|
||||
overallExcused.toString(),
|
||||
style: appStyle.fonts.H_18px.copyWith(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
initData.l10n.omission_state_excused,
|
||||
style: appStyle.fonts.B_16R.copyWith(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: FirkaCard.single(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.timerSolid,
|
||||
size: 12.0,
|
||||
color: appStyle.colors.warningAccent,
|
||||
),
|
||||
Text(
|
||||
overallPending.toString(),
|
||||
style: appStyle.fonts.H_18px.copyWith(
|
||||
color: appStyle.colors.warningAccent,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
initData.l10n.omission_state_pending,
|
||||
style: appStyle.fonts.B_16R.copyWith(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: FirkaCard.single(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.restrictedSolid,
|
||||
size: 12.0,
|
||||
color: appStyle.colors.errorAccent,
|
||||
),
|
||||
Text(
|
||||
overallUnexcused.toString(),
|
||||
style: appStyle.fonts.H_18px.copyWith(
|
||||
color: appStyle.colors.errorAccent,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
initData.l10n.omission_state_unexcused,
|
||||
style: appStyle.fonts.B_16R.copyWith(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
OmissionBar(omissions: omissions!.response!),
|
||||
SizedBox(height: 20),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
Text(
|
||||
initData.l10n.subjects,
|
||||
style: appStyle.fonts.B_16SB.copyWith(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
...omissionItems
|
||||
.fold(
|
||||
LinkedHashMap<Subject, List<Omission>>(
|
||||
equals: (a, b) => a.uid == b.uid,
|
||||
hashCode: (a) => a.uid.hashCode,
|
||||
),
|
||||
(map, o) =>
|
||||
map
|
||||
..putIfAbsent(o.subject, () => <Omission>[]).add(o),
|
||||
)
|
||||
.entries
|
||||
.map((entry) {
|
||||
final excused = entry.value
|
||||
.where((o) => o.state == OmissionState.excused)
|
||||
.length;
|
||||
|
||||
final unexcused = entry.value
|
||||
.where((o) => o.state == OmissionState.unexcused)
|
||||
.length;
|
||||
|
||||
final pending = entry.value
|
||||
.where((o) => o.state == OmissionState.pending)
|
||||
.length;
|
||||
|
||||
return FirkaCard.single(
|
||||
height: 64,
|
||||
margin: EdgeInsets.only(bottom: 10),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
spacing: 12,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InfoCard.buildSubject(
|
||||
appStyle.colors.accent,
|
||||
entry.key,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 2,
|
||||
children: [
|
||||
Text(
|
||||
entry.key.name,
|
||||
style: appStyle.fonts.B_16SB.copyWith(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Row(
|
||||
spacing: 4,
|
||||
children: [
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticonsLocal,
|
||||
"checkSolid",
|
||||
size: 12.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
Text(
|
||||
excused.toString(),
|
||||
style: appStyle.fonts.B_14R.copyWith(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.timerSolid,
|
||||
size: 12.0,
|
||||
color: appStyle.colors.warningAccent,
|
||||
),
|
||||
Text(
|
||||
pending.toString(),
|
||||
style: appStyle.fonts.B_14R.copyWith(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.restrictedLine,
|
||||
size: 12.0,
|
||||
color: appStyle.colors.errorAccent,
|
||||
),
|
||||
Text(
|
||||
unexcused.toString(),
|
||||
style: appStyle.fonts.B_14R.copyWith(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ class _HomeTimetableMonthlyScreen
|
||||
omission.subject.uid == omittedLesson.subject?.uid;
|
||||
});
|
||||
|
||||
if (omission?.state == "Igazolt") {
|
||||
if (omission?.state == OmissionState.excused) {
|
||||
body = Center(
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
@@ -242,7 +242,7 @@ class _HomeTimetableMonthlyScreen
|
||||
break;
|
||||
}
|
||||
|
||||
if (omission?.lateForMin != null) {
|
||||
if (omission?.state == OmissionState.pending) {
|
||||
body = Center(
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
|
||||
@@ -139,7 +139,10 @@ class _GradeChartState extends State<GradeChart> {
|
||||
final date = spots[_touchedIndex!].date;
|
||||
content = tooltipFormat.format(date);
|
||||
} else if (value == firstX) {
|
||||
content = DateFormat("MMMM", initData.l10n.localeName).format(DateTime(DateTime.now().year, DateTime.september)).firstUpper();
|
||||
content = DateFormat(
|
||||
"MMMM",
|
||||
initData.l10n.localeName,
|
||||
).format(DateTime.now().copyWith(month: DateTime.september)).firstUpper();
|
||||
} else if (value == lastX && !shouldHideNow) {
|
||||
content = initData.l10n.now;
|
||||
}
|
||||
@@ -188,39 +191,17 @@ class _GradeChartState extends State<GradeChart> {
|
||||
}
|
||||
|
||||
Color colorForY(double y) {
|
||||
final rounding = initData.settings
|
||||
.group("settings")
|
||||
.subGroup("application")
|
||||
.subGroup("rounding");
|
||||
return y == 0
|
||||
? appStyle.colors.card
|
||||
: getGradeColor(
|
||||
y,
|
||||
t1: rounding.dbl("1"),
|
||||
t2: rounding.dbl("2"),
|
||||
t3: rounding.dbl("3"),
|
||||
t4: rounding.dbl("4"),
|
||||
);
|
||||
return y == 0 ? appStyle.colors.card : initData.settings.getGradeColor(y);
|
||||
}
|
||||
|
||||
Widget leftTitleWidgets(double value, TitleMeta meta) {
|
||||
if (value == 0) {
|
||||
if (value == 0 || value > 5) {
|
||||
return SizedBox();
|
||||
}
|
||||
|
||||
final rounding = initData.settings
|
||||
.group("settings")
|
||||
.subGroup("application")
|
||||
.subGroup("rounding");
|
||||
final currentValue = spots.first.y == 0
|
||||
final currentValue = spots.last.y == 0
|
||||
? 0
|
||||
: roundGrade(
|
||||
_tooltipY ?? spots.first.y,
|
||||
t1: rounding.dbl("1"),
|
||||
t2: rounding.dbl("2"),
|
||||
t3: rounding.dbl("3"),
|
||||
t4: rounding.dbl("4"),
|
||||
);
|
||||
: initData.settings.roundGrade(_tooltipY ?? spots.last.y);
|
||||
final isActive = value == currentValue;
|
||||
|
||||
if (isActive) {
|
||||
@@ -294,23 +275,16 @@ class _GradeChartState extends State<GradeChart> {
|
||||
},
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
extraLinesData: ExtraLinesData(
|
||||
horizontalLines: [
|
||||
HorizontalLine(
|
||||
y: 5,
|
||||
color: const Color(0xFFC8C8C8),
|
||||
strokeWidth: 1.0,
|
||||
dashArray: [8, 12],
|
||||
),
|
||||
],
|
||||
extraLinesOnTop: false,
|
||||
),
|
||||
gridData: FlGridData(
|
||||
show: true,
|
||||
drawHorizontalLine: true,
|
||||
drawVerticalLine: false,
|
||||
horizontalInterval: 1,
|
||||
getDrawingHorizontalLine: (value) {
|
||||
if (_tooltipY != null &&
|
||||
initData.settings.roundGrade(_tooltipY!) == value) {
|
||||
return FlLine(color: const Color(0xFFC8C8C8), strokeWidth: 1.0);
|
||||
}
|
||||
return FlLine(
|
||||
color: const Color(0xFFC8C8C8),
|
||||
strokeWidth: 1.0,
|
||||
@@ -351,7 +325,7 @@ class _GradeChartState extends State<GradeChart> {
|
||||
borderData: FlBorderData(show: false),
|
||||
|
||||
minY: 0,
|
||||
maxY: 5,
|
||||
maxY: 5.0000000000001,
|
||||
|
||||
lineBarsData: [
|
||||
LineChartBarData(
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:firka_common/ui/components/filled_circle.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:kreta_api/kreta_api.dart';
|
||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||
@@ -104,6 +105,60 @@ class InfoCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
factory InfoCard.omission(List<Omission> omissions) {
|
||||
String title = "-";
|
||||
Color color = appStyle.colors.accent;
|
||||
FirkaIconType iconType = FirkaIconType.majesticons;
|
||||
Object iconData = "check";
|
||||
for (final state in [
|
||||
(
|
||||
OmissionState.pending,
|
||||
appStyle.colors.warningAccent,
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.timerSolid,
|
||||
),
|
||||
(
|
||||
OmissionState.unexcused,
|
||||
appStyle.colors.errorAccent,
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.restrictedLine,
|
||||
),
|
||||
(
|
||||
OmissionState.excused,
|
||||
appStyle.colors.accent,
|
||||
FirkaIconType.majesticonsLocal,
|
||||
"check",
|
||||
),
|
||||
]) {
|
||||
final count = omissions.where((o) => o.state == state.$1).length;
|
||||
|
||||
if (count == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
title = initData.l10n.omissions_count(state.$1.name, count);
|
||||
color = state.$2;
|
||||
iconType = state.$3;
|
||||
iconData = state.$4;
|
||||
break;
|
||||
}
|
||||
return InfoCard(
|
||||
icon: FilledCircle(
|
||||
diameter: 36,
|
||||
color: color.withAlpha(38),
|
||||
child: FirkaIconWidget(iconType, iconData, color: color, size: 24),
|
||||
),
|
||||
texts: [
|
||||
title,
|
||||
DateFormat.MMMMd(
|
||||
initData.l10n.localeName,
|
||||
).format(omissions.first.date).firstUpper(),
|
||||
],
|
||||
onTap: (context) =>
|
||||
showOmissionBottomSheet(context, initData, title, omissions),
|
||||
);
|
||||
}
|
||||
|
||||
factory InfoCard.homework(Homework homework) {
|
||||
return InfoCard(
|
||||
icon: FilledCircle(
|
||||
@@ -153,7 +208,14 @@ class InfoCard extends StatelessWidget {
|
||||
.firstUpper(),
|
||||
grade.subject.name.firstUpper(),
|
||||
],
|
||||
right: [buildSubject(appStyle.colors.accent, grade.subject)],
|
||||
right: [
|
||||
buildSubject(
|
||||
grade.numericValue != null
|
||||
? getGradeColor(grade.numericValue!)
|
||||
: appStyle.colors.accent,
|
||||
grade.subject,
|
||||
),
|
||||
],
|
||||
onTap:
|
||||
onTap ?? (context) => showGradeBottomSheet(context, initData, grade),
|
||||
);
|
||||
|
||||
@@ -42,12 +42,10 @@ class LessonWidget extends StatelessWidget {
|
||||
.group("settings")
|
||||
.subGroup("timetable_toast")
|
||||
.boolean("substitution");
|
||||
final showLessonNos =
|
||||
lesson.lessonNumber != null &&
|
||||
data.settings
|
||||
.group("settings")
|
||||
.subGroup("timetable_toast")
|
||||
.boolean("lesson_no");
|
||||
final showLessonNos = data.settings
|
||||
.group("settings")
|
||||
.subGroup("timetable_toast")
|
||||
.boolean("lesson_no");
|
||||
final isDismissed = lesson.type.name == "UresOra";
|
||||
|
||||
var accent = appStyle.colors.accent;
|
||||
@@ -115,7 +113,7 @@ class LessonWidget extends StatelessWidget {
|
||||
height: 18,
|
||||
),
|
||||
Text(
|
||||
lesson.lessonNumber!.toString(),
|
||||
lesson.lessonNumber?.toString() ?? "-",
|
||||
style: appStyle.fonts.B_14SB.apply(
|
||||
color: secondary,
|
||||
),
|
||||
|
||||
@@ -165,6 +165,8 @@ class _LoginWebviewWidgetState extends FirkaState<LoginWebviewWidget>
|
||||
|
||||
await initializeApp();
|
||||
|
||||
await initData.client.updateFCMToken();
|
||||
|
||||
if (!mounted) return NavigationDecision.prevent;
|
||||
|
||||
if (mounted) {
|
||||
@@ -286,8 +288,8 @@ class _LoginWebviewWidgetState extends FirkaState<LoginWebviewWidget>
|
||||
opacity: _isLoading
|
||||
? 1.0
|
||||
: _fadeAnimationController!.isAnimating
|
||||
? _fadeAnimation!.value
|
||||
: 0.0,
|
||||
? _fadeAnimation!.value
|
||||
: 0.0,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: Container(
|
||||
color: appStyle.colors.background,
|
||||
@@ -332,7 +334,8 @@ class _LoginWebviewWidgetState extends FirkaState<LoginWebviewWidget>
|
||||
text: _displayPath,
|
||||
style: appStyle.fonts.B_14R.copyWith(
|
||||
fontSize: 16,
|
||||
color: appStyle.colors.textTeritary ??
|
||||
color:
|
||||
appStyle.colors.textTeritary ??
|
||||
appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
|
||||
87
firka/lib/ui/phone/widgets/omission_bar.dart
Normal file
87
firka/lib/ui/phone/widgets/omission_bar.dart
Normal file
@@ -0,0 +1,87 @@
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/core/extensions.dart';
|
||||
import 'package:firka/ui/components/firka_card.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:kreta_api/kreta_api.dart';
|
||||
import 'package:firka/ui/components/grade.dart';
|
||||
import 'package:firka/ui/components/grade_helpers.dart';
|
||||
import 'package:firka/ui/shared/firka_icon.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||
|
||||
import 'package:firka/l10n/app_localizations.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
|
||||
class OmissionBar extends StatelessWidget {
|
||||
final List<Omission> omissions;
|
||||
|
||||
const OmissionBar({super.key, required this.omissions});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
DateTime now = DateTime.now();
|
||||
DateTime start = now.copyWith(month: 9, day: 1);
|
||||
DateTime startOfTheYear = now.isBefore(start)
|
||||
? start.subtract(Duration(days: 365))
|
||||
: start;
|
||||
|
||||
Map<int, Color> dayToColor = omissions.fold(
|
||||
Map.identity(),
|
||||
(map, o) => map
|
||||
..putIfAbsent(
|
||||
o.date.difference(startOfTheYear).inDays,
|
||||
() => o.state == OmissionState.excused
|
||||
? appStyle.colors.accent
|
||||
: o.state == OmissionState.unexcused
|
||||
? appStyle.colors.errorAccent
|
||||
: appStyle.colors.warningAccent,
|
||||
),
|
||||
);
|
||||
|
||||
final bar = ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Row(
|
||||
children: List.generate(now.difference(startOfTheYear).inDays, (i) {
|
||||
return Expanded(
|
||||
child: Container(
|
||||
height: 12,
|
||||
color: dayToColor[i] ?? appStyle.colors.a15p,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
return FirkaCard.single(
|
||||
margin: EdgeInsets.zero,
|
||||
padding: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
bar,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
DateFormat.MMMM(
|
||||
initData.l10n.localeName,
|
||||
).format(startOfTheYear).firstUpper(),
|
||||
style: appStyle.fonts.B_14R.copyWith(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
initData.l10n.now,
|
||||
style: appStyle.fonts.B_14R.copyWith(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
name: firka
|
||||
description: "Firka, Alternatív e-Kréta kliens."
|
||||
publish_to: 'none'
|
||||
publish_to: "none"
|
||||
|
||||
version: 1.1.2+2001
|
||||
|
||||
@@ -17,10 +17,11 @@ dependencies:
|
||||
|
||||
cupertino_icons: ^1.0.8
|
||||
flutter_launcher_icons: ^0.14.3
|
||||
flutter_local_notifications: ^22.0.0
|
||||
dio: ^5.8.0+1
|
||||
isar_community: 3.3.0
|
||||
isar_community_flutter_libs: 3.3.0
|
||||
build_runner: any
|
||||
isar_community: ^3.3.0
|
||||
isar_community_flutter_libs: ^3.3.0
|
||||
build_runner: ^2.15.0
|
||||
path_provider: ^2.1.0
|
||||
carousel_slider: ^5.0.0
|
||||
webview_flutter: ^4.7.0
|
||||
@@ -30,7 +31,7 @@ dependencies:
|
||||
permission_handler: ^12.0.1
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
intl: any
|
||||
intl: ^0.20.2
|
||||
image_picker: ^1.1.2
|
||||
image: ^4.5.4
|
||||
path: ^1.9.1
|
||||
@@ -59,20 +60,22 @@ dependencies:
|
||||
go_router: ^17.1.0
|
||||
flutter_bloc: ^9.0.0
|
||||
vibration: ^3.1.8
|
||||
firebase_messaging: ^16.2.0
|
||||
firebase_core: ^4.7.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^6.0.0
|
||||
yaml: ^3.1.2
|
||||
isar_community_generator: 3.3.0
|
||||
isar_community_generator: ^3.3.0
|
||||
android_notification_icons: ^0.0.1
|
||||
integration_test:
|
||||
sdk: flutter
|
||||
|
||||
android_notification_icons:
|
||||
image_path: 'assets/images/logos/dave_monochrome.png'
|
||||
icon_name: 'ic_notification'
|
||||
image_path: "assets/images/logos/dave_monochrome.png"
|
||||
icon_name: "ic_notification"
|
||||
|
||||
flutter:
|
||||
generate: true
|
||||
|
||||
Submodule firka_wear/lib/l10n updated: ae86f4fe2d...9097326e88
@@ -4,21 +4,21 @@ import 'subject.dart';
|
||||
|
||||
class Omission extends UidObj {
|
||||
final Subject subject;
|
||||
final Class? c;
|
||||
final OmittedLesson? lesson;
|
||||
final DateTime date;
|
||||
final String teacher;
|
||||
final NameUidDesc? type;
|
||||
final NameUidDesc? mode;
|
||||
final int? lateForMin;
|
||||
final DateTime createdAt;
|
||||
final String state;
|
||||
final OmissionState state;
|
||||
final NameUidDesc? proofType;
|
||||
final UidObj? classGroup;
|
||||
|
||||
const Omission({
|
||||
required super.uid,
|
||||
required this.subject,
|
||||
required this.c,
|
||||
required this.lesson,
|
||||
required this.date,
|
||||
required this.teacher,
|
||||
this.type,
|
||||
@@ -34,14 +34,14 @@ class Omission extends UidObj {
|
||||
return Omission(
|
||||
uid: json['Uid'],
|
||||
subject: Subject.fromJson(json['Tantargy']),
|
||||
c: json['Osztaly'] != null ? Class.fromJson(json['Osztaly']) : null,
|
||||
lesson: json['Ora'] != null ? OmittedLesson.fromJson(json['Ora']) : null,
|
||||
date: json.localDate('Datum')!,
|
||||
teacher: json['RogzitoTanarNeve'],
|
||||
type: json.nameUidDesc('Tipus'),
|
||||
mode: json.nameUidDesc('Mod'),
|
||||
lateForMin: json['KesesPercben'],
|
||||
createdAt: json.localDate('KeszitesDatuma')!,
|
||||
state: json['IgazolasAllapota'],
|
||||
state: OmissionState.fromString(json['IgazolasAllapota']),
|
||||
proofType: json.nameUidDesc('IgazolasTipusa'),
|
||||
classGroup: json.uid('OsztalyCsoport'),
|
||||
);
|
||||
@@ -52,7 +52,7 @@ class Omission extends UidObj {
|
||||
return 'Omission('
|
||||
'uid: "$uid", '
|
||||
'subject: $subject, '
|
||||
'c: $c, '
|
||||
'c: $lesson, '
|
||||
'date: $date, '
|
||||
'teacher: "$teacher", '
|
||||
'type: $type, '
|
||||
@@ -66,15 +66,39 @@ class Omission extends UidObj {
|
||||
}
|
||||
}
|
||||
|
||||
class Class {
|
||||
enum OmissionState {
|
||||
excused("Igazolt"),
|
||||
unexcused("Igazolatlan"),
|
||||
pending("Igazolando"),
|
||||
unknown("");
|
||||
|
||||
final String key;
|
||||
const OmissionState(this.key);
|
||||
|
||||
static fromString(String string) {
|
||||
for (final state in OmissionState.values) {
|
||||
if (state.key == string) {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
print("Unknown omission state: ${string}");
|
||||
return OmissionState.unknown;
|
||||
}
|
||||
}
|
||||
|
||||
class OmittedLesson {
|
||||
final DateTime start;
|
||||
final DateTime end;
|
||||
final int classNo;
|
||||
final int? classNo;
|
||||
|
||||
const Class({required this.start, required this.end, required this.classNo});
|
||||
const OmittedLesson({
|
||||
required this.start,
|
||||
required this.end,
|
||||
required this.classNo,
|
||||
});
|
||||
|
||||
factory Class.fromJson(Map<String, dynamic> json) {
|
||||
return Class(
|
||||
factory OmittedLesson.fromJson(Map<String, dynamic> json) {
|
||||
return OmittedLesson(
|
||||
start: json.localDate('KezdoDatum')!,
|
||||
end: json.localDate('VegDatum')!,
|
||||
classNo: json['Oraszam'],
|
||||
@@ -83,7 +107,7 @@ class Class {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Class('
|
||||
return 'OmittedLesson('
|
||||
'start: "$start", '
|
||||
'end: "$end", '
|
||||
'classNo: $classNo'
|
||||
|
||||
Reference in New Issue
Block a user