Compare commits
52 Commits
cleanup/re
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c08119ebc | |||
| 945d698f4c | |||
| f19d8cd387 | |||
| bc605dde0d | |||
| f2317c1fe5 | |||
| b41fc7ec08 | |||
| 368545dc24 | |||
| b933e1e7b8 | |||
| fd909ade1d | |||
| dceeed25a3 | |||
| 9c06a87001 | |||
| 02b2043b5c | |||
| 77af5acba3 | |||
| 85dbc6d373 | |||
|
|
e008325e53 | ||
|
|
facb3326de | ||
| eb196e9f60 | |||
|
|
744fcbf233 | ||
| 4334ed095e | |||
|
|
ed55ed6226 | ||
| 8645e7d4c7 | |||
| 6a058f5166 | |||
| 76fa644ccd | |||
| 74064054e1 | |||
| 1373fef4af | |||
| 2082bdbdbc | |||
| c1d677b4df | |||
| 34d386c033 | |||
| 69ec627762 | |||
| 6cb461654e | |||
| fdf350c2c6 | |||
| 857fa5e230 | |||
| 5a15894833 | |||
| 609f79c3b9 | |||
| e42298d32a | |||
| de4e8339a1 | |||
| 62d6a829bf | |||
| 9dcf04e32d | |||
|
|
5e757d9afd | ||
|
|
fff41d95d7 | ||
|
|
93b1d78fd2 | ||
|
|
717b4b27aa | ||
| a097c80516 | |||
| ec2b22c825 | |||
| d8ee1d8073 | |||
| 280b5142a5 | |||
| 31b9d86ed9 | |||
| ff297bf4b8 | |||
| 0f0b7c0c8b | |||
| 394b7bfd70 | |||
| 95b6af52c2 | |||
| fcf6a08e79 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -100,9 +100,12 @@ firka/debug-info/
|
||||
**/.env*
|
||||
**/*.dart.js
|
||||
**/*.info.json
|
||||
**/*.g.dart
|
||||
**/.codegen-cache.yaml
|
||||
|
||||
# tools.py logs
|
||||
tool_logs/build/*.log
|
||||
tool_logs/d8dx_fix/*.log
|
||||
tool_logs/pub_fix/*.log
|
||||
secrets/upload_certificate.pem
|
||||
secrets (2)/upload_certificate.pem
|
||||
|
||||
8
.gitmodules
vendored
8
.gitmodules
vendored
@@ -1,8 +0,0 @@
|
||||
[submodule "firka/lib/l10n"]
|
||||
path = firka/lib/l10n
|
||||
url = https://git.firka.app/firka/firka-localization
|
||||
branch = weblate
|
||||
[submodule "firka_wear/lib/l10n"]
|
||||
path = firka_wear/lib/l10n
|
||||
url = https://git.firka.app/firka/firka-localization
|
||||
branch = weblate
|
||||
|
||||
120
.woodpecker.yml
120
.woodpecker.yml
@@ -28,6 +28,7 @@ steps:
|
||||
commands:
|
||||
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
|
||||
- cd firka
|
||||
- '[ -f .env ] || cp .env.example .env 2>/dev/null || touch .env'
|
||||
- flutter pub get
|
||||
|
||||
- name: codegen
|
||||
@@ -37,30 +38,115 @@ steps:
|
||||
- cd firka
|
||||
- dart run scripts/codegen.dart
|
||||
|
||||
- name: clone-mock-kreta-server
|
||||
image: git.firka.app/firka/firka-builder:latest
|
||||
environment:
|
||||
GITEA_USERNAME:
|
||||
from_secret: gitea_username
|
||||
GITEA_TOKEN:
|
||||
from_secret: gitea_token
|
||||
commands:
|
||||
- pwd
|
||||
# The heredoc uses a quoted delimiter so $GITEA_USERNAME/$GITEA_TOKEN
|
||||
# are written to the script literally, not expanded here -- keeps the
|
||||
# secret values out of this (traced) command's expanded output.
|
||||
- |
|
||||
cat > /tmp/write_netrc.sh <<'NETRC_SCRIPT'
|
||||
printf 'machine git.firka.app\nlogin %s\npassword %s\n' "$GITEA_USERNAME" "$GITEA_TOKEN" > "$HOME/.netrc"
|
||||
chmod 600 "$HOME/.netrc"
|
||||
NETRC_SCRIPT
|
||||
# Runs as an untraced child shell, so the expansion above never hits the log.
|
||||
- sh /tmp/write_netrc.sh
|
||||
- git clone --depth 1 https://git.firka.app/firka/mock_kreta_server.git mock_kreta_server
|
||||
- rm -f /tmp/write_netrc.sh "$HOME/.netrc"
|
||||
|
||||
- name: build-mock-kreta-server
|
||||
image: golang:1.26
|
||||
commands:
|
||||
- cd mock_kreta_server
|
||||
- go build -o ../mock_kreta_server_bin .
|
||||
|
||||
# Runs the mock server in the background and exercises kreta_api's DTOs
|
||||
# against its real wire format, catching drift between the two repos.
|
||||
- name: kreta-api-mock-server-tests
|
||||
image: git.firka.app/firka/firka-builder:latest
|
||||
commands:
|
||||
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
|
||||
- ./mock_kreta_server_bin -addr :8090 -data mock_kreta_server/data.json &
|
||||
- sleep 1
|
||||
- cd kreta_api
|
||||
- dart pub get
|
||||
- MOCK_KRETA_SERVER_URL=http://127.0.0.1:8090 dart test
|
||||
|
||||
- name: firka-e2e-tests
|
||||
image: git.firka.app/firka/firka-builder:latest
|
||||
commands:
|
||||
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
|
||||
- ./mock_kreta_server_bin -addr :8090 -data mock_kreta_server/data.json &
|
||||
- sleep 1
|
||||
- cd firka
|
||||
- '[ -f .env ] || cp .env.example .env 2>/dev/null || touch .env'
|
||||
- cp $(find "$PUB_CACHE" -name libisar.so | grep linux | head -n 1) libisar.so 2>/dev/null || true
|
||||
- flutter test test/data/widget_test.dart test/e2e/screenshot_widget_test.dart test/e2e/notification_diff_test.dart
|
||||
|
||||
- name: firka-integration-tests
|
||||
image: git.firka.app/firka/firka-builder:latest
|
||||
privileged: true
|
||||
volumes:
|
||||
- /dev/kvm:/dev/kvm
|
||||
commands:
|
||||
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
|
||||
- 'grep -q "::1" /etc/hosts || echo "::1 localhost ip6-localhost ip6-loopback" >> /etc/hosts 2>/dev/null || true'
|
||||
- sysctl -w net.ipv6.conf.all.disable_ipv6=0 2>/dev/null || true
|
||||
- sed -i 's/TIMEOUT=60/TIMEOUT=300/' /opt/bin/start-emulator.sh
|
||||
- sed -i 's/-snapshot default_boot/-no-snapshot-load/' /opt/bin/start-emulator.sh
|
||||
- ./mock_kreta_server_bin -addr :8090 -data mock_kreta_server/data.json &
|
||||
- sleep 1
|
||||
- /opt/bin/start-emulator.sh
|
||||
- adb reverse tcp:8090 tcp:8090
|
||||
- cd firka
|
||||
- '[ -f .env ] || cp .env.example .env 2>/dev/null || touch .env'
|
||||
- flutter test integration_test/widget_e2e_test.dart
|
||||
|
||||
- name: build-release
|
||||
image: git.firka.app/firka/firka-builder:latest
|
||||
when:
|
||||
- branch: main
|
||||
- branch: [main, staging]
|
||||
commands:
|
||||
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
|
||||
- cd firka
|
||||
- flutter build appbundle --release
|
||||
- '[ -f "$(git rev-parse --git-dir)/shallow" ] && git fetch --unshallow 2>/dev/null || true'
|
||||
- SHA=$(git rev-parse --short HEAD)
|
||||
- COMMIT_COUNT=$(git rev-list --count HEAD)
|
||||
- 'BASE_VERSION=$(grep "^version:" pubspec.yaml | cut -d: -f2 | cut -d+ -f1 | tr -d " ")'
|
||||
- BUILD_NAME="$BASE_VERSION-$SHA"
|
||||
- VERSION_CODE=$((2000 + COMMIT_COUNT))
|
||||
- flutter build appbundle --release --build-name="$BUILD_NAME" --build-number="$VERSION_CODE"
|
||||
# universal apk for the website's download button, the .aab is for stores
|
||||
- flutter build apk --release --build-name="$BUILD_NAME" --build-number="$VERSION_CODE"
|
||||
|
||||
- name: build-debug
|
||||
image: git.firka.app/firka/firka-builder:latest
|
||||
when:
|
||||
- branch:
|
||||
exclude: main
|
||||
exclude: [main, staging]
|
||||
commands:
|
||||
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
|
||||
- cd firka
|
||||
- flutter build apk --debug --split-per-abi
|
||||
- '[ -f "$(git rev-parse --git-dir)/shallow" ] && git fetch --unshallow 2>/dev/null || true'
|
||||
- SHA=$(git rev-parse --short HEAD)
|
||||
- COMMIT_COUNT=$(git rev-list --count HEAD)
|
||||
- 'BASE_VERSION=$(grep "^version:" pubspec.yaml | cut -d: -f2 | cut -d+ -f1 | tr -d " ")'
|
||||
- BUILD_NAME="$BASE_VERSION-$SHA"
|
||||
- VERSION_CODE=$((2000 + COMMIT_COUNT))
|
||||
- flutter build apk --debug --split-per-abi --build-name="$BUILD_NAME" --build-number="$VERSION_CODE"
|
||||
|
||||
|
||||
- name: publish-release
|
||||
image: woodpeckercommunity/plugin-gitea-package:latest
|
||||
pull: true
|
||||
when:
|
||||
- branch: main
|
||||
- branch: [main, staging]
|
||||
settings:
|
||||
user:
|
||||
from_secret: gitea_username
|
||||
@@ -73,12 +159,29 @@ steps:
|
||||
file_name: app-release.aab
|
||||
update: 'true'
|
||||
|
||||
- name: publish-release-apk
|
||||
image: woodpeckercommunity/plugin-gitea-package:latest
|
||||
pull: true
|
||||
when:
|
||||
- branch: [main, staging]
|
||||
settings:
|
||||
user:
|
||||
from_secret: gitea_username
|
||||
password:
|
||||
from_secret: gitea_token
|
||||
owner: firka
|
||||
package_name: firka
|
||||
package_version: ${CI_COMMIT_SHA}
|
||||
file_source: ./firka/build/app/outputs/flutter-apk/app-release.apk
|
||||
file_name: app-release.apk
|
||||
update: 'true'
|
||||
|
||||
- name: publish-debug-arm64-v8a
|
||||
image: woodpeckercommunity/plugin-gitea-package:latest
|
||||
pull: true
|
||||
when:
|
||||
- branch:
|
||||
exclude: main
|
||||
exclude: [main, staging]
|
||||
settings:
|
||||
user:
|
||||
from_secret: gitea_username
|
||||
@@ -96,7 +199,7 @@ steps:
|
||||
pull: true
|
||||
when:
|
||||
- branch:
|
||||
exclude: main
|
||||
exclude: [main, staging]
|
||||
settings:
|
||||
user:
|
||||
from_secret: gitea_username
|
||||
@@ -114,7 +217,7 @@ steps:
|
||||
pull: true
|
||||
when:
|
||||
- branch:
|
||||
exclude: main
|
||||
exclude: [main, staging]
|
||||
settings:
|
||||
user:
|
||||
from_secret: gitea_username
|
||||
@@ -126,3 +229,4 @@ steps:
|
||||
file_source: ./firka/build/app/outputs/flutter-apk/app-x86_64-debug.apk
|
||||
file_name: app-x86_64-debug.apk
|
||||
update: 'true'
|
||||
|
||||
|
||||
10
CLAUDE.md
Normal file
10
CLAUDE.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Firka
|
||||
|
||||
Before you change code, write a comment or make a commit in this repo, get the Firka style guide and follow it. It is in a separate repo so it stays the same across all Firka projects.
|
||||
|
||||
```bash
|
||||
[ -d ../style-guide ] && git -C ../style-guide pull --ff-only \
|
||||
|| git clone https://git.firka.app/firka/style-guide.git ../style-guide
|
||||
```
|
||||
|
||||
Then read `../style-guide/CLAUDE.md` and do what it says. It lists the skills to install and which style skill belongs to this repo.
|
||||
3
firka/.gitignore
vendored
3
firka/.gitignore
vendored
@@ -52,4 +52,5 @@ app.*.map.json
|
||||
coverage
|
||||
|
||||
# Generated files
|
||||
*.g.dart
|
||||
*.g.dart
|
||||
libisar.so
|
||||
@@ -7,6 +7,10 @@
|
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps,
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
analyzer:
|
||||
exclude:
|
||||
- build/**
|
||||
- android/**
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
linter:
|
||||
|
||||
@@ -12,7 +12,7 @@ plugins {
|
||||
}
|
||||
android {
|
||||
namespace = "app.firka.naplo"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
compileSdk = 37
|
||||
ndkVersion = flutter.ndkVersion
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
@@ -59,7 +59,7 @@ android {
|
||||
if (config != null) {
|
||||
signingConfig = config
|
||||
}
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
proguardFiles("proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,7 @@ configurations.all {
|
||||
dependencies {
|
||||
implementation("androidx.glance:glance-appwidget:1.1.1")
|
||||
implementation("com.google.android.gms:play-services-wearable:18.1.0")
|
||||
implementation("com.google.android.gms:play-services-base:18.5.0")
|
||||
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
|
||||
}
|
||||
// Ensure .env exists before Flutter bundles assets (copy from .env.example if missing)
|
||||
@@ -93,6 +94,26 @@ tasks.register("ensureEnv") {
|
||||
tasks.matching { it.name.startsWith("compileFlutterBuild") }.configureEach {
|
||||
dependsOn("ensureEnv")
|
||||
}
|
||||
|
||||
// Ensure default ProGuard files exist at the projectDir location expected by AGP/R8 when build directory is relocated
|
||||
val defaultProguardDir = file("${project.projectDir}/build/intermediates/default_proguard_files/global")
|
||||
defaultProguardDir.mkdirs()
|
||||
val defaultProguardOptimize = File(defaultProguardDir, "proguard-android-optimize.txt-9.2.0")
|
||||
if (!defaultProguardOptimize.exists()) {
|
||||
defaultProguardOptimize.writeText("-allowaccessmodification\n")
|
||||
}
|
||||
tasks.register("ensureProguardFiles") {
|
||||
doLast {
|
||||
defaultProguardDir.mkdirs()
|
||||
if (!defaultProguardOptimize.exists()) {
|
||||
defaultProguardOptimize.writeText("-allowaccessmodification\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.matching { it.name.startsWith("compile") || it.name.contains("minify", ignoreCase = true) || it.name.contains("r8", ignoreCase = true) }.configureEach {
|
||||
dependsOn("ensureProguardFiles")
|
||||
}
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
76
firka/android/app/proguard-rules.pro
vendored
76
firka/android/app/proguard-rules.pro
vendored
@@ -1 +1,75 @@
|
||||
-keep class app.firka.naplo.glance.** { *; }
|
||||
# Firka custom keep rules
|
||||
-keep class app.firka.naplo.glance.** { *; }
|
||||
|
||||
# Android optimize rules (-allowaccessmodification)
|
||||
-allowaccessmodification
|
||||
|
||||
# Android common keep rules
|
||||
-keepattributes AnnotationDefault,
|
||||
EnclosingMethod,
|
||||
InnerClasses,
|
||||
RuntimeVisibleAnnotations,
|
||||
RuntimeVisibleParameterAnnotations,
|
||||
RuntimeVisibleTypeAnnotations,
|
||||
Signature
|
||||
|
||||
-keep public class com.google.vending.licensing.ILicensingService
|
||||
-keep public class com.android.vending.licensing.ILicensingService
|
||||
-keep public class com.google.android.vending.licensing.ILicensingService
|
||||
-dontnote com.android.vending.licensing.ILicensingService
|
||||
-dontnote com.google.vending.licensing.ILicensingService
|
||||
-dontnote com.google.android.vending.licensing.ILicensingService
|
||||
|
||||
# Native methods
|
||||
-keepclasseswithmembernames,includedescriptorclasses class * {
|
||||
native <methods>;
|
||||
}
|
||||
|
||||
# Keep setters in Views so that animations can still work.
|
||||
-keepclassmembers public class * extends android.view.View {
|
||||
void set*(***);
|
||||
*** get*();
|
||||
}
|
||||
|
||||
# We want to keep methods in Activity that could be used in the XML attribute onClick.
|
||||
-keepclassmembers class * extends android.app.Activity {
|
||||
public void *(android.view.View);
|
||||
}
|
||||
|
||||
# For enumeration classes
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
-keepclassmembers class * implements android.os.Parcelable {
|
||||
public static final ** CREATOR;
|
||||
}
|
||||
|
||||
# Preserve annotated Javascript interface methods.
|
||||
-keepclassmembers class * {
|
||||
@android.webkit.JavascriptInterface <methods>;
|
||||
}
|
||||
|
||||
# The support libraries contains references to newer platform versions.
|
||||
-dontnote android.support.**
|
||||
-dontnote androidx.**
|
||||
-dontwarn android.support.**
|
||||
-dontwarn androidx.**
|
||||
|
||||
# Understand the @Keep support annotation.
|
||||
-keep class android.support.annotation.Keep
|
||||
-keep @android.support.annotation.Keep class * {*;}
|
||||
-keepclasseswithmembers class * {
|
||||
@android.support.annotation.Keep <methods>;
|
||||
}
|
||||
-keepclasseswithmembers class * {
|
||||
@android.support.annotation.Keep <fields>;
|
||||
}
|
||||
-keepclasseswithmembers class * {
|
||||
@android.support.annotation.Keep <init>(...);
|
||||
}
|
||||
|
||||
-dontnote org.apache.http.**
|
||||
-dontnote android.net.http.**
|
||||
-dontnote java.lang.invoke.**
|
||||
@@ -3,9 +3,16 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
||||
<uses-permission android:name="android.permission.POST_PROMOTED_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
|
||||
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<application
|
||||
android:name=".AppMain"
|
||||
@@ -16,6 +23,24 @@
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="dataSync" />
|
||||
|
||||
<service
|
||||
android:name=".ProgressNotificationForegroundService"
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="specialUse">
|
||||
<property
|
||||
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||
android:value="Displays ongoing school day lesson and break progress updates." />
|
||||
</service>
|
||||
|
||||
<receiver
|
||||
android:name=".ProgressAlarmReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="app.firka.naplo.ACTION_PROGRESS_6AM_ALARM" />
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
@@ -669,6 +694,7 @@
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
<action android:name="app.firka.naplo.ACTION_REFRESH_WIDGET" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
|
||||
@@ -7,8 +7,9 @@ import org.json.JSONObject
|
||||
|
||||
fun JSONObject.getStringOrNull(key: String): String? {
|
||||
return try {
|
||||
if (has(key)) {
|
||||
getString(key)
|
||||
if (has(key) && !isNull(key)) {
|
||||
val v = getString(key)
|
||||
if (v == "null" || v.isBlank()) null else v
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package app.firka.naplo
|
||||
|
||||
import android.app.NotificationManager
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
@@ -10,6 +11,8 @@ import android.util.Log
|
||||
import androidx.glance.appwidget.updateAll
|
||||
import app.firka.naplo.glance.TimetableWidget
|
||||
import app.firka.naplo.glance.TimetableWidgetReceiver
|
||||
import com.google.android.gms.common.ConnectionResult
|
||||
import com.google.android.gms.common.GoogleApiAvailability
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
@@ -23,6 +26,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
private val channel = "firka.app/main"
|
||||
private val wearSyncChannel = "app.firka/wear_sync"
|
||||
private val progressNotificationChannel = "app.firka/progress_notification"
|
||||
|
||||
private fun forceIconUpdate() {
|
||||
try {
|
||||
@@ -90,6 +94,67 @@ class MainActivity : FlutterActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, progressNotificationChannel).setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"startProgressService" -> {
|
||||
val intent = Intent(this, ProgressNotificationForegroundService::class.java).apply {
|
||||
action = ProgressNotificationForegroundService.ACTION_START
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(intent)
|
||||
} else {
|
||||
startService(intent)
|
||||
}
|
||||
result.success(true)
|
||||
}
|
||||
"stopProgressService" -> {
|
||||
val intent = Intent(this, ProgressNotificationForegroundService::class.java).apply {
|
||||
action = ProgressNotificationForegroundService.ACTION_STOP
|
||||
}
|
||||
startService(intent)
|
||||
result.success(true)
|
||||
}
|
||||
"isProgressServiceRunning" -> {
|
||||
val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||
val isNotifActive = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
try {
|
||||
nm.activeNotifications?.any { it.id == 4002 } ?: false
|
||||
} catch (e: Exception) {
|
||||
ProgressNotificationForegroundService.isRunning
|
||||
}
|
||||
} else {
|
||||
ProgressNotificationForegroundService.isRunning
|
||||
}
|
||||
result.success(ProgressNotificationForegroundService.isRunning && isNotifActive)
|
||||
}
|
||||
"updateProgressStrings" -> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val strings = call.arguments as? Map<String, String>
|
||||
if (strings != null) {
|
||||
ProgressNotificationForegroundService.saveStrings(this, strings)
|
||||
if (ProgressNotificationForegroundService.isRunning) {
|
||||
val intent = Intent(this, ProgressNotificationForegroundService::class.java).apply {
|
||||
action = ProgressNotificationForegroundService.ACTION_UPDATE
|
||||
}
|
||||
startService(intent)
|
||||
}
|
||||
result.success(true)
|
||||
} else {
|
||||
result.error("INVALID_ARGS", "strings map required", null)
|
||||
}
|
||||
}
|
||||
"schedule6AmAlarm" -> {
|
||||
ProgressAlarmReceiver.scheduleNext6AmAlarm(this)
|
||||
result.success(true)
|
||||
}
|
||||
"cancel6AmAlarm" -> {
|
||||
ProgressAlarmReceiver.cancel6AmAlarm(this)
|
||||
result.success(true)
|
||||
}
|
||||
else -> result.notImplemented()
|
||||
}
|
||||
}
|
||||
|
||||
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, channel).setMethodCallHandler {
|
||||
call, result ->
|
||||
when (call.method) {
|
||||
@@ -163,17 +228,10 @@ class MainActivity : FlutterActivity() {
|
||||
CoroutineScope(SupervisorJob() + Dispatchers.Default).launch {
|
||||
try {
|
||||
val appContext = context.applicationContext
|
||||
val appWidgetManager = AppWidgetManager.getInstance(appContext)
|
||||
val componentName = ComponentName(appContext, TimetableWidgetReceiver::class.java)
|
||||
val ids = appWidgetManager.getAppWidgetIds(componentName)
|
||||
if (ids.isNotEmpty()) {
|
||||
val intent = Intent(appContext, TimetableWidgetReceiver::class.java).apply {
|
||||
action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
||||
putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
|
||||
addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
|
||||
}
|
||||
appContext.sendBroadcast(intent)
|
||||
val intent = Intent(appContext, TimetableWidgetReceiver::class.java).apply {
|
||||
action = TimetableWidgetReceiver.ACTION_REFRESH_WIDGET
|
||||
}
|
||||
appContext.sendBroadcast(intent)
|
||||
TimetableWidget().updateAll(appContext)
|
||||
result.success(true)
|
||||
} catch (e: Exception) {
|
||||
@@ -181,6 +239,15 @@ class MainActivity : FlutterActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
"isGmsAvailable" -> {
|
||||
try {
|
||||
val availability = GoogleApiAvailability.getInstance()
|
||||
val resultCode = availability.isGooglePlayServicesAvailable(context)
|
||||
result.success(resultCode == ConnectionResult.SUCCESS)
|
||||
} catch (e: Exception) {
|
||||
result.success(false)
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
result.notImplemented()
|
||||
}
|
||||
@@ -190,6 +257,29 @@ class MainActivity : FlutterActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
window.clearFlags(android.view.WindowManager.LayoutParams.FLAG_SECURE)
|
||||
handleIntent(intent)
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
setIntent(intent)
|
||||
handleIntent(intent)
|
||||
}
|
||||
|
||||
private fun handleIntent(intent: Intent?) {
|
||||
val action = intent?.getStringExtra("action")
|
||||
if (action == "pin_widget") {
|
||||
val appWidgetManager = AppWidgetManager.getInstance(this)
|
||||
val myProvider = ComponentName(this, TimetableWidgetReceiver::class.java)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && appWidgetManager.isRequestPinAppWidgetSupported) {
|
||||
appWidgetManager.requestPinAppWidget(myProvider, null, null)
|
||||
}
|
||||
} else if (action == "refresh_widget") {
|
||||
val appContext = applicationContext
|
||||
val refreshIntent = Intent(appContext, TimetableWidgetReceiver::class.java).apply {
|
||||
this.action = TimetableWidgetReceiver.ACTION_REFRESH_WIDGET
|
||||
}
|
||||
appContext.sendBroadcast(refreshIntent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package app.firka.naplo
|
||||
|
||||
import android.app.AlarmManager
|
||||
import android.app.PendingIntent
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
import java.time.ZoneId
|
||||
|
||||
class ProgressAlarmReceiver : BroadcastReceiver() {
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent?) {
|
||||
Log.d(TAG, "onReceive action: ${intent?.action}")
|
||||
|
||||
scheduleNext6AmAlarm(context)
|
||||
|
||||
val data = ProgressNotificationForegroundService.loadTodayTimetable(context)
|
||||
if (data == null || data.lessons.isEmpty()) {
|
||||
Log.d(TAG, "No timetable for today at 6 AM wakeup; skipping service start")
|
||||
return
|
||||
}
|
||||
|
||||
val sorted = data.lessons.sortedBy { it.start }
|
||||
val lastLesson = sorted.last()
|
||||
val now = LocalDateTime.now()
|
||||
|
||||
if (now.isBefore(lastLesson.end)) {
|
||||
Log.d(TAG, "Starting ProgressNotificationForegroundService from 6 AM alarm")
|
||||
val serviceIntent = Intent(context, ProgressNotificationForegroundService::class.java).apply {
|
||||
action = ProgressNotificationForegroundService.ACTION_START
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
context.startForegroundService(serviceIntent)
|
||||
} else {
|
||||
context.startService(serviceIntent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "ProgressAlarmReceiver"
|
||||
const val ACTION_PROGRESS_6AM_ALARM = "app.firka.naplo.ACTION_PROGRESS_6AM_ALARM"
|
||||
const val ALARM_REQUEST_CODE = 400201
|
||||
|
||||
fun scheduleNext6AmAlarm(context: Context) {
|
||||
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as? AlarmManager ?: return
|
||||
val intent = Intent(context, ProgressAlarmReceiver::class.java).apply {
|
||||
action = ACTION_PROGRESS_6AM_ALARM
|
||||
}
|
||||
val pendingIntent = PendingIntent.getBroadcast(
|
||||
context,
|
||||
ALARM_REQUEST_CODE,
|
||||
intent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
|
||||
val now = LocalDateTime.now()
|
||||
var target = now.toLocalDate().atTime(6, 0)
|
||||
if (!target.isAfter(now)) {
|
||||
target = target.plusDays(1)
|
||||
}
|
||||
|
||||
val epochMillis = target.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()
|
||||
Log.d(TAG, "Scheduling next 6 AM alarm for $target ($epochMillis)")
|
||||
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, epochMillis, pendingIntent)
|
||||
} else {
|
||||
alarmManager.setExact(AlarmManager.RTC_WAKEUP, epochMillis, pendingIntent)
|
||||
}
|
||||
} catch (e: SecurityException) {
|
||||
Log.w(TAG, "SecurityException while scheduling exact 6 AM alarm, falling back to setWindow", e)
|
||||
alarmManager.set(AlarmManager.RTC_WAKEUP, epochMillis, pendingIntent)
|
||||
}
|
||||
}
|
||||
|
||||
fun cancel6AmAlarm(context: Context) {
|
||||
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as? AlarmManager ?: return
|
||||
val intent = Intent(context, ProgressAlarmReceiver::class.java).apply {
|
||||
action = ACTION_PROGRESS_6AM_ALARM
|
||||
}
|
||||
val pendingIntent = PendingIntent.getBroadcast(
|
||||
context,
|
||||
ALARM_REQUEST_CODE,
|
||||
intent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
alarmManager.cancel(pendingIntent)
|
||||
Log.d(TAG, "Cancelled 6 AM progress alarm")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,649 @@
|
||||
package app.firka.naplo
|
||||
|
||||
import android.app.AlarmManager
|
||||
import android.app.Notification
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.app.PendingIntent
|
||||
import android.app.Service
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.pm.ServiceInfo
|
||||
import android.graphics.drawable.Icon
|
||||
import android.os.Build
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import app.firka.naplo.glance.WidgetLesson
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
import java.time.Duration
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
import java.time.ZoneId
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
class ProgressNotificationForegroundService : Service() {
|
||||
|
||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
||||
private var tickerJob: Job? = null
|
||||
private var isForegroundStarted = false
|
||||
private var transitionPendingIntent: PendingIntent? = null
|
||||
|
||||
private val timeReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
when (intent?.action) {
|
||||
Intent.ACTION_TIME_TICK,
|
||||
Intent.ACTION_SCREEN_ON,
|
||||
Intent.ACTION_USER_PRESENT -> {
|
||||
refreshAndPostNotification()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val channelId = "firka_progress_notification_v3"
|
||||
private val notificationId = 4002
|
||||
|
||||
private val hhmm = DateTimeFormatter.ofPattern("HH:mm")
|
||||
|
||||
private fun formatTemplate(template: String, vararg replacements: Pair<String, String>): String {
|
||||
var res = template
|
||||
for ((key, value) in replacements) {
|
||||
res = res.replace("{$key}", value)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
isRunning = true
|
||||
createNotificationChannel()
|
||||
val filter = IntentFilter().apply {
|
||||
addAction(Intent.ACTION_TIME_TICK)
|
||||
addAction(Intent.ACTION_SCREEN_ON)
|
||||
addAction(Intent.ACTION_USER_PRESENT)
|
||||
}
|
||||
ContextCompat.registerReceiver(
|
||||
this,
|
||||
timeReceiver,
|
||||
filter,
|
||||
ContextCompat.RECEIVER_NOT_EXPORTED
|
||||
)
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
createNotificationChannel()
|
||||
when (intent?.action) {
|
||||
ACTION_START, ACTION_UPDATE -> {
|
||||
isRunning = true
|
||||
refreshAndPostNotification()
|
||||
startTicker()
|
||||
}
|
||||
ACTION_STOP -> {
|
||||
isRunning = false
|
||||
stopForegroundService()
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
else -> {
|
||||
isRunning = true
|
||||
refreshAndPostNotification()
|
||||
startTicker()
|
||||
}
|
||||
}
|
||||
return START_STICKY
|
||||
}
|
||||
|
||||
override fun onBind(intent: Intent?): IBinder? = null
|
||||
|
||||
override fun onDestroy() {
|
||||
isRunning = false
|
||||
cancelTransitionAlarm()
|
||||
try {
|
||||
unregisterReceiver(timeReceiver)
|
||||
} catch (_: Exception) {}
|
||||
tickerJob?.cancel()
|
||||
scope.cancel()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
private fun startTicker() {
|
||||
tickerJob?.cancel()
|
||||
tickerJob = scope.launch {
|
||||
while (isActive) {
|
||||
val currentMillis = System.currentTimeMillis()
|
||||
val millisIntoMinute = currentMillis % 60_000
|
||||
// Target next :00 or :30 second boundary
|
||||
val delayMillis = if (millisIntoMinute < 30_000) {
|
||||
30_000 - millisIntoMinute
|
||||
} else {
|
||||
60_000 - millisIntoMinute
|
||||
}.coerceIn(1_000, 30_000)
|
||||
|
||||
delay(delayMillis)
|
||||
refreshAndPostNotification()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun refreshAndPostNotification() {
|
||||
val widgetData = loadTodayTimetable(applicationContext)
|
||||
|
||||
if (widgetData == null || widgetData.lessons.isEmpty()) {
|
||||
Log.d(TAG, "No lessons for today; stopping progress service")
|
||||
stopForegroundService()
|
||||
return
|
||||
}
|
||||
|
||||
val lessons = widgetData.lessons.sortedBy { it.start }
|
||||
val now = LocalDateTime.now()
|
||||
val lastLesson = lessons.last()
|
||||
|
||||
// If today's last lesson has ended, stop notification & foreground service
|
||||
if (now.isAfter(lastLesson.end) || now.isEqual(lastLesson.end)) {
|
||||
Log.d(TAG, "Last lesson of the day ended (${lastLesson.end}); stopping progress service")
|
||||
stopForegroundService()
|
||||
return
|
||||
}
|
||||
|
||||
val notification = buildProgressNotification(widgetData, now)
|
||||
if (notification == null) {
|
||||
stopForegroundService()
|
||||
return
|
||||
}
|
||||
|
||||
if (!isForegroundStarted) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
startForeground(
|
||||
notificationId,
|
||||
notification,
|
||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE
|
||||
)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
startForeground(notificationId, notification)
|
||||
}
|
||||
isForegroundStarted = true
|
||||
}
|
||||
|
||||
val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||
nm.notify(notificationId, notification)
|
||||
|
||||
// Schedule exact alarm for next transition (lesson start/end or break end)
|
||||
val firstLesson = lessons.first()
|
||||
val targetTransitionTime: LocalDateTime? = when {
|
||||
now.isBefore(firstLesson.start) -> firstLesson.start
|
||||
else -> {
|
||||
val currentLesson = lessons.find { !now.isBefore(it.start) && now.isBefore(it.end) }
|
||||
if (currentLesson != null) {
|
||||
currentLesson.end
|
||||
} else {
|
||||
val nextLesson = lessons.firstOrNull { it.start.isAfter(now) }
|
||||
nextLesson?.start
|
||||
}
|
||||
}
|
||||
}
|
||||
if (targetTransitionTime != null) {
|
||||
scheduleNextTransitionAlarm(targetTransitionTime)
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildProgressNotification(data: TimetableProgressData, now: LocalDateTime): Notification? {
|
||||
val strings = getStrings(this)
|
||||
val lessons = data.lessons.sortedBy { it.start }
|
||||
val firstLesson = lessons.first()
|
||||
val lastLesson = lessons.last()
|
||||
|
||||
val pendingIntent = PendingIntent.getActivity(
|
||||
this,
|
||||
0,
|
||||
packageManager.getLaunchIntentForPackage(packageName),
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
|
||||
val accentColor = data.accentColor
|
||||
val breakColor = data.breakColor
|
||||
|
||||
val remainingLessonsCount = lessons.count { !now.isAfter(it.end) }
|
||||
val remainingSuffix = if (remainingLessonsCount == 1) {
|
||||
strings["progress_notif_remaining_lessons_one"] ?: ""
|
||||
} else {
|
||||
val template = strings["progress_notif_remaining_lessons_other"] ?: ""
|
||||
formatTemplate(template, "count" to remainingLessonsCount.toString())
|
||||
}
|
||||
|
||||
if (now.isBefore(firstLesson.start)) {
|
||||
val minutesLeft = minutesRemaining(now, firstLesson.start)
|
||||
val firstLessonIconRes = resolveSubjectIcon(firstLesson)
|
||||
|
||||
val title = if (firstLesson.lessonNumber != null) {
|
||||
val template = strings["progress_notif_lesson_title"] ?: ""
|
||||
if (template.isNotEmpty()) {
|
||||
formatTemplate(template, "number" to firstLesson.lessonNumber.toString(), "name" to firstLesson.name)
|
||||
} else {
|
||||
firstLesson.name
|
||||
}
|
||||
} else {
|
||||
firstLesson.name
|
||||
}
|
||||
|
||||
val room = firstLesson.roomName?.trim()
|
||||
val roomSuffix = if (!room.isNullOrBlank() && room != "null") "\n$room" else ""
|
||||
val subSuffix = if (!firstLesson.substituteTeacher.isNullOrBlank() && firstLesson.substituteTeacher != "null" && firstLesson.substituteTeacher != "-") {
|
||||
strings["progress_notif_substitution"] ?: ""
|
||||
} else ""
|
||||
val timeRange = "${firstLesson.start.format(hhmm)}-${firstLesson.end.format(hhmm)}"
|
||||
val templateCase1 = strings["progress_notif_case1_text"] ?: ""
|
||||
val text = formatTemplate(
|
||||
templateCase1,
|
||||
"minutes" to minutesLeft.toString(),
|
||||
"timeRange" to timeRange,
|
||||
"room" to roomSuffix,
|
||||
"substitution" to subSuffix,
|
||||
"remaining" to remainingSuffix
|
||||
)
|
||||
val criticalTemplate = strings["progress_notif_critical_text"] ?: ""
|
||||
val criticalText = formatTemplate(criticalTemplate, "minutes" to minutesLeft.toString())
|
||||
|
||||
val morningStart = firstLesson.start.toLocalDate().atTime(6, 0)
|
||||
val baseStart = if (now.isBefore(morningStart)) now else morningStart
|
||||
val totalMinutes = Duration.between(baseStart, firstLesson.start).toMinutes().coerceAtLeast(15)
|
||||
val elapsed = Duration.between(baseStart, now).toMinutes().coerceIn(0, totalMinutes)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 36) {
|
||||
val progressStyle = Notification.ProgressStyle()
|
||||
.setProgress(elapsed.toInt())
|
||||
.setProgressSegments(listOf(
|
||||
Notification.ProgressStyle.Segment(totalMinutes.toInt()).setColor(accentColor)
|
||||
))
|
||||
.setProgressEndIcon(Icon.createWithResource(this, firstLessonIconRes))
|
||||
.setProgressTrackerIcon(Icon.createWithResource(this, R.drawable.ic_subject_break))
|
||||
|
||||
val builder = Notification.Builder(this, channelId)
|
||||
.setStyle(progressStyle)
|
||||
.setContentTitle(title)
|
||||
.setContentText(text)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setLargeIcon(Icon.createWithResource(this, firstLessonIconRes))
|
||||
.setContentIntent(pendingIntent)
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true)
|
||||
.setRequestPromotedOngoing(true)
|
||||
.setShortCriticalText(criticalText.take(7))
|
||||
|
||||
return builder.build()
|
||||
} else {
|
||||
return NotificationCompat.Builder(this, channelId)
|
||||
.setContentTitle(title)
|
||||
.setContentText(text)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setProgress(totalMinutes.toInt(), elapsed.toInt(), false)
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
val currentLesson = lessons.find { !now.isBefore(it.start) && now.isBefore(it.end) }
|
||||
|
||||
val title: String
|
||||
val text: String
|
||||
val criticalText: String
|
||||
val trackerIconRes: Int
|
||||
val largeIconRes: Int
|
||||
val endIconRes: Int
|
||||
val itemDuration: Int
|
||||
val itemElapsed: Int
|
||||
val itemColor: Int
|
||||
|
||||
if (currentLesson != null) {
|
||||
val lessonDuration = Duration.between(currentLesson.start, currentLesson.end).toMinutes().coerceAtLeast(1).toInt()
|
||||
val elapsed = Duration.between(currentLesson.start, now).toMinutes().coerceIn(0, lessonDuration.toLong()).toInt()
|
||||
val timeLeft = minutesRemaining(now, currentLesson.end)
|
||||
|
||||
itemDuration = lessonDuration
|
||||
itemElapsed = elapsed
|
||||
itemColor = accentColor
|
||||
|
||||
trackerIconRes = resolveSubjectIcon(currentLesson)
|
||||
largeIconRes = trackerIconRes
|
||||
endIconRes = R.drawable.ic_subject_break
|
||||
|
||||
val prefix = if (currentLesson.lessonNumber != null) {
|
||||
val template = strings["progress_notif_lesson_title"] ?: ""
|
||||
if (template.isNotEmpty()) {
|
||||
formatTemplate(template, "number" to currentLesson.lessonNumber.toString(), "name" to currentLesson.name)
|
||||
} else {
|
||||
currentLesson.name
|
||||
}
|
||||
} else {
|
||||
currentLesson.name
|
||||
}
|
||||
title = prefix
|
||||
val room = currentLesson.roomName?.trim()
|
||||
val roomSuffix = if (!room.isNullOrBlank() && room != "null") "\n$room" else ""
|
||||
val subSuffix = if (!currentLesson.substituteTeacher.isNullOrBlank() && currentLesson.substituteTeacher != "null" && currentLesson.substituteTeacher != "-") {
|
||||
strings["progress_notif_substitution"] ?: ""
|
||||
} else ""
|
||||
val timeRange = "${currentLesson.start.format(hhmm)}-${currentLesson.end.format(hhmm)}"
|
||||
val templateLesson = strings["progress_notif_case2_lesson_text"] ?: ""
|
||||
text = formatTemplate(
|
||||
templateLesson,
|
||||
"minutes" to timeLeft.toString(),
|
||||
"timeRange" to timeRange,
|
||||
"room" to roomSuffix,
|
||||
"substitution" to subSuffix,
|
||||
"remaining" to remainingSuffix
|
||||
)
|
||||
val criticalTemplate = strings["progress_notif_critical_text"] ?: ""
|
||||
criticalText = formatTemplate(criticalTemplate, "minutes" to timeLeft.toString())
|
||||
} else {
|
||||
val previousLesson = lessons.lastOrNull { !now.isBefore(it.end) }
|
||||
val nextLesson = lessons.firstOrNull { it.start.isAfter(now) }
|
||||
val breakStart = previousLesson?.end ?: now
|
||||
val breakEnd = nextLesson?.start ?: lastLesson.end
|
||||
|
||||
val breakDuration = Duration.between(breakStart, breakEnd).toMinutes().coerceAtLeast(1).toInt()
|
||||
val elapsed = Duration.between(breakStart, now).toMinutes().coerceIn(0, breakDuration.toLong()).toInt()
|
||||
val timeLeft = minutesRemaining(now, breakEnd)
|
||||
|
||||
itemDuration = breakDuration
|
||||
itemElapsed = elapsed
|
||||
itemColor = breakColor
|
||||
|
||||
trackerIconRes = R.drawable.ic_subject_break
|
||||
largeIconRes = if (nextLesson != null) resolveSubjectIcon(nextLesson) else trackerIconRes
|
||||
endIconRes = if (nextLesson != null) resolveSubjectIcon(nextLesson) else trackerIconRes
|
||||
|
||||
title = strings["progress_notif_case2_break_title"] ?: ""
|
||||
val templateBreak = strings["progress_notif_case2_break_text"] ?: ""
|
||||
text = formatTemplate(
|
||||
templateBreak,
|
||||
"minutes" to timeLeft.toString(),
|
||||
"remaining" to remainingSuffix
|
||||
)
|
||||
val criticalTemplate = strings["progress_notif_critical_text"] ?: ""
|
||||
criticalText = formatTemplate(criticalTemplate, "minutes" to timeLeft.toString())
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 36) {
|
||||
val progressStyle = Notification.ProgressStyle()
|
||||
.setProgress(itemElapsed)
|
||||
.setProgressSegments(listOf(
|
||||
Notification.ProgressStyle.Segment(itemDuration).setColor(itemColor)
|
||||
))
|
||||
.setProgressTrackerIcon(Icon.createWithResource(this, trackerIconRes))
|
||||
.setProgressEndIcon(Icon.createWithResource(this, endIconRes))
|
||||
|
||||
val builder = Notification.Builder(this, channelId)
|
||||
.setStyle(progressStyle)
|
||||
.setContentTitle(title)
|
||||
.setContentText(text)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setLargeIcon(Icon.createWithResource(this, largeIconRes))
|
||||
.setContentIntent(pendingIntent)
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true)
|
||||
.setRequestPromotedOngoing(true)
|
||||
.setShortCriticalText(criticalText.take(7))
|
||||
|
||||
return builder.build()
|
||||
} else {
|
||||
return NotificationCompat.Builder(this, channelId)
|
||||
.setContentTitle(title)
|
||||
.setContentText(text)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setProgress(itemDuration, itemElapsed, false)
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
private fun resolveSubjectIcon(lesson: WidgetLesson): Int {
|
||||
if (!lesson.icon.isNullOrEmpty()) {
|
||||
val res = getSubjectIconRes(lesson.icon)
|
||||
if (res != R.drawable.ic_notification) return res
|
||||
}
|
||||
val name = lesson.name.lowercase()
|
||||
return when {
|
||||
Regex("mate(k|matika)").containsMatchIn(name) -> R.drawable.ic_subject_mathematics
|
||||
Regex("magyar nyelv|nyelvtan").containsMatchIn(name) -> R.drawable.ic_subject_grammar
|
||||
Regex("irodalom").containsMatchIn(name) -> R.drawable.ic_subject_literature
|
||||
Regex("tor(i|tenelem)").containsMatchIn(name) -> R.drawable.ic_subject_history
|
||||
Regex("foldrajz").containsMatchIn(name) -> R.drawable.ic_subject_geography
|
||||
Regex("rajz|muvtori|muveszet|vizualis").containsMatchIn(name) -> R.drawable.ic_subject_art
|
||||
Regex("fizika").containsMatchIn(name) -> R.drawable.ic_subject_physics
|
||||
Regex("^enek|zene|szolfezs|zongora|korus").containsMatchIn(name) -> R.drawable.ic_subject_music
|
||||
Regex("^tes(i|tneveles)|sport|edzeselmelet").containsMatchIn(name) -> R.drawable.ic_subject_pe
|
||||
Regex("kemia").containsMatchIn(name) -> R.drawable.ic_subject_chemistry
|
||||
Regex("biologia").containsMatchIn(name) -> R.drawable.ic_subject_biology
|
||||
Regex("angol|nemet|francia|olasz|orosz|spanyol|latin|kinai|idegen|nyelv").containsMatchIn(name) -> R.drawable.ic_subject_language
|
||||
Regex("informatika|szoftver|digitalis").containsMatchIn(name) -> R.drawable.ic_subject_it
|
||||
Regex("prog|alkalmazas").containsMatchIn(name) -> R.drawable.ic_subject_code
|
||||
Regex("halozat").containsMatchIn(name) -> R.drawable.ic_subject_networking
|
||||
Regex("filozofia").containsMatchIn(name) -> R.drawable.ic_subject_philosophy
|
||||
Regex("osztaly(fonoki|kozosseg)").containsMatchIn(name) -> R.drawable.ic_subject_ofo
|
||||
Regex("penzugy|gazdasag").containsMatchIn(name) -> R.drawable.ic_subject_economics
|
||||
Regex("kornyezet|termeszet").containsMatchIn(name) -> R.drawable.ic_subject_env
|
||||
Regex("(hit|erkolcs)tan|vallas|etika").containsMatchIn(name) -> R.drawable.ic_subject_religion
|
||||
Regex("adatbazis").containsMatchIn(name) -> R.drawable.ic_subject_database
|
||||
else -> R.drawable.ic_subject_unknown
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSubjectIconRes(iconName: String?): Int {
|
||||
if (iconName == null) return R.drawable.ic_subject_unknown
|
||||
return when (iconName.lowercase()) {
|
||||
"mathematics" -> R.drawable.ic_subject_mathematics
|
||||
"grammar" -> R.drawable.ic_subject_grammar
|
||||
"literature" -> R.drawable.ic_subject_literature
|
||||
"history" -> R.drawable.ic_subject_history
|
||||
"geography" -> R.drawable.ic_subject_geography
|
||||
"art" -> R.drawable.ic_subject_art
|
||||
"physics" -> R.drawable.ic_subject_physics
|
||||
"music" -> R.drawable.ic_subject_music
|
||||
"pe" -> R.drawable.ic_subject_pe
|
||||
"chemistry" -> R.drawable.ic_subject_chemistry
|
||||
"biology" -> R.drawable.ic_subject_biology
|
||||
"env" -> R.drawable.ic_subject_env
|
||||
"religion" -> R.drawable.ic_subject_religion
|
||||
"economics" -> R.drawable.ic_subject_economics
|
||||
"it" -> R.drawable.ic_subject_it
|
||||
"code" -> R.drawable.ic_subject_code
|
||||
"networking" -> R.drawable.ic_subject_networking
|
||||
"theatre" -> R.drawable.ic_subject_theatre
|
||||
"film" -> R.drawable.ic_subject_film
|
||||
"electricalengineering" -> R.drawable.ic_subject_electricalengineering
|
||||
"mechanicalengineering" -> R.drawable.ic_subject_mechanicalengineering
|
||||
"technika" -> R.drawable.ic_subject_technika
|
||||
"dance" -> R.drawable.ic_subject_dance
|
||||
"philosophy" -> R.drawable.ic_subject_philosophy
|
||||
"erettsegi" -> R.drawable.ic_subject_erettsegi
|
||||
"ofo" -> R.drawable.ic_subject_ofo
|
||||
"diligence" -> R.drawable.ic_subject_diligence
|
||||
"attitude" -> R.drawable.ic_subject_attitude
|
||||
"language" -> R.drawable.ic_subject_language
|
||||
"linux" -> R.drawable.ic_subject_linux
|
||||
"database" -> R.drawable.ic_subject_database
|
||||
"applications" -> R.drawable.ic_subject_applications
|
||||
"project" -> R.drawable.ic_subject_project
|
||||
"break" -> R.drawable.ic_subject_break
|
||||
else -> R.drawable.ic_subject_unknown
|
||||
}
|
||||
}
|
||||
|
||||
private fun createNotificationChannel() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||
try {
|
||||
nm.deleteNotificationChannel("firka_progress_notification")
|
||||
nm.deleteNotificationChannel("firka_progress_notification_v2")
|
||||
} catch (_: Exception) {}
|
||||
|
||||
val strings = getStrings(this)
|
||||
val channelName = strings["progress_notif_channel_name"]?.takeIf { it.isNotBlank() } ?: "Firka"
|
||||
val channelDesc = strings["progress_notif_channel_desc"] ?: ""
|
||||
|
||||
val channel = NotificationChannel(
|
||||
channelId,
|
||||
channelName,
|
||||
NotificationManager.IMPORTANCE_DEFAULT
|
||||
).apply {
|
||||
setShowBadge(false)
|
||||
setSound(null, null)
|
||||
enableVibration(false)
|
||||
description = channelDesc
|
||||
}
|
||||
nm.createNotificationChannel(channel)
|
||||
}
|
||||
}
|
||||
|
||||
private fun scheduleNextTransitionAlarm(targetTime: LocalDateTime) {
|
||||
val alarmManager = getSystemService(ALARM_SERVICE) as? AlarmManager ?: return
|
||||
cancelTransitionAlarm()
|
||||
|
||||
val intent = Intent(this, ProgressNotificationForegroundService::class.java).apply {
|
||||
action = ACTION_UPDATE
|
||||
}
|
||||
val pendingIntent = PendingIntent.getService(
|
||||
this,
|
||||
1001,
|
||||
intent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
transitionPendingIntent = pendingIntent
|
||||
|
||||
val epochMillis = targetTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()
|
||||
if (epochMillis > System.currentTimeMillis()) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, epochMillis, pendingIntent)
|
||||
} else {
|
||||
alarmManager.setExact(AlarmManager.RTC_WAKEUP, epochMillis, pendingIntent)
|
||||
}
|
||||
} catch (e: SecurityException) {
|
||||
Log.w(TAG, "Cannot schedule transition alarm", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun cancelTransitionAlarm() {
|
||||
val alarmManager = getSystemService(ALARM_SERVICE) as? AlarmManager ?: return
|
||||
transitionPendingIntent?.let {
|
||||
alarmManager.cancel(it)
|
||||
transitionPendingIntent = null
|
||||
}
|
||||
}
|
||||
|
||||
private fun stopForegroundService() {
|
||||
isRunning = false
|
||||
cancelTransitionAlarm()
|
||||
tickerJob?.cancel()
|
||||
isForegroundStarted = false
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
stopForeground(STOP_FOREGROUND_REMOVE)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
stopForeground(true)
|
||||
}
|
||||
stopSelf()
|
||||
}
|
||||
|
||||
private fun minutesRemaining(from: LocalDateTime, to: LocalDateTime): Int {
|
||||
val seconds = Duration.between(from, to).seconds
|
||||
return if (seconds <= 0) 1 else ((seconds + 59) / 60).toInt().coerceAtLeast(1)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "ProgressNotifService"
|
||||
const val ACTION_START = "app.firka.naplo.ProgressNotificationForegroundService.START"
|
||||
const val ACTION_UPDATE = "app.firka.naplo.ProgressNotificationForegroundService.UPDATE"
|
||||
const val ACTION_STOP = "app.firka.naplo.ProgressNotificationForegroundService.STOP"
|
||||
|
||||
private const val PREFS_STRINGS = "firka_progress_strings"
|
||||
|
||||
@Volatile
|
||||
var isRunning: Boolean = false
|
||||
|
||||
fun saveStrings(context: Context, strings: Map<String, String>) {
|
||||
val prefs = context.applicationContext.getSharedPreferences(PREFS_STRINGS, Context.MODE_PRIVATE)
|
||||
val editor = prefs.edit()
|
||||
for ((k, v) in strings) {
|
||||
editor.putString(k, v)
|
||||
}
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
fun getStrings(context: Context): Map<String, String> {
|
||||
val prefs = context.applicationContext.getSharedPreferences(PREFS_STRINGS, Context.MODE_PRIVATE)
|
||||
val all = prefs.all
|
||||
val result = mutableMapOf<String, String>()
|
||||
for ((k, v) in all) {
|
||||
if (v is String) {
|
||||
result[k] = v
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
fun loadTodayTimetable(context: Context): TimetableProgressData? {
|
||||
return try {
|
||||
val appFlutter = File(context.applicationContext.dataDir, "app_flutter")
|
||||
val widgetStateFile = File(appFlutter, "widget_state.json")
|
||||
if (!widgetStateFile.exists()) return null
|
||||
val text = widgetStateFile.readText(Charsets.UTF_8)
|
||||
val json = JSONObject(text)
|
||||
|
||||
val tt = json.getJSONArray("timetable")
|
||||
val allLessons = mutableListOf<WidgetLesson>()
|
||||
for (i in 0 until tt.length()) {
|
||||
allLessons.add(WidgetLesson(tt.getJSONObject(i)))
|
||||
}
|
||||
|
||||
val today = LocalDate.now()
|
||||
var todayLessons = allLessons.filter { it.start.toLocalDate() == today }
|
||||
if (todayLessons.isEmpty()) {
|
||||
val displayDateStr = json.optString("displayDate", "")
|
||||
if (displayDateStr.isNotEmpty()) {
|
||||
try {
|
||||
val displayDate = LocalDate.parse(displayDateStr)
|
||||
todayLessons = allLessons.filter { it.start.toLocalDate() == displayDate }
|
||||
} catch (_: Exception) {}
|
||||
}
|
||||
}
|
||||
|
||||
val colorsObj = json.optJSONObject("colors")
|
||||
val accent = colorsObj?.optInt("accent", 0xFF4C662B.toInt()) ?: 0xFF4C662B.toInt()
|
||||
val secondary = colorsObj?.optInt("secondary", 0xFF586249.toInt()) ?: 0xFF586249.toInt()
|
||||
val language = json.optString("language", null)
|
||||
|
||||
TimetableProgressData(todayLessons, accent, secondary, language)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Error reading timetable data", e)
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class TimetableProgressData(
|
||||
val lessons: List<WidgetLesson>,
|
||||
val accentColor: Int,
|
||||
val breakColor: Int,
|
||||
val language: String? = null,
|
||||
)
|
||||
@@ -54,31 +54,35 @@ class TimetableWidget : GlanceAppWidget() {
|
||||
}
|
||||
|
||||
private fun loadWidgetData(context: Context): WidgetData? {
|
||||
val appFlutter = File(context.applicationContext.dataDir, "app_flutter")
|
||||
val widgetStateFile = File(appFlutter, "widget_state.json")
|
||||
if (!widgetStateFile.exists()) return null
|
||||
val widgetState = JSONObject(widgetStateFile.readText(Charsets.UTF_8))
|
||||
val colors = Colors(widgetState)
|
||||
val tt = widgetState.getJSONArray("timetable")
|
||||
val lessons = mutableListOf<WidgetLesson>()
|
||||
for (i in 0..<tt.length()) {
|
||||
lessons.add(WidgetLesson(tt.getJSONObject(i)))
|
||||
}
|
||||
val displayDateStr = widgetState.optString("displayDate", "")
|
||||
val targetDate = if (displayDateStr.isNotEmpty()) {
|
||||
try {
|
||||
LocalDate.parse(displayDateStr)
|
||||
} catch (_: Exception) {
|
||||
try {
|
||||
val appFlutter = File(context.applicationContext.dataDir, "app_flutter")
|
||||
val widgetStateFile = File(appFlutter, "widget_state.json")
|
||||
if (!widgetStateFile.exists()) return null
|
||||
val text = widgetStateFile.readText(Charsets.UTF_8)
|
||||
val widgetState = JSONObject(text)
|
||||
val colors = Colors(widgetState)
|
||||
val tt = widgetState.getJSONArray("timetable")
|
||||
val lessons = mutableListOf<WidgetLesson>()
|
||||
for (i in 0..<tt.length()) {
|
||||
lessons.add(WidgetLesson(tt.getJSONObject(i)))
|
||||
}
|
||||
val displayDateStr = widgetState.optString("displayDate", "")
|
||||
val targetDate = if (displayDateStr.isNotEmpty()) {
|
||||
try {
|
||||
LocalDate.parse(displayDateStr)
|
||||
} catch (_: Exception) {
|
||||
LocalDate.now()
|
||||
}
|
||||
} else {
|
||||
LocalDate.now()
|
||||
}
|
||||
} else {
|
||||
LocalDate.now()
|
||||
val filtered = lessons.filter { it.start.toLocalDate() == targetDate }
|
||||
val headerText = if (displayDateStr.isNotEmpty()) displayDateStr else "Mai órarend"
|
||||
return WidgetData(colors, headerText, filtered)
|
||||
} catch (e: Throwable) {
|
||||
android.util.Log.e("TimetableWidget", "Error in loadWidgetData", e)
|
||||
return null
|
||||
}
|
||||
val start = LocalDateTime.of(targetDate.year, targetDate.month, targetDate.dayOfMonth, 0, 0)
|
||||
val end = start.plusHours(23)
|
||||
val filtered = lessons.filter { it.start.isAfter(start) && it.end.isBefore(end) }
|
||||
val headerText = if (displayDateStr.isNotEmpty()) displayDateStr else "Mai órarend"
|
||||
return WidgetData(colors, headerText, filtered)
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
@@ -7,9 +7,37 @@ import HomeWidgetGlanceWidgetReceiver
|
||||
import androidx.glance.appwidget.GlanceAppWidgetManager
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import androidx.glance.appwidget.updateAll
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class TimetableWidgetReceiver : HomeWidgetGlanceWidgetReceiver<TimetableWidget>() {
|
||||
override val glanceAppWidget = TimetableWidget()
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
super.onReceive(context, intent)
|
||||
val action = intent.action
|
||||
if (action == ACTION_REFRESH_WIDGET ||
|
||||
action == AppWidgetManager.ACTION_APPWIDGET_UPDATE ||
|
||||
action == Intent.ACTION_BOOT_COMPLETED ||
|
||||
action == Intent.ACTION_MY_PACKAGE_REPLACED) {
|
||||
val pendingResult = goAsync()
|
||||
CoroutineScope(SupervisorJob() + Dispatchers.Default).launch {
|
||||
try {
|
||||
glanceAppWidget.updateAll(context)
|
||||
} catch (e: Exception) {
|
||||
Log.e("TimetableWidget", "Failed glanceAppWidget.updateAll from onReceive", e)
|
||||
} finally {
|
||||
pendingResult?.finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAppWidgetOptionsChanged(
|
||||
context: Context,
|
||||
appWidgetManager: AppWidgetManager,
|
||||
@@ -17,9 +45,18 @@ class TimetableWidgetReceiver : HomeWidgetGlanceWidgetReceiver<TimetableWidget>(
|
||||
newOptions: Bundle,
|
||||
) {
|
||||
super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions)
|
||||
runBlocking {
|
||||
val glanceId = GlanceAppWidgetManager(context).getGlanceIdBy(appWidgetId)
|
||||
glanceAppWidget.update(context, glanceId)
|
||||
val pendingResult = goAsync()
|
||||
CoroutineScope(SupervisorJob() + Dispatchers.Default).launch {
|
||||
try {
|
||||
val glanceId = GlanceAppWidgetManager(context).getGlanceIdBy(appWidgetId)
|
||||
glanceAppWidget.update(context, glanceId)
|
||||
} finally {
|
||||
pendingResult?.finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val ACTION_REFRESH_WIDGET = "app.firka.naplo.ACTION_REFRESH_WIDGET"
|
||||
}
|
||||
}
|
||||
@@ -4,20 +4,46 @@ import app.firka.naplo.getIntOrNull
|
||||
import app.firka.naplo.getStringOrNull
|
||||
import org.json.JSONObject
|
||||
import java.time.LocalDateTime
|
||||
import java.time.OffsetDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.format.DateTimeFormatterBuilder
|
||||
import java.time.temporal.ChronoField
|
||||
|
||||
class WidgetLesson(data: JSONObject) {
|
||||
val formatter = DateTimeFormatterBuilder()
|
||||
.appendPattern("yyyy-MM-dd'T'HH:mm:ss.SSS")
|
||||
.optionalStart()
|
||||
.appendLiteral('Z')
|
||||
.optionalEnd()
|
||||
.toFormatter()
|
||||
companion object {
|
||||
private val formatter: DateTimeFormatter = DateTimeFormatterBuilder()
|
||||
.appendPattern("yyyy-MM-dd'T'HH:mm:ss")
|
||||
.optionalStart()
|
||||
.appendFraction(ChronoField.NANO_OF_SECOND, 1, 9, true)
|
||||
.optionalEnd()
|
||||
.optionalStart()
|
||||
.appendLiteral('Z')
|
||||
.optionalEnd()
|
||||
.optionalStart()
|
||||
.appendOffset("+HH:MM", "+00:00")
|
||||
.optionalEnd()
|
||||
.toFormatter()
|
||||
|
||||
val name: String = data.getString("Nev")
|
||||
val start: LocalDateTime = LocalDateTime.parse(data.getString("KezdetIdopont"), formatter)
|
||||
val end: LocalDateTime = LocalDateTime.parse(data.getString("VegIdopont"), formatter)
|
||||
val lessonNumber: Int? = data.getIntOrNull("Oraszam")
|
||||
val roomName: String? = data.getStringOrNull("TeremNeve")
|
||||
val substituteTeacher: String? = data.getStringOrNull("HelyettesTanarNeve")
|
||||
fun parseDateTime(raw: String): LocalDateTime {
|
||||
return try {
|
||||
LocalDateTime.parse(raw, formatter)
|
||||
} catch (_: Exception) {
|
||||
try {
|
||||
OffsetDateTime.parse(raw).toLocalDateTime()
|
||||
} catch (_: Exception) {
|
||||
LocalDateTime.parse(raw)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val name: String = data.optString("name", data.optString("Nev", ""))
|
||||
val start: LocalDateTime = parseDateTime(data.optString("start", data.optString("KezdetIdopont", "")))
|
||||
val end: LocalDateTime = parseDateTime(data.optString("end", data.optString("VegIdopont", "")))
|
||||
val lessonNumber: Int? = data.getIntOrNull("dailyNth") ?: data.getIntOrNull("Oraszam")
|
||||
val roomName: String? = (data.getStringOrNull("roomName") ?: data.getStringOrNull("TeremNeve"))
|
||||
?.takeIf { it != "null" && it != "-" && it.isNotBlank() }
|
||||
val substituteTeacher: String? = (data.getStringOrNull("substituteTeacher") ?: data.getStringOrNull("HelyettesTanarNeve"))
|
||||
?.takeIf { it != "null" && it != "-" && it.isNotBlank() }
|
||||
val icon: String? = data.getStringOrNull("icon")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M19 4H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"
|
||||
android:fillColor="#FFFFFFFF" />
|
||||
<path
|
||||
android:pathData="M12 16h7a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h7zm0 0v4m0 0h4m-4 0H8"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
11
firka/android/app/src/main/res/drawable/ic_subject_art.xml
Normal file
11
firka/android/app/src/main/res/drawable/ic_subject_art.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M15.586 3a2 2 0 0 1 2.828 0L21 5.586a2 2 0 0 1 0 2.828L19.414 10 14 4.586 15.586 3zm-3 3-9 9A2 2 0 0 0 3 16.414V19a2 2 0 0 0 2 2h2.586A2 2 0 0 0 9 20.414l9-9L12.586 6z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M 7.0,8.0 a 5.0,5.0 0 1,0 10.0,0 a 5.0,5.0 0 1,0 -10.0,0 Z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:pathData="M20 21a8 8 0 1 0-16 0"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:pathData="M12 13a8 8 0 0 0-8 8h16a8 8 0 0 0-8-8z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M10 1a1 1 0 0 0 0 2h1v1.062A7.96 7.96 0 0 0 7.094 5.68L5.914 4.5l.793-.793a1 1 0 0 0-1.414-1.414l-3 3a1 1 0 0 0 1.414 1.414l.793-.793 1.18 1.18A7.96 7.96 0 0 0 4.062 11H3v-1a1 1 0 0 0-2 0v4a1 1 0 1 0 2 0v-1h1.062c.182 1.46.759 2.8 1.618 3.906l-1.18 1.18-.793-.793a1 1 0 0 0-1.414 1.414l3 3a1 1 0 0 0 1.414-1.414l-.793-.793 1.18-1.18A7.965 7.965 0 0 0 11 19.938V21h-1a1 1 0 1 0 0 2h4a1 1 0 1 0 0-2h-1v-1.062a7.965 7.965 0 0 0 3.906-1.618l1.18 1.18-.793.793a1 1 0 0 0 1.414 1.414l3-3a1 1 0 0 0-1.414-1.414l-.793.793-1.18-1.18A7.965 7.965 0 0 0 19.938 13H21v1a1 1 0 1 0 2 0v-4a1 1 0 1 0-2 0v1h-1.062a7.965 7.965 0 0 0-1.618-3.906l1.18-1.18.793.793a1 1 0 1 0 1.414-1.414l-3-3a1 1 0 1 0-1.414 1.414l.793.793-1.18 1.18A7.966 7.966 0 0 0 13 4.062V3h1a1 1 0 1 0 0-2h-4zm3 13a1 1 0 0 1 1-1h.001a1 1 0 1 1 0 2H14a1 1 0 0 1-1-1zm-3-3.5a.5.5 0 1 1 1 0 .5.5 0 0 1-1 0zm.5-2.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
11
firka/android/app/src/main/res/drawable/ic_subject_break.xml
Normal file
11
firka/android/app/src/main/res/drawable/ic_subject_break.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12zm11-5a1 1 0 1 0-2 0v3.764a3 3 0 0 0 1.658 2.683l2.895 1.447a1 1 0 1 0 .894-1.788l-2.894-1.448a1 1 0 0 1-.553-.894V7z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M6 2a1 1 0 0 0 0 2h1v13a5 5 0 0 0 10 0V4h1a1 1 0 1 0 0-2H6zm3 5V4h6v3H9zm4.708 5.708a1 1 0 0 1-1.414 0h-.001a1 1 0 0 1 1.414-1.415 1 1 0 0 1 0 1.415zm-3.414 4a1 1 0 1 0 1.414-1.414v-.001a1 1 0 0 0-1.415 1.414z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
13
firka/android/app/src/main/res/drawable/ic_subject_code.xml
Normal file
13
firka/android/app/src/main/res/drawable/ic_subject_code.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M9.5 5H9a2 2 0 0 0-2 2v2c0 1-.6 3-3 3 1 0 3 .6 3 3v2a2 2 0 0 0 2 2h.5m5-14h.5a2 2 0 0 1 2 2v2c0 1 .6 3 3 3-1 0-3 .6-3 3v2a2 2 0 0 1-2 2h-.5"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
14
firka/android/app/src/main/res/drawable/ic_subject_dance.xml
Normal file
14
firka/android/app/src/main/res/drawable/ic_subject_dance.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M17 7a5.001 5.001 0 0 0-4.607 3.053C11.963 11.07 12.896 12 14 12h6c1.105 0 2.037-.93 1.607-1.947A5.001 5.001 0 0 0 17 7zm0 10a5.001 5.001 0 0 0-3.053-4.607C12.93 11.963 12 12.896 12 14v6c0 1.105.93 2.037 1.947 1.607A5.001 5.001 0 0 0 17 17zM7 17a5.001 5.001 0 0 0 4.607-3.053C12.037 12.93 11.104 12 10 12H4c-1.105 0-2.037.93-1.607 1.947A5.001 5.001 0 0 0 7 17zM7 7a5.001 5.001 0 0 0 3.053 4.607C11.07 12.037 12 11.104 12 10V4c0-1.105-.93-2.037-1.947-1.607A5.001 5.001 0 0 0 7 7z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M21 7c0 2.21-4.03 4-9 4S3 9.21 3 7s4.03-4 9-4 9 1.79 9 4z"
|
||||
android:fillColor="#FFFFFFFF" />
|
||||
<path
|
||||
android:pathData="M21 7c0 2.21-4.03 4-9 4S3 9.21 3 7m18 0c0-2.21-4.03-4-9-4S3 4.79 3 7m18 0v5M3 7v5m18 0c0 2.21-4.03 4-9 4s-9-1.79-9-4m18 0v5c0 2.21-4.03 4-9 4s-9-1.79-9-4v-5"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M10 2a3.001 3.001 0 0 0-2.83 2H6a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h12a3 3 0 0 0 3-3V7a3 3 0 0 0-3-3h-1.17A3.001 3.001 0 0 0 14 2h-4zM9 5a1 1 0 0 1 1-1h4a1 1 0 1 1 0 2h-4a1 1 0 0 1-1-1zm6.78 6.625a1 1 0 1 0-1.56-1.25l-3.303 4.128-1.21-1.21a1 1 0 0 0-1.414 1.414l2 2a1 1 0 0 0 1.488-.082l4-5z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M21 8c0 1.02-1.186 1.92-3 2.462-1.134.34-2.513.538-4 .538s-2.866-.199-4-.538C8.187 9.92 7 9.02 7 8c0-1.657 3.134-3 7-3s7 1.343 7 3z"
|
||||
android:fillColor="#FFFFFFFF" />
|
||||
<path
|
||||
android:pathData="M21 8c0-1.657-3.134-3-7-3S7 6.343 7 8m14 0v4c0 1.02-1.186 1.92-3 2.462-1.134.34-2.513.538-4 .538s-2.866-.199-4-.538C8.187 13.92 7 13.02 7 12V8m14 0c0 1.02-1.186 1.92-3 2.462-1.134.34-2.513.538-4 .538s-2.866-.199-4-.538C8.187 9.92 7 9.02 7 8"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:pathData="M3 12v4c0 1.02 1.187 1.92 3 2.462 1.134.34 2.513.538 4 .538s2.866-.199 4-.538c1.813-.542 3-1.442 3-2.462v-1M3 12c0-1.197 1.635-2.23 4-2.711M3 12c0 1.02 1.187 1.92 3 2.462 1.134.34 2.513.538 4 .538.695 0 1.366-.043 2-.124"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M4 14 14 3v7h6L10 21v-7H4z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
11
firka/android/app/src/main/res/drawable/ic_subject_env.xml
Normal file
11
firka/android/app/src/main/res/drawable/ic_subject_env.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M20.156 6.473a2.639 2.639 0 0 0-2.63-2.629C15.049 3.817 9.909 4.193 6.5 7.6c-2.796 2.796-2.915 7.3-.157 10.057 2.758 2.758 7.26 2.639 10.057-.157 3.407-3.408 3.783-8.548 3.756-11.027zm-4.62 1.991a1 1 0 0 1 0 1.415l-.978.977.587.195a1 1 0 0 1-.633 1.898l-1.535-.512-1.247 1.247.586.196a1 1 0 0 1-.632 1.897l-1.173-.39a3.01 3.01 0 0 1-.344-.14l-2.41 2.41-3.121 3.121a1 1 0 0 1-1.414-1.414l3.121-3.121 2.41-2.41a3.009 3.009 0 0 1-.14-.344l-.39-1.173a1 1 0 0 1 1.897-.632l.196.586 1.247-1.247-.512-1.535a1 1 0 0 1 1.898-.633l.195.587.977-.978a1 1 0 0 1 1.414 0z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M 5.0,9.0 a 7.0,7.0 0 1,0 14.0,0 a 7.0,7.0 0 1,0 -14.0,0 Z"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:pathData="M7 20.234V14c.667.667 2.6 2 5 2s4.333-1.333 5-2v6.234a1 1 0 0 1-1.514.857l-2.972-1.782a1 1 0 0 0-1.028 0L8.514 21.09A1 1 0 0 1 7 20.234z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
11
firka/android/app/src/main/res/drawable/ic_subject_film.xml
Normal file
11
firka/android/app/src/main/res/drawable/ic_subject_film.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M5 5a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3v-1.586l2.293 2.293A1 1 0 0 0 22 16V8a1 1 0 0 0-1.707-.707L18 9.586V8a3 3 0 0 0-3-3H5z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M 3.0,12.0 a 9.0,9.0 0 1,0 18.0,0 a 9.0,9.0 0 1,0 -18.0,0 Z"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:pathData="M13.5 6h.5a2 2 0 0 0 2-2C8.4 1.2 4.5 6.5 3.5 9.5l4.167 5.093c.215.263.333.593.333.933C8 16.34 8.673 17 9.487 17c.828 0 1.513.672 1.513 1.5V21c2.167-.167 6.8-1.2 8-4h-1a2 2 0 0 1-2-2 2 2 0 0 0-2-2h-2a2 2 0 0 1-2-2v-1a1 1 0 0 1 1-1 1 1 0 0 0 1-1v-.5A1.5 1.5 0 0 1 13.5 6z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M3 5a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V5zm5 0v7l2.293-2.293a1 1 0 0 1 1.414 0L14 12V5a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12zm14.243-4.243L9.879 9.88l-2.122 6.364 6.364-2.122 2.122-6.364z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
11
firka/android/app/src/main/res/drawable/ic_subject_it.xml
Normal file
11
firka/android/app/src/main/res/drawable/ic_subject_it.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v7.764l1.447 2.894-.894.448.894-.448c.998 1.995-.453 4.342-2.683 4.342H4.236c-2.23 0-3.68-2.347-2.683-4.342L3 13.764V6zm3-1a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H6z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12 2H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h.93a2 2 0 0 1 1.664.89l.574.862a1 1 0 0 0 1.664 0l.574-.861A2 2 0 0 1 11.07 12H12a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:pathData="M18 10h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-.93a2 2 0 0 0-1.664.89l-.574.862a1 1 0 0 1-1.664 0l-.574-.861A2 2 0 0 0 12.93 20H12a2 2 0 0 1-2-2v-1"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
11
firka/android/app/src/main/res/drawable/ic_subject_linux.xml
Normal file
11
firka/android/app/src/main/res/drawable/ic_subject_linux.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12 3a2 2 0 0 0-1 3.732V8H8c-3.2 0-4 2.667-4 4v7c0 .667.4 2 2 2h1v-4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v4h1c1.6 0 2-1.333 2-2v-7c0-3.2-2.667-4-4-4h-3V6.732A2 2 0 0 0 12 3zm3 18v-3h-2v3h2zm-4 0v-3H9v3h2zm10-3v-5c.667 0 2 .4 2 2v1c0 .667-.4 2-2 2zM3 13v5c-1.6 0-2-1.333-2-2v-1c0-1.6 1.333-2 2-2zm6-1a1 1 0 1 0 0 2h.001a1 1 0 1 0 0-2H9zm5 1a1 1 0 0 1 1-1h.001a1 1 0 1 1 0 2H15a1 1 0 0 1-1-1z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M11 4.85c-2.195-1.022-5.52-1.565-8.633.979A1 1 0 0 0 2 6.603V19a1 1 0 0 0 1.633.774c2.736-2.236 5.734-1.31 7.367-.255V4.849zm2 0v14.669c1.633-1.056 4.63-1.981 7.367.255A1 1 0 0 0 22 19V6.603a1 1 0 0 0-.367-.774C18.52 3.285 15.195 3.828 13 4.849z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M7 2a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3V5a3 3 0 0 0-3-3H7zm0 4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V6zm1 7a1 1 0 1 0 0 2h.01a1 1 0 1 0 0-2H8zm3 1a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1zm1 2a1 1 0 1 0 0 2h.01a1 1 0 1 0 0-2H12zm-5 1a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1zm10-3a1 1 0 1 0-2 0v3a1 1 0 1 0 2 0v-3z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M9.024 2.783A1 1 0 0 1 10 2h4a1 1 0 0 1 .976.783l.44 1.981c.4.19.781.41 1.14.66l1.938-.61a1 1 0 0 1 1.166.454l2 3.464a1 1 0 0 1-.19 1.237l-1.497 1.373a8.1 8.1 0 0 1 0 1.316l1.497 1.373a1 1 0 0 1 .19 1.237l-2 3.464a1 1 0 0 1-1.166.454l-1.937-.61c-.36.25-.741.47-1.14.66l-.44 1.98A1 1 0 0 1 14 22h-4a1 1 0 0 1-.976-.783l-.44-1.981c-.4-.19-.781-.41-1.14-.66l-1.938.61a1 1 0 0 1-1.166-.454l-2-3.464a1 1 0 0 1 .19-1.237l1.497-1.373a8.097 8.097 0 0 1 0-1.316L2.53 9.97a1 1 0 0 1-.19-1.237l2-3.464a1 1 0 0 1 1.166-.454l1.937.61c.36-.25.741-.47 1.14-.66l.44-1.98zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
16
firka/android/app/src/main/res/drawable/ic_subject_music.xml
Normal file
16
firka/android/app/src/main/res/drawable/ic_subject_music.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M13 4h4v4h-4v9c0 1-.6 3-3 3s-3-2-3-3 .6-3 3-3 3 2 3 3V4z"
|
||||
android:fillColor="#FFFFFFFF" />
|
||||
<path
|
||||
android:pathData="M13 17V8m0 9c0 1-.6 3-3 3s-3-2-3-3 .6-3 3-3 3 2 3 3zm0-9V4h4v4h-4z"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M2 13.5C2 17.9 5.667 19 7.5 19h10c1.5 0 4.5-.9 4.5-4.5S19 10 17.5 10c0-1.5-1.5-5-5-5-2.8 0-4.5 2-5 3C5.667 8 2 9.1 2 13.5z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
27
firka/android/app/src/main/res/drawable/ic_subject_ofo.xml
Normal file
27
firka/android/app/src/main/res/drawable/ic_subject_ofo.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M 5.0,9.0 a 4.0,4.0 0 1,0 8.0,0 a 4.0,4.0 0 1,0 -8.0,0 Z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:pathData="M9 13c-3.866 0-7 2.686-7 6h14c0-3.314-3.134-6-7-6z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:pathData="M15 13a4 4 0 1 0-3-6.646m0 5.411c.897.942 2.193 1.235 3 1.235 3.866 0 7 2.686 7 6h-6"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
13
firka/android/app/src/main/res/drawable/ic_subject_pe.xml
Normal file
13
firka/android/app/src/main/res/drawable/ic_subject_pe.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M3 12h4l3 7 4-14 3 7h4"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12 7a5 5 0 0 0-2 9.584V19h4v-2.416A5.001 5.001 0 0 0 12 7z"
|
||||
android:fillColor="#FFFFFFFF" />
|
||||
<path
|
||||
android:pathData="M21 12h1m-3.5-6.5 1-1M12 3V2M5.5 5.5l-1-1M3 12H2m8 10h4m3-10a5 5 0 1 0-7 4.584V19h4v-2.416A5.001 5.001 0 0 0 17 12z"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M18.893 7.936a8.003 8.003 0 0 1-7.774 12.016m-6.012-3.888a8.003 8.003 0 0 1 7.774-12.016"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:pathData="M 15.657,6.343 a 2.0,2.0 0 1,0 4.0,0 a 2.0,2.0 0 1,0 -4.0,0 Z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:pathData="M 4.343,17.657 a 2.0,2.0 0 1,0 4.0,0 a 2.0,2.0 0 1,0 -4.0,0 Z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:pathData="M 10.0,12.0 a 2.0,2.0 0 1,0 4.0,0 a 2.0,2.0 0 1,0 -4.0,0 Z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M3 2a1 1 0 0 0 0 2v11a1 1 0 0 0 1 1h4.613L7.05 20.684a1 1 0 0 0 1.898.632L10.72 16h2.558l1.772 5.316a1 1 0 0 0 1.898-.632L15.387 16H20a1 1 0 0 0 1-1V4a1 1 0 1 0 0-2H3z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12 3a1 1 0 0 1 1 1v1h1a1 1 0 1 1 0 2h-1v1.5l7.6 5.7A1 1 0 0 1 20 16h-1v3h2a1 1 0 1 1 0 2h-7v-3a2 2 0 1 0-4 0v3H3a1 1 0 1 1 0-2h2v-3H4a1 1 0 0 1-.6-1.8L11 8.5V7h-1a1 1 0 0 1 0-2h1V4a1 1 0 0 1 1-1z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12.879 3.707a3 3 0 0 1 4.242 0l3.172 3.172a3 3 0 0 1 0 4.242l-9.172 9.172a3 3 0 0 1-4.242 0L3.707 17.12a3 3 0 0 1 0-4.242L4.586 12l1.707 1.707a1 1 0 0 0 1.414-1.414L6 10.586 7.586 9l2.707 2.707a1 1 0 0 0 1.414-1.414L9 7.586 10.586 6l1.707 1.707a1 1 0 1 0 1.414-1.414L12 4.586l.879-.879z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M2 3a1 1 0 0 1 1-1h18a1 1 0 1 1 0 2v11a1 1 0 0 1-1 1h-4.613l1.562 4.684a1 1 0 0 1-1.898.632L13.28 16h-2.558L8.95 21.316a1 1 0 1 1-1.898-.632L8.613 16H4a1 1 0 0 1-1-1V4a1 1 0 0 1-1-1zm9.555 3.168A1 1 0 0 0 10 7v4a1 1 0 0 0 1.555.832l3-2a1 1 0 0 0 0-1.664l-3-2zM12.197 9 12 9.131V8.87l.197.131z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm0 5a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0V8a1 1 0 0 1 1-1zm1 9a1 1 0 1 0-2 0 1 1 0 1 0 2 0z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
@@ -13,25 +13,27 @@ rootProject.layout.buildDirectory.value(newBuildDir)
|
||||
|
||||
subprojects {
|
||||
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
|
||||
project.layout.buildDirectory.value(newSubprojectBuildDir)
|
||||
|
||||
afterEvaluate {
|
||||
if (plugins.hasPlugin("com.android.application")) {
|
||||
extensions.configure<ApplicationExtension> {
|
||||
compileSdk = 37
|
||||
defaultConfig {
|
||||
// buildToolsVersion can be set here if needed
|
||||
if (project.name != "app") {
|
||||
project.evaluationDependsOn(":app")
|
||||
|
||||
// android_alarm_manager_plus 5.1.1's own build.gradle.kts only applies
|
||||
// org.jetbrains.kotlin.android when AGP < 9, then unconditionally
|
||||
// configures KotlinAndroidProjectExtension - which doesn't exist here
|
||||
// on AGP 9+ unless we apply the plugin ourselves first.
|
||||
if (project.name == "android_alarm_manager_plus") {
|
||||
pluginManager.apply("org.jetbrains.kotlin.android")
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
if (plugins.hasPlugin("com.android.library")) {
|
||||
extensions.configure<LibraryExtension> {
|
||||
compileSdk = 37
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugins.hasPlugin("com.android.library")) {
|
||||
extensions.configure<LibraryExtension> {
|
||||
compileSdk = 37
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project.layout.buildDirectory.value(newSubprojectBuildDir)
|
||||
}
|
||||
|
||||
tasks.register<Delete>("clean") {
|
||||
|
||||
@@ -15,3 +15,6 @@ kotlin.incremental.useClasspathSnapshot=true
|
||||
android.builtInKotlin=false
|
||||
|
||||
android.newDsl=false
|
||||
|
||||
# Prevent AGP 9.0+ build failures due to relocated build directory ProGuard path mismatches
|
||||
android.proguard.failOnMissingFiles=false
|
||||
|
||||
@@ -1,22 +1,10 @@
|
||||
icons:
|
||||
"flutter_launcher_icons.yaml": "c600507ca0df7cebd0f708124842512a14ed3d597b779176200d6ba25b1335b1"
|
||||
"pubspec.yaml": "5d40f014d654e257bc58e8ebfb2468a5ed7f75d913a67fb89314b9fda1c257a6"
|
||||
"flutter_launcher_icons.yaml": "993c1cd3a99db70747299601e556d19ec959b0a16fd9ff2dbf2386cb6f2a640d"
|
||||
"pubspec.yaml": "97e478fd72968c34de0c0ad4421daa9b2e2531d60bb28a893d7d3b5a9a90116c"
|
||||
"assets/images/logos/colored_logo.webp": "4b4fa99d144fe6694aa4487ba1b26aeecafae41e3c877836cd7da28d61a77983"
|
||||
"assets/images/logos/monochrome_logo.png": "188d2b0a64c70323b09bcee721663d6698fb557066f20ddaec97bba6869c1c6c"
|
||||
"assets/images/logos/monochrome_logo.png": "c269a5e689622484d800a4fda5927591a0bf99d34790a4f146b93cf6edabd455"
|
||||
"assets/images/logos/colored_logo_without_mustache.png": "d11cff9f38985885873bfdd2d84e61f8fab03803eada94d4caac1545ef3685f3"
|
||||
"assets/images/logos/colored_logo_only_mustache.png": "bad6220c11bdfb1dfe04e5173bd2ebedd3999689d4b3a68fc63dc520c96dd33b"
|
||||
l10n:
|
||||
"l10n.yml": "a57bc304cac4a2b0235593586f17f400a5165d67fc9aadeaa11893cfa36ee082"
|
||||
"lib/l10n/app_pl.arb": "a8426455757e587c7635c3a62c650a4aae2a0cac1de1175e8ab7fb0d3b387537"
|
||||
"lib/l10n/app_de.arb": "c498950bbc917e35b1910451ad9fbd4e625db89151f07558e846a7c119a583af"
|
||||
"lib/l10n/app_en.arb": "159405752b5e73eedbe546a59567550091926a37cf9cf6ce78dd58f1a0dd1d4b"
|
||||
"lib/l10n/app_hu.arb": "c7fba2a8f91217433698d766e9451d8fad86ae71021adf714639fc3907a34891"
|
||||
isar:
|
||||
"lib/data/models/app_settings_model.dart": "5eb5af345f1347f104257f0999763650fe2673f9da1754bd12d3f756fe5c9723"
|
||||
"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"
|
||||
"flutter_native_splash.yaml": "f1bddb74798b1539c4e9213ca9ae305d625ebb0ac5bcbe079b523437e0abc2c4"
|
||||
"assets/images/logos/splash.png": "88fbebc3d686cb9095bcce362029b69978b1b14270e465e91d962b1425db1152"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
flutter_launcher_icons:
|
||||
generate: true
|
||||
android: "launcher_icon"
|
||||
ios: false
|
||||
image_path: "assets/images/logos/colored_logo.webp"
|
||||
adaptive_icon_monochrome: "assets/images/logos/monochrome_logo.png"
|
||||
adaptive_icon_background: "assets/images/logos/colored_logo_without_mustache.png"
|
||||
|
||||
@@ -17,4 +17,6 @@ flutter_native_splash:
|
||||
icon_background_color: "#7ca120"
|
||||
icon_background_color_dark: "#7ca120"
|
||||
|
||||
android: true
|
||||
ios: false
|
||||
web: false
|
||||
|
||||
173
firka/integration_test/widget_e2e_test.dart
Normal file
173
firka/integration_test/widget_e2e_test.dart
Normal file
@@ -0,0 +1,173 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/app/initialization.dart';
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:firka/data/widget.dart';
|
||||
import 'package:firka/services/notification_diff_service.dart';
|
||||
import 'package:firka_common/data/database.dart';
|
||||
import 'package:firka_common/data/models/token_model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
import 'package:kreta_api/kreta_api.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
const _mockServerUrl = 'http://127.0.0.1:8090';
|
||||
|
||||
Future<TokenGrantResponse> _authenticateMockServer(HttpClient httpClient) async {
|
||||
final loginReq = await httpClient.getUrl(Uri.parse('$_mockServerUrl/Account/Login'));
|
||||
final loginResp = await loginReq.close();
|
||||
final loginBody = await loginResp.transform(utf8.decoder).join();
|
||||
|
||||
final match = RegExp(r'name="code" value="([^"]+)"').firstMatch(loginBody);
|
||||
if (match == null) {
|
||||
throw Exception('Failed to extract code from mock server login: $loginBody');
|
||||
}
|
||||
final code = match.group(1)!;
|
||||
|
||||
final tokenReq = await httpClient.postUrl(Uri.parse('$_mockServerUrl/connect/token'));
|
||||
tokenReq.headers.contentType = ContentType('application', 'x-www-form-urlencoded');
|
||||
tokenReq.write('grant_type=authorization_code&code=${Uri.encodeQueryComponent(code)}');
|
||||
final tokenResp = await tokenReq.close();
|
||||
final tokenBody = await tokenResp.transform(utf8.decoder).join();
|
||||
if (tokenResp.statusCode != 200) {
|
||||
throw Exception('Token request failed (${tokenResp.statusCode}): $tokenBody');
|
||||
}
|
||||
return TokenGrantResponse.fromJson(jsonDecode(tokenBody) as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> _getMockLessons(HttpClient httpClient) async {
|
||||
final req = await httpClient.getUrl(Uri.parse('$_mockServerUrl/admin/api/lessons'));
|
||||
final resp = await req.close();
|
||||
final body = await resp.transform(utf8.decoder).join();
|
||||
final list = jsonDecode(body) as List;
|
||||
return list.cast<Map<String, dynamic>>();
|
||||
}
|
||||
|
||||
Future<void> _putMockLessons(HttpClient httpClient, List<Map<String, dynamic>> lessons) async {
|
||||
final req = await httpClient.putUrl(Uri.parse('$_mockServerUrl/admin/api/lessons'));
|
||||
req.headers.contentType = ContentType.json;
|
||||
req.write(jsonEncode(lessons));
|
||||
final resp = await req.close();
|
||||
if (resp.statusCode != 204 && resp.statusCode != 200) {
|
||||
final body = await resp.transform(utf8.decoder).join();
|
||||
throw Exception('Failed to update mock lessons (${resp.statusCode}): $body');
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
logger = Logger("FirkaTest");
|
||||
dio.options.connectTimeout = const Duration(seconds: 5);
|
||||
dio.options.receiveTimeout = const Duration(seconds: 3);
|
||||
dio.options.validateStatus = (status) => status != null && status < 500;
|
||||
|
||||
group('Widget End-to-End Test with Mock Kreta Server', () {
|
||||
late HttpClient httpClient;
|
||||
|
||||
setUp(() {
|
||||
httpClient = HttpClient();
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
httpClient.close(force: true);
|
||||
});
|
||||
|
||||
testWidgets('Opening app updates widget with timetable and FCM wakeup syncs timetable changes', (tester) async {
|
||||
// 1. Initialize DB and authenticate with mock_kreta_server
|
||||
final isar = await initDB();
|
||||
Settings = SettingsRepository(isar);
|
||||
await Settings.loadAll();
|
||||
|
||||
// Configure mock backend settings and enable notifications
|
||||
await Settings.mockBackendEnabled.set(true);
|
||||
await Settings.mockBackendUrl.set(_mockServerUrl);
|
||||
await Settings.notifyAll.set(true);
|
||||
|
||||
final originalLessons = await _getMockLessons(httpClient);
|
||||
final today = DateTime.now();
|
||||
final seededLessons = originalLessons.indexed.map((entry) {
|
||||
final (i, l) = entry;
|
||||
final m = Map<String, dynamic>.from(l);
|
||||
m['KezdetIdopont'] = DateTime(today.year, today.month, today.day, 8 + i, 0).toIso8601String();
|
||||
m['VegIdopont'] = DateTime(today.year, today.month, today.day, 8 + i, 45).toIso8601String();
|
||||
return m;
|
||||
}).toList();
|
||||
await _putMockLessons(httpClient, seededLessons);
|
||||
|
||||
final tokenResp = await _authenticateMockServer(httpClient);
|
||||
final tokenModel = TokenModel.fromResp(tokenResp);
|
||||
|
||||
await isar.writeTxn(() async {
|
||||
await isar.tokenModels.clear();
|
||||
await isar.tokenModels.put(tokenModel);
|
||||
});
|
||||
|
||||
// 2. Initialize app (simulates opening the app)
|
||||
await initializeApp();
|
||||
expect(initDone, isTrue);
|
||||
|
||||
if (initData.client != null) {
|
||||
await initData.client!.init();
|
||||
await initData.client!.renewCache(reInit: false);
|
||||
await WidgetCacheHelper.updateWidgetCacheFromIsar();
|
||||
}
|
||||
|
||||
final dataDir = await getApplicationDocumentsDirectory();
|
||||
final widgetFile = File(p.join(dataDir.path, 'widget_state.json'));
|
||||
|
||||
// Verify that widget_state.json was created on app opening
|
||||
expect(widgetFile.existsSync(), isTrue, reason: 'widget_state.json must exist after opening app');
|
||||
|
||||
final initialContent = jsonDecode(widgetFile.readAsStringSync()) as Map<String, dynamic>;
|
||||
expect(initialContent.containsKey('colors'), isTrue);
|
||||
expect(initialContent.containsKey('timetable'), isTrue);
|
||||
|
||||
final initialTimetable = (initialContent['timetable'] as List).cast<Map<String, dynamic>>();
|
||||
expect(initialTimetable.isNotEmpty, isTrue, reason: 'Timetable in widget must not be empty');
|
||||
|
||||
final firstLessonName = initialTimetable.first['name'];
|
||||
expect(firstLessonName, isNotNull);
|
||||
expect(initialTimetable.first.containsKey('dailyNth'), isTrue);
|
||||
expect(initialTimetable.first.containsKey('start'), isTrue);
|
||||
expect(initialTimetable.first.containsKey('end'), isTrue);
|
||||
|
||||
// 3. Simulate timetable change on mock server
|
||||
final currentMockLessons = await _getMockLessons(httpClient);
|
||||
expect(currentMockLessons.isNotEmpty, isTrue);
|
||||
|
||||
// Mutate the target lesson: change room and assign a substitute teacher
|
||||
final modifiedLessons = List<Map<String, dynamic>>.from(currentMockLessons);
|
||||
final targetIndex = modifiedLessons.indexWhere((l) => l['Nev'] == firstLessonName);
|
||||
expect(targetIndex != -1, isTrue);
|
||||
final updatedLesson = Map<String, dynamic>.from(modifiedLessons[targetIndex]);
|
||||
updatedLesson['TeremNeve'] = 'LAB-999';
|
||||
updatedLesson['HelyettesTanarNeve'] = 'Prof. E2E Teszt';
|
||||
modifiedLessons[targetIndex] = updatedLesson;
|
||||
|
||||
await _putMockLessons(httpClient, modifiedLessons);
|
||||
|
||||
// 4. Trigger FCM wakeup processing
|
||||
await NotificationDiffService.checkAll();
|
||||
|
||||
// 5. Verify widget_state.json was updated with modified timetable
|
||||
final updatedContent = jsonDecode(widgetFile.readAsStringSync()) as Map<String, dynamic>;
|
||||
final updatedTimetable = (updatedContent['timetable'] as List).cast<Map<String, dynamic>>();
|
||||
|
||||
final updatedMatch = updatedTimetable.firstWhere(
|
||||
(l) => l['name'] == firstLessonName,
|
||||
orElse: () => <String, dynamic>{},
|
||||
);
|
||||
expect(updatedMatch.isNotEmpty, isTrue);
|
||||
expect(updatedMatch['roomName'], equals('LAB-999'), reason: 'Widget state should have updated room name');
|
||||
expect(updatedMatch['substituteTeacher'], equals('Prof. E2E Teszt'), reason: 'Widget state should have updated substitute teacher');
|
||||
|
||||
// Revert mock server lessons back to original
|
||||
await _putMockLessons(httpClient, originalLessons);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -38,6 +38,22 @@ class KretaClient {
|
||||
final CacheManager cache;
|
||||
final ToastCubit _toastCubit = initData.toastCubit;
|
||||
|
||||
// Serializes writes from independent call sites (renewCache,
|
||||
// refreshHomeFeed, etc.) so one can't clobber another's fresher data.
|
||||
Future<void> _writeQueue = Future.value();
|
||||
|
||||
Future<T> _enqueueWrite<T>(Future<T> Function() action) {
|
||||
final completer = Completer<T>();
|
||||
_writeQueue = _writeQueue.then((_) async {
|
||||
try {
|
||||
completer.complete(await action());
|
||||
} catch (ex, st) {
|
||||
completer.completeError(ex, st);
|
||||
}
|
||||
});
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
KretaClient(TokenModel model) : cache = CacheManager(model);
|
||||
|
||||
bool get needsReauth => _toastCubit.state.type == ActiveToastType.reauth;
|
||||
@@ -75,6 +91,27 @@ class KretaClient {
|
||||
return lessons;
|
||||
}
|
||||
|
||||
/// Splits [from, to) into the sub-range(s) that don't fall inside
|
||||
/// [excludeFrom, excludeTo). Returns [(from, to)] unchanged if there's no
|
||||
/// overlap (including when either exclude bound is null).
|
||||
static List<(DateTime, DateTime)> _excludingRange(
|
||||
DateTime from,
|
||||
DateTime to,
|
||||
DateTime? excludeFrom,
|
||||
DateTime? excludeTo,
|
||||
) {
|
||||
if (excludeFrom == null ||
|
||||
excludeTo == null ||
|
||||
!from.isBefore(excludeTo) ||
|
||||
!to.isAfter(excludeFrom)) {
|
||||
return [(from, to)];
|
||||
}
|
||||
final ranges = <(DateTime, DateTime)>[];
|
||||
if (from.isBefore(excludeFrom)) ranges.add((from, excludeFrom));
|
||||
if (to.isAfter(excludeTo)) ranges.add((excludeTo, to));
|
||||
return ranges;
|
||||
}
|
||||
|
||||
Future<void> renewTimetable({
|
||||
bool wholeYear = false,
|
||||
DateTime? skipFrom,
|
||||
@@ -129,13 +166,15 @@ class KretaClient {
|
||||
int waitAfter = 5;
|
||||
while (date.isBefore(to)) {
|
||||
DateTime tmpTo = date.add(Duration(days: 14));
|
||||
final alreadyFetched =
|
||||
skipFrom != null &&
|
||||
skipTo != null &&
|
||||
!date.isBefore(skipFrom) &&
|
||||
!tmpTo.isAfter(skipTo);
|
||||
if (!alreadyFetched) {
|
||||
requests.add(getLessons(date, tmpTo));
|
||||
// Chunk boundaries rarely align with skipFrom/skipTo. Trim the
|
||||
// overlap instead of skipping only fully-contained chunks.
|
||||
for (final (reqFrom, reqTo) in _excludingRange(
|
||||
date,
|
||||
tmpTo,
|
||||
skipFrom,
|
||||
skipTo,
|
||||
)) {
|
||||
requests.add(getLessons(reqFrom, reqTo));
|
||||
i++;
|
||||
}
|
||||
date = tmpTo;
|
||||
@@ -161,12 +200,47 @@ class KretaClient {
|
||||
await getNoticeBoard(from: from);
|
||||
}
|
||||
|
||||
Future<void> init() async {
|
||||
Future<void>? _initInFlight;
|
||||
|
||||
/// Two `init()` calls close together (initialization.dart + a
|
||||
/// reInit-triggered renewCache()) used to run fully concurrently and
|
||||
/// interleave writes. Coalesce to one in-flight future.
|
||||
Future<void> init() {
|
||||
final inFlight = _initInFlight;
|
||||
if (inFlight != null) return inFlight;
|
||||
final future = _initImpl();
|
||||
_initInFlight = future;
|
||||
// whenComplete() would return an unawaited derived future, so an
|
||||
// error here would get reported as unhandled even though real
|
||||
// callers already catch it via the returned `future`.
|
||||
future.then((_) => _initInFlight = null, onError: (_) => _initInFlight = null);
|
||||
return future;
|
||||
}
|
||||
|
||||
Future<void> _initImpl() async {
|
||||
await getStudent();
|
||||
await getClassGroups();
|
||||
}
|
||||
|
||||
Future<void> renewCache({bool reInit = false}) async {
|
||||
Future<void>? _renewCacheInFlight;
|
||||
|
||||
/// Multiple call sites trigger renewCache() close together on cold
|
||||
/// start; without this a second call re-runs the whole sync concurrently
|
||||
/// and can clobber the first's fresher writes.
|
||||
Future<void> renewCache({bool reInit = false}) {
|
||||
final inFlight = _renewCacheInFlight;
|
||||
if (inFlight != null) return inFlight;
|
||||
final future = _renewCacheImpl(reInit: reInit);
|
||||
_renewCacheInFlight = future;
|
||||
// See init()'s comment on why this isn't future.whenComplete(...).
|
||||
future.then(
|
||||
(_) => _renewCacheInFlight = null,
|
||||
onError: (_) => _renewCacheInFlight = null,
|
||||
);
|
||||
return future;
|
||||
}
|
||||
|
||||
Future<void> _renewCacheImpl({bool reInit = false}) async {
|
||||
_toastCubit.setActiveToast(.fetching);
|
||||
try {
|
||||
if (reInit) {
|
||||
@@ -456,10 +530,30 @@ class KretaClient {
|
||||
}
|
||||
}
|
||||
|
||||
/// Upserts [caches]. Deletes stale rows in [staleScope]. Queued behind
|
||||
/// [_writeQueue] — see its doc comment.
|
||||
Future<List<C>> _save<C extends GenericCacheModel<I>, I extends Identifiable>(
|
||||
List<C> caches, [
|
||||
QueryBuilder<C, C, QAfterFilterCondition>? staleScope,
|
||||
]) {
|
||||
return _enqueueWrite(() => _saveImpl(caches, staleScope));
|
||||
}
|
||||
|
||||
Future<List<C>>
|
||||
_saveImpl<C extends GenericCacheModel<I>, I extends Identifiable>(
|
||||
List<C> caches,
|
||||
QueryBuilder<C, C, QAfterFilterCondition>? staleScope,
|
||||
) async {
|
||||
isarInit.writeTxnSync(() {
|
||||
if (staleScope != null) {
|
||||
final freshKeys = caches.map((c) => c.cacheKey).toSet();
|
||||
final staleIds = staleScope
|
||||
.findAllSync()
|
||||
.map((c) => c.cacheKey)
|
||||
.where((key) => !freshKeys.contains(key))
|
||||
.toList();
|
||||
isarInit.collection<C>().deleteAllSync(staleIds);
|
||||
}
|
||||
isarInit.collection<C>().putAllSync(caches);
|
||||
});
|
||||
initData.homeRefreshCubit.requestRefresh();
|
||||
@@ -478,19 +572,40 @@ class KretaClient {
|
||||
}
|
||||
|
||||
Future<StudentCacheModel> getStudent() async {
|
||||
return (await _renewCache<StudentCacheModel, Student>(
|
||||
final list = await _renewCache<StudentCacheModel, Student>(
|
||||
KretaEndpoints.getStudent(cache.token.iss),
|
||||
StudentCacheModel.new,
|
||||
(cache) => Student.fromJson(cache),
|
||||
).then(_save)).first;
|
||||
).then(_save);
|
||||
if (list.isNotEmpty) {
|
||||
return list.first;
|
||||
}
|
||||
final existing = cache.findStudentOrNull();
|
||||
if (existing != null) {
|
||||
logger.warning("getStudent returned empty, falling back to cached student");
|
||||
return existing;
|
||||
}
|
||||
throw StateError("No student data returned from Kreta and no cached student found");
|
||||
}
|
||||
|
||||
Future<List<ClassGroupCacheModel>> getClassGroups() async {
|
||||
return await _renewCache(
|
||||
final list = await _renewCache(
|
||||
KretaEndpoints.getClassGroups(cache.token.iss),
|
||||
ClassGroupCacheModel.new,
|
||||
(item) => ClassGroup.fromJson(item),
|
||||
).then(_save);
|
||||
if (list.isNotEmpty) {
|
||||
return list;
|
||||
}
|
||||
final existing = isarInit.classGroupCacheModels
|
||||
.filter()
|
||||
.group(cache.isCurrentClassGroup)
|
||||
.findAllSync();
|
||||
if (existing.isNotEmpty) {
|
||||
logger.warning("getClassGroups returned empty, falling back to cached class groups");
|
||||
return existing;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
Future<List<MessageCacheModel>> getNoticeBoard({
|
||||
@@ -520,7 +635,7 @@ class KretaClient {
|
||||
KretaEndpoints.getGrades(cache.token.iss),
|
||||
GradeCacheModel.new,
|
||||
(json) => Grade.fromJson(json),
|
||||
).then(_save);
|
||||
).then((caches) => _save(caches, cache.getGrades()));
|
||||
}
|
||||
|
||||
Future<List<HomeworkCacheModel>> getHomework({
|
||||
@@ -534,17 +649,70 @@ class KretaClient {
|
||||
KretaEndpoints.getHomework(cache.token.iss, from, to),
|
||||
HomeworkCacheModel.new,
|
||||
(item) => Homework.fromJson(item),
|
||||
).then(_save);
|
||||
).then((caches) => _save(caches, cache.getHomeworks()));
|
||||
}
|
||||
|
||||
/// Automatically aligns requests to start at Monday and end at Sunday
|
||||
Future<List<LessonCacheModel>> getLessons(DateTime from, DateTime to) async {
|
||||
/// Wipes and replaces every cached lesson in [from]..[to], no Uid diffing.
|
||||
Future<List<LessonCacheModel>> _replaceTimetableRange(
|
||||
DateTime from,
|
||||
DateTime to,
|
||||
List<LessonCacheModel> caches,
|
||||
) async {
|
||||
late int existingCount;
|
||||
late int deletedCount;
|
||||
isarInit.writeTxnSync(() {
|
||||
// NOT between(from, to): it's inclusive of `to`'s whole day, but
|
||||
// `to` here is exclusive (matches what was actually fetched) — the
|
||||
// inclusive version deleted a day beyond what `caches` covers.
|
||||
final scope = cache.getTimeTable().and().startBetween(
|
||||
from.getMidnight(),
|
||||
to.getMidnight(),
|
||||
includeUpper: false,
|
||||
);
|
||||
existingCount = scope.countSync();
|
||||
deletedCount = scope.deleteAllSync();
|
||||
isarInit.lessonCacheModels.putAllSync(caches);
|
||||
});
|
||||
|
||||
logger.fine(
|
||||
"[RenewCache] _replaceTimetableRange $from..$to: "
|
||||
"existing=$existingCount deleted=$deletedCount inserting=${caches.length}",
|
||||
);
|
||||
initData.homeRefreshCubit.requestRefresh();
|
||||
return caches;
|
||||
}
|
||||
|
||||
/// Automatically aligns requests to start at Monday and end at Sunday.
|
||||
/// Queued behind [_writeQueue] so overlapping ranges can't race.
|
||||
Future<List<LessonCacheModel>> getLessons(DateTime from, DateTime to) {
|
||||
return _enqueueWrite(() => _getLessonsImpl(from, to));
|
||||
}
|
||||
|
||||
Future<List<LessonCacheModel>> _getLessonsImpl(
|
||||
DateTime from,
|
||||
DateTime to,
|
||||
) async {
|
||||
assert(from.difference(to).inDays < 30);
|
||||
return (await _renewCache(
|
||||
List<LessonCacheModel> caches;
|
||||
try {
|
||||
caches = await _renewCache(
|
||||
KretaEndpoints.getTimeTable(cache.token.iss, from, to),
|
||||
LessonCacheModel.new,
|
||||
(json) => Lesson.fromJson(json),
|
||||
).then(resolveDailyNth).then(_save))
|
||||
).then(resolveDailyNth);
|
||||
} catch (ex) {
|
||||
if (isTokenExpired(ex)) {
|
||||
rethrow;
|
||||
}
|
||||
// fall back to cache instead of losing the range
|
||||
logger.warning(
|
||||
"[Timetable] failed to refresh $from..$to, falling back to cache: $ex",
|
||||
);
|
||||
return cache.getTimeTable().and().between(from, to).findAllSync()
|
||||
..sort((a, b) => a.start.compareTo(b.start));
|
||||
}
|
||||
|
||||
return (await _replaceTimetableRange(from, to, caches))
|
||||
..sort((a, b) => a.start.compareTo(b.start));
|
||||
}
|
||||
|
||||
@@ -553,15 +721,28 @@ class KretaClient {
|
||||
KretaEndpoints.getTests(cache.token.iss, from, to),
|
||||
TestCacheModel.new,
|
||||
(item) => Test.fromJson(item),
|
||||
).then(_save);
|
||||
).then(
|
||||
(caches) => _save(
|
||||
caches,
|
||||
isarInit.testCacheModels.filter().classGroup(cache.isCurrentClassGroup),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<List<OmissionCacheModel>> getOmissions() async {
|
||||
return (await _renewCache(
|
||||
KretaEndpoints.getOmissions(cache.token.iss),
|
||||
OmissionCacheModel.new,
|
||||
(item) => Omission.fromJson(item),
|
||||
).then(_save))..sort((a, b) => a.createdAt.compareTo(b.createdAt));
|
||||
KretaEndpoints.getOmissions(cache.token.iss),
|
||||
OmissionCacheModel.new,
|
||||
(item) => Omission.fromJson(item),
|
||||
).then(
|
||||
(caches) => _save(
|
||||
caches,
|
||||
isarInit.omissionCacheModels.filter().classGroup(
|
||||
cache.isCurrentClassGroup,
|
||||
),
|
||||
),
|
||||
))
|
||||
..sort((a, b) => a.createdAt.compareTo(b.createdAt));
|
||||
}
|
||||
|
||||
Future<List<SubjectCacheModel>> getSubjects() async {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import "package:firka/app/app_state.dart";
|
||||
import "package:firka/app/initialization.dart";
|
||||
import "package:firka/services/fcm_service.dart";
|
||||
import "package:firka/services/notification_delivery_service.dart";
|
||||
import "package:firka_common/data/models/token_model.dart";
|
||||
import "package:kreta_api/kreta_api.dart";
|
||||
|
||||
@@ -18,9 +18,8 @@ Future<void> completeLogin(
|
||||
await initializeApp();
|
||||
|
||||
if (data.client != null) {
|
||||
await FcmService.onUserLogin(
|
||||
await NotificationDeliveryService.onUserLogin(
|
||||
client: data.client!,
|
||||
settingsStore: data.settings,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,17 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'dart:ui' as ui;
|
||||
import 'package:firka_common/data/database.dart';
|
||||
import 'package:firka_common/data/models/lesson_cache_model.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/api/client/kreta_client.dart';
|
||||
import 'package:firka_common/data/models/token_model.dart';
|
||||
import 'package:firka/services/fcm_service.dart';
|
||||
import 'package:firka/services/notification_delivery_service.dart';
|
||||
import 'package:firka/services/progress_notification_service.dart';
|
||||
import 'package:firka/data/widget.dart';
|
||||
import 'package:firka/core/extensions.dart';
|
||||
import 'package:firka/core/settings/settings_effects.dart';
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
@@ -19,6 +23,7 @@ import 'package:firka/l10n/app_localizations_hu.dart';
|
||||
import 'package:firka/core/swear_generator.dart';
|
||||
import 'package:firka/ui/phone/screens/themes/builtin_theme_id.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:firka_common/ui/theme/core_theme.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
@@ -26,6 +31,7 @@ import 'package:isar_community/isar.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
|
||||
Future<void> initLang(AppInitialization data) async {
|
||||
switch (Settings.language.value) {
|
||||
case AppLanguage.hu:
|
||||
@@ -53,12 +59,15 @@ Future<void> initLang(AppInitialization data) async {
|
||||
}
|
||||
}
|
||||
|
||||
void initTheme(AppInitialization data) {
|
||||
final themeCubit = data.themeCubit;
|
||||
|
||||
final brightness =
|
||||
SchedulerBinding.instance.platformDispatcher.platformBrightness;
|
||||
|
||||
/// Builds a full style for an explicit brightness, applying all custom color
|
||||
/// overrides — independent of the device's/app's actual current brightness.
|
||||
/// Used by [initTheme] itself, and by screens (like the theme editor) that
|
||||
/// need to preview a brightness other than the one currently on screen.
|
||||
FirkaStyle buildStyleForBrightness(
|
||||
bool isLight, {
|
||||
bool? isCustomTheme,
|
||||
bool forceCustomColors = false,
|
||||
}) {
|
||||
final titleFont = Settings.titleFont.value;
|
||||
final titleWeight = Settings.titleWeight.value;
|
||||
final fonts = buildAppFonts(
|
||||
@@ -66,6 +75,28 @@ void initTheme(AppInitialization data) {
|
||||
headingWeight: titleWeight,
|
||||
supportsWeight: titleFont.supportsWeight,
|
||||
);
|
||||
final coreId = Settings.selectedCoreThemeId.value;
|
||||
final gradeId = Settings.selectedGradeThemeId.value;
|
||||
|
||||
final style = styleFor(
|
||||
coreId: coreId,
|
||||
gradeId: gradeId,
|
||||
isLight: isLight,
|
||||
fonts: fonts,
|
||||
);
|
||||
_applyCustomColors(
|
||||
style,
|
||||
isCustomTheme: isCustomTheme,
|
||||
force: forceCustomColors,
|
||||
);
|
||||
return style;
|
||||
}
|
||||
|
||||
void initTheme(AppInitialization data) {
|
||||
final themeCubit = data.themeCubit;
|
||||
|
||||
final brightness =
|
||||
SchedulerBinding.instance.platformDispatcher.platformBrightness;
|
||||
|
||||
appHeadingTextCase = switch (Settings.titleCapitalization.value) {
|
||||
TitleCapitalization.lower => HeadingTextCase.lower,
|
||||
@@ -73,63 +104,241 @@ void initTheme(AppInitialization data) {
|
||||
TitleCapitalization.normal => HeadingTextCase.normal,
|
||||
};
|
||||
|
||||
FirkaStyle baseStyle;
|
||||
final coreId = Settings.selectedCoreThemeId.value;
|
||||
final gradeId = Settings.selectedGradeThemeId.value;
|
||||
switch (Settings.themeBrightness.value) {
|
||||
case ThemeBrightness.light:
|
||||
baseStyle = styleFor(
|
||||
coreId: coreId,
|
||||
gradeId: gradeId,
|
||||
isLight: true,
|
||||
fonts: fonts,
|
||||
);
|
||||
themeCubit.setLightMode(true);
|
||||
break;
|
||||
case ThemeBrightness.dark:
|
||||
baseStyle = styleFor(
|
||||
coreId: coreId,
|
||||
gradeId: gradeId,
|
||||
isLight: false,
|
||||
fonts: fonts,
|
||||
);
|
||||
themeCubit.setLightMode(false);
|
||||
break;
|
||||
case ThemeBrightness.auto:
|
||||
if (brightness == Brightness.dark) {
|
||||
baseStyle = styleFor(
|
||||
coreId: coreId,
|
||||
gradeId: gradeId,
|
||||
isLight: false,
|
||||
fonts: fonts,
|
||||
);
|
||||
themeCubit.setLightMode(false);
|
||||
} else {
|
||||
baseStyle = styleFor(
|
||||
coreId: coreId,
|
||||
gradeId: gradeId,
|
||||
isLight: true,
|
||||
fonts: fonts,
|
||||
);
|
||||
themeCubit.setLightMode(true);
|
||||
}
|
||||
final isLight = switch (Settings.themeBrightness.value) {
|
||||
ThemeBrightness.light => true,
|
||||
ThemeBrightness.dark => false,
|
||||
ThemeBrightness.auto => brightness != Brightness.dark,
|
||||
};
|
||||
themeCubit.setLightMode(isLight);
|
||||
appStyle = buildStyleForBrightness(isLight);
|
||||
}
|
||||
|
||||
void _applyCustomColors(
|
||||
FirkaStyle style, {
|
||||
bool? isCustomTheme,
|
||||
bool force = false,
|
||||
}) {
|
||||
final colors = style.colors;
|
||||
|
||||
colors.grade5 = Settings.customGradeColor5.value.toColorFromHexSetting();
|
||||
colors.grade4 = Settings.customGradeColor4.value.toColorFromHexSetting();
|
||||
colors.grade3 = Settings.customGradeColor3.value.toColorFromHexSetting();
|
||||
colors.grade2 = Settings.customGradeColor2.value.toColorFromHexSetting();
|
||||
colors.grade1 = Settings.customGradeColor1.value.toColorFromHexSetting();
|
||||
|
||||
final customActive =
|
||||
isCustomTheme ?? !isBuiltinThemeId(Settings.selectedThemeId.value);
|
||||
if (!force && !customActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
appStyle = baseStyle;
|
||||
final isLight = style.isLight;
|
||||
|
||||
colors.accent =
|
||||
(isLight
|
||||
? Settings.customAccentColorLight
|
||||
: Settings.customAccentColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
colors.a10p = colors.accent.withAlpha(0x1a);
|
||||
colors.a15p = colors.accent.withAlpha(0x26);
|
||||
|
||||
final bgGrad = (isLight
|
||||
? Settings.customBackgroundGradientLight
|
||||
: Settings.customBackgroundGradientDark)
|
||||
.value
|
||||
.toColorListFromHexSetting();
|
||||
|
||||
if (bgGrad.isNotEmpty) {
|
||||
colors.backgroundGradient = bgGrad;
|
||||
colors.background = bgGrad.first;
|
||||
} else {
|
||||
colors.background =
|
||||
(isLight
|
||||
? Settings.customBackgroundColorLight
|
||||
: Settings.customBackgroundColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
colors.backgroundGradient = null;
|
||||
}
|
||||
colors.background0p = colors.background.withAlpha(0);
|
||||
|
||||
colors.card =
|
||||
(isLight
|
||||
? Settings.customCardColorLight
|
||||
: Settings.customCardColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
colors.cardTranslucent = colors.card.withAlpha(0x80);
|
||||
|
||||
colors.buttonSecondaryFill =
|
||||
(isLight
|
||||
? Settings.customButtonColorLight
|
||||
: Settings.customButtonColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
|
||||
colors.secondary =
|
||||
(isLight
|
||||
? Settings.customSecondaryColorLight
|
||||
: Settings.customSecondaryColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
colors.buttonDisabledIcon = colors.secondary.withAlpha(0x80);
|
||||
|
||||
final customTextLight = Settings.customTextColorLight.value;
|
||||
final customTextDark = Settings.customTextColorDark.value;
|
||||
final isCustomTextLight =
|
||||
customTextLight != SettingsRegistry.customTextColorLight.defaultValue;
|
||||
final isCustomTextDark =
|
||||
customTextDark != SettingsRegistry.customTextColorDark.defaultValue;
|
||||
|
||||
final textLight = customTextLight.toColorFromHexSetting();
|
||||
final textDark = customTextDark.toColorFromHexSetting();
|
||||
colors.textPrimary = isLight ? textLight : textDark;
|
||||
|
||||
final customSecLight = Settings.customTextSecondaryColorLight.value;
|
||||
final customSecDark = Settings.customTextSecondaryColorDark.value;
|
||||
final isCustomSecLight = customSecLight !=
|
||||
SettingsRegistry.customTextSecondaryColorLight.defaultValue;
|
||||
final isCustomSecDark = customSecDark !=
|
||||
SettingsRegistry.customTextSecondaryColorDark.defaultValue;
|
||||
|
||||
colors.textSecondary = isLight
|
||||
? (isCustomSecLight
|
||||
? customSecLight.toColorFromHexSetting()
|
||||
: (isCustomTextLight
|
||||
? textLight.withAlpha(0xCC)
|
||||
: customSecLight.toColorFromHexSetting()))
|
||||
: (isCustomSecDark
|
||||
? customSecDark.toColorFromHexSetting()
|
||||
: (isCustomTextDark
|
||||
? textDark.withAlpha(0xB3)
|
||||
: customSecDark.toColorFromHexSetting()));
|
||||
|
||||
final customTertLight = Settings.customTextTertiaryColorLight.value;
|
||||
final customTertDark = Settings.customTextTertiaryColorDark.value;
|
||||
final isCustomTertLight = customTertLight !=
|
||||
SettingsRegistry.customTextTertiaryColorLight.defaultValue;
|
||||
final isCustomTertDark = customTertDark !=
|
||||
SettingsRegistry.customTextTertiaryColorDark.defaultValue;
|
||||
|
||||
colors.textTertiary = isLight
|
||||
? (isCustomTertLight
|
||||
? customTertLight.toColorFromHexSetting()
|
||||
: (isCustomTextLight
|
||||
? textLight.withAlpha(0x80)
|
||||
: customTertLight.toColorFromHexSetting()))
|
||||
: (isCustomTertDark
|
||||
? customTertDark.toColorFromHexSetting()
|
||||
: (isCustomTextDark
|
||||
? textDark.withAlpha(0x80)
|
||||
: customTertDark.toColorFromHexSetting()));
|
||||
colors.textTeritary = colors.textTertiary;
|
||||
|
||||
colors.textPrimaryLight = textLight;
|
||||
colors.textSecondaryLight = isCustomSecLight
|
||||
? customSecLight.toColorFromHexSetting()
|
||||
: (isCustomTextLight
|
||||
? textLight.withAlpha(0xCC)
|
||||
: customSecLight.toColorFromHexSetting());
|
||||
colors.textTertiaryLight = isCustomTertLight
|
||||
? customTertLight.toColorFromHexSetting()
|
||||
: (isCustomTextLight
|
||||
? textLight.withAlpha(0x80)
|
||||
: customTertLight.toColorFromHexSetting());
|
||||
|
||||
colors.shadowColor =
|
||||
(isLight
|
||||
? Settings.customShadowColorLight
|
||||
: Settings.customShadowColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
|
||||
colors.success =
|
||||
(isLight
|
||||
? Settings.customSuccessColorLight
|
||||
: Settings.customSuccessColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
|
||||
colors.warningAccent =
|
||||
(isLight
|
||||
? Settings.customWarningAccentColorLight
|
||||
: Settings.customWarningAccentColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
colors.warning15p = colors.warningAccent.withAlpha(0x26);
|
||||
|
||||
colors.warningText =
|
||||
(isLight
|
||||
? Settings.customWarningTextColorLight
|
||||
: Settings.customWarningTextColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
|
||||
colors.warningCard =
|
||||
(isLight
|
||||
? Settings.customWarningCardColorLight
|
||||
: Settings.customWarningCardColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
|
||||
colors.errorAccent =
|
||||
(isLight
|
||||
? Settings.customErrorAccentColorLight
|
||||
: Settings.customErrorAccentColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
colors.error15p = colors.errorAccent.withAlpha(0x26);
|
||||
|
||||
colors.errorText =
|
||||
(isLight
|
||||
? Settings.customErrorTextColorLight
|
||||
: Settings.customErrorTextColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
|
||||
colors.errorCard =
|
||||
(isLight
|
||||
? Settings.customErrorCardColorLight
|
||||
: Settings.customErrorCardColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
}
|
||||
|
||||
DateTime? _lastInitDataAt;
|
||||
String? _lastInitDataUsername;
|
||||
|
||||
Future<void> _initData(AppInitialization init) async {
|
||||
await init.settings.loadAll();
|
||||
|
||||
// Old cacheKey scheme could collide across dates; wipe once so stale
|
||||
// rows don't linger until their date range naturally resyncs.
|
||||
if (!Settings.lessonCacheKeyMigrationDone.value) {
|
||||
await isarInit.writeTxn(() async {
|
||||
await isarInit.lessonCacheModels.clear();
|
||||
});
|
||||
await Settings.lessonCacheKeyMigrationDone.set(true);
|
||||
logger.info(
|
||||
"[Init] One-time migration: cleared the lesson cache to drop rows "
|
||||
"keyed under the pre-fix cacheKey scheme",
|
||||
);
|
||||
}
|
||||
|
||||
final selectedThemeId = Settings.selectedThemeId.value;
|
||||
final normalized = normalizeSelectedThemeId(selectedThemeId);
|
||||
if (normalized != selectedThemeId) {
|
||||
await Settings.selectedThemeId.set(normalized);
|
||||
}
|
||||
await initLang(init);
|
||||
await regenerateM3eTheme();
|
||||
initTheme(init);
|
||||
|
||||
var dispatcher = SchedulerBinding.instance.platformDispatcher;
|
||||
|
||||
dispatcher.onPlatformBrightnessChanged = () {
|
||||
dispatcher.onPlatformBrightnessChanged = () async {
|
||||
await regenerateM3eTheme();
|
||||
initTheme(init);
|
||||
};
|
||||
|
||||
@@ -147,6 +356,7 @@ Future<void> _initData(AppInitialization init) async {
|
||||
logger.info(
|
||||
"[Init] System locale changed in auto mode: $previousLocale -> $nextLocale",
|
||||
);
|
||||
await ProgressNotificationService.syncStrings(init.l10n);
|
||||
}
|
||||
init.themeCubit.refresh();
|
||||
}());
|
||||
@@ -158,6 +368,26 @@ Future<void> _initData(AppInitialization init) async {
|
||||
init.client = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// _initData reruns on ordinary resumes too (Android can recreate the
|
||||
// Activity/engine without a real config change), and used to always
|
||||
// build a fresh KretaClient — discarding its in-flight guards and
|
||||
// letting two resumes race. Reuse the client within a short cooldown.
|
||||
const initCooldown = Duration(minutes: 2);
|
||||
final lastInit = _lastInitDataAt;
|
||||
if (init.client != null &&
|
||||
_lastInitDataUsername == token.username &&
|
||||
lastInit != null &&
|
||||
DateTime.now().difference(lastInit) < initCooldown) {
|
||||
logger.info(
|
||||
"[Init] Reusing existing kréta client for ${token.username} "
|
||||
"(resynced within the last ${initCooldown.inMinutes}m)",
|
||||
);
|
||||
return;
|
||||
}
|
||||
_lastInitDataAt = DateTime.now();
|
||||
_lastInitDataUsername = token.username;
|
||||
|
||||
logger.fine("Initializing kréta client as: ${token.username}");
|
||||
init.client = KretaClient(token);
|
||||
|
||||
@@ -166,7 +396,11 @@ Future<void> _initData(AppInitialization init) async {
|
||||
// this the FCM token would only ever get (re-)registered for a user who
|
||||
// explicitly logs out and back in. Safe to call on every startup:
|
||||
// onUserLogin() itself no-ops if notifyAll is off or permission is denied.
|
||||
unawaited(FcmService.onUserLogin(client: init.client!));
|
||||
unawaited(NotificationDeliveryService.onUserLogin(client: init.client!));
|
||||
|
||||
// Immediately refresh widget state from cached Isar lessons so widget is up to date
|
||||
unawaited(WidgetCacheHelper.updateWidgetCacheFromIsar());
|
||||
unawaited(ProgressNotificationService.checkAndStartOnMorning());
|
||||
|
||||
// Don't block first paint on the network: render whatever is already
|
||||
// cached, then stream in student/timetable/grades/etc. as they arrive.
|
||||
@@ -182,6 +416,8 @@ Future<void> _initData(AppInitialization init) async {
|
||||
init.homeRefreshCubit.requestRefresh();
|
||||
|
||||
await init.client!.renewCache(reInit: false);
|
||||
await WidgetCacheHelper.updateWidgetCacheFromIsar();
|
||||
unawaited(ProgressNotificationService.checkAndStartIfActive());
|
||||
init.homeRefreshCubit.requestRefresh();
|
||||
}());
|
||||
|
||||
@@ -239,14 +475,21 @@ Future<void> initializeApp() async {
|
||||
);
|
||||
initData.settings.cubit = initData.settingsCubit;
|
||||
Settings = initData.settings;
|
||||
await Settings.loadAll();
|
||||
registerSettingsEffects(initData.settings, initData);
|
||||
|
||||
try {
|
||||
await FcmService.initialize().timeout(const Duration(seconds: 8));
|
||||
await NotificationDeliveryService.initialize().timeout(
|
||||
const Duration(seconds: 8),
|
||||
);
|
||||
} on TimeoutException catch (e, st) {
|
||||
logger.warning('FcmService init timed out: $e', e, st);
|
||||
logger.warning('NotificationDeliveryService init timed out: $e', e, st);
|
||||
} catch (e, st) {
|
||||
logger.severe('Failed to initialize FcmService: $e', e, st);
|
||||
logger.severe(
|
||||
'Failed to initialize NotificationDeliveryService: $e',
|
||||
e,
|
||||
st,
|
||||
);
|
||||
}
|
||||
|
||||
await _initData(initData);
|
||||
|
||||
@@ -15,7 +15,7 @@ import 'package:firka/core/bloc/settings_cubit.dart';
|
||||
import 'package:firka/core/bloc/theme_cubit.dart';
|
||||
import 'package:firka/core/firka_bundle.dart';
|
||||
import 'package:firka/routing/app_router.dart';
|
||||
import 'package:firka/services/watch_sync_helper.dart';
|
||||
import 'package:firka/services/wear_sync_helper.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:firka/ui/phone/pages/extras/main_wear_pair.dart';
|
||||
import 'package:firka/l10n/app_localizations.dart';
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:firka/l10n/app_localizations.dart';
|
||||
@@ -284,18 +288,48 @@ extension LessonExtension on List<Lesson> {
|
||||
}
|
||||
}
|
||||
|
||||
extension RandomColorExtension on Random {
|
||||
HSVColor nextVividHSVColor() {
|
||||
final hue = nextDouble() * 360;
|
||||
final saturation = 0.55 + nextDouble() * 0.45;
|
||||
final value = 0.7 + nextDouble() * 0.3;
|
||||
return HSVColor.fromAHSV(1.0, hue, saturation, value);
|
||||
}
|
||||
}
|
||||
|
||||
extension ColorHexExtension on Color {
|
||||
String toHexSetting() =>
|
||||
"0x${toARGB32().toRadixString(16).toUpperCase().padLeft(8, '0')}";
|
||||
}
|
||||
|
||||
extension HexSettingExtension on String {
|
||||
Color toColorFromHexSetting() => Color(int.tryParse(this) ?? 0xFFFFFFFF);
|
||||
|
||||
List<Color> toColorListFromHexSetting() {
|
||||
try {
|
||||
final decoded = jsonDecode(this);
|
||||
if (decoded is List) {
|
||||
return decoded
|
||||
.map((e) => e.toString().toColorFromHexSetting())
|
||||
.toList();
|
||||
}
|
||||
} catch (_) {}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
extension ColorListHexExtension on List<Color> {
|
||||
String toHexSettingJson() {
|
||||
return jsonEncode(map((c) => c.toHexSetting()).toList());
|
||||
}
|
||||
}
|
||||
|
||||
extension StringExtension on String {
|
||||
bool isNumeric() {
|
||||
final regex = RegExp(r'^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$');
|
||||
return regex.hasMatch(trim());
|
||||
}
|
||||
|
||||
String firstUpper() {
|
||||
if (isEmpty) return this;
|
||||
if (length == 1) this[0].toUpperCase();
|
||||
return this[0].toUpperCase() + substring(1, length);
|
||||
}
|
||||
|
||||
String shortenName([int start = 0]) {
|
||||
if (length <= 16 || start >= length) {
|
||||
return this;
|
||||
|
||||
@@ -293,6 +293,19 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
SettingsRegistry.notifyAll,
|
||||
always,
|
||||
),
|
||||
SettingsUiBoolean(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.clockSolid,
|
||||
l10n.s_progress_notification,
|
||||
SettingsRegistry.progressNotificationEnabled,
|
||||
isPushNotificationsEnabled,
|
||||
),
|
||||
SettingsUiHeaderSmall(l10n.s_notif_delivery_method_header, isPushNotificationsEnabled),
|
||||
SettingsUiEnum(SettingsRegistry.notificationDeliveryMethod, [
|
||||
l10n.s_notif_delivery_auto,
|
||||
l10n.s_notif_delivery_fcm,
|
||||
l10n.s_notif_delivery_alarm,
|
||||
], isPushNotificationsEnabled),
|
||||
SettingsUiHeaderSmall(l10n.s_notif_wakeup_interval_header, isPushNotificationsEnabled),
|
||||
SettingsUiEnum(SettingsRegistry.notifyWakeupInterval, [
|
||||
l10n.s_notif_wakeup_hourly,
|
||||
|
||||
@@ -5,8 +5,13 @@ import "package:permission_handler/permission_handler.dart";
|
||||
import "package:firka/app/app_state.dart";
|
||||
import "package:firka/app/initialization.dart";
|
||||
import "package:firka/services/fcm_service.dart";
|
||||
import "package:firka/services/watch_sync_helper.dart";
|
||||
import "package:firka/services/notification_delivery_service.dart";
|
||||
import "package:firka/services/progress_notification_service.dart";
|
||||
import "package:firka/services/wear_sync_helper.dart";
|
||||
import "package:firka/ui/phone/screens/themes/builtin_theme_id.dart";
|
||||
import "package:firka_common/ui/theme/core_theme.dart";
|
||||
|
||||
import "package:firka/data/widget.dart";
|
||||
import "settings_repository.dart";
|
||||
import "settings_schema.dart";
|
||||
|
||||
@@ -19,9 +24,14 @@ void registerSettingsEffects(
|
||||
repo.onChange(SettingsRegistry.language, (_) async {
|
||||
await initLang(initData);
|
||||
initData.homeRefreshCubit.requestRefresh();
|
||||
await WidgetCacheHelper.updateWidgetCacheFromIsar();
|
||||
await ProgressNotificationService.syncStrings(initData.l10n);
|
||||
});
|
||||
|
||||
repo.onChange(SettingsRegistry.themeBrightness, (_) async {
|
||||
if (Settings.selectedCoreThemeId.value == "m3e") {
|
||||
await regenerateM3eTheme();
|
||||
}
|
||||
initTheme(initData);
|
||||
initData.themeCubit.refresh();
|
||||
initData.homeRefreshCubit.requestRefresh();
|
||||
@@ -37,6 +47,78 @@ void registerSettingsEffects(
|
||||
repo.onChange(SettingsRegistry.titleWeight, refreshTitleStyle);
|
||||
repo.onChange(SettingsRegistry.titleCapitalization, refreshTitleStyle);
|
||||
|
||||
Future<void> refreshPresetTheme(_) async {
|
||||
if (Settings.selectedCoreThemeId.value == "m3e") {
|
||||
await regenerateM3eTheme();
|
||||
}
|
||||
if (isBuiltinThemeId(Settings.selectedThemeId.value)) {
|
||||
final next = composeBuiltinThemeId(
|
||||
Settings.selectedCoreThemeId.value,
|
||||
Settings.selectedGradeThemeId.value,
|
||||
);
|
||||
if (next != Settings.selectedThemeId.value) {
|
||||
await Settings.selectedThemeId.setSilently(next);
|
||||
}
|
||||
}
|
||||
initTheme(initData);
|
||||
initData.themeCubit.refresh();
|
||||
initData.homeRefreshCubit.requestRefresh();
|
||||
}
|
||||
|
||||
repo.onChange(SettingsRegistry.selectedCoreThemeId, refreshPresetTheme);
|
||||
repo.onChange(SettingsRegistry.selectedGradeThemeId, refreshPresetTheme);
|
||||
repo.onChange(SettingsRegistry.selectedThemeId, refreshPresetTheme);
|
||||
|
||||
Future<void> refreshCustomColors(_) async {
|
||||
initTheme(initData);
|
||||
initData.themeCubit.refresh();
|
||||
initData.homeRefreshCubit.requestRefresh();
|
||||
}
|
||||
|
||||
for (final setting in [
|
||||
SettingsRegistry.customGradeColor5,
|
||||
SettingsRegistry.customGradeColor4,
|
||||
SettingsRegistry.customGradeColor3,
|
||||
SettingsRegistry.customGradeColor2,
|
||||
SettingsRegistry.customGradeColor1,
|
||||
SettingsRegistry.customAccentColorLight,
|
||||
SettingsRegistry.customAccentColorDark,
|
||||
SettingsRegistry.customBackgroundColorLight,
|
||||
SettingsRegistry.customBackgroundColorDark,
|
||||
SettingsRegistry.customCardColorLight,
|
||||
SettingsRegistry.customCardColorDark,
|
||||
SettingsRegistry.customButtonColorLight,
|
||||
SettingsRegistry.customButtonColorDark,
|
||||
SettingsRegistry.customSecondaryColorLight,
|
||||
SettingsRegistry.customSecondaryColorDark,
|
||||
SettingsRegistry.customTextColorLight,
|
||||
SettingsRegistry.customTextColorDark,
|
||||
SettingsRegistry.customTextSecondaryColorLight,
|
||||
SettingsRegistry.customTextSecondaryColorDark,
|
||||
SettingsRegistry.customTextTertiaryColorLight,
|
||||
SettingsRegistry.customTextTertiaryColorDark,
|
||||
SettingsRegistry.customShadowColorLight,
|
||||
SettingsRegistry.customShadowColorDark,
|
||||
SettingsRegistry.customSuccessColorLight,
|
||||
SettingsRegistry.customSuccessColorDark,
|
||||
SettingsRegistry.customWarningAccentColorLight,
|
||||
SettingsRegistry.customWarningAccentColorDark,
|
||||
SettingsRegistry.customWarningTextColorLight,
|
||||
SettingsRegistry.customWarningTextColorDark,
|
||||
SettingsRegistry.customWarningCardColorLight,
|
||||
SettingsRegistry.customWarningCardColorDark,
|
||||
SettingsRegistry.customErrorAccentColorLight,
|
||||
SettingsRegistry.customErrorAccentColorDark,
|
||||
SettingsRegistry.customErrorTextColorLight,
|
||||
SettingsRegistry.customErrorTextColorDark,
|
||||
SettingsRegistry.customErrorCardColorLight,
|
||||
SettingsRegistry.customErrorCardColorDark,
|
||||
SettingsRegistry.customBackgroundGradientLight,
|
||||
SettingsRegistry.customBackgroundGradientDark,
|
||||
]) {
|
||||
repo.onChange(setting, refreshCustomColors);
|
||||
}
|
||||
|
||||
repo.onChange(SettingsRegistry.wearOsSupport, (enabled) async {
|
||||
if (!Platform.isAndroid) return;
|
||||
if (enabled && initDone) {
|
||||
@@ -53,12 +135,21 @@ void registerSettingsEffects(
|
||||
}
|
||||
});
|
||||
|
||||
repo.onChange(SettingsRegistry.notifyAll, (enabled) async {
|
||||
await FcmService.handleEnabledChange(enabled);
|
||||
repo.onChange(SettingsRegistry.notifyAll, (_) async {
|
||||
await NotificationDeliveryService.syncDeliveryBackend();
|
||||
await ProgressNotificationService.sync();
|
||||
});
|
||||
|
||||
repo.onChange(SettingsRegistry.notificationDeliveryMethod, (_) async {
|
||||
await NotificationDeliveryService.syncDeliveryBackend();
|
||||
});
|
||||
|
||||
repo.onChange(SettingsRegistry.progressNotificationEnabled, (_) async {
|
||||
await ProgressNotificationService.sync();
|
||||
});
|
||||
|
||||
repo.onChange(SettingsRegistry.notifyWakeupInterval, (_) async {
|
||||
await FcmService.handleWakeupIntervalChange();
|
||||
await NotificationDeliveryService.handleWakeupIntervalChange();
|
||||
});
|
||||
|
||||
for (final setting in [
|
||||
|
||||
@@ -24,6 +24,8 @@ enum TitleCapitalization { lower, normal, upper }
|
||||
/// `wakeup-2hourly` sent by the `fcm-notifier` backend service.
|
||||
enum NotifyWakeupInterval { hourly, twoHourly }
|
||||
|
||||
enum NotificationDeliveryMethod { auto, fcm, alarm }
|
||||
|
||||
abstract class SettingsSchema {
|
||||
@DoubleSetting(id: 1001, defaultValue: 0, min: 0, max: 120)
|
||||
double get bellDelay;
|
||||
@@ -177,4 +179,146 @@ abstract class SettingsSchema {
|
||||
|
||||
@BoolSetting(id: 1046, defaultValue: false)
|
||||
bool get fcmDebugNotifyOnMessage;
|
||||
|
||||
@EnumSetting(
|
||||
id: 1047,
|
||||
defaultValue: NotificationDeliveryMethod.auto,
|
||||
values: NotificationDeliveryMethod.values,
|
||||
)
|
||||
NotificationDeliveryMethod get notificationDeliveryMethod;
|
||||
|
||||
// Gates a one-time lesson cache wipe to drop rows keyed under the old,
|
||||
// colliding cacheKey scheme (see LessonCacheModel.cacheKey history).
|
||||
@BoolSetting(id: 1048, defaultValue: false)
|
||||
bool get lessonCacheKeyMigrationDone;
|
||||
|
||||
@BoolSetting(id: 1049, defaultValue: false)
|
||||
bool get progressNotificationEnabled;
|
||||
|
||||
// Custom grade colors stored as 0xAARRGGBB hex strings.
|
||||
// Defaults match the firka grade theme.
|
||||
@StringSetting(id: 1050, defaultValue: "0xFF22CCAD")
|
||||
String get customGradeColor5;
|
||||
|
||||
@StringSetting(id: 1051, defaultValue: "0xFF92EA3B")
|
||||
String get customGradeColor4;
|
||||
|
||||
@StringSetting(id: 1052, defaultValue: "0xFFF9CF00")
|
||||
String get customGradeColor3;
|
||||
|
||||
@StringSetting(id: 1053, defaultValue: "0xFFFFA046")
|
||||
String get customGradeColor2;
|
||||
|
||||
@StringSetting(id: 1054, defaultValue: "0xFFFF54A1")
|
||||
String get customGradeColor1;
|
||||
|
||||
// Custom theme colors stored as 0xAARRGGBB hex strings.
|
||||
// Defaults match the firka core theme.
|
||||
@StringSetting(id: 1055, defaultValue: "0xFFA7DC22")
|
||||
String get customAccentColorLight;
|
||||
|
||||
@StringSetting(id: 1056, defaultValue: "0xFFA7DC22")
|
||||
String get customAccentColorDark;
|
||||
|
||||
@StringSetting(id: 1057, defaultValue: "0xFFFAFFF0")
|
||||
String get customBackgroundColorLight;
|
||||
|
||||
@StringSetting(id: 1058, defaultValue: "0xFF0D1202")
|
||||
String get customBackgroundColorDark;
|
||||
|
||||
@StringSetting(id: 1059, defaultValue: "0xFFF3FBDE")
|
||||
String get customCardColorLight;
|
||||
|
||||
@StringSetting(id: 1060, defaultValue: "0xFF141905")
|
||||
String get customCardColorDark;
|
||||
|
||||
@StringSetting(id: 1061, defaultValue: "0xFFFEFFFD")
|
||||
String get customButtonColorLight;
|
||||
|
||||
@StringSetting(id: 1062, defaultValue: "0xFF20290B")
|
||||
String get customButtonColorDark;
|
||||
|
||||
@StringSetting(id: 1063, defaultValue: "0xFF6E8F1B")
|
||||
String get customSecondaryColorLight;
|
||||
|
||||
@StringSetting(id: 1064, defaultValue: "0xFFCBEE71")
|
||||
String get customSecondaryColorDark;
|
||||
|
||||
@StringSetting(id: 1065, defaultValue: "0xFF394C0A")
|
||||
String get customTextColorLight;
|
||||
|
||||
@StringSetting(id: 1066, defaultValue: "0xFFEAF7CC")
|
||||
String get customTextColorDark;
|
||||
|
||||
@StringSetting(id: 1067, defaultValue: "0xCC394C0A")
|
||||
String get customTextSecondaryColorLight;
|
||||
|
||||
@StringSetting(id: 1068, defaultValue: "0xB3EAF7CC")
|
||||
String get customTextSecondaryColorDark;
|
||||
|
||||
@StringSetting(id: 1069, defaultValue: "0x80394C0A")
|
||||
String get customTextTertiaryColorLight;
|
||||
|
||||
@StringSetting(id: 1070, defaultValue: "0x80EAF7CC")
|
||||
String get customTextTertiaryColorDark;
|
||||
|
||||
@StringSetting(id: 1071, defaultValue: "0x33647E22")
|
||||
String get customShadowColorLight;
|
||||
|
||||
@StringSetting(id: 1072, defaultValue: "0x26CBEE71")
|
||||
String get customShadowColorDark;
|
||||
|
||||
@StringSetting(id: 1073, defaultValue: "0xFF92EA3B")
|
||||
String get customSuccessColorLight;
|
||||
|
||||
@StringSetting(id: 1074, defaultValue: "0xFF92EA3B")
|
||||
String get customSuccessColorDark;
|
||||
|
||||
@StringSetting(id: 1075, defaultValue: "0xFFFFA046")
|
||||
String get customWarningAccentColorLight;
|
||||
|
||||
@StringSetting(id: 1076, defaultValue: "0xFFFFA046")
|
||||
String get customWarningAccentColorDark;
|
||||
|
||||
@StringSetting(id: 1077, defaultValue: "0xFF8F531B")
|
||||
String get customWarningTextColorLight;
|
||||
|
||||
@StringSetting(id: 1078, defaultValue: "0xFFF0B37A")
|
||||
String get customWarningTextColorDark;
|
||||
|
||||
@StringSetting(id: 1079, defaultValue: "0xFFFAEBDC")
|
||||
String get customWarningCardColorLight;
|
||||
|
||||
@StringSetting(id: 1080, defaultValue: "0xFF201203")
|
||||
String get customWarningCardColorDark;
|
||||
|
||||
@StringSetting(id: 1081, defaultValue: "0xFFFF54A1")
|
||||
String get customErrorAccentColorLight;
|
||||
|
||||
@StringSetting(id: 1082, defaultValue: "0xFFFF54A1")
|
||||
String get customErrorAccentColorDark;
|
||||
|
||||
@StringSetting(id: 1083, defaultValue: "0xFF8F1B4F")
|
||||
String get customErrorTextColorLight;
|
||||
|
||||
@StringSetting(id: 1084, defaultValue: "0xFFF59EC5")
|
||||
String get customErrorTextColorDark;
|
||||
|
||||
@StringSetting(id: 1085, defaultValue: "0xFFFADCE9")
|
||||
String get customErrorCardColorLight;
|
||||
|
||||
@StringSetting(id: 1086, defaultValue: "0xFF1E030F")
|
||||
String get customErrorCardColorDark;
|
||||
|
||||
@StringSetting(
|
||||
id: 1087,
|
||||
defaultValue: "[\"0xFFFAFFF0\",\"0xFFE8F7C8\"]",
|
||||
)
|
||||
String get customBackgroundGradientLight;
|
||||
|
||||
@StringSetting(
|
||||
id: 1088,
|
||||
defaultValue: "[\"0xFF0D1202\",\"0xFF1A2405\"]",
|
||||
)
|
||||
String get customBackgroundGradientDark;
|
||||
}
|
||||
|
||||
@@ -44,9 +44,51 @@ class SettingsRegistry {
|
||||
static const notifyMutedSubjects = StringSetting(id: 1044, defaultValue: "[]");
|
||||
static const notifyWakeupInterval = EnumSetting(id: 1045, defaultValue: NotifyWakeupInterval.hourly, values: NotifyWakeupInterval.values);
|
||||
static const fcmDebugNotifyOnMessage = BoolSetting(id: 1046, defaultValue: false);
|
||||
static const notificationDeliveryMethod = EnumSetting(id: 1047, defaultValue: NotificationDeliveryMethod.auto, values: NotificationDeliveryMethod.values);
|
||||
static const lessonCacheKeyMigrationDone = BoolSetting(id: 1048, defaultValue: false);
|
||||
static const progressNotificationEnabled = BoolSetting(id: 1049, defaultValue: false);
|
||||
static const customGradeColor5 = StringSetting(id: 1050, defaultValue: "0xFF22CCAD");
|
||||
static const customGradeColor4 = StringSetting(id: 1051, defaultValue: "0xFF92EA3B");
|
||||
static const customGradeColor3 = StringSetting(id: 1052, defaultValue: "0xFFF9CF00");
|
||||
static const customGradeColor2 = StringSetting(id: 1053, defaultValue: "0xFFFFA046");
|
||||
static const customGradeColor1 = StringSetting(id: 1054, defaultValue: "0xFFFF54A1");
|
||||
static const customAccentColorLight = StringSetting(id: 1055, defaultValue: "0xFFA7DC22");
|
||||
static const customAccentColorDark = StringSetting(id: 1056, defaultValue: "0xFFA7DC22");
|
||||
static const customBackgroundColorLight = StringSetting(id: 1057, defaultValue: "0xFFFAFFF0");
|
||||
static const customBackgroundColorDark = StringSetting(id: 1058, defaultValue: "0xFF0D1202");
|
||||
static const customCardColorLight = StringSetting(id: 1059, defaultValue: "0xFFF3FBDE");
|
||||
static const customCardColorDark = StringSetting(id: 1060, defaultValue: "0xFF141905");
|
||||
static const customButtonColorLight = StringSetting(id: 1061, defaultValue: "0xFFFEFFFD");
|
||||
static const customButtonColorDark = StringSetting(id: 1062, defaultValue: "0xFF20290B");
|
||||
static const customSecondaryColorLight = StringSetting(id: 1063, defaultValue: "0xFF6E8F1B");
|
||||
static const customSecondaryColorDark = StringSetting(id: 1064, defaultValue: "0xFFCBEE71");
|
||||
static const customTextColorLight = StringSetting(id: 1065, defaultValue: "0xFF394C0A");
|
||||
static const customTextColorDark = StringSetting(id: 1066, defaultValue: "0xFFEAF7CC");
|
||||
static const customTextSecondaryColorLight = StringSetting(id: 1067, defaultValue: "0xCC394C0A");
|
||||
static const customTextSecondaryColorDark = StringSetting(id: 1068, defaultValue: "0xB3EAF7CC");
|
||||
static const customTextTertiaryColorLight = StringSetting(id: 1069, defaultValue: "0x80394C0A");
|
||||
static const customTextTertiaryColorDark = StringSetting(id: 1070, defaultValue: "0x80EAF7CC");
|
||||
static const customShadowColorLight = StringSetting(id: 1071, defaultValue: "0x33647E22");
|
||||
static const customShadowColorDark = StringSetting(id: 1072, defaultValue: "0x26CBEE71");
|
||||
static const customSuccessColorLight = StringSetting(id: 1073, defaultValue: "0xFF92EA3B");
|
||||
static const customSuccessColorDark = StringSetting(id: 1074, defaultValue: "0xFF92EA3B");
|
||||
static const customWarningAccentColorLight = StringSetting(id: 1075, defaultValue: "0xFFFFA046");
|
||||
static const customWarningAccentColorDark = StringSetting(id: 1076, defaultValue: "0xFFFFA046");
|
||||
static const customWarningTextColorLight = StringSetting(id: 1077, defaultValue: "0xFF8F531B");
|
||||
static const customWarningTextColorDark = StringSetting(id: 1078, defaultValue: "0xFFF0B37A");
|
||||
static const customWarningCardColorLight = StringSetting(id: 1079, defaultValue: "0xFFFAEBDC");
|
||||
static const customWarningCardColorDark = StringSetting(id: 1080, defaultValue: "0xFF201203");
|
||||
static const customErrorAccentColorLight = StringSetting(id: 1081, defaultValue: "0xFFFF54A1");
|
||||
static const customErrorAccentColorDark = StringSetting(id: 1082, defaultValue: "0xFFFF54A1");
|
||||
static const customErrorTextColorLight = StringSetting(id: 1083, defaultValue: "0xFF8F1B4F");
|
||||
static const customErrorTextColorDark = StringSetting(id: 1084, defaultValue: "0xFFF59EC5");
|
||||
static const customErrorCardColorLight = StringSetting(id: 1085, defaultValue: "0xFFFADCE9");
|
||||
static const customErrorCardColorDark = StringSetting(id: 1086, defaultValue: "0xFF1E030F");
|
||||
static const customBackgroundGradientLight = StringSetting(id: 1087, defaultValue: "[\"0xFFFAFFF0\",\"0xFFE8F7C8\"]");
|
||||
static const customBackgroundGradientDark = StringSetting(id: 1088, defaultValue: "[\"0xFF0D1202\",\"0xFF1A2405\"]");
|
||||
|
||||
static const all = <Setting>[
|
||||
bellDelay, rounding1, rounding2, rounding3, rounding4, classAvgOnGraph, leftHandedMode, language, appIcon, childProtection, betaWarning, ttToastLessonNo, ttToastTestsAndHw, ttToastBreaks, statsForNerds, developerOptsEnabled, themeBrightness, ttToastSubstitution, ttToastABTimetable, wearOsSupport, titleFont, titleWeight, titleCapitalization, selectedThemeId, selectedCoreThemeId, selectedGradeThemeId, mockBackendEnabled, mockBackendUrl, lastSeen, surpriseGrades, seasonalAppIcons, uwuMode, notifyAll, notifyGrades, notifyHomeworkTests, notifyAbsences, notifyLessons, notifyMessages, notifyMutedSubjects, notifyWakeupInterval, fcmDebugNotifyOnMessage,
|
||||
bellDelay, rounding1, rounding2, rounding3, rounding4, classAvgOnGraph, leftHandedMode, language, appIcon, childProtection, betaWarning, ttToastLessonNo, ttToastTestsAndHw, ttToastBreaks, statsForNerds, developerOptsEnabled, themeBrightness, ttToastSubstitution, ttToastABTimetable, wearOsSupport, titleFont, titleWeight, titleCapitalization, selectedThemeId, selectedCoreThemeId, selectedGradeThemeId, mockBackendEnabled, mockBackendUrl, lastSeen, surpriseGrades, seasonalAppIcons, uwuMode, notifyAll, notifyGrades, notifyHomeworkTests, notifyAbsences, notifyLessons, notifyMessages, notifyMutedSubjects, notifyWakeupInterval, fcmDebugNotifyOnMessage, notificationDeliveryMethod, lessonCacheKeyMigrationDone, progressNotificationEnabled, customGradeColor5, customGradeColor4, customGradeColor3, customGradeColor2, customGradeColor1, customAccentColorLight, customAccentColorDark, customBackgroundColorLight, customBackgroundColorDark, customCardColorLight, customCardColorDark, customButtonColorLight, customButtonColorDark, customSecondaryColorLight, customSecondaryColorDark, customTextColorLight, customTextColorDark, customTextSecondaryColorLight, customTextSecondaryColorDark, customTextTertiaryColorLight, customTextTertiaryColorDark, customShadowColorLight, customShadowColorDark, customSuccessColorLight, customSuccessColorDark, customWarningAccentColorLight, customWarningAccentColorDark, customWarningTextColorLight, customWarningTextColorDark, customWarningCardColorLight, customWarningCardColorDark, customErrorAccentColorLight, customErrorAccentColorDark, customErrorTextColorLight, customErrorTextColorDark, customErrorCardColorLight, customErrorCardColorDark, customBackgroundGradientLight, customBackgroundGradientDark,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -92,4 +134,46 @@ extension SettingsAccessors on SettingsRepository {
|
||||
SilentlySettable<String> get notifyMutedSubjects => SilentlySettable(this, SettingsRegistry.notifyMutedSubjects);
|
||||
SilentlySettable<NotifyWakeupInterval> get notifyWakeupInterval => SilentlySettable(this, SettingsRegistry.notifyWakeupInterval);
|
||||
SilentlySettable<bool> get fcmDebugNotifyOnMessage => SilentlySettable(this, SettingsRegistry.fcmDebugNotifyOnMessage);
|
||||
SilentlySettable<NotificationDeliveryMethod> get notificationDeliveryMethod => SilentlySettable(this, SettingsRegistry.notificationDeliveryMethod);
|
||||
SilentlySettable<bool> get lessonCacheKeyMigrationDone => SilentlySettable(this, SettingsRegistry.lessonCacheKeyMigrationDone);
|
||||
SilentlySettable<bool> get progressNotificationEnabled => SilentlySettable(this, SettingsRegistry.progressNotificationEnabled);
|
||||
SilentlySettable<String> get customGradeColor5 => SilentlySettable(this, SettingsRegistry.customGradeColor5);
|
||||
SilentlySettable<String> get customGradeColor4 => SilentlySettable(this, SettingsRegistry.customGradeColor4);
|
||||
SilentlySettable<String> get customGradeColor3 => SilentlySettable(this, SettingsRegistry.customGradeColor3);
|
||||
SilentlySettable<String> get customGradeColor2 => SilentlySettable(this, SettingsRegistry.customGradeColor2);
|
||||
SilentlySettable<String> get customGradeColor1 => SilentlySettable(this, SettingsRegistry.customGradeColor1);
|
||||
SilentlySettable<String> get customAccentColorLight => SilentlySettable(this, SettingsRegistry.customAccentColorLight);
|
||||
SilentlySettable<String> get customAccentColorDark => SilentlySettable(this, SettingsRegistry.customAccentColorDark);
|
||||
SilentlySettable<String> get customBackgroundColorLight => SilentlySettable(this, SettingsRegistry.customBackgroundColorLight);
|
||||
SilentlySettable<String> get customBackgroundColorDark => SilentlySettable(this, SettingsRegistry.customBackgroundColorDark);
|
||||
SilentlySettable<String> get customCardColorLight => SilentlySettable(this, SettingsRegistry.customCardColorLight);
|
||||
SilentlySettable<String> get customCardColorDark => SilentlySettable(this, SettingsRegistry.customCardColorDark);
|
||||
SilentlySettable<String> get customButtonColorLight => SilentlySettable(this, SettingsRegistry.customButtonColorLight);
|
||||
SilentlySettable<String> get customButtonColorDark => SilentlySettable(this, SettingsRegistry.customButtonColorDark);
|
||||
SilentlySettable<String> get customSecondaryColorLight => SilentlySettable(this, SettingsRegistry.customSecondaryColorLight);
|
||||
SilentlySettable<String> get customSecondaryColorDark => SilentlySettable(this, SettingsRegistry.customSecondaryColorDark);
|
||||
SilentlySettable<String> get customTextColorLight => SilentlySettable(this, SettingsRegistry.customTextColorLight);
|
||||
SilentlySettable<String> get customTextColorDark => SilentlySettable(this, SettingsRegistry.customTextColorDark);
|
||||
SilentlySettable<String> get customTextSecondaryColorLight => SilentlySettable(this, SettingsRegistry.customTextSecondaryColorLight);
|
||||
SilentlySettable<String> get customTextSecondaryColorDark => SilentlySettable(this, SettingsRegistry.customTextSecondaryColorDark);
|
||||
SilentlySettable<String> get customTextTertiaryColorLight => SilentlySettable(this, SettingsRegistry.customTextTertiaryColorLight);
|
||||
SilentlySettable<String> get customTextTertiaryColorDark => SilentlySettable(this, SettingsRegistry.customTextTertiaryColorDark);
|
||||
SilentlySettable<String> get customShadowColorLight => SilentlySettable(this, SettingsRegistry.customShadowColorLight);
|
||||
SilentlySettable<String> get customShadowColorDark => SilentlySettable(this, SettingsRegistry.customShadowColorDark);
|
||||
SilentlySettable<String> get customSuccessColorLight => SilentlySettable(this, SettingsRegistry.customSuccessColorLight);
|
||||
SilentlySettable<String> get customSuccessColorDark => SilentlySettable(this, SettingsRegistry.customSuccessColorDark);
|
||||
SilentlySettable<String> get customWarningAccentColorLight => SilentlySettable(this, SettingsRegistry.customWarningAccentColorLight);
|
||||
SilentlySettable<String> get customWarningAccentColorDark => SilentlySettable(this, SettingsRegistry.customWarningAccentColorDark);
|
||||
SilentlySettable<String> get customWarningTextColorLight => SilentlySettable(this, SettingsRegistry.customWarningTextColorLight);
|
||||
SilentlySettable<String> get customWarningTextColorDark => SilentlySettable(this, SettingsRegistry.customWarningTextColorDark);
|
||||
SilentlySettable<String> get customWarningCardColorLight => SilentlySettable(this, SettingsRegistry.customWarningCardColorLight);
|
||||
SilentlySettable<String> get customWarningCardColorDark => SilentlySettable(this, SettingsRegistry.customWarningCardColorDark);
|
||||
SilentlySettable<String> get customErrorAccentColorLight => SilentlySettable(this, SettingsRegistry.customErrorAccentColorLight);
|
||||
SilentlySettable<String> get customErrorAccentColorDark => SilentlySettable(this, SettingsRegistry.customErrorAccentColorDark);
|
||||
SilentlySettable<String> get customErrorTextColorLight => SilentlySettable(this, SettingsRegistry.customErrorTextColorLight);
|
||||
SilentlySettable<String> get customErrorTextColorDark => SilentlySettable(this, SettingsRegistry.customErrorTextColorDark);
|
||||
SilentlySettable<String> get customErrorCardColorLight => SilentlySettable(this, SettingsRegistry.customErrorCardColorLight);
|
||||
SilentlySettable<String> get customErrorCardColorDark => SilentlySettable(this, SettingsRegistry.customErrorCardColorDark);
|
||||
SilentlySettable<String> get customBackgroundGradientLight => SilentlySettable(this, SettingsRegistry.customBackgroundGradientLight);
|
||||
SilentlySettable<String> get customBackgroundGradientDark => SilentlySettable(this, SettingsRegistry.customBackgroundGradientDark);
|
||||
}
|
||||
|
||||
@@ -1,23 +1,70 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:firka/api/client/kreta_client.dart';
|
||||
import 'package:firka_common/data/database.dart';
|
||||
import 'package:firka_common/data/models/lesson_cache_model.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:home_widget/home_widget.dart';
|
||||
import 'package:isar_community/isar.dart';
|
||||
import 'package:kreta_api/kreta_api.dart';
|
||||
import 'package:firka/core/debug_helper.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
import 'package:firka_common/core/icon_helper.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
|
||||
class WidgetCacheHelper {
|
||||
static Map<String, dynamic> toJson(
|
||||
FirkaStyle style,
|
||||
List<LessonCacheModel> timetable,
|
||||
) {
|
||||
List<Map<String, dynamic>> timetableJson = [];
|
||||
static Map<String, dynamic> lessonToJson(LessonCacheModel lesson) {
|
||||
return {
|
||||
'name': lesson.name,
|
||||
'start': lesson.start.toIso8601String(),
|
||||
'end': lesson.end.toIso8601String(),
|
||||
'dailyNth': lesson.dailyNth,
|
||||
'yearlyNth': lesson.yearlyNth,
|
||||
'roomName': lesson.roomName,
|
||||
'substituteTeacher': lesson.substituteTeacher,
|
||||
'teacher': lesson.teacher,
|
||||
'topic': lesson.topic,
|
||||
'state': lesson.state,
|
||||
'type': lesson.type,
|
||||
'icon': getIconTypeByName(lesson.name)?.name,
|
||||
// Backward-compatibility aliases for legacy receivers
|
||||
'Nev': lesson.name,
|
||||
'KezdetIdopont': lesson.start.toIso8601String(),
|
||||
'VegIdopont': lesson.end.toIso8601String(),
|
||||
'Oraszam': lesson.dailyNth,
|
||||
'TeremNeve': lesson.roomName,
|
||||
'HelyettesTanarNeve': lesson.substituteTeacher,
|
||||
};
|
||||
}
|
||||
|
||||
return {'colors': _colorsMap(style), 'timetable': timetableJson};
|
||||
static Map<String, dynamic> toJson(
|
||||
FirkaStyle? style,
|
||||
List<LessonCacheModel> timetable, {
|
||||
Map<String, dynamic>? existingColors,
|
||||
}) {
|
||||
final timetableJson = timetable.map(lessonToJson).toList();
|
||||
final colors = style != null
|
||||
? _colorsMap(style)
|
||||
: (existingColors ?? _defaultColors());
|
||||
String? languageCode;
|
||||
try {
|
||||
final lang = Settings.language.value;
|
||||
languageCode = lang == AppLanguage.auto
|
||||
? ui.PlatformDispatcher.instance.locale.languageCode
|
||||
: lang.name;
|
||||
} catch (_) {}
|
||||
return {
|
||||
'colors': colors,
|
||||
'timetable': timetableJson,
|
||||
if (languageCode != null) 'language': languageCode,
|
||||
};
|
||||
}
|
||||
|
||||
static Map<String, dynamic> toAndroidWidgetJson(
|
||||
@@ -27,6 +74,12 @@ class WidgetCacheHelper {
|
||||
final timetableJson = <Map<String, dynamic>>[];
|
||||
for (var lesson in timetable) {
|
||||
timetableJson.add({
|
||||
'name': lesson.name,
|
||||
'start': lesson.start.toUtc().toIso8601String(),
|
||||
'end': lesson.end.toUtc().toIso8601String(),
|
||||
'dailyNth': lesson.lessonNumber,
|
||||
'roomName': lesson.roomName,
|
||||
'substituteTeacher': lesson.substituteTeacher,
|
||||
'Nev': lesson.name,
|
||||
'KezdetIdopont': lesson.start.toUtc().toIso8601String(),
|
||||
'VegIdopont': lesson.end.toUtc().toIso8601String(),
|
||||
@@ -38,6 +91,38 @@ class WidgetCacheHelper {
|
||||
return {'colors': _colorsMap(style), 'timetable': timetableJson};
|
||||
}
|
||||
|
||||
static Map<String, dynamic> _defaultColors() {
|
||||
return {
|
||||
'background': 0xFFFAFFF0,
|
||||
'backgroundAmoled': 0xFF000000,
|
||||
'background0p': 0x00000000,
|
||||
'success': 0xFF2E7D32,
|
||||
'textPrimary': 0xFF1B1C18,
|
||||
'textSecondary': 0xFF45483D,
|
||||
'textTertiary': 0xFF76786B,
|
||||
'card': 0xFFEFF4E3,
|
||||
'cardTranslucent': 0xDDEFF4E3,
|
||||
'buttonSecondaryFill': 0xFFE0E5D4,
|
||||
'accent': 0xFF4C662B,
|
||||
'secondary': 0xFF586249,
|
||||
'shadowColor': 0x1A000000,
|
||||
'a15p': 0x264C662B,
|
||||
'warningAccent': 0xFFE65100,
|
||||
'warningText': 0xFFBF360C,
|
||||
'warning15p': 0x26E65100,
|
||||
'warningCard': 0xFFFFE0B2,
|
||||
'errorAccent': 0xFFBA1A1A,
|
||||
'errorText': 0xFFBA1A1A,
|
||||
'error15p': 0x26BA1A1A,
|
||||
'errorCard': 0xFFFFDAD6,
|
||||
'grade5': 0xFF4C662B,
|
||||
'grade4': 0xFF688837,
|
||||
'grade3': 0xFFE6A000,
|
||||
'grade2': 0xFFE66A00,
|
||||
'grade1': 0xFFBA1A1A,
|
||||
};
|
||||
}
|
||||
|
||||
static Map<String, dynamic> _colorsMap(FirkaStyle style) {
|
||||
return {
|
||||
'background': style.colors.background.toARGB32(),
|
||||
@@ -70,23 +155,84 @@ class WidgetCacheHelper {
|
||||
};
|
||||
}
|
||||
|
||||
static Future<void> refreshWidget() async {
|
||||
if (!Platform.isAndroid) return;
|
||||
try {
|
||||
await HomeWidget.updateWidget(
|
||||
name: 'TimetableWidget',
|
||||
qualifiedAndroidName: 'app.firka.naplo.glance.TimetableWidgetReceiver',
|
||||
);
|
||||
try {
|
||||
const channel = MethodChannel("firka.app/main");
|
||||
await channel.invokeMethod<void>('refreshTimetableWidget');
|
||||
} catch (_) {}
|
||||
} catch (e) {
|
||||
debugPrint('Error refreshing timetable widget: $e');
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> updateWidgetCacheFromLessons(
|
||||
List<LessonCacheModel> lessons, {
|
||||
FirkaStyle? style,
|
||||
String? displayDate,
|
||||
}) async {
|
||||
final dataDir = await getApplicationDocumentsDirectory();
|
||||
final widgetFile = File(p.join(dataDir.path, "widget_state.json"));
|
||||
|
||||
Map<String, dynamic>? existingColors;
|
||||
if (style == null && await widgetFile.exists()) {
|
||||
try {
|
||||
final content = jsonDecode(await widgetFile.readAsString());
|
||||
if (content is Map && content['colors'] is Map) {
|
||||
existingColors = Map<String, dynamic>.from(content['colors']);
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
final data = toJson(style, lessons, existingColors: existingColors);
|
||||
if (displayDate != null) {
|
||||
data['displayDate'] = displayDate;
|
||||
}
|
||||
|
||||
await widgetFile.writeAsString(jsonEncode(data));
|
||||
await refreshWidget();
|
||||
}
|
||||
|
||||
static Future<void> updateWidgetCacheFromIsar({
|
||||
FirkaStyle? style,
|
||||
String? displayDate,
|
||||
}) async {
|
||||
try {
|
||||
final now = timeNow();
|
||||
final start = now.subtract(const Duration(days: 7));
|
||||
final end = now.add(const Duration(days: 14));
|
||||
var lessons = await isarInit.lessonCacheModels
|
||||
.filter()
|
||||
.startBetween(start, end)
|
||||
.sortByStart()
|
||||
.findAll();
|
||||
if (lessons.isEmpty) {
|
||||
lessons = await isarInit.lessonCacheModels.where().sortByStart().findAll();
|
||||
}
|
||||
await updateWidgetCacheFromLessons(
|
||||
lessons,
|
||||
style: style,
|
||||
displayDate: displayDate,
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint('Error updating widget cache from Isar: $e');
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> updateWidgetCache(
|
||||
FirkaStyle style,
|
||||
KretaClient client,
|
||||
) async {
|
||||
final dataDir = await getApplicationDocumentsDirectory();
|
||||
|
||||
final now = timeNow();
|
||||
|
||||
final start = now.subtract(Duration(days: 7));
|
||||
final end = now.add(Duration(days: 14));
|
||||
final start = now.subtract(const Duration(days: 7));
|
||||
final end = now.add(const Duration(days: 14));
|
||||
final lessons = await client.getLessons(start, end);
|
||||
|
||||
final widgetFile = File(p.join(dataDir.path, "widget_state.json"));
|
||||
|
||||
widgetFile.writeAsString(
|
||||
jsonEncode(WidgetCacheHelper.toJson(style, lessons)),
|
||||
);
|
||||
await updateWidgetCacheFromLessons(lessons, style: style);
|
||||
}
|
||||
|
||||
static Future<void> generateWidgetStateForDate(
|
||||
@@ -94,13 +240,16 @@ class WidgetCacheHelper {
|
||||
FirkaStyle style,
|
||||
KretaClient client,
|
||||
) async {
|
||||
final dataDir = await getApplicationDocumentsDirectory();
|
||||
|
||||
final json = toJson(style, []);
|
||||
json['displayDate'] =
|
||||
final dayStart = DateTime(date.year, date.month, date.day);
|
||||
final dayEnd = dayStart.add(const Duration(hours: 23, minutes: 59));
|
||||
final lessons = await client.getLessons(dayStart, dayEnd);
|
||||
final displayDate =
|
||||
'${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}';
|
||||
|
||||
final widgetFile = File(p.join(dataDir.path, "widget_state.json"));
|
||||
await widgetFile.writeAsString(jsonEncode(json));
|
||||
await updateWidgetCacheFromLessons(
|
||||
lessons,
|
||||
style: style,
|
||||
displayDate: displayDate,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Submodule firka/lib/l10n deleted from b80df466d2
447
firka/lib/l10n/app_de.arb
Normal file
447
firka/lib/l10n/app_de.arb
Normal file
@@ -0,0 +1,447 @@
|
||||
{
|
||||
"restart_title": "App neu starten",
|
||||
"restart_body": "Klicke hier, um die App zu öffnen.",
|
||||
"loginBtn": "Login mit E-Kréta",
|
||||
"privacyLabel": "Datenschutzerklärung",
|
||||
"title1": "Alles auf einen Blick",
|
||||
"subtitle1": "Oben auf der Startseite findest du nützliche Informationen zu deinem Tag.",
|
||||
"title2": "Hier finden deine Fächer Platz",
|
||||
"subtitle2": "Hier findest du Statistiken, bevorstehende Prüfungen und sogar deine Noten aus früheren Schuljahren.",
|
||||
"title3": "Individuell anpassbarer Stundenplan",
|
||||
"subtitle3": "Wähle auf der Stundenplanseite aus, was du sehen möchtest, und schalte Tests, Hausaufgaben, Pausen und Freistunden ein oder aus.",
|
||||
"title4": "Viele Extras, die du in Kreta niemals finden wirst",
|
||||
"subtitle4": "",
|
||||
"yesterday": "Gestern",
|
||||
"today": "Heute",
|
||||
"tomorrow": "Morgen",
|
||||
"debug_screen": "Entwicklermenü",
|
||||
"settings_screen": "Einstellungen",
|
||||
"home": "Startseite",
|
||||
"grades": "Noten",
|
||||
"timetable": "Stundenplan",
|
||||
"other": "Andere",
|
||||
"refreshing": "Daten werden aktualisiert...",
|
||||
"reauth": "Login notwendig",
|
||||
"api_error": "Kréta API Fehler",
|
||||
"pairing": "Koppel deine Uhr",
|
||||
"pairing_description": "Möchtest du diese Uhr mit der Firka App koppeln?\nNach der Kopplung kannst du deinen Stundenplan, neue Noten, Tests und Aufgaben einsehen.",
|
||||
"cancel": "Abbrechen",
|
||||
"save": "Speichern",
|
||||
"okay": "Okay",
|
||||
"pair": "Kopplung",
|
||||
"beta_title": "Firka - öffentliche Beta",
|
||||
"beta_body": "Die Anwendung befindet sich noch in der Entwicklung; einige Funktionen sind möglicherweise noch nicht fertiggestellt, funktionieren nicht richtig oder weisen Fehler auf.",
|
||||
"good_morning": "Guten Morgen, {p}!",
|
||||
"@good_morning": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"good_day": "Guten Tag, {p}!",
|
||||
"@good_day": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"n_left_subtitle": "Halte durch, es sind nur noch {n} Stunden übrig!",
|
||||
"@n_left_subtitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"suffering_almost_over_subtitle": "Du hast es fast geschafft. Pass weiterhin bei deinem Lehrer gut auf.",
|
||||
"school_ending": "Bist du nervös, {p}?",
|
||||
"@school_ending": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tomorrow_subtitle": "So sieht dein morgiger Tag aus.",
|
||||
"good_afternoon": "Guten Nachmittag, {p}!",
|
||||
"@good_afternoon": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"good_night": "Guten Abend, {p}!",
|
||||
"@good_night": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"starting_soon": "Deine erste Unterrichtstunde beginnt gleich!",
|
||||
"starting_hour": "Stunde",
|
||||
"starting_hour_plural": "Stunden",
|
||||
"starting_min": "Minute",
|
||||
"starting_min_plural": "Minuten",
|
||||
"starting_sec": "Sekunde",
|
||||
"starting_sec_plural": "Sekunden",
|
||||
"subjects": "Fächer",
|
||||
"your_subjects": "Deine Fächer",
|
||||
"data": "Details",
|
||||
"subject_avg": "Notendurchschnitt",
|
||||
"subject_avg_rounded": "Notendurchschnitt nach Rundung",
|
||||
"class_avg": "Klassendurchschnitt",
|
||||
"class_n": "Wöchentliche Stundenzahl",
|
||||
"tt_no_classes_l1": "Diese Woche hast du keinen Unterricht!",
|
||||
"tt_no_classes_l2": "Yippee!",
|
||||
"class_dismissed": "Abgesagte Unterrichtsstunde",
|
||||
"class_substitution": "Vertretung",
|
||||
"lesson_subject": "Thema der Stunde",
|
||||
"tt_settings_toast": "Stundenplan Einstellungen",
|
||||
"tt_settings_toast_lesson_nos": "Anzahl von Stunden",
|
||||
"tt_settings_toast_lesson_tests": "Tests & Sonstiges",
|
||||
"tt_settings_toast_lesson_breaks": "Pausen",
|
||||
"a_week": "A Woche",
|
||||
"b_week": "B Woche",
|
||||
"stats_date": "Datum",
|
||||
"stats_created_at": "Erstellt am",
|
||||
"stats_last_mod": "Zuletzt bearbeitet",
|
||||
"s_developer": "Entwicklereinstellungen",
|
||||
"s_stats_for_nerds": "Statistiken für Nerds",
|
||||
"s_settings": "Einstellungen",
|
||||
"s_a": "Applikation",
|
||||
"s_ag": "Allgemein",
|
||||
"s_ag_bell_delay": "Glockenverzögerung",
|
||||
"s_ag_rounding": "Standardmäßige Rundung",
|
||||
"s_customization": "Personalisierung",
|
||||
"s_ag_r1": "1 → 2",
|
||||
"s_ag_r2": "2 → 3",
|
||||
"s_ag_r3": "3 → 4",
|
||||
"s_ag_r4": "4 → 5",
|
||||
"s_ag_class_avg_on_graph": "Klassendurchschnitt in der Grafik",
|
||||
"s_ag_navbar": "Navigationsleiste",
|
||||
"s_ag_left_handed_mode": "Linkshänder Modus",
|
||||
"s_ag_language_header": "Sprache",
|
||||
"s_ag_language_auto": "Automatisch",
|
||||
"s_ag_language_hu": "Ungarisch",
|
||||
"s_ag_language_en": "Englisch",
|
||||
"s_ag_language_de": "Deutsch",
|
||||
"s_c": "Personalisierung",
|
||||
"s_c_icon_header": "App Symbole",
|
||||
"s_c_replace_icon": "Symbol ersetzen",
|
||||
"s_ci_icon_header": "App Symbol",
|
||||
"s_ci_warning_header": "[!] Im Debug-Modus funktioniert das Ändern des Symbols nicht",
|
||||
"s_ci_icon_subtitle": "Such dir ein hübsches App-Symbol aus, wenn du das grüne satt hast.",
|
||||
"s_ci_icon_g1": "Catboy domain",
|
||||
"s_ci_icon_g2": "Filc-Stift",
|
||||
"s_ci_icon_g3": "Nostalgie",
|
||||
"s_ci_icon_g4": "Neu gedacht",
|
||||
"s_ci_icon_g5": "Referenz",
|
||||
"s_ci_icon_g6": "Weihnachtslogo-Wettbewerb 2024",
|
||||
"s_ci_icon_g6_desc": "Von @emilia6_6",
|
||||
"s_ci_icon_g7": "Pride",
|
||||
"s_ci_icon_g8": "Pride ",
|
||||
"s_c_theme_header": "Thema",
|
||||
"s_c_theme_auto": "Automatisch",
|
||||
"s_c_theme_light": "Hell",
|
||||
"s_c_theme_dark": "Dunkel",
|
||||
"s_ci_child_protection": "Kinderschutz",
|
||||
"ic_ace": "Asexuell",
|
||||
"ic_ace_f": "Asexuell",
|
||||
"ic_bi": "Bisexuell",
|
||||
"ic_bi_f": "Bisexuell",
|
||||
"ic_cactus": "Kaktusgarten",
|
||||
"ic_cc": "Kreative Wolke",
|
||||
"ic_enby": "Nicht-binär",
|
||||
"ic_enby_f": "Nicht-binär",
|
||||
"ic_fidesz": "Orange",
|
||||
"ic_filc": "Filc Tagebuch",
|
||||
"ic_filco": "Filc . O",
|
||||
"ic_galaxy": "Galaxie",
|
||||
"ic_gay": "Schwul",
|
||||
"ic_gay_f": "Schwul",
|
||||
"ic_half_firka_2": "Revolution",
|
||||
"ic_kreta": "eFirka",
|
||||
"ic_lesb": "Lesbisch",
|
||||
"ic_lesb_f": "Lesbisch",
|
||||
"ic_lgbtq": "LGBTQ+",
|
||||
"ic_lgbtq_f": "LGBTQ+",
|
||||
"ic_lgbtqp": "Progression",
|
||||
"ic_lgbtqp_f": "Progression",
|
||||
"ic_lidl": "Einkaufen",
|
||||
"ic_mkkp": "Freikarten",
|
||||
"ic_nuke": "Nuklear",
|
||||
"ic_modern": "Modern",
|
||||
"ic_o1g": "Orbán ist ein Arschloch",
|
||||
"ic_old": "Domain David",
|
||||
"ic_original": "Original",
|
||||
"ic_paper": "Papier",
|
||||
"ic_pear": "Birne",
|
||||
"ic_pixel": "Pixel",
|
||||
"ic_pixelized": "Verpixelt",
|
||||
"ic_pride": "Weltraumregenbogen",
|
||||
"ic_proto": "Prototyp",
|
||||
"ic_refilc": "reFilc",
|
||||
"ic_refulc": "firk’a",
|
||||
"ic_repont": "Fünfzig Forint",
|
||||
"ic_szivacs": "Schwamm",
|
||||
"ic_tisza": "Árad a firka",
|
||||
"ic_trans": "Trans",
|
||||
"ic_trans_f": "Trans",
|
||||
"ic_void_icon": "Leere",
|
||||
"ic_xmas1": "Liste der Bösen",
|
||||
"ic_xmas2": "Geschenk",
|
||||
"ic_xmas3": "FirWeihnachten",
|
||||
"wear_phone_unpaired": "Deine Uhr ist nicht mit deinem Handy gekoppelt!",
|
||||
"wear_phone_disconnected": "Deine Uhr ist nicht mit deinem Handy verbunden!",
|
||||
"wear_pairing_request_sent": "Die Kopplung läuft, öffne die App auf deinem Smartphone",
|
||||
"wear_pairing_check_phone": "Setze die Kopplung auf deinem Smartphone fort",
|
||||
"wear_try_again": "Erneut versuchen",
|
||||
"breakTxt": "Pause",
|
||||
"empty_class": "Freistunde",
|
||||
"timeLeft": "{mins} Minuten übrig",
|
||||
"@timeLeft": {
|
||||
"placeholders": {
|
||||
"mins": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"noClasses": "Heute ist Schulfrei, ruh dich aus!",
|
||||
"noMoreClasses": "Du hast heute keinen Unterricht mehr",
|
||||
"firstIn": "Deine erste Stunde: {t}",
|
||||
"@firstIn": {
|
||||
"placeholders": {
|
||||
"t": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"wearTitle": "{n}. Stunde",
|
||||
"@wearTitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"view_subject_btn": "Fach anzeigen",
|
||||
"view_lesson_btn": "Stunde anzeigen",
|
||||
"date": "Datum",
|
||||
"tt_settings_toast_lesson_substitution": "Vertretungen",
|
||||
"tt_settings_toast_lesson_ab_timetable": "Zweiwöchiger Stundenplan",
|
||||
"s_ag_navbar_desc": "Wähle aus, was in der Navigationsleiste angezeigt werden soll, und ordne die Elemente an. Die übrigen Seiten sind über die Schaltfläche „Mehr“ erreichbar. Du kannst maximal 4 Seiten festlegen.",
|
||||
"s_ag_navbar_home": "Startseite",
|
||||
"s_ag_navbar_visible": "Erscheint",
|
||||
"s_ag_navbar_hidden": "Versteckt",
|
||||
"tests_tomorrow": "Du hast {tests} Prüfungen",
|
||||
"@tests_tomorrow": {
|
||||
"placeholders": {
|
||||
"tests": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"no_tests_tomorrow": "Du hast morgen keine Prüfungen",
|
||||
"get_ready": "Entspann dich und mach dich bereit für morgen",
|
||||
"mark_as_done": "Als erledigt markieren",
|
||||
"mark_as_not_done": "Als unvollständig markieren",
|
||||
"grade_teacherName": "Name des Lehrers: ",
|
||||
"grade_strValue": "Textbasierte Bewertung: ",
|
||||
"no_grades": "Du hast noch keine Noten für dieses Fach.",
|
||||
"unknown_teacher": "Unbekannter Lehrer",
|
||||
"s_your_account": "Dein Konto",
|
||||
"s_acc_kreta": "eKRÉTA Konto",
|
||||
"s_acc_add": "Neues Konto hinzufügen",
|
||||
"s_acc_logout": "Abmelden",
|
||||
"close": "Schließen",
|
||||
"licensesLabel": "Lizenzen",
|
||||
"tt_added": "Eingetragen: ",
|
||||
"happy_birthday": "Alles Gute zum Geburtstag, {p}!",
|
||||
"@happy_birthday": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"licenseDescription": "Lizenzen für die von der Applikation verwendeten externen Bibliotheken",
|
||||
"homework": "Hausaufgaben",
|
||||
"tt_non_instructional_day": "Unterrichtsfreier Schultag",
|
||||
"tt_public_holiday": "Feiertag",
|
||||
"tt_spring_break": "Frühlingsferien",
|
||||
"tt_winter_break": "Winterferien",
|
||||
"tt_autumn_break": "Herbstferien",
|
||||
"tt_instructional_day": "Unterrichtstag",
|
||||
"tt_first_semester_end": "Ende des ersten Semesters",
|
||||
"tt_holiday": "Ferien",
|
||||
"tt_rest_day": "Ruhetag",
|
||||
"tt_first_instructional_day": "Erster Schultag",
|
||||
"tt_last_instructional_day": "Letzter Schultag",
|
||||
"tt_last_instructional_day_graduates": "Letzter Schultag für die Absolventen",
|
||||
"tt_full_day_trip": "Ganztägiger Ausflug",
|
||||
"tt_quarter_end": "Quartalsende",
|
||||
"lessons_tomorrow": "{lessons} Stunden morgen",
|
||||
"@lessons_tomorrow": {
|
||||
"placeholders": {
|
||||
"lessons": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subject": "Fach",
|
||||
"grade_calculator": "Notenrechner",
|
||||
"grade_calculator_add": "Hinzufügen",
|
||||
"ghost_grade": "Geist-Note",
|
||||
"ghost_grades": "Geist-Noten",
|
||||
"gradesCount": "{count} Note(n)",
|
||||
"@gradesCount": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"overall_avg": "Gesamtdurchschnitt",
|
||||
"now": "Jetzt",
|
||||
"s_n": "Benachrichtigungen",
|
||||
"s_n_morning": "Morgendliche Benachrichtigung",
|
||||
"s_n_morning_time": "Zeitpunkt der Benachrichtigung vor Schulbeginn",
|
||||
"s_n_live_activity": "Live Aktivität",
|
||||
"s_n_test": "Testbenachrichtigung senden",
|
||||
"s_wear": "Wear OS",
|
||||
"s_wear_os_support": "Wear OS Unterstützung",
|
||||
"wearSyncNotificationTitle": "Mit Uhr synchronisieren",
|
||||
"wearSyncNotificationText": "Daten mit Uhr synchronisieren",
|
||||
"wear_sync_with_phone": "Öffne die Smartphone App, um die Synchronisierung durchzuführen",
|
||||
"wear_syncing": "Synchronisieren...",
|
||||
"la_privacy_header": "Datenschutzerklärung für Live Aktivität",
|
||||
"la_privacy_intro": "Um die Funktion „Live Aktivität“ nutzen zu können, müssen wir bestimmte Daten speichern und verarbeiten. Bitte lies dir die folgenden Informationen sorgfältig durch.",
|
||||
"la_privacy_section1_title": "Welche Daten speichern wir?",
|
||||
"la_privacy_section1_body": "Für den Betrieb von Live Aktivität speichern wir die folgenden Daten zusammen mit deiner Gerätekennung:\n\n• Gerätekennung (UUID)\n• Gerätetoken\n• Live-Aktivität-Push-Token\n• APNs-Push-Token\n• Geräte-Hash\n• Spracheinstellung\n• Glockenverzögerung\n\nDeine Stundenplandaten (Tabelle „lessons“) enthalten Folgendes:\n• Fach und Uhrzeit der Unterrichtsstunde\n• Name des Lehrers\n• Name des Raums\n• Nummer der Unterrichtsstunde\n• Thema der Unterrichtsstunde\n• Daten zur Vertretung\n• Kennzeichnung einer ausgefallenen Unterrichtsstunde\n\nDie zeitgesteuerten Benachrichtigungen (Tabelle „scheduled_notifications“) enthalten Folgendes:\n• ID\n• Geräte-ID\n• Zeitpunkt der Benachrichtigung\n• Status und Zeitpunkt der Übermittlung\n• Erstellungs- und Aktualisierungszeitpunkt",
|
||||
"la_privacy_section2_title": "Wie schützen wir deine Daten?",
|
||||
"la_privacy_section2_body": "Wir nehmen die Sicherheit deiner Daten ernst:\n\n• Alle Daten in den Tabellen „Geräte“ und „Stunden“ sind verschlüsselt\n• Die Daten werden auf einem sicheren Server gespeichert\n• Wir speichern die Daten nur so lange, wie es erforderlich ist",
|
||||
"la_privacy_section3_title": "Wie lange speichern wir die Daten?",
|
||||
"la_privacy_section3_body": "Die Speicherung der Daten ist auf einen minimalen Zeitraum beschränkt:\n\n• Live-Aktivität-Push-Token: Wird so lange gespeichert, wie du an diesem Tag Stunden hast (einschließlich des Zeitraums von zwei Stunden vor der ersten Stunde). Wenn du keine Stunden mehr hast, wird der Wert auf Null gesetzt.\n\n• Stundenplan-Daten: Sie werden nur für die Dauer der Stunden gespeichert und anschließend automatisch gelöscht. Am Freitag nach der letzten Stunde ist die Tabelle mit dem Stundenplan vollständig leer.\n\n• Gerätedaten (Token, Identifikatoren): Sie werden so lange gespeichert, wie die Live-Aktivität-Funktion aktiviert ist. Beim Deaktivieren der Funktion werden diese Daten sofort gelöscht.",
|
||||
"la_privacy_section4_title": "Wofür verwenden wir die Daten?",
|
||||
"la_privacy_section4_body": "Wir verwenden die Daten ausschließlich für den Betrieb der Live-Aktivität-Funktion:\n\n• Anzeige des Live-Stundenplans auf dem Sperrbildschirm\n• Versand von Push-Benachrichtigungen bei Stundenwechseln\n• Synchronisierung des Stundenplans auf deinem Gerät\n• Sicherstellung der Zustellung der Benachrichtigungen am Montagmorgen auch nach der wöchentlichen Datenbankbereinigung\n\nWir geben deine Daten nicht an Dritte weiter und verwenden sie nicht für Marketingzwecke.",
|
||||
"la_privacy_section5_title": "Deine Rechte",
|
||||
"la_privacy_section5_body": "Gemäß der DSGVO stehen dir folgende Rechte zu:\n\n• Recht auf Auskunft: Die Art der gespeicherten Daten kannst du in dieser Datenschutzerklärung einsehen.\n• Recht auf Löschung: Durch das Deaktivieren der Live-Aktivität-Funktion werden alle mit dieser Funktion verbundenen Daten (Geräte-IDs, Stundenplan) sofort und endgültig von unseren Servern gelöscht.\n• Recht auf Berichtigung: Die Änderung der Stundenplandaten erfolgt im Kréta-System durch die dazu berechtigten Personen (z. B. Lehrkräfte).\n• Widerspruchsrecht: Du kannst der Datenverarbeitung jederzeit widersprechen, indem du die Live-Aktivität-Funktion deaktivierst.",
|
||||
"la_privacy_footer": "Letzte Aktualisierung der Datenschutzerklärung: November 2025",
|
||||
"la_privacy_contact": "Hast du eine Frage? Schreib uns an support@firka.app.",
|
||||
"la_privacy_summary1": "Gerätetoken, Live-Aktivität-Token, Stundenplandaten",
|
||||
"la_privacy_summary2": "Verschlüsselte Speicherung, sichere Server",
|
||||
"la_privacy_summary3": "Die Daten werden automatisch gelöscht, sobald sie nicht mehr benötigt werden",
|
||||
"la_title": "Live Aktivität",
|
||||
"la_subtitle": "Live-Anzeige des Stundenplans auf dem Sperrbildschirm des Geräts",
|
||||
"la_privacy_title": "Datenschutzerklärung",
|
||||
"la_privacy_required": "Um Live Aktivität nutzen zu können, musst du der Datenschutzerklärung zustimmen",
|
||||
"la_learn_more": "Mehr dazu",
|
||||
"la_accept": "Ich stimme zu",
|
||||
"la_decline": "Ich lehne ab",
|
||||
"runningInDomainBrowser": "Domain-Browser",
|
||||
"copied": "Kopiert",
|
||||
"view_day_btn": "Tag anzeigen",
|
||||
"omission": "Abwesenheit",
|
||||
"omissions": "Abwesenheiten",
|
||||
"omission_state_excused": "Entschuldigt",
|
||||
"omission_state_unexcused": "Unentschuldigt",
|
||||
"omission_state_pending": "Ausstehend",
|
||||
"omissions_count": "{state, select, unexcused{{count} unentschuldigt} pending{{count} zu entschuldigen} other{{count}}} Fehlzeiten",
|
||||
"@omissions_count": {
|
||||
"placeholders": {
|
||||
"state": {
|
||||
"type": "String"
|
||||
},
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_beta_warning": "Beta-Warnung",
|
||||
"s_ag_privacy_ever_declined": "Datenschutz zuvor abgelehnt",
|
||||
"s_c_tab_appearance": "App-Design",
|
||||
"s_c_tab_subjects": "Fächer",
|
||||
"s_c_tab_fonts": "Schriftarten",
|
||||
"s_c_my_themes": "Meine Themes",
|
||||
"s_c_manage_subjects": "Fächer verwalten",
|
||||
"s_c_change_app_icon": "App-Icon ändern",
|
||||
"s_c_colors_header": "Farben",
|
||||
"s_c_grade_colors_header": "Notenfarben",
|
||||
"s_c_title_style_header": "Titelstil",
|
||||
"s_c_title_weight_header": "Titelstärke",
|
||||
"s_c_title_weight_subtitle": "Wird nicht von allen Schriftarten unterstützt",
|
||||
"s_c_title_weight_thin": "Dünn",
|
||||
"s_c_title_weight_thick": "Fett",
|
||||
"s_c_capitalization_header": "Groß-/Kleinschreibung",
|
||||
"s_c_capitalization_lower": "kleinbuchstaben",
|
||||
"s_c_capitalization_normal": "Normal",
|
||||
"s_c_capitalization_upper": "GROSSBUCHSTABEN",
|
||||
"s_c_change": "Ändern",
|
||||
"s_c_customize": "Anpassen",
|
||||
"s_c_themes_current": "Aktuell",
|
||||
"s_c_themes_own": "Eigene",
|
||||
"s_c_themes_downloaded": "Heruntergeladen",
|
||||
"s_c_themes_share_current": "Aktuelles Theme teilen",
|
||||
"s_c_themes_create_new": "Neues Theme erstellen",
|
||||
"s_c_themes_import": "Theme importieren",
|
||||
"s_c_themes_use": "Verwenden",
|
||||
"s_c_themes_continue": "Weiter",
|
||||
"s_c_themes_own_label": "Eigenes Theme",
|
||||
"s_c_themes_imported_label": "Importiertes Theme",
|
||||
"s_c_themes_builtin_label": "Integriertes Theme",
|
||||
"s_c_themes_builtin_name": "Standard",
|
||||
"s_c_themes_create_title": "Neues Theme erstellen",
|
||||
"s_c_themes_create_subtitle": "Gib einen Namen für das Theme ein",
|
||||
"s_c_themes_create_placeholder": "Themename",
|
||||
"s_c_themes_delete_title": "Theme löschen",
|
||||
"s_c_themes_delete_subtitle": "Möchtest du dieses Theme wirklich löschen? Diese Aktion kann rückgängig gemacht werden.",
|
||||
"s_c_themes_delete_confirm": "Löschen",
|
||||
"s_about": "Über die App",
|
||||
"s_extras": "Extras",
|
||||
"s_other": "Sonstiges",
|
||||
"grade_weight_x1": "einfache Gewichtung",
|
||||
"grade_weight_x2": "doppelte Gewichtung",
|
||||
"grade_weight_x3": "dreifache Gewichtung",
|
||||
"grade_weight_x4": "vierfache Gewichtung",
|
||||
"grade_weight_x5": "fünffache Gewichtung",
|
||||
"grade_weight_percent": "{percent}%ige Gewichtung",
|
||||
"@grade_weight_percent": {
|
||||
"placeholders": {
|
||||
"percent": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"surprise_grade_rank_5": "LEGENDÄR",
|
||||
"surprise_grade_rank_4": "AUSGEZEICHNET",
|
||||
"surprise_grade_rank_3": "OKAY",
|
||||
"surprise_grade_rank_2": "SCHWACH",
|
||||
"surprise_grade_rank_1": "KATASTROPHE",
|
||||
"new_grades_card": "Du hast neue Noten",
|
||||
"s_notifications": "Benachrichtigungen",
|
||||
"s_sticker_map": "Stickerkarte",
|
||||
"s_qr_reader": "QR-Code-Scanner",
|
||||
"s_feedback": "Feedback",
|
||||
"s_a_desc": "Navigation, Sprache, Glocke, Rundung",
|
||||
"s_c_desc": "Notenfarben, Thema, App-Symbol",
|
||||
"s_todo": "túdú: program this",
|
||||
"s_surprise_grades": "Überraschungsnoten",
|
||||
"s_seasonal_icons": "Saisonale App-Symbole",
|
||||
"s_uwu_mode": "UwU-Modus",
|
||||
"s_calendar_sync": "Kalendersynchronisierung",
|
||||
"s_save_grades": "Noten speichern",
|
||||
"s_welcome_msg": "Begrüßungsnachricht",
|
||||
"s_extras_desc": "Überraschungsnoten, Kalendersynchronisierung",
|
||||
"s_notifications_desc": "Noten, Stundenplanänderungen, Fehlzeiten",
|
||||
"s_n_all": "Alle",
|
||||
"s_n_grades": "Neue Noten",
|
||||
"s_n_homework_tests": "Hausaufgaben & Prüfungen",
|
||||
"s_n_absences": "Fehlzeiten",
|
||||
"s_n_lessons": "Stunden",
|
||||
"s_n_messages": "Nachrichten",
|
||||
"s_n_by_subject": "Nach Fach"
|
||||
}
|
||||
585
firka/lib/l10n/app_en.arb
Normal file
585
firka/lib/l10n/app_en.arb
Normal file
@@ -0,0 +1,585 @@
|
||||
{
|
||||
"restart_title": "Restart application",
|
||||
"restart_body": "Click here to open the app again.",
|
||||
"loginBtn": "Login with E-Kréta",
|
||||
"privacyLabel": "Privacy policy",
|
||||
"title1": "Know everything at a glance",
|
||||
"subtitle1": "You can see useful info about your day on the top of your home screen.",
|
||||
"title2": "Your classes fit here comfortably",
|
||||
"subtitle2": "See statistics, upcoming tests, and even your grades from previous school years.",
|
||||
"title3": "Customizable timetable",
|
||||
"subtitle3": "Decide what you want to see on your timetable page. Turn tests, assignments, breaks, and even free periods on or off.",
|
||||
"title4": "Many extras you will never find in Kréta",
|
||||
"subtitle4": "",
|
||||
"yesterday": "Yesterday",
|
||||
"today": "Today",
|
||||
"tomorrow": "Tomorrow",
|
||||
"debug_screen": "Developer options",
|
||||
"settings_screen": "Settings",
|
||||
"home": "Home",
|
||||
"grades": "Grades",
|
||||
"timetable": "Timetable",
|
||||
"other": "Other",
|
||||
"refreshing": "Refreshing...",
|
||||
"reauth": "Reauthentication required",
|
||||
"api_error": "Kréta API error",
|
||||
"pairing": "Pair your watch",
|
||||
"pairing_description": "Would you like to pair this watch with the Firka app?\nAfter pairing, you will be able to see your timetable, new grades, tests and tasks.",
|
||||
"cancel": "Cancel",
|
||||
"save": "Save",
|
||||
"okay": "Okay",
|
||||
"pair": "Pair",
|
||||
"beta_title": "Firka - Public Beta",
|
||||
"beta_body": "The application is still in development; some features may be unfinished, not work correctly, or be buggy.",
|
||||
"good_morning": "Good morning, {p}!",
|
||||
"@good_morning": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"good_day": "Good day, {p}!",
|
||||
"@good_day": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"n_left_subtitle": "Hang in there, there's only {n} lessons left!",
|
||||
"@n_left_subtitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"suffering_almost_over_subtitle": "You're almost free. Keep paying attention to your teacher.",
|
||||
"school_ending": "Are you anxious, {p}?",
|
||||
"@school_ending": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tomorrow_subtitle": "Your next day",
|
||||
"good_afternoon": "Good afternoon, {p}!",
|
||||
"@good_afternoon": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"good_night": "Good evening, {p}!",
|
||||
"@good_night": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"starting_soon": "Your first lesson will start soon!",
|
||||
"starting_hour": "hour",
|
||||
"starting_hour_plural": "hours",
|
||||
"starting_min": "min",
|
||||
"starting_min_plural": "mins",
|
||||
"starting_sec": "sec",
|
||||
"starting_sec_plural": "secs",
|
||||
"subjects": "Subjects",
|
||||
"your_subjects": "Your Subjects",
|
||||
"data": "Info",
|
||||
"subject_avg": "Subject average",
|
||||
"subject_avg_rounded": "Subject average after rounding",
|
||||
"class_avg": "Class average",
|
||||
"class_n": "Weekly lesson number",
|
||||
"tt_no_classes_l1": "You don't have any lessons on this day!",
|
||||
"tt_no_classes_l2": "Yippee!",
|
||||
"class_dismissed": "Dismissed lesson",
|
||||
"catalog_lesson_btn": "Catalog lesson",
|
||||
"catalog_lesson_title": "Catalog lesson",
|
||||
"catalog_lesson_topic_hint": "Topic covered",
|
||||
"catalog_lesson_submit_btn": "Save",
|
||||
"class_substitution": "Substitution",
|
||||
"lesson_subject": "Lesson subject",
|
||||
"tt_settings_toast": "Timetable settings",
|
||||
"tt_settings_toast_lesson_nos": "Number of lessons",
|
||||
"tt_settings_toast_lesson_tests": "Tests & others",
|
||||
"tt_settings_toast_lesson_breaks": "Breaks",
|
||||
"a_week": "A week",
|
||||
"b_week": "B week",
|
||||
"stats_date": "Date",
|
||||
"stats_created_at": "Created at",
|
||||
"stats_last_mod": "Last modified",
|
||||
"s_developer": "Developer settings",
|
||||
"s_stats_for_nerds": "Stats for nerds",
|
||||
"s_settings": "Settings",
|
||||
"s_a": "Application",
|
||||
"s_ag": "General",
|
||||
"s_ag_bell_delay": "Bell delay",
|
||||
"s_ag_rounding": "Default rounding",
|
||||
"s_shortened_timetable": "Shortened timetable",
|
||||
"s_shortened_timetable_enable": "Enable shortened timetable",
|
||||
"s_shortened_timetable_start": "Starts",
|
||||
"s_shortened_timetable_end": "Ends",
|
||||
"s_shortened_timetable_no_lessons": "No lessons to show in the cache. Refresh the timetable and try again.",
|
||||
"s_shortened_timetable_reset": "Reset to original times",
|
||||
"s_shortened_timetable_invalid_time": "The end must be after the start",
|
||||
"s_shortened_timetable_lesson": "Lesson {n}",
|
||||
"@s_shortened_timetable_lesson": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_customization": "Customization",
|
||||
"s_ag_r1": "1 → 2",
|
||||
"s_ag_r2": "2 → 3",
|
||||
"s_ag_r3": "3 → 4",
|
||||
"s_ag_r4": "4 → 5",
|
||||
"s_ag_class_avg_on_graph": "Class's average on the graph",
|
||||
"s_ag_navbar": "Navbar",
|
||||
"s_ag_left_handed_mode": "Left-handed mode",
|
||||
"s_ag_language_header": "Language",
|
||||
"s_ag_language_auto": "Automatic",
|
||||
"s_ag_language_hu": "Hungarian",
|
||||
"s_ag_language_en": "English",
|
||||
"s_ag_language_de": "German",
|
||||
"s_c": "Customization",
|
||||
"s_c_icon_header": "App icons",
|
||||
"s_c_replace_icon": "Replace icon",
|
||||
"s_ci_icon_header": "App icon",
|
||||
"s_ci_warning_header": "[!] Changing the app's icon in debug mode won't work",
|
||||
"s_ci_icon_subtitle": "Choose a pretty app icon if you're already tired of the green one.",
|
||||
"s_ci_icon_g1": "Catboy domain",
|
||||
"s_ci_icon_g2": "Felt pen",
|
||||
"s_ci_icon_g3": "Nostalgia",
|
||||
"s_ci_icon_g4": "Reimagined",
|
||||
"s_ci_icon_g5": "Reference",
|
||||
"s_ci_icon_g6": "Christmas logo competition 2024",
|
||||
"s_ci_icon_g6_desc": "By @emilia6_6",
|
||||
"s_ci_icon_g7": "Pride",
|
||||
"s_ci_icon_g8": "Pride ",
|
||||
"s_c_theme_header": "Theme",
|
||||
"s_c_theme_auto": "Auto",
|
||||
"s_c_theme_light": "Light",
|
||||
"s_c_theme_dark": "Dark",
|
||||
"s_ci_child_protection": "Child protection",
|
||||
"ic_ace": "Asexual",
|
||||
"ic_ace_f": "Asexual",
|
||||
"ic_bi": "Bisexual",
|
||||
"ic_bi_f": "Bisexual",
|
||||
"ic_cactus": "Cactus grove",
|
||||
"ic_cc": "Creative Cloud",
|
||||
"ic_enby": "Non-binary",
|
||||
"ic_enby_f": "Non-binary",
|
||||
"ic_fidesz": "Fidesz",
|
||||
"ic_filc": "Firka",
|
||||
"ic_filco": "Filc . O",
|
||||
"ic_galaxy": "Galaxy",
|
||||
"ic_gay": "Gay",
|
||||
"ic_gay_f": "Gay",
|
||||
"ic_half_firka_2": "Revolution",
|
||||
"ic_kreta": "eFirka",
|
||||
"ic_lesb": "Lesbian",
|
||||
"ic_lesb_f": "Lesbian",
|
||||
"ic_lgbtq": "LGBTQ+",
|
||||
"ic_lgbtq_f": "LGBTQ+",
|
||||
"ic_lgbtqp": "Progression",
|
||||
"ic_lgbtqp_f": "Progression",
|
||||
"ic_lidl": "Shopping",
|
||||
"ic_mkkp": "Free grades",
|
||||
"ic_nuke": "Nuclear",
|
||||
"ic_modern": "Modern",
|
||||
"ic_o1g": "Orbán is a cunt",
|
||||
"ic_old": "Domain Dave",
|
||||
"ic_original": "Original",
|
||||
"ic_paper": "Paper",
|
||||
"ic_pear": "Pear",
|
||||
"ic_pixel": "Pixel",
|
||||
"ic_pixelized": "Pixelified",
|
||||
"ic_pride": "Space rainbow",
|
||||
"ic_proto": "Prototype",
|
||||
"ic_refilc": "reFilc",
|
||||
"ic_refulc": "firk'a",
|
||||
"ic_repont": "Repont",
|
||||
"ic_szivacs": "sponge",
|
||||
"ic_tisza": "árad a firka",
|
||||
"ic_trans": "Trans",
|
||||
"ic_trans_f": "Trans",
|
||||
"ic_void_icon": "Nothing",
|
||||
"ic_xmas1": "naughty list",
|
||||
"ic_xmas2": "gift",
|
||||
"ic_xmas3": "FirCristmas",
|
||||
"wear_phone_unpaired": "Your watch isn't paired with your phone!",
|
||||
"wear_phone_disconnected": "Your watch isn't connected to your phone!",
|
||||
"wear_pairing_request_sent": "Open the app on your phone",
|
||||
"wear_pairing_check_phone": "Check your phone",
|
||||
"wear_try_again": "Try again",
|
||||
"breakTxt": "Break",
|
||||
"empty_class": "Empty class",
|
||||
"timeLeft": "{mins, plural, =1{1 min left} other{{mins} mins left}}",
|
||||
"@timeLeft": {
|
||||
"placeholders": {
|
||||
"mins": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"noClasses": "School's out today, take it easy!",
|
||||
"noMoreClasses": "No more classes for you today",
|
||||
"firstIn": "First class in: {t}",
|
||||
"@firstIn": {
|
||||
"placeholders": {
|
||||
"t": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"wearTitle": "{n}. class",
|
||||
"@wearTitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"licensesLabel": "Licenses",
|
||||
"licenseDescription": "Licenses for external libraries used by the application",
|
||||
"view_subject_btn": "View subject",
|
||||
"date": "Time of the class",
|
||||
"tt_settings_toast_lesson_substitution": "Substitutions",
|
||||
"tt_settings_toast_lesson_ab_timetable": "Two-week class schedule",
|
||||
"s_ag_navbar_desc": "Choose which items appear in the navigation bar and arrange them. The other pages are accessible via the “More” button. You can display up to 4 pages.",
|
||||
"s_ag_navbar_home": "Home",
|
||||
"s_ag_navbar_visible": "Appears",
|
||||
"happy_birthday": "Happy birthday, {p}!",
|
||||
"@happy_birthday": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tests_tomorrow": "You'll have {tests} exams",
|
||||
"@tests_tomorrow": {
|
||||
"placeholders": {
|
||||
"tests": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"no_tests_tomorrow": "You don't have any exams tomorrow",
|
||||
"get_ready": "Relax, and prepare for tomorrow",
|
||||
"homework": "Homework",
|
||||
"mark_as_done": "Mark as finished",
|
||||
"mark_as_not_done": "Mark as unfinished",
|
||||
"grade_teacherName": "Teacher's name: ",
|
||||
"grade_strValue": "Text-based rating: ",
|
||||
"no_grades": "You don't have any grades for this subject yet.",
|
||||
"unknown_teacher": "Unknown teacher",
|
||||
"tt_added": "Created at: ",
|
||||
"view_lesson_btn": "View lesson",
|
||||
"s_ag_navbar_hidden": "Hidden",
|
||||
"s_your_account": "Your account",
|
||||
"s_acc_kreta": "eKRÉTA accounts",
|
||||
"s_acc_accounts": "Accounts",
|
||||
"s_neptun_title": "ELTE Neptun",
|
||||
"s_neptun_user_hint": "ID (e.g. abc123)",
|
||||
"s_neptun_password_hint": "Password",
|
||||
"s_neptun_totp_code_hint": "Enter the 6-digit code",
|
||||
"s_neptun_code_by_email": "code sent by e-mail",
|
||||
"s_neptun_confirm_code": "Confirm code",
|
||||
"s_neptun_login_btn": "Log in",
|
||||
"s_neptun_seed_hint": "Authenticator key (optional)",
|
||||
"s_neptun_seed_help": "Enter your 2FA authenticator's secret key. NOT the 6 digit code.",
|
||||
"s_neptun_login_with_elte": "Log in with ELTE Neptun",
|
||||
"s_neptun_seed_failed": "Automatic 2FA code generation failed — check your authenticator key.",
|
||||
"s_neptun_2fa_rejected": "2FA code rejected — if the code is correct, restart the login and enter a fresh code.",
|
||||
"s_neptun_login_failed": "Login failed",
|
||||
"s_acc_accounts": "Accounts",
|
||||
"s_acc_add": "Add new student account",
|
||||
"s_acc_add_teacher": "Add new teacher account",
|
||||
"s_acc_logout": "Log out",
|
||||
"close": "Close",
|
||||
"tt_non_instructional_day": "Non-instructional workday",
|
||||
"tt_public_holiday": "Non-instructional day",
|
||||
"tt_spring_break": "Spring break",
|
||||
"tt_winter_break": "Winter break",
|
||||
"tt_autumn_break": "Autumn break",
|
||||
"tt_instructional_day": "Instructional day",
|
||||
"tt_first_semester_end": "End of first semester",
|
||||
"tt_holiday": "Holiday",
|
||||
"tt_rest_day": "Rest day",
|
||||
"tt_first_instructional_day": "First instructional day",
|
||||
"tt_last_instructional_day": "Last instructional day",
|
||||
"tt_last_instructional_day_graduates": "Last instructional day for graduates",
|
||||
"tt_full_day_trip": "Full-day trip",
|
||||
"tt_quarter_end": "end of quarter",
|
||||
"lessons_tomorrow": "You'll have {lessons} lessons",
|
||||
"@lessons_tomorrow": {
|
||||
"placeholders": {
|
||||
"lessons": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subject": "Subject",
|
||||
"grade_calculator": "Grade calculator",
|
||||
"grade_calculator_add": "Add",
|
||||
"ghost_grade": "Ghost grade",
|
||||
"ghost_grades": "Ghost grades",
|
||||
"gradesCount": "{count} grade(s)",
|
||||
"@gradesCount": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"overall_avg": "Overall average",
|
||||
"now": "Now",
|
||||
"s_n": "Notifications",
|
||||
"s_n_morning": "Morning notification",
|
||||
"s_n_morning_time": "Time of notification before school",
|
||||
"s_n_live_activity": "Live Activity",
|
||||
"s_n_test": "Send test notification",
|
||||
"s_wear": "Wear OS",
|
||||
"s_wear_os_support": "Wear OS support",
|
||||
"wearSyncNotificationTitle": "Synchronize with watch",
|
||||
"wearSyncNotificationText": "Keep watch's data in sync",
|
||||
"wear_sync_with_phone": "Open the mobile app to sync",
|
||||
"wear_syncing": "Syncing...",
|
||||
"la_privacy_header": "Live Activity privacy policy",
|
||||
"la_privacy_intro": "We have to store and process certain data for use in the Live Activity function. Please, read the disclosure below.",
|
||||
"la_privacy_section1_title": "What data do we store?",
|
||||
"la_privacy_section1_body": "For the Live Activity to function, we store the below data with your device identifier:\n\n• Device Identifier (UUID)\n• Device token\n• Live Activity push token\n• APNs push token\n• Device hash\n• Language setting\n• Bell delay\n\nYour timetable data (lessons table) contains the following:\n• The subject and time of the lesson\n• The name of the teacher\n• The name of the classroom\n• Period number of the lesson\n• The topic of the lesson\n• Details of a substitution\n• Indication of dismissed lesson\n\nThe scheduled notifications (scheduled_notifications table) contains the following:\n• Identifier\n• Device identifier\n• Scheduled time\n• Status and time of notification\n• Time of creation and update",
|
||||
"la_privacy_section2_title": "How do we protect your data?",
|
||||
"la_privacy_section2_body": "We take the security of your data seriously:\n\n• The data in the \"devices\" and \"lessons\" tables are encrypted\n• We store the data on secure servers\n• We only store data for as long as we need it",
|
||||
"la_privacy_section3_title": "How long do we store data for?",
|
||||
"la_privacy_section3_body": "We store data for the least amount of time possible:\n\n• Live Activity push token: Only stored as long as you have lessons on the given day (including the 2-hour period before). If you don't have any lessons left, the value becomes zero.\n\n• Timetable data: Only stored for the length of the lessons and they're deleted automatically. On Fridays, the table containing the timetable will be completely empty after the last lesson.\n\n• Device data (token, identifiers): Stored for as long as the Live Activity function is enabled. This data gets deleted when disabling the function.",
|
||||
"la_privacy_section4_title": "What do we use the data for?",
|
||||
"la_privacy_section4_body": "We use the data exclusively for the Live Activity function:\n\n• Displaying a live timetable on your lockscreen\n• Sending push notifications when lessons change\n• Synchronizing the timetable on your device\n• Ensuring the Monday morning notifications get delivered even after the weekly database-clearing.\n\nWe don't share your data with third parties and we don't use them for marketing.",
|
||||
"la_privacy_section5_title": "Your rights",
|
||||
"la_privacy_section5_body": "Under the GDPR, you have the following rights:\n\n• Right of access: You can view the type of data stored in this privacy policy.\n• Right to erasure: By disabling the Live Activity function, all data related to the function (device identifiers, timetable) will be immediately and permanently deleted from our servers.\n• Right to modification: The timetable data is modified in the Kréta system by authorized persons (e.g. teachers).\n• Right to object: You can object to data processing at any time by disabling the Live Activity function.",
|
||||
"la_privacy_footer": "This privacy policy was last updated on: November 2025",
|
||||
"la_privacy_contact": "Do you have any questions? Contact us at support@firka.app.",
|
||||
"la_privacy_summary1": "Device tokens, Live Activity tokens, timetable data",
|
||||
"la_privacy_summary2": "Encrypted storage, secure servers",
|
||||
"la_privacy_summary3": "Data is automatically deleted when it is no longer needed.",
|
||||
"la_title": "Live Activity",
|
||||
"la_subtitle": "Show your schedule live on your device's lock screen",
|
||||
"la_privacy_title": "Privacy Policy",
|
||||
"la_privacy_required": "To use Live Activity you must accept the privacy policy",
|
||||
"la_learn_more": "Learn More",
|
||||
"la_accept": "Accept",
|
||||
"la_decline": "Decline",
|
||||
"runningInDomainBrowser": "Domain Böngésző",
|
||||
"copied": "Copied",
|
||||
"view_day_btn": "View day",
|
||||
"omission": "Absence",
|
||||
"omissions": "Absences",
|
||||
"omission_state_excused": "Verified",
|
||||
"omission_state_unexcused": "Unverified",
|
||||
"omission_state_pending": "Pending",
|
||||
"omissions_count": "{state, select, unexcused{{count} igazolatlan} pending{{count} igazolandó} other{{count}}} hiányzás",
|
||||
"@omissions_count": {
|
||||
"placeholders": {
|
||||
"state": {
|
||||
"type": "String"
|
||||
},
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_beta_warning": "Beta warning",
|
||||
"s_ag_privacy_ever_declined": "Privacy previously declined",
|
||||
"s_c_tab_appearance": "Appearance",
|
||||
"s_c_tab_subjects": "Subjects",
|
||||
"s_c_tab_fonts": "Fonts",
|
||||
"s_c_my_themes": "My themes",
|
||||
"s_c_manage_subjects": "Manage subjects",
|
||||
"s_c_change_app_icon": "Change app icon",
|
||||
"s_c_colors_header": "Colors",
|
||||
"s_c_grade_colors_header": "Grade colors",
|
||||
"s_c_colors_theme_header": "Colors & Theme",
|
||||
"s_c_slot_accent": "Accent",
|
||||
"s_c_slot_background": "Background",
|
||||
"s_c_slot_cards": "Cards",
|
||||
"s_c_slot_buttons": "Buttons",
|
||||
"s_c_mode_both": "Both",
|
||||
"s_c_slot_secondary": "Secondary",
|
||||
"s_c_slot_text": "Text",
|
||||
"s_c_slot_text_secondary": "Secondary text",
|
||||
"s_c_slot_text_tertiary": "Tertiary text",
|
||||
"s_c_slot_shadow": "Shadow",
|
||||
"s_c_slot_success": "Success",
|
||||
"s_c_slot_warning": "Warning",
|
||||
"s_c_slot_warning_text": "Warning text",
|
||||
"s_c_slot_warning_card": "Warning card",
|
||||
"s_c_slot_error": "Error",
|
||||
"s_c_slot_error_text": "Error text",
|
||||
"s_c_slot_error_card": "Error card",
|
||||
"s_c_title_style_header": "Title style",
|
||||
"s_c_title_weight_header": "Title weight",
|
||||
"s_c_title_weight_subtitle": "Not all fonts support this",
|
||||
"s_c_title_weight_thin": "Thin",
|
||||
"s_c_title_weight_thick": "Bold",
|
||||
"s_c_capitalization_header": "Capitalization",
|
||||
"s_c_capitalization_lower": "lowercase",
|
||||
"s_c_capitalization_normal": "Normal",
|
||||
"s_c_capitalization_upper": "UPPERCASE",
|
||||
"s_c_change": "Change",
|
||||
"s_c_customize": "Customize",
|
||||
"s_c_themes_current": "Current",
|
||||
"s_c_themes_own": "Mine",
|
||||
"s_c_themes_downloaded": "Downloaded",
|
||||
"s_c_themes_share_current": "Share current theme",
|
||||
"s_c_themes_create_new": "Create new theme",
|
||||
"s_c_themes_import": "Import theme",
|
||||
"s_c_themes_use": "Use",
|
||||
"s_c_themes_continue": "Continue",
|
||||
"s_c_themes_own_label": "My theme",
|
||||
"s_c_themes_imported_label": "Imported theme",
|
||||
"s_c_themes_builtin_label": "Built-in theme",
|
||||
"s_c_themes_builtin_name": "Default",
|
||||
"s_c_themes_create_title": "Create new theme",
|
||||
"s_c_themes_create_subtitle": "Enter a name for the theme",
|
||||
"s_c_themes_create_placeholder": "Theme name",
|
||||
"s_c_themes_delete_title": "Delete theme",
|
||||
"s_c_themes_delete_subtitle": "Are you sure you want to delete this theme? This action can be undone.",
|
||||
"s_c_themes_delete_confirm": "Delete",
|
||||
"s_about": "About",
|
||||
"s_extras": "Extras",
|
||||
"s_other": "Other",
|
||||
"grade_weight_x1": "single weight",
|
||||
"grade_weight_x2": "double weight",
|
||||
"grade_weight_x3": "triple weight",
|
||||
"grade_weight_x4": "quadruple weight",
|
||||
"grade_weight_x5": "quintuple weight",
|
||||
"grade_weight_percent": "{percent}% weight",
|
||||
"@grade_weight_percent": {
|
||||
"placeholders": {
|
||||
"percent": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"surprise_grade_rank_5": "LEGENDARY",
|
||||
"surprise_grade_rank_4": "EXCELLENT",
|
||||
"surprise_grade_rank_3": "OKAY",
|
||||
"surprise_grade_rank_2": "WEAK",
|
||||
"surprise_grade_rank_1": "CATASTROPHE",
|
||||
"new_grades_card": "You have new grades",
|
||||
"s_notifications": "Notifications",
|
||||
"s_sticker_map": "Sticker map",
|
||||
"s_qr_reader": "QR code reader",
|
||||
"s_feedback": "Feedback",
|
||||
"s_a_desc": "Navigation, language, bell, rounding",
|
||||
"s_c_desc": "Grade colors, theme, app icon",
|
||||
"s_todo": "túdú: program this",
|
||||
"s_surprise_grades": "Surprise grades",
|
||||
"s_seasonal_icons": "Seasonal app icons",
|
||||
"s_uwu_mode": "UwU mode",
|
||||
"s_calendar_sync": "Calendar sync",
|
||||
"s_save_grades": "Save grades",
|
||||
"s_welcome_msg": "Welcome message",
|
||||
"s_extras_desc": "Surprise grades, calendar sync",
|
||||
"s_notifications_desc": "Grades, timetable changes, absences",
|
||||
"s_notif_push_enabled": "Enable push notifications",
|
||||
"s_notif_delivery_method_header": "Delivery method",
|
||||
"s_notif_delivery_auto": "Automatic",
|
||||
"s_notif_delivery_fcm": "Firebase Cloud Messaging (FCM)",
|
||||
"s_notif_delivery_alarm": "Alarm (background check)",
|
||||
"s_notif_wakeup_interval_header": "Check frequency",
|
||||
"s_notif_wakeup_hourly": "Hourly",
|
||||
"s_notif_wakeup_two_hourly": "Every 2 hours",
|
||||
"s_notif_categories_header": "Categories",
|
||||
"s_notif_grades": "Grades",
|
||||
"s_notif_homework_tests": "Homework & tests",
|
||||
"s_notif_absences": "Absences",
|
||||
"s_notif_lessons": "Lesson changes",
|
||||
"s_notif_lessons_cancelled": "Cancelled lessons",
|
||||
"s_notif_lessons_substituted": "Substitutions",
|
||||
"s_notif_messages": "Messages",
|
||||
"s_progress_notification": "Progress-centric notification",
|
||||
"s_progress_notification_desc": "Live progress notification for lessons and breaks throughout the school day",
|
||||
"progress_notif_channel_name": "School day progress",
|
||||
"progress_notif_channel_desc": "Live progress notification for today's lessons and breaks",
|
||||
"progress_notif_lesson_title": "Lesson {number}: {name}",
|
||||
"@progress_notif_lesson_title": {
|
||||
"placeholders": {
|
||||
"number": {"type": "String"},
|
||||
"name": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_substitution": " (Substitution)",
|
||||
"progress_notif_case1_text": "In {minutes} min ({timeRange}){room}{substitution}{remaining}",
|
||||
"@progress_notif_case1_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"},
|
||||
"timeRange": {"type": "String"},
|
||||
"room": {"type": "String"},
|
||||
"substitution": {"type": "String"},
|
||||
"remaining": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_case2_lesson_text": "{minutes} min left ({timeRange}){room}{substitution}{remaining}",
|
||||
"@progress_notif_case2_lesson_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"},
|
||||
"timeRange": {"type": "String"},
|
||||
"room": {"type": "String"},
|
||||
"substitution": {"type": "String"},
|
||||
"remaining": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_case2_break_title": "Break",
|
||||
"progress_notif_case2_break_text": "{minutes} min left{remaining}",
|
||||
"@progress_notif_case2_break_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"},
|
||||
"remaining": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_critical_text": "{minutes}m",
|
||||
"@progress_notif_critical_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_remaining_lessons_one": " - 1 lesson remaining",
|
||||
"progress_notif_remaining_lessons_other": " - {count} lessons remaining",
|
||||
"@progress_notif_remaining_lessons_other": {
|
||||
"placeholders": {
|
||||
"count": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"s_fcm_status_title": "FCM status",
|
||||
"s_fcm_status_initialized": "Initialized",
|
||||
"s_fcm_status_not_initialized": "Not initialized",
|
||||
"s_fcm_status_token_present": "Token present",
|
||||
"s_fcm_status_token_missing": "No token",
|
||||
"s_fcm_status_permission_label": "Notification permission",
|
||||
"s_fcm_status_permission_granted": "Granted",
|
||||
"s_fcm_status_permission_denied": "Denied",
|
||||
"s_fcm_status_permission_unknown": "Unknown",
|
||||
"s_fcm_status_topic_label": "Subscribed topic",
|
||||
"s_fcm_status_last_refresh_label": "Last token refresh",
|
||||
"s_fcm_status_last_refresh_never": "Never",
|
||||
"s_fcm_status_refresh_button": "Refresh",
|
||||
"s_fcm_notify_on_message": "Notify on FCM message",
|
||||
"s_fcm_test_notifications_title": "Test notifications",
|
||||
"s_fcm_test_notifications_multi_title": "Simulate multi-account",
|
||||
"s_n_all": "All",
|
||||
"s_n_grades": "New grades",
|
||||
"s_n_homework_tests": "Homework & Tests",
|
||||
"s_n_absences": "Absences",
|
||||
"s_n_lessons": "Lessons",
|
||||
"s_n_messages": "Messages",
|
||||
"s_n_by_subject": "By subject"
|
||||
}
|
||||
585
firka/lib/l10n/app_hu.arb
Normal file
585
firka/lib/l10n/app_hu.arb
Normal file
@@ -0,0 +1,585 @@
|
||||
{
|
||||
"restart_title": "Alkalmazás újraindítása",
|
||||
"restart_body": "Kattints ide az alkalmazás megnyitásához.",
|
||||
"loginBtn": "Bejelentkezés E-Kréta fiókkal",
|
||||
"privacyLabel": "Adatvédelmi tájékoztató",
|
||||
"title1": "Egy pillantásra tudhatsz mindent",
|
||||
"subtitle1": "A főoldal tetején hasznos információkat láthatsz a napodról.",
|
||||
"title2": "A tantárgyaid kényelmesen elférnek itt",
|
||||
"subtitle2": "Láss statisztikákat, közelgő számonkéréseket, és akár a régebbi tanéves jegyeidet is.",
|
||||
"title3": "Személyre szabható órarend",
|
||||
"subtitle3": "Válaszd ki, mit szeretnél látni az órarend oldalon, kapcsold ki vagy be a számonkéréseket, házi feladatokat, szüneteket és lyukas órákat is.",
|
||||
"title4": "Sok extra dolog, amit a Krétában sosem fogsz megtalálni",
|
||||
"subtitle4": "",
|
||||
"yesterday": "Tegnap",
|
||||
"today": "Ma",
|
||||
"runningInDomainBrowser": "Doméjn böngésző",
|
||||
"tomorrow": "Holnap",
|
||||
"debug_screen": "Fejlesztői menü",
|
||||
"settings_screen": "Beállítások",
|
||||
"home": "Kezdőlap",
|
||||
"grades": "Jegyek",
|
||||
"timetable": "Órarend",
|
||||
"other": "Több",
|
||||
"refreshing": "Adatok frissítése...",
|
||||
"reauth": "Bejelentkezés szükséges",
|
||||
"api_error": "Kréta API hiba",
|
||||
"pairing": "Óra párosítása",
|
||||
"pairing_description": "Szeretnéd ezt az órát párosítani a Firka appal?\nPárosítás láthatod az órarendet, és a legújabb jegyeidet, számonkéréseidet, és a feladataidat.",
|
||||
"cancel": "Mégse",
|
||||
"save": "Mentés",
|
||||
"okay": "Rendben",
|
||||
"pair": "Párosítás",
|
||||
"beta_title": "Firka - Publikus béta",
|
||||
"beta_body": "Az alkalmazás fejlesztés alatt áll; egyes funkciók hibásan működhetnek, nem működnek, vagy még nem készültek el.",
|
||||
"good_morning": "Jó reggelt, {p}!",
|
||||
"@good_morning": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"happy_birthday": "Boldog születésnapot, {p}!",
|
||||
"@happy_birthday": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"good_day": "Szép napot, {p}!",
|
||||
"@good_day": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"n_left_subtitle": "Tarts ki, már csak {n} óra!",
|
||||
"@n_left_subtitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"suffering_almost_over_subtitle": "Mindjárt szabad vagy. Figyelj oda a tanárra.",
|
||||
"school_ending": "Izgulsz, {p}?",
|
||||
"@school_ending": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tomorrow_subtitle": "Itt a holnapi napod.",
|
||||
"good_afternoon": "Szép délutánt, {p}!",
|
||||
"@good_afternoon": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"good_night": "Szép estét, {p}!",
|
||||
"@good_night": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tests_tomorrow": "{tests} dolgozatod lesz",
|
||||
"@tests_tomorrow": {
|
||||
"placeholders": {
|
||||
"tests": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"no_tests_tomorrow": "Holnap nincs dolgozatod",
|
||||
"get_ready": "Pihend ki magad, és készülj fel",
|
||||
"homework": "Házi feladat",
|
||||
"mark_as_done": "Megjelölés befejezettként",
|
||||
"mark_as_not_done": "Megjelölés befejezetlenként",
|
||||
"starting_soon": "Hamarosan kezdődik az első órád!",
|
||||
"starting_hour": "óra",
|
||||
"starting_hour_plural": "óra",
|
||||
"starting_min": "perc",
|
||||
"starting_min_plural": "perc",
|
||||
"starting_sec": "másodperc",
|
||||
"starting_sec_plural": "másodperc",
|
||||
"subjects": "Tantárgyak",
|
||||
"your_subjects": "Tantárgyaid",
|
||||
"data": "Adatok",
|
||||
"subject_avg": "Tantárgyi átlag",
|
||||
"subject_avg_rounded": "Tantárgyi átlag kerekítés után",
|
||||
"class_avg": "Osztályátlag",
|
||||
"class_n": "Heti óraszám",
|
||||
"grade_teacherName": "Tanár neve: ",
|
||||
"grade_strValue": "Szöveges értékelés: ",
|
||||
"no_grades": "Ebből a tantárgyból még nincsen jegyed.",
|
||||
"unknown_teacher": "Ismeretlen tanár",
|
||||
"tt_no_classes_l1": "Ezen a napon nincsenek óráid!",
|
||||
"tt_no_classes_l2": "Yippee!",
|
||||
"tt_non_instructional_day": "Tanítás nélküli munkanap",
|
||||
"tt_public_holiday": "Munkaszüneti nap",
|
||||
"tt_spring_break": "Tavaszi szünet",
|
||||
"tt_winter_break": "Téli szünet",
|
||||
"tt_autumn_break": "Őszi szünet",
|
||||
"tt_instructional_day": "Tanítási nap",
|
||||
"tt_first_semester_end": "Első félév vége",
|
||||
"tt_holiday": "Ünnepnap",
|
||||
"tt_rest_day": "Pihenőnap",
|
||||
"tt_first_instructional_day": "Első tanítási nap",
|
||||
"tt_last_instructional_day": "Utolsó tanítási nap",
|
||||
"tt_last_instructional_day_graduates": "Utolsó tanítási nap a végzős évfolyamokon",
|
||||
"tt_full_day_trip": "Egész napos kirándulás",
|
||||
"tt_quarter_end": "negyedév vége",
|
||||
"tt_added": "Létrehozva: ",
|
||||
"class_dismissed": "Elmaradt óra",
|
||||
"catalog_lesson_btn": "Óra naplózása",
|
||||
"catalog_lesson_title": "Óra naplózása",
|
||||
"catalog_lesson_topic_hint": "Az óra témája",
|
||||
"catalog_lesson_submit_btn": "Mentés",
|
||||
"class_substitution": "Helyettesítés",
|
||||
"lesson_subject": "Az óra tárgya",
|
||||
"view_subject_btn": "Tantárgy megtekintése",
|
||||
"view_lesson_btn": "Óra megtekintése",
|
||||
"view_day_btn": "Nap megtekintése",
|
||||
"date": "Időpont",
|
||||
"tt_settings_toast": "Órarend beállításai",
|
||||
"tt_settings_toast_lesson_nos": "Óraszámok",
|
||||
"tt_settings_toast_lesson_tests": "Számonkérések & egyéb",
|
||||
"tt_settings_toast_lesson_breaks": "Szünetek",
|
||||
"tt_settings_toast_lesson_substitution": "Helyettesítések",
|
||||
"tt_settings_toast_lesson_ab_timetable": "Kéthetes órarend",
|
||||
"a_week": "A hét",
|
||||
"b_week": "B hét",
|
||||
"stats_date": "Dátum",
|
||||
"stats_created_at": "Létrehozva",
|
||||
"stats_last_mod": "Utoljára módosítva",
|
||||
"s_developer": "Fejlesztői beállítások",
|
||||
"s_stats_for_nerds": "Extra információ mutatása",
|
||||
"s_beta_warning": "Béta figyelmeztetés",
|
||||
"s_settings": "Beállítások",
|
||||
"s_a": "Alkalmazás",
|
||||
"s_ag": "Általános",
|
||||
"s_ag_bell_delay": "Csengő eltolódása",
|
||||
"s_ag_rounding": "Alapértelmezett kerekítés",
|
||||
"s_shortened_timetable": "Rövidített órák",
|
||||
"s_shortened_timetable_enable": "Rövidített órák engedélyezése",
|
||||
"s_shortened_timetable_start": "Kezdete",
|
||||
"s_shortened_timetable_end": "Vége",
|
||||
"s_shortened_timetable_no_lessons": "Nincs megjeleníthető óra a gyorsítótárban. Frissítsd az órarendet, majd próbáld újra.",
|
||||
"s_shortened_timetable_reset": "Eredeti időpontok visszaállítása",
|
||||
"s_shortened_timetable_invalid_time": "A végének a kezdete után kell lennie",
|
||||
"s_shortened_timetable_lesson": "{n}. óra",
|
||||
"@s_shortened_timetable_lesson": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_customization": "Személyre szabás",
|
||||
"s_ag_r1": "1 → 2",
|
||||
"s_ag_r2": "2 → 3",
|
||||
"s_ag_r3": "3 → 4",
|
||||
"s_ag_r4": "4 → 5",
|
||||
"s_ag_class_avg_on_graph": "Osztályátlag a grafikonon",
|
||||
"s_ag_navbar": "Navigációs sáv",
|
||||
"s_ag_navbar_desc": "Válaszd ki, mik jelenjenek meg a navigációs sávon, és rendezd el őket. A többi oldal elérhető a “több” gombon keresztül. Maximum 4 oldalt tudsz kitűzni.",
|
||||
"s_ag_navbar_home": "Kezdőlap",
|
||||
"s_ag_navbar_visible": "Megjelenik",
|
||||
"s_ag_navbar_hidden": "Elrejtve",
|
||||
"s_ag_left_handed_mode": "Balkezes mód",
|
||||
"s_ag_privacy_ever_declined": "Adatvédelem korábban elutasítva",
|
||||
"s_ag_language_header": "Nyelv",
|
||||
"s_ag_language_auto": "Automatikus",
|
||||
"s_ag_language_hu": "Magyar",
|
||||
"s_ag_language_en": "Angol",
|
||||
"s_ag_language_de": "Német",
|
||||
"s_c": "Személyre szabás",
|
||||
"s_c_icon_header": "App ikonok",
|
||||
"s_c_replace_icon": "Ikon cseréje",
|
||||
"s_ci_icon_header": "App ikon",
|
||||
"s_ci_warning_header": "[!] Debug módban nem fog működni az ikon megváltoztatása",
|
||||
"s_ci_icon_subtitle": "Válassz egy csodaszép app ikont, ha már unod a zöldet.",
|
||||
"s_ci_icon_g1": "Catboy domain",
|
||||
"s_ci_icon_g2": "Filctoll",
|
||||
"s_ci_icon_g3": "Nosztalgia",
|
||||
"s_ci_icon_g4": "Újragondolt",
|
||||
"s_ci_icon_g5": "Referencia",
|
||||
"s_ci_icon_g6": "Karácsonyi logó verseny 2024",
|
||||
"s_ci_icon_g6_desc": "@emilia6_6 által",
|
||||
"s_ci_icon_g7": "Pride",
|
||||
"s_ci_icon_g8": "Pride ",
|
||||
"s_c_theme_header": "Téma",
|
||||
"s_c_theme_auto": "Automatikus",
|
||||
"s_c_theme_light": "Világos",
|
||||
"s_c_theme_dark": "Sötét",
|
||||
"s_c_tab_appearance": "App kinézete",
|
||||
"s_c_tab_subjects": "Tantárgyak",
|
||||
"s_c_tab_fonts": "Betűk",
|
||||
"s_c_my_themes": "Témáim",
|
||||
"s_c_manage_subjects": "Tantárgyak kezelése",
|
||||
"s_c_change_app_icon": "App ikon cseréje",
|
||||
"s_c_colors_header": "Színek",
|
||||
"s_c_grade_colors_header": "Jegyek színei",
|
||||
"s_c_colors_theme_header": "Színek & téma",
|
||||
"s_c_slot_accent": "Accent",
|
||||
"s_c_slot_background": "Háttér",
|
||||
"s_c_slot_cards": "Kártyák",
|
||||
"s_c_slot_buttons": "Gombok",
|
||||
"s_c_mode_both": "Mindkettő",
|
||||
"s_c_slot_secondary": "Másodlagos",
|
||||
"s_c_slot_text": "Szöveg",
|
||||
"s_c_slot_text_secondary": "Másodlagos szöveg",
|
||||
"s_c_slot_text_tertiary": "Harmadlagos szöveg",
|
||||
"s_c_slot_shadow": "Árnyék",
|
||||
"s_c_slot_success": "Siker",
|
||||
"s_c_slot_warning": "Figyelmeztetés",
|
||||
"s_c_slot_warning_text": "Figyelmeztető szöveg",
|
||||
"s_c_slot_warning_card": "Figyelmeztető kártya",
|
||||
"s_c_slot_error": "Hiba",
|
||||
"s_c_slot_error_text": "Hiba szöveg",
|
||||
"s_c_slot_error_card": "Hiba kártya",
|
||||
"s_c_title_style_header": "Címek stílusa",
|
||||
"s_c_title_weight_header": "Címek vastagsága",
|
||||
"s_c_title_weight_subtitle": "Ezt nem mindegyik betűtípus támogatja",
|
||||
"s_c_title_weight_thin": "Vékony",
|
||||
"s_c_title_weight_thick": "Vastag",
|
||||
"s_c_capitalization_header": "Kapitalizáció",
|
||||
"s_c_capitalization_lower": "kisbetűs",
|
||||
"s_c_capitalization_normal": "Normál",
|
||||
"s_c_capitalization_upper": "NAGYBETŰS",
|
||||
"s_c_change": "Csere",
|
||||
"s_c_customize": "Személyre szabás",
|
||||
"s_c_themes_current": "Jelenlegi",
|
||||
"s_c_themes_own": "Saját",
|
||||
"s_c_themes_downloaded": "Letöltött",
|
||||
"s_c_themes_share_current": "Jelenlegi téma megosztása",
|
||||
"s_c_themes_create_new": "Új téma létrehozása",
|
||||
"s_c_themes_import": "Téma importálása",
|
||||
"s_c_themes_use": "Használat",
|
||||
"s_c_themes_continue": "Folytatás",
|
||||
"s_c_themes_own_label": "Saját téma",
|
||||
"s_c_themes_imported_label": "Importált téma",
|
||||
"s_c_themes_builtin_label": "Beépített téma",
|
||||
"s_c_themes_builtin_name": "Alapértelmezett",
|
||||
"s_c_themes_create_title": "Új téma létrehozása",
|
||||
"s_c_themes_create_subtitle": "Add meg a téma nevét",
|
||||
"s_c_themes_create_placeholder": "A téma neve",
|
||||
"s_c_themes_delete_title": "Téma törlése",
|
||||
"s_c_themes_delete_subtitle": "Biztosan törölni szeretnéd ezt a témát? Ez a művelet visszavonható.",
|
||||
"s_c_themes_delete_confirm": "Törlés",
|
||||
"s_ci_child_protection": "Gyermekvédelem",
|
||||
"ic_ace": "Aszexuális",
|
||||
"ic_ace_f": "Aszexuális",
|
||||
"ic_bi": "Biszexuális",
|
||||
"ic_bi_f": "Biszexuális",
|
||||
"ic_cactus": "Kaktuszliget",
|
||||
"ic_cc": "Kreatív Felhő",
|
||||
"ic_enby": "Nembináris",
|
||||
"ic_enby_f": "Nembináris",
|
||||
"ic_fidesz": "Narancs",
|
||||
"ic_filc": "Filc Napló",
|
||||
"ic_filco": "Filc . O",
|
||||
"ic_galaxy": "Galaxis",
|
||||
"ic_gay": "Meleg",
|
||||
"ic_gay_f": "Meleg",
|
||||
"ic_half_firka_2": "Revolution",
|
||||
"ic_kreta": "eFIRKA",
|
||||
"ic_lesb": "Leszbikus",
|
||||
"ic_lesb_f": "Leszbikus",
|
||||
"ic_lgbtq": "LMGBTQ+",
|
||||
"ic_lgbtq_f": "LMGBTQ+",
|
||||
"ic_lgbtqp": "Progresszió",
|
||||
"ic_lgbtqp_f": "Progresszió",
|
||||
"ic_lidl": "Bevásárlás",
|
||||
"ic_mkkp": "Ingyen jegyek",
|
||||
"ic_nuke": "Nukleáris",
|
||||
"ic_modern": "Modern",
|
||||
"ic_o1g": "O1G",
|
||||
"ic_old": "Domain Dév Dévid",
|
||||
"ic_original": "Az eredeti",
|
||||
"ic_paper": "Papír",
|
||||
"ic_pear": "Körte",
|
||||
"ic_pixel": "Pixel",
|
||||
"ic_pixelized": "Pixelizált",
|
||||
"ic_pride": "Űrszívárvány",
|
||||
"ic_proto": "Prototípus",
|
||||
"ic_refilc": "reFilc",
|
||||
"ic_refulc": "firk’a",
|
||||
"ic_repont": "Ötven forint",
|
||||
"ic_szivacs": "Szivacs",
|
||||
"ic_tisza": "Árad a firka",
|
||||
"ic_trans": "Transz",
|
||||
"ic_trans_f": "Transz",
|
||||
"ic_void_icon": "Semmi",
|
||||
"ic_xmas1": "Rosszak listája",
|
||||
"ic_xmas2": "Ajándék",
|
||||
"ic_xmas3": "reKarácsony",
|
||||
"s_your_account": "Fiókod",
|
||||
"s_acc_kreta": "eKRÉTA Fiókok",
|
||||
"s_acc_accounts": "Fiókok",
|
||||
"s_neptun_title": "ELTE Neptun",
|
||||
"s_neptun_user_hint": "Azonosító (pl. abc123)",
|
||||
"s_neptun_password_hint": "Jelszó",
|
||||
"s_neptun_totp_code_hint": "Add meg a 6-jegyős kódot",
|
||||
"s_neptun_code_by_email": "e-mailben elküldve",
|
||||
"s_neptun_confirm_code": "Kód megerősítése",
|
||||
"s_neptun_login_btn": "Bejelentkezés",
|
||||
"s_neptun_seed_hint": "Hitelesítő kulcs (opcionális)",
|
||||
"s_neptun_seed_help": "Add meg a 2FA hitelesítőd titkos kulcsát. NEM a 6 jegyű kódot.",
|
||||
"s_neptun_login_with_elte": "Bejelentkezés ELTE Neptunnal",
|
||||
"s_neptun_seed_failed": "A 2FA automatikus kódgenerálás sikertelen — ellenőrizd a hitelesítő kulcsot.",
|
||||
"s_neptun_2fa_rejected": "A 2FA kódot elutasította a rendszer — ha a kód helyes, indítsd újra a bejelentkezést és adj meg egy friss kódot.",
|
||||
"s_neptun_login_failed": "Bejelentkezés sikertelen",
|
||||
"s_acc_accounts": "Fiókok",
|
||||
"s_acc_add": "Új diákfiók hozzáadása",
|
||||
"s_acc_add_teacher": "Új tanárfiók hozzáadása",
|
||||
"s_acc_logout": "Kijelentkezés",
|
||||
"close": "Bezárás",
|
||||
"s_about": "Névjegy",
|
||||
"licensesLabel": "Licencek",
|
||||
"licenseDescription": "Az alkalmazás által használt külső könyvtárak licencei",
|
||||
"wear_phone_unpaired": "Az órád nincs párosítva a telefonoddal!",
|
||||
"wear_phone_disconnected": "Az órád nincs csatlakoztatva a telefonoddal!",
|
||||
"wear_pairing_request_sent": "Párosítás folyamatban, nyisd meg az appot a telefonodon",
|
||||
"wear_pairing_check_phone": "Folytasd a párosítást a telefonodon",
|
||||
"wear_try_again": "Újra",
|
||||
"copied": "Másolva",
|
||||
"breakTxt": "Szünet",
|
||||
"empty_class": "Lyukasóra",
|
||||
"timeLeft": "Még {mins} perc",
|
||||
"@timeLeft": {
|
||||
"placeholders": {
|
||||
"mins": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"noClasses": "Nincs ma iskola, pihend ki magad!",
|
||||
"noMoreClasses": "Nincs több órád ma",
|
||||
"firstIn": "Első órád: {t}",
|
||||
"@firstIn": {
|
||||
"placeholders": {
|
||||
"t": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"wearTitle": "{n}. óra",
|
||||
"@wearTitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lessons_tomorrow": "{lessons} órád lesz",
|
||||
"@lessons_tomorrow": {
|
||||
"placeholders": {
|
||||
"lessons": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subject": "Tantárgy",
|
||||
"grade_calculator": "Jegy kalkulátor",
|
||||
"grade_calculator_add": "Hozzáadás",
|
||||
"ghost_grade": "Szellem jegy",
|
||||
"ghost_grades": "Szellem jegyek",
|
||||
"gradesCount": "{count} jegy",
|
||||
"@gradesCount": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"overall_avg": "Összesített átlag",
|
||||
"now": "Most",
|
||||
"s_n": "Értesítések",
|
||||
"s_n_morning": "Reggeli értesítés",
|
||||
"s_n_morning_time": "Értesítés ideje iskola előtt",
|
||||
"s_n_live_activity": "Live Activity",
|
||||
"s_n_test": "Teszt értesítés küldése",
|
||||
"s_wear": "Wear OS",
|
||||
"s_wear_os_support": "Wear OS támogatás",
|
||||
"s_extras": "Extrák",
|
||||
"s_other": "Egyéb",
|
||||
"wearSyncNotificationTitle": "Szinkronizálás az órával",
|
||||
"wearSyncNotificationText": "Óra adatainak szinkronban tartása",
|
||||
"wear_sync_with_phone": "Nyisd meg a telefonos appot a szinkronizáláshoz",
|
||||
"wear_syncing": "Szinkronizálás...",
|
||||
"la_privacy_header": "Live Activity adatvédelmi tájékoztató",
|
||||
"la_privacy_intro": "A Live Activity funkció használatához bizonyos adatokat kell tárolnunk és feldolgoznunk. Kérjük, olvasd el figyelmesen az alábbi tájékoztatót.",
|
||||
"la_privacy_section1_title": "Milyen adatokat tárolunk?",
|
||||
"la_privacy_section1_body": "A Live Activity működéséhez az alábbi adatokat tároljuk eszközazonosítóddal együtt:\n\n• Eszköz azonosító (UUID)\n• Eszköz token\n• Live Activity push token\n• APNs push token\n• Eszköz hash\n• Nyelvi beállítás\n• Csengő eltolódása\n\nAz órarendi adataid (lessons tábla) a következőket tartalmazzák:\n• Óra tárgya és időpontja\n• Tanár neve\n• Terem neve\n• Óra sorszáma\n• Óra témája\n• Helyettesítés adatai\n• Elmaradt óra jelzése\n\nAz időzített értesítések (scheduled_notifications tábla) a következőket tartalmazzák:\n• Azonosító\n• Eszköz azonosító\n• Időzített időpont\n• Küldés állapota és ideje\n• Létrehozás és frissítés ideje",
|
||||
"la_privacy_section2_title": "Hogyan védjük az adataidat?",
|
||||
"la_privacy_section2_body": "Komolyan vesszük az adataid biztonságát:\n\n• A devices és lessons táblákban lévő összes adat titkosítva van\n• Az adatokat biztonságos szerveren tároljuk\n• Csak a szükséges időtartamig tároljuk az adatokat",
|
||||
"la_privacy_section3_title": "Meddig tároljuk az adatokat?",
|
||||
"la_privacy_section3_body": "Az adatok tárolása minimális időtartamra korlátozódik:\n\n• Live Activity push token: Addig van tárolva, amíg óráid vannak az adott napon (beleértve az első óra előtti 2 órás időszakot is). Ha nincs több órád, az érték null lesz.\n\n• Órarendi adatok: Csak az órák időtartamára tárolódnak, majd automatikusan törlődnek. Pénteken az utolsó óra után az órarendet tartalmazó tábla teljesen üres lesz.\n\n• Eszközadatok (token, azonosítók): Addig van tárolva, amíg a Live Activity funkció engedélyezve van. A funkció kikapcsolásakor ezek az adatok azonnal törlésre kerülnek.",
|
||||
"la_privacy_section4_title": "Mire használjuk az adatokat?",
|
||||
"la_privacy_section4_body": "Az adatokat kizárólag a Live Activity funkció működtetésére használjuk:\n\n• Élő órarend megjelenítése a lezárási képernyőn\n• Push értesítések küldése óraváltásokkor\n• Az órarend szinkronizálása az eszközödön\n• A hétfő reggeli értesítések kézbesítésének biztosítása a heti adatbázis-ürítés után is\n\nAz adataidat nem adjuk át harmadik félnek, és nem használjuk marketing célokra.",
|
||||
"la_privacy_section5_title": "Jogaid",
|
||||
"la_privacy_section5_body": "A GDPR alapján az alábbi jogokkal rendelkezel:\n\n• Hozzáférési jog: A tárolt adatok típusát ebben az adatvédelmi tájékoztatóban tekintheted meg.\n• Törlési jog: A Live Activity funkció kikapcsolásával minden, a funkcióhoz kapcsolódó adat (eszközazonosítók, órarend) azonnal és véglegesen törlődik a szervereinkről.\n• Módosítási jog: Az órarendi adatok módosítása a Kréta rendszerben történik, az arra jogosult személyek (pl. tanárok) által.\n• Tiltakozási jog: Az adatkezelés ellen bármikor tiltakozhatsz a Live Activity funkció kikapcsolásával.",
|
||||
"la_privacy_footer": "Az adatvédelmi tájékoztató utolsó frissítése: 2025. november",
|
||||
"la_privacy_contact": "Kérdésed van? Keress minket a support @firka.app címen.",
|
||||
"la_privacy_summary1": "Eszköz tokenek, Live Activity tokenek, órarendi adatok",
|
||||
"la_privacy_summary2": "Titkosított tárolás, biztonságos szerverek",
|
||||
"la_privacy_summary3": "Az adatok automatikusan törlődnek, ha már nincs rájuk szükség",
|
||||
"la_title": "Live Activity",
|
||||
"la_subtitle": "Az órarended élő megjelenítése az eszköz lezárási képernyőjén",
|
||||
"la_privacy_title": "Adatvédelmi tájékoztató",
|
||||
"la_privacy_required": "A Live Activity használatához el kell fogadnod az adatvédelmi tájékoztatót",
|
||||
"la_learn_more": "Bővebben",
|
||||
"la_accept": "Elfogadom",
|
||||
"la_decline": "Elutasítom",
|
||||
"omission": "Hiányzás",
|
||||
"omissions": "Hiányzások",
|
||||
"omission_state_excused": "Igazolt",
|
||||
"omission_state_unexcused": "Igazolatlan",
|
||||
"omission_state_pending": "Függőben",
|
||||
"omissions_count": "{state, select, unexcused{{count} igazolatlan} pending{{count} igazolandó} other{{count}}} hiányzás",
|
||||
"@omissions_count": {
|
||||
"placeholders": {
|
||||
"state": {
|
||||
"type": "String"
|
||||
},
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"grade_weight_x1": "egyszeres súllyal",
|
||||
"grade_weight_x2": "dupla súllyal",
|
||||
"grade_weight_x3": "tripla súllyal",
|
||||
"grade_weight_x4": "négyszeres súllyal",
|
||||
"grade_weight_x5": "ötszörös súllyal",
|
||||
"grade_weight_percent": "{percent}%-os súllyal",
|
||||
"@grade_weight_percent": {
|
||||
"placeholders": {
|
||||
"percent": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"surprise_grade_rank_5": "LEGENDÁS",
|
||||
"surprise_grade_rank_4": "KIVÁLÓ",
|
||||
"surprise_grade_rank_3": "RENDBEN",
|
||||
"surprise_grade_rank_2": "GYENGE",
|
||||
"surprise_grade_rank_1": "KATASZTRÓFA",
|
||||
"new_grades_card": "Új jegyeid vannak",
|
||||
"s_notifications": "Értesítések",
|
||||
"s_sticker_map": "Matrica térkép",
|
||||
"s_qr_reader": "QR-kód olvasó",
|
||||
"s_feedback": "Visszajelzés",
|
||||
"s_a_desc": "Navigáció, nyelv, csengő, kerekítés",
|
||||
"s_c_desc": "Jegyek színe, téma, app ikon",
|
||||
"s_todo": "túdú: program this",
|
||||
"s_surprise_grades": "Meglepetés jegyek",
|
||||
"s_seasonal_icons": "Szezonális app ikonok",
|
||||
"s_uwu_mode": "UwU mód",
|
||||
"s_calendar_sync": "Naptár szinkronizálás",
|
||||
"s_save_grades": "Jegyek mentése",
|
||||
"s_welcome_msg": "Üdvözlő üzenet",
|
||||
"s_extras_desc": "Meglepetés jegyek, naptár szinkronizálás",
|
||||
"s_notifications_desc": "Jegyek, órarend változások, hiányok",
|
||||
"s_notif_push_enabled": "Push értesítések engedélyezése",
|
||||
"s_notif_delivery_method_header": "Kézbesítési mód",
|
||||
"s_notif_delivery_auto": "Automatikus",
|
||||
"s_notif_delivery_fcm": "Firebase Cloud Messaging (FCM)",
|
||||
"s_notif_delivery_alarm": "Ébresztő (háttérellenőrzés)",
|
||||
"s_notif_wakeup_interval_header": "Ellenőrzési gyakoriság",
|
||||
"s_notif_wakeup_hourly": "Óránként",
|
||||
"s_notif_wakeup_two_hourly": "Kétóránként",
|
||||
"s_notif_categories_header": "Kategóriák",
|
||||
"s_notif_grades": "Jegyek",
|
||||
"s_notif_homework_tests": "Házi feladatok és dolgozatok",
|
||||
"s_notif_absences": "Hiányzások",
|
||||
"s_notif_lessons": "Órarendváltozások",
|
||||
"s_notif_lessons_cancelled": "Elmaradt órák",
|
||||
"s_notif_lessons_substituted": "Helyettesítések",
|
||||
"s_notif_messages": "Üzenetek",
|
||||
"s_progress_notification": "Folyamatjelző értesítés",
|
||||
"s_progress_notification_desc": "Élő folyamatjelző értesítés a tanítási nap óráiról és szüneteiről",
|
||||
"progress_notif_channel_name": "Tanítási nap folyamata",
|
||||
"progress_notif_channel_desc": "Élő értesítés a mai órák és szünetek állapotáról",
|
||||
"progress_notif_lesson_title": "{number}. óra: {name}",
|
||||
"@progress_notif_lesson_title": {
|
||||
"placeholders": {
|
||||
"number": {"type": "String"},
|
||||
"name": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_substitution": " (Helyettesítés)",
|
||||
"progress_notif_case1_text": "{minutes} perc múlva ({timeRange}){room}{substitution}{remaining}",
|
||||
"@progress_notif_case1_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"},
|
||||
"timeRange": {"type": "String"},
|
||||
"room": {"type": "String"},
|
||||
"substitution": {"type": "String"},
|
||||
"remaining": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_case2_lesson_text": "{minutes} perc van hátra ({timeRange}){room}{substitution}{remaining}",
|
||||
"@progress_notif_case2_lesson_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"},
|
||||
"timeRange": {"type": "String"},
|
||||
"room": {"type": "String"},
|
||||
"substitution": {"type": "String"},
|
||||
"remaining": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_case2_break_title": "Szünet",
|
||||
"progress_notif_case2_break_text": "{minutes} perc van hátra{remaining}",
|
||||
"@progress_notif_case2_break_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"},
|
||||
"remaining": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_critical_text": "{minutes}p",
|
||||
"@progress_notif_critical_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_remaining_lessons_one": " - Még 1 óra van hátra",
|
||||
"progress_notif_remaining_lessons_other": " - Még {count} óra van hátra",
|
||||
"@progress_notif_remaining_lessons_other": {
|
||||
"placeholders": {
|
||||
"count": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"s_fcm_status_title": "FCM állapot",
|
||||
"s_fcm_status_initialized": "Inicializálva",
|
||||
"s_fcm_status_not_initialized": "Nincs inicializálva",
|
||||
"s_fcm_status_token_present": "Token megvan",
|
||||
"s_fcm_status_token_missing": "Nincs token",
|
||||
"s_fcm_status_permission_label": "Értesítési engedély",
|
||||
"s_fcm_status_permission_granted": "Engedélyezve",
|
||||
"s_fcm_status_permission_denied": "Elutasítva",
|
||||
"s_fcm_status_permission_unknown": "Ismeretlen",
|
||||
"s_fcm_status_topic_label": "Feliratkozott téma",
|
||||
"s_fcm_status_last_refresh_label": "Utolsó token frissítés",
|
||||
"s_fcm_status_last_refresh_never": "Még nem történt",
|
||||
"s_fcm_status_refresh_button": "Frissítés",
|
||||
"s_fcm_notify_on_message": "Értesítés FCM üzenetkor",
|
||||
"s_fcm_test_notifications_title": "Teszt értesítések",
|
||||
"s_fcm_test_notifications_multi_title": "Több fiók szimulálása",
|
||||
"s_n_all": "Összes",
|
||||
"s_n_grades": "Új jegyek",
|
||||
"s_n_homework_tests": "Feladatok & Számonkérések",
|
||||
"s_n_absences": "Hiányzások",
|
||||
"s_n_lessons": "Órák",
|
||||
"s_n_messages": "Üzenetek",
|
||||
"s_n_by_subject": "Tantárgyak szerint"
|
||||
}
|
||||
2697
firka/lib/l10n/app_localizations.dart
Normal file
2697
firka/lib/l10n/app_localizations.dart
Normal file
File diff suppressed because it is too large
Load Diff
1343
firka/lib/l10n/app_localizations_de.dart
Normal file
1343
firka/lib/l10n/app_localizations_de.dart
Normal file
File diff suppressed because it is too large
Load Diff
1349
firka/lib/l10n/app_localizations_en.dart
Normal file
1349
firka/lib/l10n/app_localizations_en.dart
Normal file
File diff suppressed because it is too large
Load Diff
1343
firka/lib/l10n/app_localizations_hu.dart
Normal file
1343
firka/lib/l10n/app_localizations_hu.dart
Normal file
File diff suppressed because it is too large
Load Diff
1343
firka/lib/l10n/app_localizations_pl.dart
Normal file
1343
firka/lib/l10n/app_localizations_pl.dart
Normal file
File diff suppressed because it is too large
Load Diff
406
firka/lib/l10n/app_pl.arb
Normal file
406
firka/lib/l10n/app_pl.arb
Normal file
@@ -0,0 +1,406 @@
|
||||
{
|
||||
"tt_settings_toast_lesson_ab_timetable": "Dwutygodniowy plan lekcji",
|
||||
"restart_title": "Uruchom ponownie aplikację",
|
||||
"s_wear": "Wear OS",
|
||||
"s_ag_navbar_home": "Strona główna",
|
||||
"tt_holiday": "Dzień świąteczny",
|
||||
"pairing": "Łączenie lekcji",
|
||||
"s_c_replace_icon": "Zmiana ikony",
|
||||
"close": "Zamknij",
|
||||
"ghost_grade": "Szellem jegy",
|
||||
"la_privacy_required": "A Live Activity használatához el kell fogadnod az adatvédelmi tájékoztatót",
|
||||
"debug_screen": "Menu deweloperskie",
|
||||
"save": "Zapisz",
|
||||
"starting_hour_plural": "godzina",
|
||||
"ic_void_icon": "Nic",
|
||||
"wearSyncNotificationText": "Óra adatainak szinkronban tartása",
|
||||
"wear_pairing_check_phone": "Folytasd a párosítást a telefonodon",
|
||||
"la_privacy_section2_body": "Komolyan vesszük az adataid biztonságát:\n\n• A devices és lessons táblákban lévő összes adat titkosítva van\n• Az adatokat biztonságos szerveren tároljuk\n• Csak a szükséges időtartamig tároljuk az adatokat",
|
||||
"unknown_teacher": "Nieznany nauczyciel",
|
||||
"la_privacy_header": "Live Activity adatvédelmi tájékoztató",
|
||||
"title4": "Wiele dodatkowych rzeczy, których nigdy nie znajdziesz w Kréta.",
|
||||
"gradesCount": "{count} jegy",
|
||||
"@gradesCount": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_ag_rounding": "Domyślne zaokrąglanie",
|
||||
"wear_syncing": "Szinkronizálás...",
|
||||
"s_ci_icon_g8": "Pride ",
|
||||
"ic_lgbtq_f": "LGBTQ+",
|
||||
"licensesLabel": "Licencek",
|
||||
"s_c": "Dostosowanie",
|
||||
"starting_hour": "godzina",
|
||||
"wear_try_again": "Újra",
|
||||
"title1": "Poznaj wszystko na pierwszy rzut oka",
|
||||
"subtitle1": "Na górze strony głównej możesz zobaczyć przydatne informacje o swoim dniu.",
|
||||
"subject_avg": "Średnia z przedmiotu",
|
||||
"view_subject_btn": "Zobacz przedmiot",
|
||||
"tt_winter_break": "Zimowa przerwa",
|
||||
"stats_created_at": "Utworzono",
|
||||
"s_n": "Értesítések",
|
||||
"tt_settings_toast": "Ustawienia planu lekcji",
|
||||
"refreshing": "Aktualizowanie danych...",
|
||||
"la_privacy_footer": "Az adatvédelmi tájékoztató utolsó frissítése: 2025. november",
|
||||
"la_privacy_section5_body": "A GDPR alapján az alábbi jogokkal rendelkezel:\n\n• Hozzáférési jog: A tárolt adatok típusát ebben az adatvédelmi tájékoztatóban tekintheted meg.\n• Törlési jog: A Live Activity funkció kikapcsolásával minden, a funkcióhoz kapcsolódó adat (eszközazonosítók, órarend) azonnal és véglegesen törlődik a szervereinkről.\n• Módosítási jog: Az órarendi adatok módosítása a Kréta rendszerben történik, az arra jogosult személyek (pl. tanárok) által.\n• Tiltakozási jog: Az adatkezelés ellen bármikor tiltakozhatsz a Live Activity funkció kikapcsolásával.",
|
||||
"grades": "Oceny",
|
||||
"good_afternoon": "Miłego popołudnia, {p}!",
|
||||
"@good_afternoon": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tt_last_instructional_day_graduates": "Ostatni dzień zajęć dla klas kończących szkołę",
|
||||
"s_ci_icon_g3": "Nostalgia",
|
||||
"tt_first_instructional_day": "Pierwszy dzień nauki",
|
||||
"ic_gay": "Gej",
|
||||
"ic_nuke": "Nuklearny",
|
||||
"noMoreClasses": "Nincs több órád ma",
|
||||
"ic_lesb_f": "Lesbijka",
|
||||
"s_acc_add": "Dodaj nowe konto",
|
||||
"ic_old": "Domain Dave",
|
||||
"licenseDescription": "Az alkalmazás által használt külső könyvtárak licencei",
|
||||
"tt_autumn_break": "Jesienna przerwa",
|
||||
"s_ci_icon_header": "Ikona aplikacji",
|
||||
"empty_class": "Lyukasóra",
|
||||
"lesson_subject": "Przedmiot lekcji",
|
||||
"pairing_description": "Czy chcesz połączyć tę lekcję z aplikacją Firka?\nPo połączeniu zobaczysz plan lekcji oraz swoje najnowsze oceny, sprawdziany i zadania.",
|
||||
"date": "Godzina lekcji",
|
||||
"ic_szivacs": "Gąbka",
|
||||
"starting_sec_plural": "sekunda",
|
||||
"s_ci_icon_g6_desc": "przez @emilia6_6",
|
||||
"ic_filco": "Filc . O",
|
||||
"good_day": "Miłego dnia, {p}!",
|
||||
"@good_day": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tt_full_day_trip": "Całodniowa wycieczka",
|
||||
"wear_pairing_request_sent": "Párosítás folyamatban, nyisd meg az appot a telefonodon",
|
||||
"grade_calculator_add": "Hozzáadás",
|
||||
"ic_kreta": "eFIRKA",
|
||||
"subtitle2": "Zobacz statystyki, nadchodzące sprawdziany, a nawet oceny z poprzednich lat szkolnych.",
|
||||
"s_n_live_activity": "Live Activity",
|
||||
"wear_phone_disconnected": "Az órád nincs csatlakoztatva a telefonoddal!",
|
||||
"la_privacy_section3_body": "Az adatok tárolása minimális időtartamra korlátozódik:\n\n• Live Activity push token: Addig van tárolva, amíg óráid vannak az adott napon (beleértve az első óra előtti 2 órás időszakot is). Ha nincs több órád, az érték null lesz.\n\n• Órarendi adatok: Csak az órák időtartamára tárolódnak, majd automatikusan törlődnek. Pénteken az utolsó óra után az órarendet tartalmazó tábla teljesen üres lesz.\n\n• Eszközadatok (token, azonosítók): Addig van tárolva, amíg a Live Activity funkció engedélyezve van. A funkció kikapcsolásakor ezek az adatok azonnal törlésre kerülnek.",
|
||||
"tt_last_instructional_day": "Ostatni dzień nauki",
|
||||
"tt_settings_toast_lesson_nos": "Numery lekcji",
|
||||
"s_ci_icon_g5": "Referencja",
|
||||
"tt_settings_toast_lesson_substitution": "Zastępstwa",
|
||||
"tt_added": "Utworzono: ",
|
||||
"la_privacy_section3_title": "Meddig tároljuk az adatokat?",
|
||||
"school_ending": "Denerwujesz się, {p}?",
|
||||
"@school_ending": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_wear_os_support": "Wear OS támogatás",
|
||||
"ic_enby": "Niebinarna",
|
||||
"tt_settings_toast_lesson_tests": "Sprawdziany i inne",
|
||||
"happy_birthday": "Wszystkiego najlepszego, {p}!",
|
||||
"@happy_birthday": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"api_error": "Błąd API Kréta",
|
||||
"ic_trans_f": "Trans",
|
||||
"ic_enby_f": "Niebinarna",
|
||||
"ic_lidl": "Zakupy",
|
||||
"tests_tomorrow": "Masz {tests} sprawdzianów",
|
||||
"@tests_tomorrow": {
|
||||
"placeholders": {
|
||||
"tests": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ic_trans": "Trans",
|
||||
"s_ci_icon_g4": "Przeprojektowany",
|
||||
"tt_public_holiday": "Dzień wolny od pracy",
|
||||
"s_ag_language_header": "Język",
|
||||
"tt_instructional_day": "Dzień zajęć szkolnych",
|
||||
"ic_cc": "Chmura Kreatywna",
|
||||
"la_privacy_title": "Adatvédelmi tájékoztató",
|
||||
"s_ag_r1": "1 → 2",
|
||||
"s_c_theme_light": "Jasny",
|
||||
"title2": "Twoje przedmioty wygodnie się tutaj mieszczą",
|
||||
"tomorrow_subtitle": "Oto Twój jutrzejszy dzień.",
|
||||
"s_n_test": "Teszt értesítés küldése",
|
||||
"starting_min_plural": "minuta",
|
||||
"ic_mkkp": "Darmowe oceny",
|
||||
"subjects": "Przedmioty",
|
||||
"s_c_theme_header": "Motyw",
|
||||
"s_a": "Aplikacja",
|
||||
"loginBtn": "Zaloguj się za pomocą konta E-Kréta",
|
||||
"mark_as_not_done": "Oznacz jako nieukończone",
|
||||
"wearSyncNotificationTitle": "Szinkronizálás az órával",
|
||||
"mark_as_done": "Oznacz jako ukończone",
|
||||
"s_ag": "Ogólne",
|
||||
"ic_xmas3": "FirŚwięta",
|
||||
"data": "Dane",
|
||||
"la_learn_more": "Bővebben",
|
||||
"ic_pixelized": "Spikselizowany",
|
||||
"other": "Więcej",
|
||||
"ic_o1g": "Orbán to pizda",
|
||||
"la_privacy_section2_title": "Hogyan védjük az adataidat?",
|
||||
"good_night": "Miłego wieczoru, {p}!",
|
||||
"@good_night": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_ag_r4": "4 → 5",
|
||||
"s_ci_icon_g1": "Catboy domain",
|
||||
"starting_min": "minuta",
|
||||
"ic_pride": "Kosmiczna tęcza",
|
||||
"suffering_almost_over_subtitle": "Już niedługo będziesz wolny. Uważaj na nauczyciela.",
|
||||
"la_privacy_section5_title": "Jogaid",
|
||||
"ghost_grades": "Szellem jegyek",
|
||||
"s_customization": "Personalizacja",
|
||||
"tomorrow": "Jutro",
|
||||
"breakTxt": "Szünet",
|
||||
"la_privacy_section1_title": "Milyen adatokat tárolunk?",
|
||||
"s_ci_warning_header": "[!] W trybie debug zmiana ikony nie będzie działać",
|
||||
"tt_spring_break": "Wiosenna przerwa",
|
||||
"s_ag_language_hu": "Węgierski",
|
||||
"tt_no_classes_l2": "Yippee!",
|
||||
"class_n": "Liczba godzin tygodniowo",
|
||||
"s_settings": "Ustawienia",
|
||||
"subject_avg_rounded": "Średnia z przedmiotu po zaokrągleniu",
|
||||
"class_dismissed": "Odwołana lekcja",
|
||||
"s_ci_icon_subtitle": "Wybierz piękną ikonę aplikacji, jeśli znudził Ci się zielony kolor.",
|
||||
"s_ci_icon_g6": "Konkurs na świąteczne logo 2024",
|
||||
"ic_lgbtqp": "Postęp",
|
||||
"beta_title": "Firka – publiczna beta",
|
||||
"la_title": "Live Activity",
|
||||
"n_left_subtitle": "Wytrzymaj, zostało tylko {n} godzin!",
|
||||
"@n_left_subtitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pair": "Parowanie",
|
||||
"grade_strValue": "Ocena opisowa: ",
|
||||
"s_acc_kreta": "Konta eKRÉTA",
|
||||
"ic_pear": "Gruszka",
|
||||
"s_ag_bell_delay": "Przesunięcie dzwonka",
|
||||
"s_your_account": "Twoje konto",
|
||||
"wear_phone_unpaired": "Az órád nincs párosítva a telefonoddal!",
|
||||
"tt_non_instructional_day": "Dzień wolny od zajęć dydaktycznych",
|
||||
"b_week": "Tydzień B",
|
||||
"home": "Strona główna",
|
||||
"subject": "Tantárgy",
|
||||
"s_c_icon_header": "Ikony aplikacji",
|
||||
"cancel": "Anuluj",
|
||||
"yesterday": "Wczoraj",
|
||||
"ic_repont": "Pięćdziesiąt groszy",
|
||||
"ic_cactus": "Kaktusowy zagajnik",
|
||||
"get_ready": "Odpocznij i przygotuj się",
|
||||
"ic_lesb": "Lesbijka",
|
||||
"s_acc_logout": "Wyloguj się",
|
||||
"stats_date": "Data",
|
||||
"your_subjects": "Twoje przedmioty",
|
||||
"reauth": "Wymagane logowanie",
|
||||
"good_morning": "Dzień dobry, {p}!",
|
||||
"@good_morning": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"firstIn": "Első órád: {t}",
|
||||
"@firstIn": {
|
||||
"placeholders": {
|
||||
"t": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"la_privacy_section4_title": "Mire használjuk az adatokat?",
|
||||
"ic_xmas2": "Prezent",
|
||||
"settings_screen": "Ustawienia",
|
||||
"la_privacy_summary1": "Eszköz tokenek, Live Activity tokenek, órarendi adatok",
|
||||
"title3": "Personalizowany plan lekcji",
|
||||
"ic_filc": "Filc Dziennik",
|
||||
"s_c_theme_dark": "Ciemny",
|
||||
"grade_calculator": "Jegy kalkulátor",
|
||||
"la_accept": "Elfogadom",
|
||||
"s_stats_for_nerds": "Pokaż dodatkowe informacje",
|
||||
"s_ag_r3": "3 → 4",
|
||||
"ic_tisza": "Árad a firka",
|
||||
"okay": "Ok",
|
||||
"s_developer": "Ustawienia deweloperskie",
|
||||
"privacyLabel": "Polityka prywatności",
|
||||
"stats_last_mod": "Ostatnio zmodyfikowano",
|
||||
"s_ag_navbar_desc": "Wybierz, co ma się wyświetlać na pasku nawigacyjnym, i uporządkuj elementy. Pozostałe strony są dostępne przez przycisk „więcej”. Możesz przypiąć maksymalnie 4 strony.",
|
||||
"a_week": "Tydzień",
|
||||
"s_ag_r2": "2 → 3",
|
||||
"wearTitle": "{n}. óra",
|
||||
"@wearTitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timetable": "Plan lekcji",
|
||||
"ic_ace": "Aseksualny",
|
||||
"s_ci_icon_g2": "Pisak",
|
||||
"s_ci_child_protection": "Ochrona dzieci",
|
||||
"s_ag_navbar_hidden": "Ukryte",
|
||||
"runningInDomainBrowser": "Przeglądarka domen",
|
||||
"noClasses": "Nincs ma iskola, pihend ki magad!",
|
||||
"ic_bi": "Biseksualny",
|
||||
"ic_proto": "Prototyp",
|
||||
"tt_first_semester_end": "Koniec pierwszego semestru",
|
||||
"la_decline": "Elutasítom",
|
||||
"s_c_theme_auto": "Automatyczny",
|
||||
"ic_paper": "Papier",
|
||||
"ic_xmas1": "Lista złych",
|
||||
"s_ci_icon_g7": "Pride",
|
||||
"lessons_tomorrow": "{lessons} órád lesz",
|
||||
"@lessons_tomorrow": {
|
||||
"placeholders": {
|
||||
"lessons": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ic_lgbtq": "LGBTQ+",
|
||||
"subtitle3": "Wybierz, co chcesz widzieć na stronie planu lekcji. Włącz lub wyłącz sprawdziany, prace domowe, przerwy oraz okienka.",
|
||||
"ic_original": "Oryginał",
|
||||
"ic_refilc": "reFilc",
|
||||
"la_privacy_contact": "Kérdésed van? Keress minket a support @firka.app címen.",
|
||||
"tt_no_classes_l1": "W tym dniu nie masz lekcji!",
|
||||
"s_ag_class_avg_on_graph": "Średnia klasy na wykresie",
|
||||
"class_substitution": "Zastępstwo",
|
||||
"ic_half_firka_2": "Rewolucja",
|
||||
"no_tests_tomorrow": "Jutro nie masz sprawdzianu",
|
||||
"overall_avg": "Összesített átlag",
|
||||
"s_n_morning_time": "Értesítés ideje iskola előtt",
|
||||
"ic_ace_f": "Aseksualny",
|
||||
"wear_sync_with_phone": "Nyisd meg a telefonos appot a szinkronizáláshoz",
|
||||
"s_ag_navbar": "Pasek nawigacyjny",
|
||||
"class_avg": "Średnia klasy",
|
||||
"tt_quarter_end": "koniec kwartału",
|
||||
"la_privacy_section4_body": "Az adatokat kizárólag a Live Activity funkció működtetésére használjuk:\n\n• Élő órarend megjelenítése a lezárási képernyőn\n• Push értesítések küldése óraváltásokkor\n• Az órarend szinkronizálása az eszközödön\n• A hétfő reggeli értesítések kézbesítésének biztosítása a heti adatbázis-ürítés után is\n\nAz adataidat nem adjuk át harmadik félnek, és nem használjuk marketing célokra.",
|
||||
"no_grades": "Z tego przedmiotu nie masz jeszcze ocen.",
|
||||
"la_privacy_summary2": "Titkosított tárolás, biztonságos szerverek",
|
||||
"ic_lgbtqp_f": "Postęp",
|
||||
"ic_bi_f": "Biseksualny",
|
||||
"now": "Most",
|
||||
"la_privacy_section1_body": "A Live Activity működéséhez az alábbi adatokat tároljuk eszközazonosítóddal együtt:\n\n• Eszköz azonosító (UUID)\n• Eszköz token\n• Live Activity push token\n• APNs push token\n• Eszköz hash\n• Nyelvi beállítás\n• Csengő eltolódása\n\nAz órarendi adataid (lessons tábla) a következőket tartalmazzák:\n• Óra tárgya és időpontja\n• Tanár neve\n• Terem neve\n• Óra sorszáma\n• Óra témája\n• Helyettesítés adatai\n• Elmaradt óra jelzése\n\nAz időzített értesítések (scheduled_notifications tábla) a következőket tartalmazzák:\n• Azonosító\n• Eszköz azonosító\n• Időzített időpont\n• Küldés állapota és ideje\n• Létrehozás és frissítés ideje",
|
||||
"starting_soon": "Już wkrótce zaczyna się Twoja pierwsza lekcja!",
|
||||
"ic_refulc": "firk’a",
|
||||
"s_ag_left_handed_mode": "Tryb dla leworęcznych",
|
||||
"tt_rest_day": "Dzień wolny",
|
||||
"la_privacy_summary3": "Az adatok automatikusan törlődnek, ha már nincs rájuk szükség",
|
||||
"tt_settings_toast_lesson_breaks": "Przerwy",
|
||||
"s_ag_language_auto": "Automatyczny",
|
||||
"s_ag_navbar_visible": "Wyświetlane",
|
||||
"starting_sec": "sekunda",
|
||||
"la_subtitle": "Az órarended élő megjelenítése az eszköz lezárási képernyőjén",
|
||||
"grade_teacherName": "Imię i nazwisko nauczyciela: ",
|
||||
"ic_modern": "Nowoczesny",
|
||||
"timeLeft": "Még {mins} perc",
|
||||
"@timeLeft": {
|
||||
"placeholders": {
|
||||
"mins": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_ag_language_de": "Niemiecki",
|
||||
"today": "Dziś",
|
||||
"ic_gay_f": "Gej",
|
||||
"ic_fidesz": "Fidesz",
|
||||
"s_n_morning": "Reggeli értesítés",
|
||||
"restart_body": "Kliknij tutaj, aby otworzyć aplikację.",
|
||||
"s_ag_language_en": "Angielski",
|
||||
"homework": "Praca domowa",
|
||||
"ic_pixel": "Pixel",
|
||||
"view_lesson_btn": "Zobacz lekcję",
|
||||
"la_privacy_intro": "A Live Activity funkció használatához bizonyos adatokat kell tárolnunk és feldolgoznunk. Kérjük, olvasd el figyelmesen az alábbi tájékoztatót.",
|
||||
"beta_body": "Aplikacja jest w trakcie rozwoju; niektóre funkcje mogą działać nieprawidłowo, nie działać lub jeszcze nie być ukończone.",
|
||||
"ic_galaxy": "Galaktyka",
|
||||
"copied": "Másolva",
|
||||
"view_day_btn": "Zobacz dzień",
|
||||
"omission": "Hiányzás",
|
||||
"omissions": "Hiányzások",
|
||||
"omission_state_excused": "Igazolt",
|
||||
"omission_state_unexcused": "Igazolatlan",
|
||||
"omission_state_pending": "Függőben",
|
||||
"omissions_count": "{state, select, unexcused{{count} igazolatlan} pending{{count} igazolandó} other{{count}}} hiányzás",
|
||||
"@omissions_count": {
|
||||
"placeholders": {
|
||||
"state": {
|
||||
"type": "String"
|
||||
},
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_beta_warning": "Ostrzeżenie beta",
|
||||
"s_ag_privacy_ever_declined": "Wcześniej odrzucono politykę prywatności",
|
||||
"s_c_tab_appearance": "Wygląd aplikacji",
|
||||
"s_c_tab_subjects": "Przedmioty",
|
||||
"s_c_tab_fonts": "Czcionki",
|
||||
"s_c_my_themes": "Moje motywy",
|
||||
"s_c_manage_subjects": "Zarządzaj przedmiotami",
|
||||
"s_c_change_app_icon": "Zmień ikonę aplikacji",
|
||||
"s_c_colors_header": "Kolory",
|
||||
"s_c_grade_colors_header": "Kolory ocen",
|
||||
"s_c_title_style_header": "Styl tytułów",
|
||||
"s_c_title_weight_header": "Grubość tytułów",
|
||||
"s_c_title_weight_subtitle": "Nie wszystkie czcionki to obsługują",
|
||||
"s_c_title_weight_thin": "Cienka",
|
||||
"s_c_title_weight_thick": "Gruba",
|
||||
"s_c_capitalization_header": "Wielkość liter",
|
||||
"s_c_capitalization_lower": "małe litery",
|
||||
"s_c_capitalization_normal": "Normalna",
|
||||
"s_c_capitalization_upper": "WIELKIE LITERY",
|
||||
"s_c_change": "Zmień",
|
||||
"s_c_customize": "Dostosuj",
|
||||
"s_c_themes_current": "Bieżący",
|
||||
"s_c_themes_own": "Własne",
|
||||
"s_c_themes_downloaded": "Pobrane",
|
||||
"s_c_themes_share_current": "Udostępnij bieżący motyw",
|
||||
"s_c_themes_create_new": "Utwórz nowy motyw",
|
||||
"s_c_themes_import": "Importuj motyw",
|
||||
"s_c_themes_use": "Użyj",
|
||||
"s_c_themes_continue": "Kontynuuj",
|
||||
"s_c_themes_own_label": "Własny motyw",
|
||||
"s_c_themes_imported_label": "Zaimportowany motyw",
|
||||
"s_c_themes_builtin_label": "Wbudowany motyw",
|
||||
"s_c_themes_builtin_name": "Domyślny",
|
||||
"s_c_themes_create_title": "Utwórz nowy motyw",
|
||||
"s_c_themes_create_subtitle": "Podaj nazwę motywu",
|
||||
"s_c_themes_create_placeholder": "Nazwa motywu",
|
||||
"s_c_themes_delete_title": "Usuń motyw",
|
||||
"s_c_themes_delete_subtitle": "Czy na pewno chcesz usunąć ten motyw? Tę czynność można cofnąć.",
|
||||
"s_c_themes_delete_confirm": "Usuń",
|
||||
"s_about": "O aplikacji",
|
||||
"s_extras": "Dodatki",
|
||||
"s_other": "Inne",
|
||||
"subtitle4": ""
|
||||
}
|
||||
5
firka/lib/l10n/crowdin.yml
Normal file
5
firka/lib/l10n/crowdin.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
files:
|
||||
- source: app_hu.arb
|
||||
translation: /app_%two_letters_code%.arb
|
||||
bundles:
|
||||
- 3
|
||||
@@ -20,6 +20,8 @@ import 'package:firka/ui/phone/screens/login/login_screen.dart';
|
||||
import 'package:firka/ui/phone/screens/message/message_screen.dart';
|
||||
import 'package:firka/ui/phone/screens/home/home_screen.dart';
|
||||
import 'package:firka/ui/phone/screens/settings/settings_screen.dart';
|
||||
import 'package:firka/ui/phone/screens/grade_colors/grade_colors_screen.dart';
|
||||
import 'package:firka/ui/phone/screens/theme_editor/theme_editor_screen.dart';
|
||||
import 'package:firka/ui/phone/screens/themes/theme_screen.dart';
|
||||
import 'package:firka/ui/phone/screens/themes/themes_screen.dart';
|
||||
import 'package:firka/ui/phone/screens/themes/user_theme.dart';
|
||||
@@ -115,6 +117,20 @@ GoRouter createAppRouter() {
|
||||
);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: '/grade-colors',
|
||||
builder: (context, state) => DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: GradeColorsScreen(initData, key: state.pageKey),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/theme-editor',
|
||||
builder: (context, state) => DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: ThemeEditorScreen(initData, key: state.pageKey),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/message',
|
||||
builder: (context, state) {
|
||||
|
||||
@@ -22,17 +22,28 @@ class ShellWithNavBar extends StatelessWidget {
|
||||
final data = initData;
|
||||
final currentIndex = navigationShell.currentIndex;
|
||||
|
||||
final bottomBg =
|
||||
appStyle.colors.backgroundGradient?.last ?? appStyle.colors.background;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: appStyle.colors.background,
|
||||
body: child,
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.backgroundLinearGradient == null
|
||||
? appStyle.colors.background
|
||||
: null,
|
||||
gradient: appStyle.colors.backgroundLinearGradient,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.bottomCenter,
|
||||
end: Alignment.topCenter,
|
||||
colors: [
|
||||
appStyle.colors.background,
|
||||
appStyle.colors.background.withValues(alpha: 0.0),
|
||||
bottomBg,
|
||||
bottomBg.withValues(alpha: 0.0),
|
||||
],
|
||||
stops: const [0.0, 1.0],
|
||||
),
|
||||
|
||||
86
firka/lib/services/alarm_notification_service.dart
Normal file
86
firka/lib/services/alarm_notification_service.dart
Normal file
@@ -0,0 +1,86 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:android_alarm_manager_plus/android_alarm_manager_plus.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:firka/services/notification_diff_service.dart';
|
||||
|
||||
const int _alarmNotificationSyncId = 910001;
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
Future<void> alarmNotificationWakeupCallback() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await NotificationDiffService.checkAll();
|
||||
}
|
||||
|
||||
class AlarmNotificationService {
|
||||
static final Logger _logger = Logger('AlarmNotificationService');
|
||||
static bool _isInitialized = false;
|
||||
|
||||
@visibleForTesting
|
||||
static bool? isAndroidOverride;
|
||||
|
||||
static bool get _isAndroid => isAndroidOverride ?? Platform.isAndroid;
|
||||
|
||||
@visibleForTesting
|
||||
static void resetForTesting() {
|
||||
_isInitialized = false;
|
||||
isAndroidOverride = null;
|
||||
}
|
||||
|
||||
static bool get isInitialized => _isInitialized;
|
||||
|
||||
static Future<void> initialize() async {
|
||||
if (_isInitialized || !_isAndroid) return;
|
||||
try {
|
||||
await AndroidAlarmManager.initialize();
|
||||
_isInitialized = true;
|
||||
_logger.info('AlarmNotificationService initialized');
|
||||
} catch (e, st) {
|
||||
_logger.severe('Failed to initialize AlarmNotificationService: $e', e, st);
|
||||
}
|
||||
}
|
||||
|
||||
static Duration _durationFor(NotifyWakeupInterval interval) {
|
||||
switch (interval) {
|
||||
case NotifyWakeupInterval.hourly:
|
||||
return const Duration(hours: 1);
|
||||
case NotifyWakeupInterval.twoHourly:
|
||||
return const Duration(hours: 2);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> schedule() async {
|
||||
if (!_isAndroid) return;
|
||||
try {
|
||||
await initialize();
|
||||
final interval = _durationFor(Settings.notifyWakeupInterval.value);
|
||||
await AndroidAlarmManager.cancel(_alarmNotificationSyncId);
|
||||
await AndroidAlarmManager.periodic(
|
||||
interval,
|
||||
_alarmNotificationSyncId,
|
||||
alarmNotificationWakeupCallback,
|
||||
exact: false,
|
||||
wakeup: true,
|
||||
rescheduleOnReboot: true,
|
||||
);
|
||||
_logger.info('Scheduled periodic alarm every ${interval.inHours}h');
|
||||
} catch (e, st) {
|
||||
_logger.severe('Failed to schedule alarm: $e', e, st);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> cancel() async {
|
||||
if (!_isAndroid) return;
|
||||
try {
|
||||
await AndroidAlarmManager.cancel(_alarmNotificationSyncId);
|
||||
_logger.info('Cancelled periodic alarm');
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to cancel alarm: $e', e, st);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,11 +151,29 @@ class FcmService {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool>? _pendingPermissionRequest;
|
||||
|
||||
static Future<bool> _requestPermission() async {
|
||||
if (_pendingPermissionRequest != null) {
|
||||
return await _pendingPermissionRequest!;
|
||||
}
|
||||
final status = await Permission.notification.status;
|
||||
if (status.isGranted) return true;
|
||||
final result = await Permission.notification.request();
|
||||
return result.isGranted;
|
||||
|
||||
final future = () async {
|
||||
try {
|
||||
final result = await Permission.notification.request();
|
||||
return result.isGranted;
|
||||
} catch (e) {
|
||||
_logger.warning('Failed to request notification permission: $e');
|
||||
return false;
|
||||
} finally {
|
||||
_pendingPermissionRequest = null;
|
||||
}
|
||||
}();
|
||||
|
||||
_pendingPermissionRequest = future;
|
||||
return await future;
|
||||
}
|
||||
|
||||
static String? _currentStudentId(KretaClient? client) {
|
||||
|
||||
@@ -15,6 +15,8 @@ class LocalNotificationService {
|
||||
FlutterLocalNotificationsPlugin();
|
||||
static bool _initialized = false;
|
||||
|
||||
static final List<({int id, String title, String body})> postedNotifications = [];
|
||||
|
||||
static Future<void> init() async {
|
||||
if (_initialized) return;
|
||||
|
||||
@@ -38,6 +40,12 @@ class LocalNotificationService {
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
/// Returns active notifications currently shown in the system status bar (Android 6.0+).
|
||||
static Future<List<ActiveNotification>> getActiveNotifications() async {
|
||||
await init();
|
||||
return await _plugin.getActiveNotifications();
|
||||
}
|
||||
|
||||
/// Shows a single notification. [id] should be stable per logical
|
||||
/// notification (e.g. derived from account key + category) so a repeat
|
||||
/// wakeup that finds the same new items updates rather than duplicates it.
|
||||
@@ -46,6 +54,8 @@ class LocalNotificationService {
|
||||
required String title,
|
||||
required String body,
|
||||
}) async {
|
||||
postedNotifications.add((id: id, title: title, body: body));
|
||||
|
||||
await init();
|
||||
await _plugin.show(
|
||||
id,
|
||||
|
||||
153
firka/lib/services/notification_delivery_service.dart
Normal file
153
firka/lib/services/notification_delivery_service.dart
Normal file
@@ -0,0 +1,153 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
import 'package:firka/api/client/kreta_client.dart';
|
||||
import 'package:firka_common/data/database.dart';
|
||||
import 'package:firka_common/data/models/token_model.dart';
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:firka/services/alarm_notification_service.dart';
|
||||
import 'package:firka/services/fcm_service.dart';
|
||||
import 'package:firka/services/progress_notification_service.dart';
|
||||
|
||||
class NotificationDeliveryService {
|
||||
static final Logger _logger = Logger('NotificationDeliveryService');
|
||||
static const MethodChannel _mainChannel = MethodChannel('firka.app/main');
|
||||
|
||||
static bool? _cachedGmsAvailable;
|
||||
|
||||
@visibleForTesting
|
||||
static bool? gmsAvailabilityOverride;
|
||||
|
||||
@visibleForTesting
|
||||
static bool? isAndroidOverride;
|
||||
|
||||
static bool get _isAndroid => isAndroidOverride ?? Platform.isAndroid;
|
||||
|
||||
@visibleForTesting
|
||||
static void resetForTesting() {
|
||||
_cachedGmsAvailable = null;
|
||||
gmsAvailabilityOverride = null;
|
||||
isAndroidOverride = null;
|
||||
}
|
||||
|
||||
static Future<bool> isGmsAvailable({bool forceRefresh = false}) async {
|
||||
if (gmsAvailabilityOverride != null) {
|
||||
return gmsAvailabilityOverride!;
|
||||
}
|
||||
if (!_isAndroid) return false;
|
||||
if (_cachedGmsAvailable != null && !forceRefresh) {
|
||||
return _cachedGmsAvailable!;
|
||||
}
|
||||
try {
|
||||
final available = await _mainChannel.invokeMethod<bool>('isGmsAvailable');
|
||||
_cachedGmsAvailable = available ?? false;
|
||||
return _cachedGmsAvailable!;
|
||||
} catch (e) {
|
||||
_logger.warning('Error checking GMS availability: $e');
|
||||
_cachedGmsAvailable = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static Future<NotificationDeliveryMethod> getEffectiveMethod() async {
|
||||
final configured = Settings.notificationDeliveryMethod.value;
|
||||
if (configured != NotificationDeliveryMethod.auto) {
|
||||
return configured;
|
||||
}
|
||||
final gms = await isGmsAvailable();
|
||||
return gms ? NotificationDeliveryMethod.fcm : NotificationDeliveryMethod.alarm;
|
||||
}
|
||||
|
||||
static Future<void> initialize() async {
|
||||
if (!_isAndroid) return;
|
||||
|
||||
final gms = await isGmsAvailable();
|
||||
_logger.info('Initializing NotificationDeliveryService (GMS available: $gms)');
|
||||
|
||||
await AlarmNotificationService.initialize();
|
||||
|
||||
if (gms) {
|
||||
await FcmService.initialize();
|
||||
}
|
||||
|
||||
await syncDeliveryBackend();
|
||||
}
|
||||
|
||||
static Future<void> syncDeliveryBackend() async {
|
||||
if (!_isAndroid) return;
|
||||
|
||||
try {
|
||||
if (!Settings.notifyAll.value) {
|
||||
_logger.info('Push notifications disabled, tearing down delivery backends');
|
||||
await FcmService.handleEnabledChange(false);
|
||||
await AlarmNotificationService.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
final effectiveMethod = await getEffectiveMethod();
|
||||
_logger.info('Syncing delivery backend for effective method: $effectiveMethod');
|
||||
|
||||
switch (effectiveMethod) {
|
||||
case NotificationDeliveryMethod.fcm:
|
||||
await AlarmNotificationService.cancel();
|
||||
await FcmService.handleEnabledChange(true);
|
||||
break;
|
||||
case NotificationDeliveryMethod.alarm:
|
||||
await FcmService.handleEnabledChange(false);
|
||||
await AlarmNotificationService.schedule();
|
||||
break;
|
||||
case NotificationDeliveryMethod.auto:
|
||||
break;
|
||||
}
|
||||
|
||||
await ProgressNotificationService.sync();
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to sync delivery backend: $e', e, st);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> handleWakeupIntervalChange() async {
|
||||
if (!Settings.notifyAll.value) return;
|
||||
|
||||
final effectiveMethod = await getEffectiveMethod();
|
||||
if (effectiveMethod == NotificationDeliveryMethod.fcm) {
|
||||
await FcmService.handleWakeupIntervalChange();
|
||||
} else if (effectiveMethod == NotificationDeliveryMethod.alarm) {
|
||||
await AlarmNotificationService.schedule();
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> onUserLogin({required KretaClient client}) async {
|
||||
if (!_isAndroid) return;
|
||||
|
||||
try {
|
||||
final effectiveMethod = await getEffectiveMethod();
|
||||
if (effectiveMethod == NotificationDeliveryMethod.fcm) {
|
||||
await FcmService.onUserLogin(client: client);
|
||||
} else if (effectiveMethod == NotificationDeliveryMethod.alarm) {
|
||||
await AlarmNotificationService.schedule();
|
||||
}
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to process onUserLogin: $e', e, st);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> onUserLogout() async {
|
||||
if (!_isAndroid) return;
|
||||
|
||||
final effectiveMethod = await getEffectiveMethod();
|
||||
if (effectiveMethod == NotificationDeliveryMethod.fcm) {
|
||||
await FcmService.onUserLogout();
|
||||
} else if (effectiveMethod == NotificationDeliveryMethod.alarm) {
|
||||
final tokenCount = await isarInit.tokenModels.count();
|
||||
if (tokenCount == 0) {
|
||||
await AlarmNotificationService.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:isar_community/isar.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
import 'package:firka_common/data/database.dart';
|
||||
import 'package:firka_common/data/last_seen.dart';
|
||||
@@ -13,8 +16,10 @@ import 'package:firka/api/client/kreta_client.dart';
|
||||
import 'package:firka/core/last_seen_helper.dart';
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:firka/data/widget.dart';
|
||||
import 'package:firka/services/fcm_headless_bootstrap.dart';
|
||||
import 'package:firka/services/local_notification_service.dart';
|
||||
import 'package:firka/services/progress_notification_service.dart';
|
||||
|
||||
/// Runs on a silent FCM wakeup: for every locally logged-in account, fetches
|
||||
/// grades/homework/tests/absences/lessons/messages, diffs each against what
|
||||
@@ -42,6 +47,8 @@ class NotificationDiffService {
|
||||
_logger.warning('checkAll: account ${token.username} failed: $e', e, st);
|
||||
}
|
||||
}
|
||||
|
||||
await ProgressNotificationService.checkAndStartIfActive();
|
||||
}
|
||||
|
||||
static Future<void> _checkAccount(
|
||||
@@ -96,10 +103,16 @@ class NotificationDiffService {
|
||||
);
|
||||
}
|
||||
|
||||
if (Settings.notifyLessons.value) {
|
||||
final now = DateTime.now();
|
||||
final lessons = await client.getLessons(now, now.add(const Duration(days: 7)));
|
||||
final now = DateTime.now();
|
||||
final lessons = await client.getLessons(now, now.add(const Duration(days: 7)));
|
||||
|
||||
final selectedToken = Settings.getSelectedToken();
|
||||
final isActiveAccount = selectedToken == null || selectedToken.key == accountKey;
|
||||
if (isActiveAccount) {
|
||||
await _checkAndUpdateWidget(lessons);
|
||||
}
|
||||
|
||||
if (Settings.notifyLessons.value) {
|
||||
final cancelled = lessons.where(_isCancelledLesson).toList();
|
||||
final substituted = lessons
|
||||
.where((l) => !_isCancelledLesson(l) && l.substituteTeacher != null)
|
||||
@@ -198,6 +211,12 @@ class NotificationDiffService {
|
||||
body: body(newItems),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// First run: seed baseline silently without spamming backlog.
|
||||
// If there are no items yet, record current time so subsequent items notify.
|
||||
final baseline = LastSeen.newestOf(items) ?? LastSeen(DateTime.now(), 0);
|
||||
await LastSeenHelper.set(accountKey, kind, baseline);
|
||||
return;
|
||||
}
|
||||
|
||||
final newest = LastSeen.newestOf(items);
|
||||
@@ -230,6 +249,45 @@ class NotificationDiffService {
|
||||
static int _notificationId(int accountKey, String kind) =>
|
||||
Object.hash(accountKey, kind) & 0x7fffffff;
|
||||
|
||||
static Future<void> _checkAndUpdateWidget(List<LessonCacheModel> lessons) async {
|
||||
try {
|
||||
final dataDir = await getApplicationDocumentsDirectory();
|
||||
final widgetFile = File(p.join(dataDir.path, "widget_state.json"));
|
||||
if (_hasTimetableChanged(lessons, widgetFile)) {
|
||||
_logger.info('Timetable changed during FCM sync, updating widget');
|
||||
await WidgetCacheHelper.updateWidgetCacheFromLessons(lessons);
|
||||
}
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to update widget during FCM sync: $e', e, st);
|
||||
}
|
||||
}
|
||||
|
||||
static bool _hasTimetableChanged(List<LessonCacheModel> lessons, File widgetFile) {
|
||||
if (!widgetFile.existsSync()) return true;
|
||||
try {
|
||||
final content = jsonDecode(widgetFile.readAsStringSync());
|
||||
final cachedTt = content['timetable'] as List?;
|
||||
if (cachedTt == null) return true;
|
||||
if (cachedTt.length != lessons.length) return true;
|
||||
for (int i = 0; i < lessons.length; i++) {
|
||||
final l = lessons[i];
|
||||
final c = cachedTt[i] as Map?;
|
||||
if (c == null) return true;
|
||||
if (c['name'] != l.name ||
|
||||
c['start'] != l.start.toIso8601String() ||
|
||||
c['end'] != l.end.toIso8601String() ||
|
||||
c['dailyNth'] != l.dailyNth ||
|
||||
c['roomName'] != l.roomName ||
|
||||
c['substituteTeacher'] != l.substituteTeacher) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (_) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// Matches the "isCancelled" convention already used across the app's
|
||||
/// live-activity/widget code (state names aren't a stable enum, just a
|
||||
/// Kréta-provided label; "elmarad" is the substring that consistently
|
||||
|
||||
227
firka/lib/services/progress_notification_service.dart
Normal file
227
firka/lib/services/progress_notification_service.dart
Normal file
@@ -0,0 +1,227 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:isar_community/isar.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
import 'package:firka_common/core/debug_helper.dart';
|
||||
import 'package:firka_common/data/database.dart';
|
||||
import 'package:firka_common/data/models/lesson_cache_model.dart';
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:firka/data/widget.dart';
|
||||
import 'package:firka/l10n/app_localizations.dart';
|
||||
import 'package:firka/services/notification_delivery_service.dart';
|
||||
|
||||
class ProgressNotificationService {
|
||||
static final Logger _logger = Logger('ProgressNotificationService');
|
||||
static const MethodChannel _channel = MethodChannel('app.firka/progress_notification');
|
||||
|
||||
@visibleForTesting
|
||||
static bool? isAndroidOverride;
|
||||
|
||||
static bool get _isAndroid => isAndroidOverride ?? Platform.isAndroid;
|
||||
|
||||
/// Syncs notification string templates from Flutter ARB localizations to Android SharedPreferences.
|
||||
static Future<void> syncStrings([AppLocalizations? l10n]) async {
|
||||
if (!_isAndroid) return;
|
||||
try {
|
||||
l10n ??= initDone ? initData.l10n : null;
|
||||
if (l10n == null) return;
|
||||
final strings = <String, String>{
|
||||
'progress_notif_channel_name': l10n.progress_notif_channel_name,
|
||||
'progress_notif_channel_desc': l10n.progress_notif_channel_desc,
|
||||
'progress_notif_lesson_title': l10n.progress_notif_lesson_title('{number}', '{name}'),
|
||||
'progress_notif_substitution': l10n.progress_notif_substitution,
|
||||
'progress_notif_case1_text': l10n.progress_notif_case1_text(
|
||||
'{minutes}',
|
||||
'{timeRange}',
|
||||
'{room}',
|
||||
'{substitution}',
|
||||
'{remaining}',
|
||||
),
|
||||
'progress_notif_case2_lesson_text': l10n.progress_notif_case2_lesson_text(
|
||||
'{minutes}',
|
||||
'{timeRange}',
|
||||
'{room}',
|
||||
'{substitution}',
|
||||
'{remaining}',
|
||||
),
|
||||
'progress_notif_case2_break_title': l10n.progress_notif_case2_break_title,
|
||||
'progress_notif_case2_break_text': l10n.progress_notif_case2_break_text(
|
||||
'{minutes}',
|
||||
'{remaining}',
|
||||
),
|
||||
'progress_notif_critical_text': l10n.progress_notif_critical_text('{minutes}'),
|
||||
'progress_notif_remaining_lessons_one': l10n.progress_notif_remaining_lessons_one,
|
||||
'progress_notif_remaining_lessons_other': l10n.progress_notif_remaining_lessons_other('{count}'),
|
||||
};
|
||||
await _channel.invokeMethod<bool>('updateProgressStrings', strings);
|
||||
_logger.info('Synced progress notification strings to native platform');
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to sync progress notification strings: $e', e, st);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> startService() async {
|
||||
if (!_isAndroid) return false;
|
||||
try {
|
||||
await syncStrings();
|
||||
final res = await _channel.invokeMethod<bool>('startProgressService');
|
||||
_logger.info('Started ProgressNotificationForegroundService: $res');
|
||||
return res ?? true;
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to start ProgressNotificationForegroundService: $e', e, st);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> stopService() async {
|
||||
if (!_isAndroid) return false;
|
||||
try {
|
||||
final res = await _channel.invokeMethod<bool>('stopProgressService');
|
||||
_logger.info('Stopped ProgressNotificationForegroundService: $res');
|
||||
return res ?? true;
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to stop ProgressNotificationForegroundService: $e', e, st);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> schedule6AmAlarm() async {
|
||||
if (!_isAndroid) return false;
|
||||
try {
|
||||
final res = await _channel.invokeMethod<bool>('schedule6AmAlarm');
|
||||
_logger.info('Scheduled 6 AM progress alarm: $res');
|
||||
return res ?? true;
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to schedule 6 AM progress alarm: $e', e, st);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> cancel6AmAlarm() async {
|
||||
if (!_isAndroid) return false;
|
||||
try {
|
||||
final res = await _channel.invokeMethod<bool>('cancel6AmAlarm');
|
||||
_logger.info('Cancelled 6 AM progress alarm: $res');
|
||||
return res ?? true;
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to cancel 6 AM progress alarm: $e', e, st);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> isRunning() async {
|
||||
if (!_isAndroid) return false;
|
||||
try {
|
||||
final res = await _channel.invokeMethod<bool>('isProgressServiceRunning');
|
||||
return res ?? false;
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to check if progress service is running: $e', e, st);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Syncs service state based on current settings and delivery method.
|
||||
static Future<void> sync() async {
|
||||
if (!_isAndroid) return;
|
||||
|
||||
await syncStrings();
|
||||
|
||||
final isEnabled = Settings.progressNotificationEnabled.value && Settings.notifyAll.value;
|
||||
if (!isEnabled) {
|
||||
_logger.info('Progress notifications disabled, stopping service and cancelling alarm');
|
||||
await stopService();
|
||||
await cancel6AmAlarm();
|
||||
return;
|
||||
}
|
||||
|
||||
final deliveryMethod = await NotificationDeliveryService.getEffectiveMethod();
|
||||
if (deliveryMethod == NotificationDeliveryMethod.alarm) {
|
||||
await schedule6AmAlarm();
|
||||
} else {
|
||||
await cancel6AmAlarm();
|
||||
}
|
||||
|
||||
await checkAndStartIfActive();
|
||||
}
|
||||
|
||||
/// Checks if current time is on/after the start date (first lesson start)
|
||||
/// and before the last lesson ends. If so, and the progress-centric
|
||||
/// notification is not running, starts it up.
|
||||
static Future<void> checkAndStartOnAppOpen() async {
|
||||
if (!_isAndroid) return;
|
||||
if (!Settings.progressNotificationEnabled.value || !Settings.notifyAll.value) return;
|
||||
|
||||
try {
|
||||
final now = timeNow();
|
||||
final startOfDay = DateTime(now.year, now.month, now.day);
|
||||
final endOfDay = DateTime(now.year, now.month, now.day, 23, 59, 59);
|
||||
|
||||
var lessons = await isarInit.lessonCacheModels
|
||||
.filter()
|
||||
.startBetween(startOfDay, endOfDay)
|
||||
.sortByStart()
|
||||
.findAll();
|
||||
|
||||
if (lessons.isEmpty) {
|
||||
lessons = await isarInit.lessonCacheModels
|
||||
.filter()
|
||||
.on(now)
|
||||
.sortByStart()
|
||||
.findAll();
|
||||
}
|
||||
|
||||
if (lessons.isEmpty) {
|
||||
_logger.info('No lessons for today; not starting progress service on app open');
|
||||
return;
|
||||
}
|
||||
|
||||
final firstLesson = lessons.first;
|
||||
final lastLesson = lessons.last;
|
||||
final startDate = firstLesson.start;
|
||||
|
||||
final isAboveStartDate = now.isAfter(startDate) || now.isAtSameMomentAs(startDate);
|
||||
final isBelowLastLesson = now.isBefore(lastLesson.end);
|
||||
|
||||
if (!isAboveStartDate) {
|
||||
_logger.info('Current time ($now) is before start date ($startDate); not starting progress service');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isBelowLastLesson) {
|
||||
_logger.info('Current time ($now) is after last lesson end (${lastLesson.end}); stopping/not starting progress service');
|
||||
final running = await isRunning();
|
||||
if (running) {
|
||||
await stopService();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final running = await isRunning();
|
||||
if (!running) {
|
||||
_logger.info('Time is within school day and progress service is not running; starting up');
|
||||
await WidgetCacheHelper.updateWidgetCacheFromIsar();
|
||||
await startService();
|
||||
} else {
|
||||
_logger.info('Progress service is already running');
|
||||
}
|
||||
} catch (e, st) {
|
||||
_logger.warning('Error in checkAndStartOnAppOpen: $e', e, st);
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks if today has lessons and if current time is within active bounds.
|
||||
static Future<void> checkAndStartIfActive() async {
|
||||
await checkAndStartOnAppOpen();
|
||||
}
|
||||
|
||||
/// Called on app startup in the morning.
|
||||
static Future<void> checkAndStartOnMorning() async {
|
||||
await sync();
|
||||
}
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:watch_connectivity/watch_connectivity.dart';
|
||||
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/services/wear_sync_cache.dart';
|
||||
import 'package:firka/api/client/kreta_client.dart';
|
||||
|
||||
/// Helper class for Wear OS sync (Android).
|
||||
class WatchSyncHelper {
|
||||
static const _wearSyncChannel = MethodChannel('app.firka/wear_sync');
|
||||
static WatchConnectivity? _androidWatchConnectivity;
|
||||
static WatchConnectivity get _watchConnectivityAndroid {
|
||||
_androidWatchConnectivity ??= WatchConnectivity();
|
||||
return _androidWatchConnectivity!;
|
||||
}
|
||||
|
||||
/// Callback for Watch pairing message events (Android Wear OS pairing flow).
|
||||
/// Set by initialization_screen.dart to handle "ping" messages for Watch pairing.
|
||||
static void Function(Map<String, dynamic> message)? onWatchMessage;
|
||||
|
||||
/// Send a fire-and-forget message to Watch via watch_connectivity (Android).
|
||||
/// The payload is sent as a JSON string for reliable transport.
|
||||
static Future<void> sendMessageToWatch(Map<String, dynamic> message) async {
|
||||
if (!Platform.isAndroid) return;
|
||||
await _watchConnectivityAndroid.sendMessage(<String, dynamic>{
|
||||
'data': jsonEncode(message),
|
||||
});
|
||||
}
|
||||
|
||||
/// Starts the Wear sync foreground service (Android only). Call after writing initial cache.
|
||||
/// [appDirPath] is the application documents directory path (for the background isolate).
|
||||
static Future<void> startWearSyncService(
|
||||
String cachePath,
|
||||
String appDirPath,
|
||||
) async {
|
||||
if (!Platform.isAndroid) return;
|
||||
await _wearSyncChannel.invokeMethod<void>(
|
||||
'startWearSyncService',
|
||||
<String, dynamic>{'cachePath': cachePath, 'appDirPath': appDirPath},
|
||||
);
|
||||
}
|
||||
|
||||
/// Builds fresh sync payload, writes cache, and starts the Wear sync service (Android only).
|
||||
/// Use when enabling Wear OS support or on app launch when support is already enabled.
|
||||
static Future<void> startWearSyncServiceWithFreshCache(
|
||||
KretaClient client,
|
||||
String appDirPath,
|
||||
) async {
|
||||
if (!Platform.isAndroid) return;
|
||||
final payload = await buildWearSyncPayload(client);
|
||||
if (payload == null) return;
|
||||
final path = await getWearSyncCachePath();
|
||||
await writeWearSyncCache(path, payload);
|
||||
await startWearSyncService(path, appDirPath);
|
||||
}
|
||||
|
||||
/// Sets the method call handler for getLocalizedString (Android). Call once when initData is ready.
|
||||
static void setWearSyncMethodCallHandler() {
|
||||
if (!Platform.isAndroid) return;
|
||||
_wearSyncChannel.setMethodCallHandler((MethodCall call) async {
|
||||
if (call.method == 'getLocalizedString') {
|
||||
final key = call.arguments as String?;
|
||||
return getLocalizedString(key);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
/// Returns the localized string for [key] from l10n. Used by Kotlin for notification title/text.
|
||||
static String? getLocalizedString(String? key) {
|
||||
if (key == null || !initDone) return null;
|
||||
switch (key) {
|
||||
case 'wearSyncNotificationTitle':
|
||||
return initData.l10n.wearSyncNotificationTitle;
|
||||
case 'wearSyncNotificationText':
|
||||
return initData.l10n.wearSyncNotificationText;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// Stops the Wear sync foreground service (Android only).
|
||||
static Future<void> stopWearSyncService() async {
|
||||
if (!Platform.isAndroid) return;
|
||||
await _wearSyncChannel.invokeMethod<void>('stopWearSyncService');
|
||||
}
|
||||
|
||||
/// Runs sync in foreground: fetches timetable + grades, writes cache, sends sync_data to watch.
|
||||
/// Used when app is in foreground and watch sends request_sync (Android) or equivalent.
|
||||
static Future<void> runWearSyncInForeground(KretaClient client) async {
|
||||
final payload = await buildWearSyncPayload(client);
|
||||
if (payload == null) return;
|
||||
final path = await getWearSyncCachePath();
|
||||
await writeWearSyncCache(path, payload);
|
||||
await sendMessageToWatch(<String, dynamic>{'id': 'sync_data', ...payload});
|
||||
}
|
||||
|
||||
/// Stream of messages from the watch (Android: watch_connectivity). Use for request_sync etc.
|
||||
static Stream<Map<String, dynamic>> get watchMessageStream {
|
||||
if (!Platform.isAndroid) return const Stream.empty();
|
||||
return _watchConnectivityAndroid.messageStream.map((m) {
|
||||
final map = Map<String, dynamic>.from(m);
|
||||
final data = map['data'];
|
||||
if (data is String) {
|
||||
return jsonDecode(data) as Map<String, dynamic>;
|
||||
}
|
||||
return map;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import 'package:path_provider/path_provider.dart'
|
||||
show getApplicationDocumentsDirectory;
|
||||
|
||||
import 'package:firka/api/client/kreta_client.dart';
|
||||
import 'package:kreta_api/kreta_api.dart';
|
||||
import 'package:firka/core/debug_helper.dart';
|
||||
|
||||
/// File name for the Wear OS sync cache written by the phone (Dart isolate or main).
|
||||
@@ -28,15 +27,15 @@ const String wearSyncCacheFileName = 'wear_sync_cache.json';
|
||||
/// Builds the sync payload (same shape as init_data / sync_data): timetable (2 weeks), grades, lastSyncAt.
|
||||
Future<Map<String, dynamic>?> buildWearSyncPayload(KretaClient client) async {
|
||||
final (start, end) = getWearSyncTimetableRange();
|
||||
await client.getLessons(start, end);
|
||||
await client.getGrades();
|
||||
final lessons = await client.getLessons(start, end);
|
||||
final grades = await client.getGrades();
|
||||
final now = timeNow();
|
||||
final timetable = (<Lesson>[]).map((l) => l.toJson()).toList();
|
||||
final grades = (<Grade>[]).map((g) => g.toJson()).toList();
|
||||
final timetable = lessons.map((l) => l.toJson()).toList();
|
||||
final gradesJson = grades.map((g) => g.toJson()).toList();
|
||||
return {
|
||||
'lastSyncAt': now.toUtc().toIso8601String(),
|
||||
'timetable': timetable,
|
||||
'grades': grades,
|
||||
'grades': gradesJson,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
@@ -5,30 +6,33 @@ import 'package:flutter/services.dart';
|
||||
import 'package:watch_connectivity/watch_connectivity.dart';
|
||||
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/api/client/kreta_client.dart';
|
||||
import 'package:firka/services/wear_sync_cache.dart';
|
||||
import 'package:firka/api/client/kreta_client.dart';
|
||||
|
||||
/// Helper for Wear OS ↔ phone communication (Android only).
|
||||
/// Handles sync service, watch_connectivity messages, and sending data to the watch.
|
||||
class WearSyncHelper {
|
||||
WearSyncHelper._();
|
||||
|
||||
/// Helper class for Wear OS sync (Android).
|
||||
class WatchSyncHelper {
|
||||
static const _wearSyncChannel = MethodChannel('app.firka/wear_sync');
|
||||
static WatchConnectivity? _watchConnectivity;
|
||||
static WatchConnectivity get _watchConnectivityInstance {
|
||||
_watchConnectivity ??= WatchConnectivity();
|
||||
return _watchConnectivity!;
|
||||
static WatchConnectivity? _androidWatchConnectivity;
|
||||
static WatchConnectivity get _watchConnectivityAndroid {
|
||||
_androidWatchConnectivity ??= WatchConnectivity();
|
||||
return _androidWatchConnectivity!;
|
||||
}
|
||||
|
||||
/// Sends a fire-and-forget message to the Wear OS watch (payload sent as JSON string).
|
||||
/// Callback for Watch pairing message events (Android Wear OS pairing flow).
|
||||
/// Set by initialization_screen.dart to handle "ping" messages for Watch pairing.
|
||||
static void Function(Map<String, dynamic> message)? onWatchMessage;
|
||||
|
||||
/// Send a fire-and-forget message to Watch via watch_connectivity (Android).
|
||||
/// The payload is sent as a JSON string for reliable transport.
|
||||
static Future<void> sendMessageToWatch(Map<String, dynamic> message) async {
|
||||
if (!Platform.isAndroid) return;
|
||||
await _watchConnectivityInstance.sendMessage(<String, dynamic>{
|
||||
await _watchConnectivityAndroid.sendMessage(<String, dynamic>{
|
||||
'data': jsonEncode(message),
|
||||
});
|
||||
}
|
||||
|
||||
/// Starts the Wear sync foreground service (Android only).
|
||||
/// Starts the Wear sync foreground service (Android only). Call after writing initial cache.
|
||||
/// [appDirPath] is the application documents directory path (for the background isolate).
|
||||
static Future<void> startWearSyncService(
|
||||
String cachePath,
|
||||
String appDirPath,
|
||||
@@ -41,6 +45,7 @@ class WearSyncHelper {
|
||||
}
|
||||
|
||||
/// Builds fresh sync payload, writes cache, and starts the Wear sync service (Android only).
|
||||
/// Use when enabling Wear OS support or on app launch when support is already enabled.
|
||||
static Future<void> startWearSyncServiceWithFreshCache(
|
||||
KretaClient client,
|
||||
String appDirPath,
|
||||
@@ -85,8 +90,8 @@ class WearSyncHelper {
|
||||
}
|
||||
|
||||
/// Runs sync in foreground: fetches timetable + grades, writes cache, sends sync_data to watch.
|
||||
/// Used when app is in foreground and watch sends request_sync (Android) or equivalent.
|
||||
static Future<void> runWearSyncInForeground(KretaClient client) async {
|
||||
if (!Platform.isAndroid) return;
|
||||
final payload = await buildWearSyncPayload(client);
|
||||
if (payload == null) return;
|
||||
final path = await getWearSyncCachePath();
|
||||
@@ -94,10 +99,10 @@ class WearSyncHelper {
|
||||
await sendMessageToWatch(<String, dynamic>{'id': 'sync_data', ...payload});
|
||||
}
|
||||
|
||||
/// Stream of messages from the Wear OS watch. Empty when not on Android.
|
||||
/// Stream of messages from the watch (Android: watch_connectivity). Use for request_sync etc.
|
||||
static Stream<Map<String, dynamic>> get watchMessageStream {
|
||||
if (!Platform.isAndroid) return const Stream.empty();
|
||||
return _watchConnectivityInstance.messageStream.map((m) {
|
||||
return _watchConnectivityAndroid.messageStream.map((m) {
|
||||
final map = Map<String, dynamic>.from(m);
|
||||
final data = map['data'];
|
||||
if (data is String) {
|
||||
|
||||
87
firka/lib/ui/components/color_slider.dart
Normal file
87
firka/lib/ui/components/color_slider.dart
Normal file
@@ -0,0 +1,87 @@
|
||||
import "package:flutter/material.dart";
|
||||
import "package:firka/ui/theme/style.dart";
|
||||
import "package:firka_common/ui/components/firka_card.dart";
|
||||
|
||||
class ColorSlider extends StatelessWidget {
|
||||
final double value;
|
||||
final LinearGradient trackGradient;
|
||||
final Color thumbColor;
|
||||
final ValueChanged<double> onChanged;
|
||||
|
||||
const ColorSlider({
|
||||
required this.value,
|
||||
required this.trackGradient,
|
||||
required this.thumbColor,
|
||||
required this.onChanged,
|
||||
super.key,
|
||||
});
|
||||
|
||||
static const _trackHeight = 52.0;
|
||||
static const _thumbSize = 28.0;
|
||||
static const _thumbRadius = _thumbSize / 2;
|
||||
static const _edgePad = 16.0;
|
||||
|
||||
void _setFromLocalX(double localX, double width) {
|
||||
final start = _edgePad + _thumbRadius;
|
||||
final end = width - _edgePad - _thumbRadius;
|
||||
if (end <= start) return;
|
||||
final t = ((localX - start) / (end - start)).clamp(0.0, 1.0);
|
||||
onChanged(t);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FirkaCard.single(
|
||||
width: double.infinity,
|
||||
height: _trackHeight,
|
||||
padding: EdgeInsets.zero,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final width = constraints.maxWidth;
|
||||
final start = _edgePad + _thumbRadius;
|
||||
final end = width - _edgePad - _thumbRadius;
|
||||
final thumbLeft = start + value * (end - start) - _thumbRadius;
|
||||
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTapDown: (d) => _setFromLocalX(d.localPosition.dx, width),
|
||||
onHorizontalDragUpdate: (d) =>
|
||||
_setFromLocalX(d.localPosition.dx, width),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Container(decoration: BoxDecoration(gradient: trackGradient)),
|
||||
Positioned(
|
||||
left: thumbLeft,
|
||||
top: (_trackHeight - _thumbSize) / 2,
|
||||
child: Container(
|
||||
width: _thumbSize,
|
||||
height: _thumbSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: thumbColor,
|
||||
border: Border.all(
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
width: 3,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: appStyle.colors.shadowColor,
|
||||
offset: const Offset(0, 1),
|
||||
blurRadius: appStyle.isLight ? 3 : 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import 'package:firka/ui/phone/widgets/lesson.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:firka/ui/shared/class_icon.dart';
|
||||
import 'package:firka_common/ui/components/firka_card.dart';
|
||||
import 'package:firka/ui/components/stats_table.dart';
|
||||
import 'package:firka_common/ui/components/grade.dart';
|
||||
|
||||
Future<void> showFirkaBottomSheet(
|
||||
@@ -47,34 +48,40 @@ Future<void> showFirkaBottomSheet(
|
||||
Align(
|
||||
alignment: AlignmentGeometry.bottomCenter,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.sizeOf(context).height * 0.85,
|
||||
),
|
||||
padding: const EdgeInsets.all(20) - EdgeInsets.only(top: 20),
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.background,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
|
||||
),
|
||||
child: SelectionArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Align(
|
||||
heightFactor: 0,
|
||||
alignment: Alignment.topCenter,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 18),
|
||||
width: 40,
|
||||
height: 4,
|
||||
foregroundDecoration: ShapeDecoration(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadiusGeometry.circular(2),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Align(
|
||||
heightFactor: 0,
|
||||
alignment: Alignment.topCenter,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 18),
|
||||
width: 40,
|
||||
height: 4,
|
||||
foregroundDecoration: ShapeDecoration(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadiusGeometry.circular(2),
|
||||
),
|
||||
color: appStyle.colors.shadowColor,
|
||||
),
|
||||
color: appStyle.colors.shadowColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
...children,
|
||||
],
|
||||
SizedBox(height: 40),
|
||||
...children,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -84,6 +91,7 @@ Future<void> showFirkaBottomSheet(
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Future<void> showLessonBottomSheet(
|
||||
BuildContext context,
|
||||
AppInitialization data,
|
||||
@@ -100,15 +108,43 @@ Future<void> showLessonBottomSheet(
|
||||
|
||||
final y2k = DateTime(2000, 1);
|
||||
|
||||
String fmt(DateTime? dt) =>
|
||||
(dt != null && dt.isAfter(y2k))
|
||||
? dt.format(data.l10n, FormatMode.yyyymmddhhmmss)
|
||||
: 'N/A';
|
||||
|
||||
if (statsForNerdsEnabled) {
|
||||
final stats =
|
||||
"${data.l10n.stats_date}: ${lesson.start.isAfter(y2k) ? lesson.start.format(data.l10n, FormatMode.yyyymmddhhmmss) : "N/A"}\n"
|
||||
"${data.l10n.stats_created_at}: ${lesson.createdAt.isAfter(y2k) ? lesson.createdAt.format(data.l10n, FormatMode.yyyymmddhhmmss) : "N/A"}\n";
|
||||
//"${data.l10n.stats_last_mod}: ${lesson.lastModifiedAt.isAfter(y2k) ? lesson.lastModifiedAt.format(data.l10n, FormatMode.yyyymmddhhmmss) : "N/A"}";
|
||||
statsForNerds = Text(
|
||||
stats,
|
||||
style: appStyle.fonts.B_16R.apply(color: appStyle.colors.textPrimary),
|
||||
);
|
||||
final cg = lesson.classGroup.loadAndGet();
|
||||
final subj = lesson.subject.loadAndGet();
|
||||
final hw = lesson.homework.loadAndGet();
|
||||
final tst = lesson.test.loadAndGet();
|
||||
final omission = lesson.omission.loadAndGet();
|
||||
|
||||
final rows = <(String, String)>[
|
||||
('id (cache key)', lesson.cacheKey.toString()),
|
||||
('uid (kréta)', lesson.uid ?? 'N/A'),
|
||||
('name', lesson.name),
|
||||
('state', lesson.state),
|
||||
('type', lesson.type),
|
||||
('start', fmt(lesson.start)),
|
||||
('end', fmt(lesson.end)),
|
||||
('last modified (kréta)', fmt(lesson.createdAt)),
|
||||
('room', lesson.roomName ?? 'N/A'),
|
||||
('teacher', lesson.teacher ?? 'N/A'),
|
||||
('sub. teacher', lesson.substituteTeacher ?? '-'),
|
||||
('lesson # (daily)', lesson.dailyNth?.toString() ?? 'N/A'),
|
||||
('lesson # (yearly)', lesson.yearlyNth?.toString() ?? 'N/A'),
|
||||
('topic', lesson.topic ?? 'N/A'),
|
||||
('subject', subj?.name ?? 'N/A'),
|
||||
('subject uid', subj?.cacheKey.toString() ?? 'N/A'),
|
||||
('class group', cg?.name ?? 'N/A'),
|
||||
('class group type', cg?.type ?? 'N/A'),
|
||||
('edu. order', cg?.educationalOrderName ?? 'N/A'),
|
||||
('homework', hw != null ? 'Yes (id: ${hw.cacheKey})' : 'None'),
|
||||
('test', tst != null ? '${tst.method}: ${tst.topic ?? "N/A"}' : 'None'),
|
||||
('omission', omission != null ? '${omission.state.name}${omission.lateMins != null ? " (${omission.lateMins}m)" : ""}' : 'None'),
|
||||
];
|
||||
statsForNerds = StatsForNerdsTable(rows: rows);
|
||||
}
|
||||
showFirkaBottomSheet(context, [
|
||||
Row(
|
||||
@@ -142,49 +178,55 @@ Future<void> showLessonBottomSheet(
|
||||
size: 26,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 6),
|
||||
Card(
|
||||
shadowColor: Colors.transparent,
|
||||
color: appStyle.colors.a15p,
|
||||
margin: EdgeInsets.all(0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 6),
|
||||
child: Text(
|
||||
lesson.roomName!,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.secondary,
|
||||
if (lesson.roomName != null && lesson.roomName!.isNotEmpty) ...[
|
||||
SizedBox(width: 6),
|
||||
Card(
|
||||
shadowColor: Colors.transparent,
|
||||
color: appStyle.colors.a15p,
|
||||
margin: EdgeInsets.all(0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 6),
|
||||
child: Text(
|
||||
lesson.roomName!,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.secondary,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"${lesson.name} ${statsForNerdsEnabled ? "(${lesson.subject.loadAndGet()!.name})" : ""}",
|
||||
style: appStyle.fonts.H_18px.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
Expanded(
|
||||
child: Text(
|
||||
"${lesson.name} ${statsForNerdsEnabled ? "(${lesson.subject.loadAndGet()!.name})" : ""}",
|
||||
style: appStyle.fonts.H_18px.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
softWrap: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
lesson.teacher!,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
decoration: lesson.substituteTeacher != null
|
||||
? TextDecoration.lineThrough
|
||||
: TextDecoration.none,
|
||||
if (lesson.teacher != null && lesson.teacher!.isNotEmpty)
|
||||
Text(
|
||||
lesson.teacher!,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
decoration: lesson.substituteTeacher != null
|
||||
? TextDecoration.lineThrough
|
||||
: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (lesson.substituteTeacher != null)
|
||||
Text(
|
||||
lesson.substituteTeacher!,
|
||||
@@ -220,11 +262,29 @@ Future<void> showLessonBottomSheet(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
?statsForNerds,
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
if (statsForNerds != null) SizedBox(height: 6),
|
||||
if (statsForNerds != null)
|
||||
FirkaCard.single(
|
||||
margin: EdgeInsets.all(0),
|
||||
padding: EdgeInsets.all(14),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Debug info',
|
||||
style: appStyle.fonts.H_14px.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
statsForNerds,
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
if (lesson.test.loadAndGet() != null)
|
||||
InfoCard.testDesc(lesson.test.loadAndGet()!),
|
||||
@@ -244,12 +304,14 @@ Future<void> showLessonBottomSheet(
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
),
|
||||
onTap: () {
|
||||
context.go('/timetable/subject', extra: lesson.subject);
|
||||
context.go('/timetable/subject', extra: lesson.subject.loadAndGet()!);
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Future<void> showOmissionBottomSheet(
|
||||
BuildContext context,
|
||||
AppInitialization data,
|
||||
|
||||
51
firka/lib/ui/components/stats_table.dart
Normal file
51
firka/lib/ui/components/stats_table.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
|
||||
class StatsForNerdsTable extends StatelessWidget {
|
||||
final List<(String, String)> rows;
|
||||
|
||||
const StatsForNerdsTable({super.key, required this.rows});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
for (int i = 0; i < rows.length; i++) ...[
|
||||
if (i > 0)
|
||||
Divider(
|
||||
height: 1,
|
||||
thickness: 0.5,
|
||||
color: appStyle.colors.shadowColor,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 5),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 130,
|
||||
child: Text(
|
||||
rows[i].$1,
|
||||
style: appStyle.fonts.B_12R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
rows[i].$2,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ 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';
|
||||
import 'package:firka/ui/shared/dave_mascot.dart';
|
||||
|
||||
class ErrorPage extends StatelessWidget {
|
||||
final String exception;
|
||||
@@ -22,20 +23,9 @@ class ErrorPage extends StatelessWidget {
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(height: 48),
|
||||
Container(
|
||||
const DaveMascot.error(
|
||||
width: 50,
|
||||
height: 50,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: ShapeDecoration(
|
||||
image: DecorationImage(
|
||||
image: PreloadedImageProvider(
|
||||
FirkaBundle(),
|
||||
('assets/images/logos/dave_error.png'),
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
shape: ContinuousRectangleBorder(),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/services/watch_sync_helper.dart';
|
||||
import 'package:firka/services/wear_sync_helper.dart';
|
||||
import 'package:firka/services/wear_sync_cache.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
@@ -10,10 +10,10 @@ import 'package:firka/ui/components/firka_icon_button.dart';
|
||||
import 'package:firka/ui/phone/widgets/grade_chart.dart';
|
||||
import 'package:firka/ui/shared/class_icon.dart';
|
||||
import 'package:firka/ui/shared/firka_icon.dart';
|
||||
import 'package:firka/ui/shared/dave_mascot.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:isar_community/isar.dart';
|
||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||
|
||||
@@ -163,8 +163,7 @@ class _HomeGradesSubjectScreen extends FirkaState<HomeGradesSubjectScreen> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
"assets/images/logos/dave.svg",
|
||||
const DaveMascot(
|
||||
width: 48,
|
||||
height: 48,
|
||||
),
|
||||
|
||||
@@ -146,6 +146,7 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
|
||||
final todayLesson = widget.data.client!.cache
|
||||
.getClassLessons()
|
||||
.on(now)
|
||||
.sortByStart()
|
||||
.findAllSync();
|
||||
|
||||
for (final item in infoItems) {
|
||||
|
||||
@@ -167,12 +167,16 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
||||
return TimeTableDayWidget(
|
||||
lessons,
|
||||
events,
|
||||
onRefresh: () => widget.data.client!.pullRefresh(
|
||||
() => widget.data.client!.getLessonsCovering(
|
||||
_currentTabWeekMonday,
|
||||
_currentTabWeekMonday.add(const Duration(days: 7)),
|
||||
),
|
||||
),
|
||||
onRefresh: () async {
|
||||
await widget.data.client!.pullRefresh(
|
||||
() => widget.data.client!.getLessonsCovering(
|
||||
_currentTabWeekMonday,
|
||||
_currentTabWeekMonday.add(const Duration(days: 7)),
|
||||
),
|
||||
);
|
||||
_lessonsCache.clear();
|
||||
if (mounted) setState(() {});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -338,6 +342,9 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
||||
listenWhen: (previous, current) =>
|
||||
current.refreshTrigger != previous.refreshTrigger,
|
||||
listener: (context, state) {
|
||||
// Underlying writes are correct now (see kreta_client.dart), so
|
||||
// a plain clear()+reread is reliable and needs no stale-value
|
||||
// workaround.
|
||||
_lessonsCache.clear();
|
||||
setState(() {});
|
||||
},
|
||||
|
||||
@@ -360,10 +360,14 @@ class _HomeTimetableMonthlyScreen
|
||||
right: 20,
|
||||
),
|
||||
child: RefreshIndicator(
|
||||
// NOT currentMonthStart/End: End is built inclusive for
|
||||
// display, but getLessonsCovering treats `to` as
|
||||
// exclusive, so the last day of the month was never
|
||||
// actually refreshed. Use the visible grid's own bounds.
|
||||
onRefresh: () => widget.data.client!.pullRefresh(
|
||||
() => widget.data.client!.getLessonsCovering(
|
||||
currentMonthStart,
|
||||
currentMonthEnd,
|
||||
dates.first,
|
||||
dates.last.add(const Duration(days: 1)),
|
||||
),
|
||||
),
|
||||
child: GridView.count(
|
||||
|
||||
@@ -26,6 +26,7 @@ import 'package:firka/core/state/firka_state.dart';
|
||||
import 'package:firka/ui/phone/screens/surprise_grades/surprise_grades_screen.dart';
|
||||
import 'package:firka/ui/shared/firka_icon.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:firka_common/ui/components/filled_circle.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:home_widget/home_widget.dart';
|
||||
import 'package:isar_community/isar.dart';
|
||||
@@ -428,6 +429,16 @@ class _DebugScreen extends FirkaState<DebugScreen> {
|
||||
},
|
||||
child: const Text('wipe users'),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
spacing: 16,
|
||||
runSpacing: 16,
|
||||
children: [
|
||||
for (final entry in _themeColorSwatches())
|
||||
_themeColorSwatch(context, entry.$1, entry.$2),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 600,
|
||||
child: GridView.count(
|
||||
@@ -471,3 +482,70 @@ class _DebugScreen extends FirkaState<DebugScreen> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
List<(String, Color)> _themeColorSwatches() {
|
||||
final c = appStyle.colors;
|
||||
return [
|
||||
("background", c.background),
|
||||
("backgroundAmoled", c.backgroundAmoled),
|
||||
("background0p", c.background0p),
|
||||
("success", c.success),
|
||||
("textPrimary", c.textPrimary),
|
||||
("textSecondary", c.textSecondary),
|
||||
("textTertiary", c.textTertiary),
|
||||
if (c.textTeritary != null) ("textTeritary", c.textTeritary!),
|
||||
("textPrimaryLight", c.textPrimaryLight),
|
||||
("textSecondaryLight", c.textSecondaryLight),
|
||||
("textTertiaryLight", c.textTertiaryLight),
|
||||
("card", c.card),
|
||||
("cardTranslucent", c.cardTranslucent),
|
||||
("buttonSecondaryFill", c.buttonSecondaryFill),
|
||||
("buttonDisabledIcon", c.buttonDisabledIcon),
|
||||
("accent", c.accent),
|
||||
("secondary", c.secondary),
|
||||
("shadowColor", c.shadowColor),
|
||||
("a10p", c.a10p),
|
||||
("a15p", c.a15p),
|
||||
("warningAccent", c.warningAccent),
|
||||
("warningText", c.warningText),
|
||||
("warning15p", c.warning15p),
|
||||
("warningCard", c.warningCard),
|
||||
("errorAccent", c.errorAccent),
|
||||
("errorText", c.errorText),
|
||||
("error15p", c.error15p),
|
||||
("errorCard", c.errorCard),
|
||||
("grade5", c.grade5),
|
||||
("grade4", c.grade4),
|
||||
("grade3", c.grade3),
|
||||
("grade2", c.grade2),
|
||||
("grade1", c.grade1),
|
||||
];
|
||||
}
|
||||
|
||||
Widget _themeColorSwatch(BuildContext context, String name, Color color) {
|
||||
final darkBg = color.computeLuminance() > 0.5;
|
||||
final bg = darkBg ? const Color(0xFF121212) : const Color(0xFFF2F2F2);
|
||||
final labelColor = darkBg ? const Color(0xFFF2F2F2) : const Color(0xFF121212);
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: bg,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
name,
|
||||
style: TextTheme.of(context).bodySmall?.copyWith(color: labelColor),
|
||||
),
|
||||
FilledCircle(
|
||||
diameter: 40,
|
||||
color: color,
|
||||
child: const SizedBox(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
531
firka/lib/ui/phone/screens/grade_colors/grade_colors_screen.dart
Normal file
531
firka/lib/ui/phone/screens/grade_colors/grade_colors_screen.dart
Normal file
@@ -0,0 +1,531 @@
|
||||
import "dart:math" as math;
|
||||
|
||||
import "package:firka/app/app_state.dart";
|
||||
import "package:firka/core/bloc/theme_cubit.dart";
|
||||
import "package:firka/core/extensions.dart";
|
||||
import "package:firka/core/settings/setting.dart";
|
||||
import "package:firka/core/settings/settings_repository.dart";
|
||||
import "package:firka/core/settings/settings_schema.dart";
|
||||
import "package:firka/ui/components/color_slider.dart";
|
||||
import "package:firka/ui/shared/firka_icon.dart";
|
||||
import "package:firka/ui/theme/style.dart";
|
||||
import "package:firka_common/ui/components/filled_circle.dart";
|
||||
import "package:firka_common/ui/components/firka_card.dart";
|
||||
import "package:firka_common/ui/theme/style.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter/services.dart";
|
||||
import "package:flutter_bloc/flutter_bloc.dart";
|
||||
import "package:go_router/go_router.dart";
|
||||
import "package:majesticons_flutter/majesticons_flutter.dart";
|
||||
|
||||
class GradeColorsScreen extends StatefulWidget {
|
||||
final AppInitialization data;
|
||||
|
||||
const GradeColorsScreen(this.data, {super.key});
|
||||
|
||||
@override
|
||||
State<GradeColorsScreen> createState() => _GradeColorsScreenState();
|
||||
}
|
||||
|
||||
StringSetting _settingFor(int grade) {
|
||||
switch (grade) {
|
||||
case 5:
|
||||
return SettingsRegistry.customGradeColor5;
|
||||
case 4:
|
||||
return SettingsRegistry.customGradeColor4;
|
||||
case 3:
|
||||
return SettingsRegistry.customGradeColor3;
|
||||
case 2:
|
||||
return SettingsRegistry.customGradeColor2;
|
||||
default:
|
||||
return SettingsRegistry.customGradeColor1;
|
||||
}
|
||||
}
|
||||
|
||||
Color _defaultFor(int grade) {
|
||||
switch (grade) {
|
||||
case 5:
|
||||
return const Color(0xFF22CCAD);
|
||||
case 4:
|
||||
return const Color(0xFF92EA3B);
|
||||
case 3:
|
||||
return const Color(0xFFF9CF00);
|
||||
case 2:
|
||||
return const Color(0xFFFFA046);
|
||||
default:
|
||||
return const Color(0xFFFF54A1);
|
||||
}
|
||||
}
|
||||
|
||||
class _GradeColorsScreenState extends State<GradeColorsScreen>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late int _selectedGrade;
|
||||
late HSVColor _hsv;
|
||||
|
||||
final _hexController = TextEditingController();
|
||||
bool _hexFocused = false;
|
||||
|
||||
late final AnimationController _ringController;
|
||||
Tween<double> _ringTween = Tween<double>(begin: 0, end: 0);
|
||||
double _ringRotation = 0;
|
||||
|
||||
SettingsRepository get _settings => widget.data.settings;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_selectedGrade = 5;
|
||||
_hsv = HSVColor.fromColor(_currentColor(_selectedGrade));
|
||||
_syncHexField();
|
||||
_ringController = AnimationController(vsync: this)
|
||||
..addListener(() {
|
||||
setState(() {
|
||||
_ringRotation = _ringTween.transform(
|
||||
Curves.easeInOutCubic.transform(_ringController.value),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_hexController.dispose();
|
||||
_ringController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Color _currentColor(int grade) {
|
||||
final raw = _settings.get(_settingFor(grade));
|
||||
return raw.toColorFromHexSetting();
|
||||
}
|
||||
|
||||
void _syncHexField() {
|
||||
if (!_hexFocused) {
|
||||
final hex = _hsv.toColor().toHexSetting().substring(4);
|
||||
_hexController.text = hex.toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _applyHsv(HSVColor hsv) async {
|
||||
setState(() => _hsv = hsv);
|
||||
_syncHexField();
|
||||
await _settings.set(
|
||||
_settingFor(_selectedGrade),
|
||||
hsv.toColor().toHexSetting(),
|
||||
);
|
||||
if (!mounted) return;
|
||||
context.read<ThemeCubit>().refresh();
|
||||
}
|
||||
|
||||
Future<void> _selectGrade(int grade) async {
|
||||
final hubIndex = _roleOrder.indexOf("hub");
|
||||
final targetMod = (hubIndex - _ring.indexOf(grade)) % _ring.length;
|
||||
var delta = (targetMod - _ringRotation) % _ring.length;
|
||||
if (delta > _ring.length / 2) delta -= _ring.length;
|
||||
final target = _ringRotation + delta;
|
||||
|
||||
_ringTween = Tween<double>(begin: _ringRotation, end: target);
|
||||
|
||||
_ringController
|
||||
..duration = Duration(
|
||||
milliseconds: (150 * delta.abs()).clamp(180, 420).round(),
|
||||
)
|
||||
..forward(from: 0);
|
||||
|
||||
setState(() {
|
||||
_selectedGrade = grade;
|
||||
_hsv = HSVColor.fromColor(_currentColor(grade));
|
||||
});
|
||||
_syncHexField();
|
||||
}
|
||||
|
||||
Future<void> _reset() async {
|
||||
final defaultColor = _defaultFor(_selectedGrade);
|
||||
await _applyHsv(HSVColor.fromColor(defaultColor));
|
||||
}
|
||||
|
||||
Future<void> _randomize() async {
|
||||
await _applyHsv(math.Random().nextVividHSVColor());
|
||||
}
|
||||
|
||||
void _onHexSubmit(String value) {
|
||||
final cleaned = value.replaceAll("#", "").trim();
|
||||
if (cleaned.length != 6) return;
|
||||
final parsed = int.tryParse("0xFF$cleaned");
|
||||
if (parsed == null) return;
|
||||
_applyHsv(HSVColor.fromColor(Color(parsed)));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider<ThemeCubit>.value(
|
||||
value: widget.data.themeCubit,
|
||||
child: BlocBuilder<ThemeCubit, ThemeState>(
|
||||
builder: (context, _) {
|
||||
return Scaffold(
|
||||
backgroundColor: appStyle.colors.background,
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_header(context),
|
||||
const SizedBox(height: 24),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_gradeBubbles(),
|
||||
const SizedBox(height: 28),
|
||||
_hueSlider(),
|
||||
const SizedBox(height: 8),
|
||||
_saturationSlider(),
|
||||
const SizedBox(height: 8),
|
||||
_valueSlider(),
|
||||
const SizedBox(height: 20),
|
||||
_hexRow(),
|
||||
const SizedBox(height: 12),
|
||||
_gradeTabBar(),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _header(BuildContext context) {
|
||||
final l10n = widget.data.l10n;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Transform.translate(
|
||||
offset: const Offset(-4, 0),
|
||||
child: GestureDetector(
|
||||
onTap: () => context.pop(),
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.chevronLeftLine,
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
l10n.s_customization,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
headingText(l10n.s_c_grade_colors_header),
|
||||
style: appStyle.fonts.H_H1.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
static const _roleSlots = <String, (double dx, double dy, double sizeFactor)>{
|
||||
"topLeft": (0.39, 0.22, 0.82),
|
||||
"topRight": (0.625, 0.22, 0.82),
|
||||
"midRight": (0.80, 0.46, 0.76),
|
||||
"hub": (0.505, 0.66, 1.0),
|
||||
"midLeft": (0.22, 0.46, 0.76),
|
||||
};
|
||||
static const _roleOrder = [
|
||||
"topLeft",
|
||||
"topRight",
|
||||
"midRight",
|
||||
"hub",
|
||||
"midLeft",
|
||||
];
|
||||
|
||||
static const _ring = [2, 3, 4, 5, 1];
|
||||
|
||||
Widget _gradeBubbles() {
|
||||
const maxCenterSize = 88.0;
|
||||
const clusterHeight = 190.0;
|
||||
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final width = constraints.maxWidth;
|
||||
final centerSize = math.min(maxCenterSize, width * 0.24);
|
||||
|
||||
return SizedBox(
|
||||
height: clusterHeight,
|
||||
width: width,
|
||||
child: Stack(
|
||||
children: [
|
||||
for (final grade in _ring)
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final u = _ring.indexOf(grade) + _ringRotation;
|
||||
final idx0 = u.floor();
|
||||
final frac = u - idx0;
|
||||
final slotA = _roleSlots[_roleOrder[idx0 % _ring.length]]!;
|
||||
final slotB =
|
||||
_roleSlots[_roleOrder[(idx0 + 1) % _ring.length]]!;
|
||||
final dx = slotA.$1 + (slotB.$1 - slotA.$1) * frac;
|
||||
final dy = slotA.$2 + (slotB.$2 - slotA.$2) * frac;
|
||||
final sizeFactor = slotA.$3 + (slotB.$3 - slotA.$3) * frac;
|
||||
final size = centerSize * sizeFactor;
|
||||
|
||||
return Positioned(
|
||||
left: dx * width - size / 2,
|
||||
top: dy * clusterHeight - size / 2,
|
||||
child: _gradeBubble(grade, size: size),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _gradeBubble(int grade, {required double size}) {
|
||||
final isSelected = grade == _selectedGrade;
|
||||
final color = isSelected ? _hsv.toColor() : _currentColor(grade);
|
||||
final pastel = Color.alphaBlend(color.withAlpha(38), appStyle.colors.card);
|
||||
const ringWidth = 4.0;
|
||||
|
||||
final circle = FilledCircle(
|
||||
diameter: isSelected ? size - ringWidth * 2 : size,
|
||||
color: pastel,
|
||||
child: Text(
|
||||
"$grade",
|
||||
style: appStyle.fonts.H_H1.copyWith(color: color, fontSize: size * 0.4),
|
||||
),
|
||||
);
|
||||
|
||||
return GestureDetector(
|
||||
onTap: isSelected ? null : () => _selectGrade(grade),
|
||||
child: Container(
|
||||
width: size,
|
||||
height: size,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: isSelected
|
||||
? Border.all(
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
width: ringWidth,
|
||||
)
|
||||
: null,
|
||||
boxShadow: isSelected && appStyle.isLight
|
||||
? [
|
||||
BoxShadow(
|
||||
color: appStyle.colors.shadowColor,
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
]
|
||||
: null,
|
||||
),
|
||||
child: Center(child: circle),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _hueSlider() {
|
||||
return ColorSlider(
|
||||
value: _hsv.hue / 360,
|
||||
trackGradient: const LinearGradient(
|
||||
colors: [
|
||||
Color(0xFFFF0000),
|
||||
Color(0xFFFFFF00),
|
||||
Color(0xFF00FF00),
|
||||
Color(0xFF00FFFF),
|
||||
Color(0xFF0000FF),
|
||||
Color(0xFFFF00FF),
|
||||
Color(0xFFFF0000),
|
||||
],
|
||||
),
|
||||
thumbColor: _hsv.toColor(),
|
||||
onChanged: (t) => _applyHsv(_hsv.withHue(t * 360)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _saturationSlider() {
|
||||
final fullSat = _hsv.withSaturation(1).withValue(1).toColor();
|
||||
return ColorSlider(
|
||||
value: _hsv.saturation,
|
||||
trackGradient: LinearGradient(colors: [Colors.white, fullSat]),
|
||||
thumbColor: _hsv.withValue(1).toColor(),
|
||||
onChanged: (t) => _applyHsv(_hsv.withSaturation(t)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _valueSlider() {
|
||||
final fullV = _hsv.withValue(1).toColor();
|
||||
return ColorSlider(
|
||||
value: _hsv.value,
|
||||
trackGradient: LinearGradient(colors: [Colors.black, fullV]),
|
||||
thumbColor: _hsv.toColor(),
|
||||
onChanged: (t) => _applyHsv(_hsv.withValue(t)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _hexRow() {
|
||||
return FirkaCard(
|
||||
left: [
|
||||
_iconCircle(icon: Majesticon.reloadLine, onTap: _reset, faded: true),
|
||||
const SizedBox(width: 12),
|
||||
Container(
|
||||
width: 28,
|
||||
height: 28,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: _hsv.toColor(),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: appStyle.colors.shadowColor,
|
||||
blurRadius: appStyle.isLight ? 3 : 0,
|
||||
offset: const Offset(0, 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
"HEX",
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(
|
||||
width: 96,
|
||||
child: Focus(
|
||||
onFocusChange: (focused) => setState(() => _hexFocused = focused),
|
||||
child: TextField(
|
||||
controller: _hexController,
|
||||
keyboardType: TextInputType.text,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
maxLength: 6,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[0-9a-fA-F]')),
|
||||
],
|
||||
onSubmitted: _onHexSubmit,
|
||||
style: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
counterText: "",
|
||||
border: InputBorder.none,
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
hintText: "FFFFFF",
|
||||
hintStyle: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textTertiary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
right: [
|
||||
_iconCircle(
|
||||
icon: Majesticon.repeatCircleLine,
|
||||
onTap: _randomize,
|
||||
accent: true,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _iconCircle({
|
||||
required Object icon,
|
||||
required VoidCallback onTap,
|
||||
bool faded = false,
|
||||
bool accent = false,
|
||||
}) {
|
||||
final bgColor = accent
|
||||
? appStyle.colors.accent
|
||||
: appStyle.colors.buttonSecondaryFill;
|
||||
final iconColor = accent
|
||||
? appStyle.colors.textPrimary
|
||||
: appStyle.colors.textSecondary;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: bgColor,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: appStyle.colors.shadowColor,
|
||||
blurRadius: appStyle.isLight ? 2 : 0,
|
||||
offset: const Offset(0, 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Center(
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
icon,
|
||||
size: 18,
|
||||
color: iconColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _gradeTabBar() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
for (final grade in [1, 2, 3, 4, 5]) ...[
|
||||
if (grade != 1) const SizedBox(width: 8),
|
||||
_gradeTab(grade),
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _gradeTab(int grade) {
|
||||
final isSelected = grade == _selectedGrade;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: isSelected ? null : () => _selectGrade(grade),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 180),
|
||||
curve: Curves.easeOut,
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: isSelected ? appStyle.colors.accent : appStyle.colors.card,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"$grade",
|
||||
style: appStyle.fonts.B_14SB.apply(
|
||||
color: isSelected
|
||||
? appStyle.colors.textPrimary
|
||||
: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user