forked from firka/firka
Compare commits
56 Commits
fff41d95d7
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85527c6ad4 | ||
|
|
8919215ecb | ||
|
|
cc2eeced0b | ||
|
|
2cf611b997 | ||
|
|
b5a1db6d85 | ||
|
|
f8e95870d2 | ||
|
|
c7eff44ce2 | ||
|
|
ad03b1698a | ||
|
|
c4689237de | ||
|
|
ea1afd541e | ||
|
|
4d41baf5f3 | ||
|
|
27a3903e29 | ||
|
|
058fccffcb | ||
| 30eb07eb78 | |||
|
|
c5a3dc0b5e | ||
|
|
9b87e2c3e4 | ||
|
|
25f303e1e9 | ||
| 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 |
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
|
||||
|
||||
@@ -122,6 +122,8 @@ steps:
|
||||
- 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
|
||||
@@ -157,6 +159,23 @@ 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
|
||||
|
||||
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.
|
||||
@@ -6,7 +6,13 @@
|
||||
<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"
|
||||
@@ -17,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"
|
||||
@@ -30,11 +54,23 @@
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme" />
|
||||
</activity>
|
||||
|
||||
<!-- The launcher entry lives on an alias, never on MainActivity
|
||||
itself: switching icons disables the outgoing entry, and
|
||||
disabling the component that hosts the running task kills it. -->
|
||||
<activity-alias
|
||||
android:name=".Default"
|
||||
android:targetActivity=".MainActivity"
|
||||
android:exported="true"
|
||||
android:enabled="true"
|
||||
android:icon="@mipmap/launcher_icon" >
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</activity-alias>
|
||||
|
||||
<activity-alias
|
||||
android:name=".ace"
|
||||
|
||||
@@ -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
|
||||
@@ -19,12 +20,12 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
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 {
|
||||
@@ -92,6 +93,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) {
|
||||
@@ -100,62 +162,81 @@ class MainActivity : FlutterActivity() {
|
||||
"${Build.VERSION.RELEASE};" +
|
||||
"${Build.VERSION.SDK_INT}")
|
||||
}
|
||||
// ".Default" ships enabled so a fresh install always has a
|
||||
// launcher entry, which means an update lands with it on even
|
||||
// for someone already using a custom icon — two icons. Called
|
||||
// on startup to put that right.
|
||||
"reconcile_icon" -> {
|
||||
try {
|
||||
val pn = context.packageName
|
||||
val ns = MainActivity::class.java.name.substringBeforeLast('.')
|
||||
val custom = call.argument<String?>("icon")
|
||||
val def = ComponentName(pn, "$ns.Default")
|
||||
val want = if (custom == null) {
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED
|
||||
} else {
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
||||
}
|
||||
if (packageManager.getComponentEnabledSetting(def) != want) {
|
||||
Log.d("firka", "Reconciling $ns.Default -> $want")
|
||||
packageManager.setComponentEnabledSetting(
|
||||
def, want, PackageManager.DONT_KILL_APP
|
||||
)
|
||||
}
|
||||
result.success(true)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
result.success(false)
|
||||
}
|
||||
}
|
||||
"set_icon" -> {
|
||||
try {
|
||||
val pn = context.packageName
|
||||
if (pn.endsWith(".debug")) {
|
||||
result.success(true)
|
||||
return@setMethodCallHandler
|
||||
}
|
||||
// The aliases are declared relative to the manifest
|
||||
// namespace, not the applicationId, so on a build with
|
||||
// an id suffix (.debug) the two differ and the class
|
||||
// names have to come from the namespace.
|
||||
val ns = MainActivity::class.java.name.substringBeforeLast('.')
|
||||
val icon = call.argument<String?>("icon")
|
||||
val icons = call.argument<String>("icons")!!.split(",")
|
||||
|
||||
if (icon != null) {
|
||||
for (ic in icons) {
|
||||
if (ic != icon) {
|
||||
Log.d("firka", "Disabling activity: $pn.$ic")
|
||||
packageManager.setComponentEnabledSetting(
|
||||
ComponentName(pn, "$pn.$ic"),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
||||
PackageManager.DONT_KILL_APP
|
||||
)
|
||||
}
|
||||
// ".Default" is the launcher entry used when no custom
|
||||
// icon is picked. MainActivity is never touched: it
|
||||
// hosts the running task, and disabling that kills it.
|
||||
val target = icon ?: "Default"
|
||||
|
||||
// Enable the new entry before retiring the old ones, so
|
||||
// the package is never left with no launcher component.
|
||||
Log.d("firka", "Enabling activity: $ns.$target")
|
||||
packageManager.setComponentEnabledSetting(
|
||||
ComponentName(pn, "$ns.$target"),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
||||
PackageManager.DONT_KILL_APP
|
||||
)
|
||||
|
||||
for (ic in icons + "Default") {
|
||||
if (ic == target) continue
|
||||
// The custom aliases ship as enabled="false", so
|
||||
// DEFAULT turns them off without an explicit
|
||||
// disable, which is what tends to take the task
|
||||
// down with it. ".Default" ships enabled, so that
|
||||
// one has to be disabled outright or the launcher
|
||||
// ends up showing two icons.
|
||||
val state = if (ic == "Default") {
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
||||
} else {
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
|
||||
}
|
||||
|
||||
Log.d("firka", "Enabling acitvity: $pn.$icon")
|
||||
Log.d("firka", "Retiring activity: $ns.$ic")
|
||||
packageManager.setComponentEnabledSetting(
|
||||
ComponentName(pn, "$pn.$icon"),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
||||
PackageManager.DONT_KILL_APP
|
||||
)
|
||||
|
||||
Log.d("firka" ,"Disabling activity: $pn.MainActivity")
|
||||
packageManager.setComponentEnabledSetting(
|
||||
ComponentName(pn, "$pn.MainActivity"),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
||||
PackageManager.DONT_KILL_APP
|
||||
)
|
||||
} else {
|
||||
for (ic in icons) {
|
||||
Log.d("firka", "Disabling activity: $pn.$ic")
|
||||
packageManager.setComponentEnabledSetting(
|
||||
ComponentName(pn, "$pn.$ic"),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
||||
PackageManager.DONT_KILL_APP
|
||||
)
|
||||
}
|
||||
|
||||
Log.d("firka", "Enabling acitvity: $pn.MainActivity")
|
||||
packageManager.setComponentEnabledSetting(
|
||||
ComponentName(pn, "$pn.MainActivity"),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
||||
ComponentName(pn, "$ns.$ic"),
|
||||
state,
|
||||
PackageManager.DONT_KILL_APP
|
||||
)
|
||||
}
|
||||
|
||||
forceIconUpdate()
|
||||
|
||||
exitProcess(-1)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
@@ -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,657 @@
|
||||
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,
|
||||
// MainActivity directly, not getLaunchIntentForPackage: that
|
||||
// resolves to whichever alias is enabled now, and the icon picker
|
||||
// retires that alias later, leaving a tap that opens nothing.
|
||||
Intent(this, MainActivity::class.java).apply {
|
||||
action = Intent.ACTION_MAIN
|
||||
addCategory(Intent.CATEGORY_LAUNCHER)
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or
|
||||
Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
},
|
||||
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,
|
||||
)
|
||||
@@ -124,7 +124,15 @@ class WearSyncForegroundService : Service(), MessageClient.OnMessageReceivedList
|
||||
val pendingIntent = PendingIntent.getActivity(
|
||||
this,
|
||||
0,
|
||||
packageManager.getLaunchIntentForPackage(packageName),
|
||||
// MainActivity directly, not getLaunchIntentForPackage: that
|
||||
// resolves to whichever alias is enabled now, and the icon picker
|
||||
// retires that alias later, leaving a tap that opens nothing.
|
||||
Intent(this, MainActivity::class.java).apply {
|
||||
action = Intent.ACTION_MAIN
|
||||
addCategory(Intent.CATEGORY_LAUNCHER)
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or
|
||||
Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
},
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
return NotificationCompat.Builder(this, channelId)
|
||||
|
||||
@@ -41,6 +41,9 @@ class WidgetLesson(data: JSONObject) {
|
||||
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")
|
||||
val substituteTeacher: String? = data.getStringOrNull("substituteTeacher") ?: data.getStringOrNull("HelyettesTanarNeve")
|
||||
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>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -1,6 +1,6 @@
|
||||
icons:
|
||||
"flutter_launcher_icons.yaml": "993c1cd3a99db70747299601e556d19ec959b0a16fd9ff2dbf2386cb6f2a640d"
|
||||
"pubspec.yaml": "198608775541fab3b6ff8cc21545e12a3413455f6ed87355cfdb576a97efab2d"
|
||||
"pubspec.yaml": "5f054e5c3d601a26cc9fade986f20c68ef5a8ac85d2bc983a5b456b60c50d072"
|
||||
"assets/images/logos/colored_logo.webp": "4b4fa99d144fe6694aa4487ba1b26aeecafae41e3c877836cd7da28d61a77983"
|
||||
"assets/images/logos/monochrome_logo.png": "c269a5e689622484d800a4fda5927591a0bf99d34790a4f146b93cf6edabd455"
|
||||
"assets/images/logos/colored_logo_without_mustache.png": "d11cff9f38985885873bfdd2d84e61f8fab03803eada94d4caac1545ef3685f3"
|
||||
|
||||
@@ -24,6 +24,7 @@ import 'package:firka/core/bloc/toast_cubit.dart';
|
||||
import 'package:firka/core/dev/mock_backend.dart';
|
||||
import 'package:firka_common/data/models/token_model.dart';
|
||||
import 'package:firka/core/debug_helper.dart';
|
||||
import 'package:firka_common/data/isar_writes.dart';
|
||||
import 'package:firka_common/data/util.dart';
|
||||
import '../token_grant.dart';
|
||||
|
||||
@@ -38,6 +39,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 +92,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 +167,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 +201,50 @@ 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) {
|
||||
@@ -186,7 +264,7 @@ class KretaClient {
|
||||
// manual link
|
||||
await getOmissions();
|
||||
|
||||
cache.resolveTeachers();
|
||||
await isarWrite(() => cache.resolveTeachers());
|
||||
_toastCubit.setActiveToast(.none);
|
||||
} catch (e) {
|
||||
if (!isTokenExpired(e)) {
|
||||
@@ -221,7 +299,7 @@ class KretaClient {
|
||||
]);
|
||||
// manual link
|
||||
await getOmissions();
|
||||
cache.resolveTeachers();
|
||||
await isarWrite(() => cache.resolveTeachers());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -262,9 +340,9 @@ class KretaClient {
|
||||
try {
|
||||
var tokenModel = await _refreshModelWithCrossDeviceLease(cache.token);
|
||||
|
||||
await isarInit.writeTxn(() async {
|
||||
await isarInit.tokenModels.put(tokenModel);
|
||||
});
|
||||
await isarWrite(
|
||||
() => isarInit.writeTxn(() => isarInit.tokenModels.put(tokenModel)),
|
||||
);
|
||||
|
||||
cache.token = tokenModel;
|
||||
logger.info("[Recovery] Step 1 SUCCESS: Local refresh succeeded");
|
||||
@@ -316,18 +394,22 @@ class KretaClient {
|
||||
}).whenComplete(() => _tokenMutexCompleter = null);
|
||||
}
|
||||
|
||||
Future<Response> _authReq(String method, String url, [Object? data]) async {
|
||||
Future<Response> _authReq(
|
||||
String method,
|
||||
String url, [
|
||||
Object? data,
|
||||
bool isRetry = false,
|
||||
]) async {
|
||||
var localToken = (await _lockAndRecoverToken()).accessToken;
|
||||
|
||||
final headers = <String, String>{
|
||||
// "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
"accept": "*/*",
|
||||
"user-agent": initData.userAgent,
|
||||
"authorization": "Bearer $localToken",
|
||||
"apiKey": "21ff6c25-d1da-4a68-a811-c881a6057463",
|
||||
};
|
||||
|
||||
return await dio.get(
|
||||
final resp = await dio.get(
|
||||
MockBackend.rewrite(url),
|
||||
options: Options(
|
||||
method: method,
|
||||
@@ -336,6 +418,16 @@ class KretaClient {
|
||||
),
|
||||
data: data,
|
||||
);
|
||||
|
||||
if (resp.statusCode == 401 && !isRetry) {
|
||||
logger.info("[AuthRetry] 401 on $url, forcing token refresh...");
|
||||
if (cache.token.accessToken == localToken) {
|
||||
cache.token.expiryDate = DateTime.now();
|
||||
}
|
||||
return _authReq(method, url, data, true);
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
Future<(dynamic, int)> _authJson(
|
||||
@@ -394,44 +486,49 @@ class KretaClient {
|
||||
var (resp, statusCode) = await _authJson("GET", url);
|
||||
|
||||
var data = resp;
|
||||
final caches = <C>[];
|
||||
if (data is Map<String, dynamic>) {
|
||||
data = [data];
|
||||
}
|
||||
if (data is List) {
|
||||
for (final e in data) {
|
||||
if (e is Map<String, dynamic>) {
|
||||
late I dto;
|
||||
try {
|
||||
dto = makeDto(e);
|
||||
} catch (ex) {
|
||||
logger.shout(
|
||||
"failed to make dto for $C",
|
||||
ex,
|
||||
ex is Error ? ex.stackTrace : null,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
// apply() creates missing subject rows in a sync transaction, so the
|
||||
// whole loop queues as one unit — it has no await points of its own.
|
||||
final caches = await isarWrite(() {
|
||||
final caches = <C>[];
|
||||
if (data is List) {
|
||||
for (final e in data) {
|
||||
if (e is Map<String, dynamic>) {
|
||||
late I dto;
|
||||
try {
|
||||
dto = makeDto(e);
|
||||
} catch (ex) {
|
||||
logger.shout(
|
||||
"failed to make dto for $C",
|
||||
ex,
|
||||
ex is Error ? ex.stackTrace : null,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
caches.add(
|
||||
makeCache()
|
||||
..createdAt = DateTime.now()
|
||||
..cacheKey = cache.genCacheKey(dto)
|
||||
..apply(CacheContext(cache, dto)),
|
||||
);
|
||||
} catch (ex) {
|
||||
logger.shout(
|
||||
"failed to make cache $C: ${ex.toString()}",
|
||||
ex,
|
||||
ex is Error ? ex.stackTrace : null,
|
||||
);
|
||||
logger.shout("object: $e");
|
||||
continue;
|
||||
try {
|
||||
caches.add(
|
||||
makeCache()
|
||||
..createdAt = DateTime.now()
|
||||
..cacheKey = cache.genCacheKey(dto)
|
||||
..apply(CacheContext(cache, dto)),
|
||||
);
|
||||
} catch (ex) {
|
||||
logger.shout(
|
||||
"failed to make cache $C: ${ex.toString()}",
|
||||
ex,
|
||||
ex is Error ? ex.stackTrace : null,
|
||||
);
|
||||
logger.shout("object: $e");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return caches;
|
||||
});
|
||||
|
||||
return caches;
|
||||
} catch (ex) {
|
||||
@@ -456,22 +553,35 @@ class KretaClient {
|
||||
}
|
||||
}
|
||||
|
||||
/// Upserts [caches]. Deletes stale rows in [staleScope].
|
||||
/// 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,
|
||||
]) 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);
|
||||
]) {
|
||||
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 {
|
||||
// Must stay sync: the async putAll has no saveLinks parameter, so it
|
||||
// writes the rows without their IsarLinks and the cache reads back empty.
|
||||
await isarWrite(() {
|
||||
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();
|
||||
return caches;
|
||||
@@ -489,19 +599,46 @@ 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({
|
||||
@@ -548,19 +685,69 @@ class KretaClient {
|
||||
).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;
|
||||
await isarWrite(() {
|
||||
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(
|
||||
KretaEndpoints.getTimeTable(cache.token.iss, from, to),
|
||||
LessonCacheModel.new,
|
||||
(json) => Lesson.fromJson(json),
|
||||
)
|
||||
.then(resolveDailyNth)
|
||||
.then(
|
||||
(caches) =>
|
||||
_save(caches, cache.getTimeTable().and().between(from, to)),
|
||||
))
|
||||
List<LessonCacheModel> caches;
|
||||
try {
|
||||
caches = await _renewCache(
|
||||
KretaEndpoints.getTimeTable(cache.token.iss, from, to),
|
||||
LessonCacheModel.new,
|
||||
(json) => Lesson.fromJson(json),
|
||||
).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));
|
||||
}
|
||||
|
||||
|
||||
@@ -125,9 +125,7 @@ class NotificationBackendClient {
|
||||
return true;
|
||||
}
|
||||
|
||||
_logger.warning(
|
||||
'Failed to unregister FCM token: ${response.statusCode}',
|
||||
);
|
||||
_logger.warning('Failed to unregister FCM token: ${response.statusCode}');
|
||||
return false;
|
||||
} catch (e) {
|
||||
_logger.severe('Error unregistering FCM token: $e');
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'package:firka_common/data/isar_writes.dart';
|
||||
import "package:firka/app/app_state.dart";
|
||||
import "package:firka/app/initialization.dart";
|
||||
import "package:firka/core/theme_sync.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";
|
||||
@@ -10,16 +12,17 @@ Future<void> completeLogin(
|
||||
) async {
|
||||
var tokenModel = TokenModel.fromResp(resp);
|
||||
|
||||
await data.isar.writeTxn(() async {
|
||||
await data.isar.tokenModels.put(tokenModel);
|
||||
});
|
||||
await isarWrite(
|
||||
() => data.isar.writeTxn(() => data.isar.tokenModels.put(tokenModel)),
|
||||
);
|
||||
|
||||
await data.settings.setSelectedAccountKey(tokenModel.key);
|
||||
await initializeApp();
|
||||
|
||||
// this account may already have a theme stored server side
|
||||
await syncThemeFromServer(data.settings);
|
||||
|
||||
if (data.client != null) {
|
||||
await NotificationDeliveryService.onUserLogin(
|
||||
client: data.client!,
|
||||
);
|
||||
await NotificationDeliveryService.onUserLogin(client: data.client!);
|
||||
}
|
||||
}
|
||||
|
||||
89
firka/lib/api/theme_sync_api.dart
Normal file
89
firka/lib/api/theme_sync_api.dart
Normal file
@@ -0,0 +1,89 @@
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import 'package:firka/app/app_state.dart';
|
||||
|
||||
const _base = 'https://api.firka.app/v1';
|
||||
|
||||
Options _options(String? writeKey) => Options(
|
||||
contentType: Headers.jsonContentType,
|
||||
receiveTimeout: const Duration(seconds: 10),
|
||||
sendTimeout: const Duration(seconds: 10),
|
||||
headers: writeKey == null ? null : {'X-Theme-Key': writeKey},
|
||||
);
|
||||
|
||||
/// the owner's own copy, by vault. null when nothing is stored yet.
|
||||
Future<({String code, String name, String shareId, String? selected})?>
|
||||
fetchTheme(String vault) async {
|
||||
try {
|
||||
final res = await dio.get(
|
||||
'$_base/theme-sync/$vault',
|
||||
options: _options(null),
|
||||
);
|
||||
final data = res.data as Map<String, dynamic>;
|
||||
return (
|
||||
code: (data['code'] as String?) ?? '',
|
||||
name: (data['name'] as String?) ?? '',
|
||||
shareId: (data['share_id'] as String?) ?? '',
|
||||
selected: data['selected'] as String?,
|
||||
);
|
||||
} on DioException catch (e) {
|
||||
if (e.response?.statusCode == 404) return null;
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/// what a share link points at right now. null when the link is dead.
|
||||
Future<({String code, String name})?> fetchSharedTheme(String shareId) async {
|
||||
try {
|
||||
final res = await dio.get(
|
||||
'$_base/theme-share/$shareId',
|
||||
options: _options(null),
|
||||
);
|
||||
final data = res.data as Map<String, dynamic>;
|
||||
return (
|
||||
code: data['code'] as String,
|
||||
name: (data['name'] as String?) ?? '',
|
||||
);
|
||||
} on DioException catch (e) {
|
||||
if (e.response?.statusCode == 404) return null;
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/// stores the theme under the vault. the write key claims the vault on the
|
||||
/// first push and proves ownership on every later one.
|
||||
Future<void> pushTheme(
|
||||
String vault, {
|
||||
required String writeKey,
|
||||
required String code,
|
||||
required String name,
|
||||
}) async {
|
||||
await dio.put(
|
||||
'$_base/theme-sync/$vault',
|
||||
data: {'code': code, 'name': name},
|
||||
options: _options(writeKey),
|
||||
);
|
||||
}
|
||||
|
||||
/// Switches the account to a built-in or a shared theme, the own one stays
|
||||
/// stored for when it is picked again.
|
||||
Future<void> pushSelected(
|
||||
String vault, {
|
||||
required String writeKey,
|
||||
required String selected,
|
||||
}) async {
|
||||
await dio.put(
|
||||
'$_base/theme-sync/$vault/selected',
|
||||
data: {'selected': selected},
|
||||
options: _options(writeKey),
|
||||
);
|
||||
}
|
||||
|
||||
/// publishes the theme and returns its public, read-only share id
|
||||
Future<String> shareTheme(String vault, {required String writeKey}) async {
|
||||
final res = await dio.post(
|
||||
'$_base/theme-sync/$vault/share',
|
||||
options: _options(writeKey),
|
||||
);
|
||||
return (res.data as Map<String, dynamic>)['share_id'] as String;
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'dart:ui' as ui;
|
||||
import 'package:firka_common/data/isar_writes.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/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -9,7 +11,9 @@ 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/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';
|
||||
@@ -20,12 +24,15 @@ 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:firka/core/theme_sync.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:isar_community/isar.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:firka_common/core/subject_overrides.dart';
|
||||
|
||||
Future<void> initLang(AppInitialization data) async {
|
||||
switch (Settings.language.value) {
|
||||
@@ -54,12 +61,16 @@ 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,
|
||||
Map<int, String>? colorOverrides,
|
||||
}) {
|
||||
final titleFont = Settings.titleFont.value;
|
||||
final titleWeight = Settings.titleWeight.value;
|
||||
final fonts = buildAppFonts(
|
||||
@@ -67,6 +78,29 @@ 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,
|
||||
colorOverrides: colorOverrides,
|
||||
);
|
||||
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,
|
||||
@@ -74,63 +108,248 @@ 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,
|
||||
Map<int, String>? colorOverrides,
|
||||
}) {
|
||||
// colorOverrides lets a theme be rendered from its own share code without
|
||||
// writing it into the settings first — see themeCodeOverrides().
|
||||
String read(SilentlySettable<String> s) =>
|
||||
colorOverrides?[s.setting.id] ?? s.value;
|
||||
|
||||
final colors = style.colors;
|
||||
|
||||
final customActive =
|
||||
isCustomTheme ?? !isBuiltinThemeId(Settings.selectedThemeId.value);
|
||||
if (!force && !customActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
appStyle = baseStyle;
|
||||
colors.grade5 = read(Settings.customGradeColor5).toColorFromHexSetting();
|
||||
colors.grade4 = read(Settings.customGradeColor4).toColorFromHexSetting();
|
||||
colors.grade3 = read(Settings.customGradeColor3).toColorFromHexSetting();
|
||||
colors.grade2 = read(Settings.customGradeColor2).toColorFromHexSetting();
|
||||
colors.grade1 = read(Settings.customGradeColor1).toColorFromHexSetting();
|
||||
|
||||
final isLight = style.isLight;
|
||||
|
||||
colors.accent = read(
|
||||
isLight ? Settings.customAccentColorLight : Settings.customAccentColorDark,
|
||||
).toColorFromHexSetting();
|
||||
colors.a10p = colors.accent.withAlpha(0x1a);
|
||||
colors.a15p = colors.accent.withAlpha(0x26);
|
||||
|
||||
final bgGrad = read(
|
||||
isLight
|
||||
? Settings.customBackgroundGradientLight
|
||||
: Settings.customBackgroundGradientDark,
|
||||
).toColorListFromHexSetting();
|
||||
|
||||
if (bgGrad.isNotEmpty) {
|
||||
colors.backgroundGradient = bgGrad;
|
||||
colors.background = bgGrad.first;
|
||||
} else {
|
||||
colors.background = read(
|
||||
isLight
|
||||
? Settings.customBackgroundColorLight
|
||||
: Settings.customBackgroundColorDark,
|
||||
).toColorFromHexSetting();
|
||||
colors.backgroundGradient = null;
|
||||
}
|
||||
colors.background0p = colors.background.withAlpha(0);
|
||||
|
||||
colors.card = read(
|
||||
isLight ? Settings.customCardColorLight : Settings.customCardColorDark,
|
||||
).toColorFromHexSetting();
|
||||
colors.cardTranslucent = colors.card.withAlpha(0x80);
|
||||
|
||||
colors.buttonSecondaryFill = read(
|
||||
isLight ? Settings.customButtonColorLight : Settings.customButtonColorDark,
|
||||
).toColorFromHexSetting();
|
||||
|
||||
colors.secondary = read(
|
||||
isLight
|
||||
? Settings.customSecondaryColorLight
|
||||
: Settings.customSecondaryColorDark,
|
||||
).toColorFromHexSetting();
|
||||
colors.buttonDisabledIcon = colors.secondary.withAlpha(0x80);
|
||||
|
||||
final customTextLight = read(Settings.customTextColorLight);
|
||||
final customTextDark = read(Settings.customTextColorDark);
|
||||
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 = read(Settings.customTextSecondaryColorLight);
|
||||
final customSecDark = read(Settings.customTextSecondaryColorDark);
|
||||
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 = read(Settings.customTextTertiaryColorLight);
|
||||
final customTertDark = read(Settings.customTextTertiaryColorDark);
|
||||
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 = read(
|
||||
isLight ? Settings.customShadowColorLight : Settings.customShadowColorDark,
|
||||
).toColorFromHexSetting();
|
||||
|
||||
colors.success = read(
|
||||
isLight
|
||||
? Settings.customSuccessColorLight
|
||||
: Settings.customSuccessColorDark,
|
||||
).toColorFromHexSetting();
|
||||
|
||||
colors.warningAccent = read(
|
||||
isLight
|
||||
? Settings.customWarningAccentColorLight
|
||||
: Settings.customWarningAccentColorDark,
|
||||
).toColorFromHexSetting();
|
||||
colors.warning15p = colors.warningAccent.withAlpha(0x26);
|
||||
|
||||
colors.warningText = read(
|
||||
isLight
|
||||
? Settings.customWarningTextColorLight
|
||||
: Settings.customWarningTextColorDark,
|
||||
).toColorFromHexSetting();
|
||||
|
||||
colors.warningCard = read(
|
||||
isLight
|
||||
? Settings.customWarningCardColorLight
|
||||
: Settings.customWarningCardColorDark,
|
||||
).toColorFromHexSetting();
|
||||
|
||||
colors.errorAccent = read(
|
||||
isLight
|
||||
? Settings.customErrorAccentColorLight
|
||||
: Settings.customErrorAccentColorDark,
|
||||
).toColorFromHexSetting();
|
||||
colors.error15p = colors.errorAccent.withAlpha(0x26);
|
||||
|
||||
colors.errorText = read(
|
||||
isLight
|
||||
? Settings.customErrorTextColorLight
|
||||
: Settings.customErrorTextColorDark,
|
||||
).toColorFromHexSetting();
|
||||
|
||||
colors.errorCard = read(
|
||||
isLight
|
||||
? Settings.customErrorCardColorLight
|
||||
: Settings.customErrorCardColorDark,
|
||||
).toColorFromHexSetting();
|
||||
}
|
||||
|
||||
DateTime? _lastInitDataAt;
|
||||
String? _lastInitDataUsername;
|
||||
|
||||
Future<void> _initData(AppInitialization init) async {
|
||||
await init.settings.loadAll();
|
||||
loadSubjectOverrides(Settings.subjectOverrides.value);
|
||||
|
||||
// An update ships ".Default" enabled, which would leave anyone already on a
|
||||
// custom icon with two launcher entries. Needs the settings, so it cannot
|
||||
// run with the rest of the platform setup in initializeApp().
|
||||
if (Platform.isAndroid) {
|
||||
final icon = Settings.appIcon.value;
|
||||
unawaited(
|
||||
const MethodChannel("firka.app/main")
|
||||
.invokeMethod("reconcile_icon", {
|
||||
"icon": icon == "original" ? null : icon,
|
||||
})
|
||||
.catchError((Object e) {
|
||||
logger.warning("[Init] reconcile_icon failed: $e");
|
||||
return null;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
// 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 isarWrite(
|
||||
() => isarInit.writeTxn(() => 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);
|
||||
};
|
||||
|
||||
@@ -148,6 +367,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();
|
||||
}());
|
||||
@@ -159,6 +379,31 @@ Future<void> _initData(AppInitialization init) async {
|
||||
init.client = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// the owner of a shared theme keeps editing it, so catch up on app open
|
||||
unawaited(refreshSharedThemes(init.settings));
|
||||
// Another device of the account may have switched theme meanwhile
|
||||
unawaited(syncThemeFromServer(init.settings));
|
||||
|
||||
// _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);
|
||||
|
||||
@@ -171,6 +416,7 @@ Future<void> _initData(AppInitialization init) async {
|
||||
|
||||
// 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.
|
||||
@@ -187,6 +433,7 @@ Future<void> _initData(AppInitialization init) async {
|
||||
|
||||
await init.client!.renewCache(reInit: false);
|
||||
await WidgetCacheHelper.updateWidgetCacheFromIsar();
|
||||
unawaited(ProgressNotificationService.checkAndStartIfActive());
|
||||
init.homeRefreshCubit.requestRefresh();
|
||||
}());
|
||||
|
||||
@@ -245,14 +492,21 @@ Future<void> initializeApp() async {
|
||||
initData.settings.cubit = initData.settingsCubit;
|
||||
Settings = initData.settings;
|
||||
await Settings.loadAll();
|
||||
loadSubjectOverrides(Settings.subjectOverrides.value);
|
||||
registerSettingsEffects(initData.settings, initData);
|
||||
|
||||
try {
|
||||
await NotificationDeliveryService.initialize().timeout(const Duration(seconds: 8));
|
||||
await NotificationDeliveryService.initialize().timeout(
|
||||
const Duration(seconds: 8),
|
||||
);
|
||||
} on TimeoutException catch (e, st) {
|
||||
logger.warning('NotificationDeliveryService init timed out: $e', e, st);
|
||||
} catch (e, st) {
|
||||
logger.severe('Failed to initialize NotificationDeliveryService: $e', e, st);
|
||||
logger.severe(
|
||||
'Failed to initialize NotificationDeliveryService: $e',
|
||||
e,
|
||||
st,
|
||||
);
|
||||
}
|
||||
|
||||
await _initData(initData);
|
||||
|
||||
@@ -15,7 +15,8 @@ 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/shake_detector.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';
|
||||
@@ -29,9 +30,44 @@ class InitializationScreen extends StatefulWidget {
|
||||
State<InitializationScreen> createState() => _InitializationScreenState();
|
||||
}
|
||||
|
||||
class _InitializationScreenState extends State<InitializationScreen> {
|
||||
class _InitializationScreenState extends State<InitializationScreen>
|
||||
with WidgetsBindingObserver {
|
||||
GoRouter? _router;
|
||||
final Future<void> _init = initializeApp();
|
||||
late final _shake = ShakeDetector(_openFeedback);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
_shake.stop();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
if (_router == null) return;
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
_shake.start();
|
||||
} else if (state == AppLifecycleState.paused) {
|
||||
_shake.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/// shaking the phone opens the feedback form, unless it is already open
|
||||
void _openFeedback() {
|
||||
final router = _router;
|
||||
if (router == null) return;
|
||||
if (router.routerDelegate.currentConfiguration.uri.path == '/feedback') {
|
||||
return;
|
||||
}
|
||||
router.push('/feedback');
|
||||
}
|
||||
|
||||
ThemeData _buildTheme(FirkaStyle style) {
|
||||
return ThemeData(
|
||||
@@ -156,6 +192,7 @@ class _InitializationScreenState extends State<InitializationScreen> {
|
||||
if (_router == null) {
|
||||
_router = createAppRouter();
|
||||
appRouter = _router;
|
||||
_shake.start();
|
||||
}
|
||||
|
||||
final themeCubit = initData.themeCubit;
|
||||
|
||||
@@ -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,6 +288,42 @@ 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+)?$');
|
||||
|
||||
54
firka/lib/core/feedback_report.dart
Normal file
54
firka/lib/core/feedback_report.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
/// characters of log that are sent, the newest ones. the api keeps up to 150 000
|
||||
const feedbackLogLimit = 100000;
|
||||
|
||||
final _logFile = RegExp(r'^\d{4}_\d{2}_\d{2}\.log$');
|
||||
|
||||
/// things that look like a secret, in case one ever ends up in a log line
|
||||
final _secrets = <RegExp>[
|
||||
RegExp(r'Bearer\s+[A-Za-z0-9._~+/=-]+', caseSensitive: false),
|
||||
RegExp(r'eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}(\.[A-Za-z0-9_-]*)?'),
|
||||
RegExp(r'[\w.+-]+@[\w-]+(\.[\w-]+)+'),
|
||||
];
|
||||
final _urlSecret = RegExp(
|
||||
r'([?&](?:code|access_token|refresh_token|id_token)=)[^&\s"]+',
|
||||
);
|
||||
|
||||
String redactSecrets(String text) {
|
||||
var out = text.replaceAllMapped(_urlSecret, (m) => '${m[1]}[redacted]');
|
||||
for (final pattern in _secrets) {
|
||||
out = out.replaceAll(pattern, '[redacted]');
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/// the newest log lines of the app, oldest first, with anything secret removed.
|
||||
/// [error] is the error the person is reporting, it goes on top.
|
||||
Future<String> collectFeedbackLogs(Directory appDir, {String? error}) async {
|
||||
final files =
|
||||
appDir
|
||||
.listSync()
|
||||
.whereType<File>()
|
||||
.where((file) => _logFile.hasMatch(p.basename(file.path)))
|
||||
.toList()
|
||||
..sort((a, b) => p.basename(b.path).compareTo(p.basename(a.path)));
|
||||
|
||||
final parts = <String>[];
|
||||
var size = 0;
|
||||
for (final file in files) {
|
||||
if (size >= feedbackLogLimit) break;
|
||||
final text = utf8.decode(await file.readAsBytes(), allowMalformed: true);
|
||||
parts.insert(0, '--- ${p.basename(file.path)} ---\n$text');
|
||||
size += text.length;
|
||||
}
|
||||
|
||||
var logs = redactSecrets(parts.join('\n'));
|
||||
if (logs.length > feedbackLogLimit) {
|
||||
logs = logs.substring(logs.length - feedbackLogLimit);
|
||||
}
|
||||
return error == null ? logs : 'Hibaüzenet:\n${redactSecrets(error)}\n\n$logs';
|
||||
}
|
||||
@@ -1,25 +1,88 @@
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:ui' show Rect;
|
||||
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:image/image.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:image/image.dart' hide Color;
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
Future<void> pickProfilePicture(
|
||||
/// Side of the stored picture, sharp on the largest avatar on any screen.
|
||||
const _pictureSize = 512;
|
||||
|
||||
/// A photo from the gallery as it is, null when the user backs out.
|
||||
Future<Uint8List?> pickPhotoBytes(ImagePicker picker) async {
|
||||
// The picker scales huge camera photos down natively, so decoding and
|
||||
// cropping them stays quick
|
||||
final file = await picker.pickImage(
|
||||
source: ImageSource.gallery,
|
||||
maxWidth: 2048,
|
||||
maxHeight: 2048,
|
||||
);
|
||||
return file?.readAsBytes();
|
||||
}
|
||||
|
||||
/// The square [crop] (in the photo's pixels) of [bytes], ready to store.
|
||||
/// Without one the middle square is kept.
|
||||
Future<Uint8List> cropProfilePicture(Uint8List bytes, Rect? crop) {
|
||||
return compute(_crop, (bytes, crop));
|
||||
}
|
||||
|
||||
Uint8List _crop((Uint8List, Rect?) args) {
|
||||
var (bytes, crop) = args;
|
||||
// Turned like the gallery shows it, as the crop screen did
|
||||
final image = bakeOrientation(decodeImage(bytes)!);
|
||||
final side = min(image.width, image.height).toDouble();
|
||||
crop ??= Rect.fromLTWH(
|
||||
(image.width - side) / 2,
|
||||
(image.height - side) / 2,
|
||||
side,
|
||||
side,
|
||||
);
|
||||
final square = copyCrop(
|
||||
image,
|
||||
x: crop.left.round(),
|
||||
y: crop.top.round(),
|
||||
width: crop.width.round(),
|
||||
height: crop.height.round(),
|
||||
);
|
||||
final size = min(_pictureSize, square.width);
|
||||
final resized = copyResize(
|
||||
square,
|
||||
width: size,
|
||||
height: size,
|
||||
interpolation: Interpolation.cubic,
|
||||
);
|
||||
return encodeJpg(resized, quality: 90);
|
||||
}
|
||||
|
||||
/// Stores [bytes] as the profile picture, null removes it.
|
||||
Future<void> saveProfilePicture(
|
||||
AppInitialization data,
|
||||
ImagePicker picker,
|
||||
Uint8List? bytes,
|
||||
) async {
|
||||
var imageFile = await picker.pickImage(source: ImageSource.gallery);
|
||||
if (imageFile == null) return;
|
||||
|
||||
var image = await decodeImageFile(imageFile.path);
|
||||
var resized = copyResize(image!, width: 128, maintainAspect: true);
|
||||
|
||||
var dataDir = await getApplicationDocumentsDirectory();
|
||||
var bytes = encodePng(resized);
|
||||
await File(p.join(dataDir.path, "profile.webp")).writeAsBytes(bytes);
|
||||
final dataDir = await getApplicationDocumentsDirectory();
|
||||
final file = File(p.join(dataDir.path, "profile.webp"));
|
||||
if (bytes == null) {
|
||||
if (await file.exists()) await file.delete();
|
||||
} else {
|
||||
await file.writeAsBytes(bytes);
|
||||
}
|
||||
|
||||
data.profilePicture = bytes;
|
||||
data.profilePictureCubit.notifyChanged();
|
||||
}
|
||||
|
||||
/// Picks a photo and keeps its middle square, for where there is no crop
|
||||
/// screen.
|
||||
Future<void> pickProfilePicture(
|
||||
AppInitialization data,
|
||||
ImagePicker picker,
|
||||
) async {
|
||||
final bytes = await pickPhotoBytes(picker);
|
||||
if (bytes == null) return;
|
||||
await saveProfilePicture(data, await cropProfilePicture(bytes, null));
|
||||
}
|
||||
|
||||
@@ -123,13 +123,12 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
);
|
||||
|
||||
final appIconPickerTree = <SettingsUiNode>[
|
||||
SettingsUiHeader(l10n.s_ci_icon_header, always),
|
||||
SettingsUiHeader(l10n.s_ci_warning_header, isDebug),
|
||||
// s_ci_icon_subtitle is intentionally unrendered: the original renderer
|
||||
// never had a case for SettingsSubtitle either, so this was already dead.
|
||||
SettingsUiPadding(24, always),
|
||||
SettingsUiBackHeader(l10n.s_ci_icon_header, always),
|
||||
SettingsUiPadding(20, always),
|
||||
SettingsUiSubtitle(l10n.s_ci_icon_subtitle, always),
|
||||
SettingsUiPadding(20, always),
|
||||
SettingsUiAppIconPreview(always),
|
||||
SettingsUiPadding(24, always),
|
||||
SettingsUiPadding(20, always),
|
||||
childProtection,
|
||||
SettingsUiAppIconPicker(
|
||||
{
|
||||
@@ -138,7 +137,6 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
l10n.s_ci_icon_g3: const ["old", "refilc", "filc", "szivacs"],
|
||||
l10n.s_ci_icon_g4: const [
|
||||
"modern",
|
||||
"cc",
|
||||
"paper",
|
||||
"filco",
|
||||
"o1g",
|
||||
@@ -185,17 +183,15 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
];
|
||||
|
||||
return SettingsUiGroup([
|
||||
SettingsUiBackHeader(l10n.s_a, always),
|
||||
SettingsUiHeader(l10n.s_settings, always),
|
||||
SettingsUiBackHeader(l10n.s_settings, always),
|
||||
SettingsUiPadding(20, always),
|
||||
SettingsUiSubGroup(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.settingsCogSolid,
|
||||
l10n.s_ag,
|
||||
[
|
||||
SettingsUiBackHeader(l10n.s_settings, always),
|
||||
SettingsUiHeader(l10n.s_ag, always),
|
||||
SettingsUiPadding(23, always),
|
||||
SettingsUiBackHeader(l10n.s_ag, always),
|
||||
SettingsUiPadding(20, always),
|
||||
SettingsUiDouble(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.bellSolid,
|
||||
@@ -209,6 +205,7 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
l10n.s_ag_rounding,
|
||||
[
|
||||
SettingsUiBackHeader(l10n.s_ag_rounding, always),
|
||||
SettingsUiPadding(20, always),
|
||||
SettingsUiDouble(
|
||||
null,
|
||||
null,
|
||||
@@ -255,6 +252,13 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
SettingsRegistry.leftHandedMode,
|
||||
never,
|
||||
),
|
||||
SettingsUiBoolean(
|
||||
null,
|
||||
null,
|
||||
l10n.s_ag_sync_theme,
|
||||
SettingsRegistry.syncAccountTheme,
|
||||
always,
|
||||
),
|
||||
SettingsUiHeaderSmall(l10n.s_ag_language_header, always),
|
||||
SettingsUiEnum(SettingsRegistry.language, [
|
||||
l10n.s_ag_language_auto,
|
||||
@@ -271,9 +275,7 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.flower2Solid,
|
||||
l10n.s_c,
|
||||
[
|
||||
SettingsUiPersonalization(appIconPickerTree, always),
|
||||
],
|
||||
[SettingsUiPersonalization(appIconPickerTree, always)],
|
||||
always,
|
||||
null,
|
||||
l10n.s_c_desc,
|
||||
@@ -283,9 +285,8 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
Majesticon.bellSolid,
|
||||
l10n.s_notifications,
|
||||
[
|
||||
SettingsUiBackHeader(l10n.s_settings, always),
|
||||
SettingsUiHeader(l10n.s_notifications, always),
|
||||
SettingsUiPadding(23, always),
|
||||
SettingsUiBackHeader(l10n.s_notifications, always),
|
||||
SettingsUiPadding(20, always),
|
||||
SettingsUiBoolean(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.bellSolid,
|
||||
@@ -293,18 +294,34 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
SettingsRegistry.notifyAll,
|
||||
always,
|
||||
),
|
||||
SettingsUiHeaderSmall(l10n.s_notif_delivery_method_header, isPushNotificationsEnabled),
|
||||
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),
|
||||
SettingsUiHeaderSmall(
|
||||
l10n.s_notif_wakeup_interval_header,
|
||||
isPushNotificationsEnabled,
|
||||
),
|
||||
SettingsUiEnum(SettingsRegistry.notifyWakeupInterval, [
|
||||
l10n.s_notif_wakeup_hourly,
|
||||
l10n.s_notif_wakeup_two_hourly,
|
||||
], isPushNotificationsEnabled),
|
||||
SettingsUiHeaderSmall(l10n.s_notif_categories_header, isPushNotificationsEnabled),
|
||||
SettingsUiHeaderSmall(
|
||||
l10n.s_notif_categories_header,
|
||||
isPushNotificationsEnabled,
|
||||
),
|
||||
SettingsUiBoolean(
|
||||
null,
|
||||
null,
|
||||
@@ -350,9 +367,8 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
Majesticon.clockSolid,
|
||||
l10n.s_wear,
|
||||
[
|
||||
SettingsUiBackHeader(l10n.s_settings, always),
|
||||
SettingsUiHeader(l10n.s_wear, always),
|
||||
SettingsUiPadding(23, always),
|
||||
SettingsUiBackHeader(l10n.s_wear, always),
|
||||
SettingsUiPadding(20, always),
|
||||
SettingsUiBoolean(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.clockSolid,
|
||||
@@ -368,9 +384,8 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
Majesticon.lightningBoltSolid,
|
||||
l10n.s_extras,
|
||||
[
|
||||
SettingsUiBackHeader(l10n.s_settings, always),
|
||||
SettingsUiHeader(l10n.s_extras, always),
|
||||
SettingsUiPadding(23, always),
|
||||
SettingsUiBackHeader(l10n.s_extras, always),
|
||||
SettingsUiPadding(20, always),
|
||||
SettingsUiBoolean(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.questionCircleSolid,
|
||||
@@ -410,7 +425,6 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
null,
|
||||
l10n.s_todo,
|
||||
),
|
||||
SettingsUiPadding(20, always),
|
||||
SettingsUiHeaderSmall(l10n.s_welcome_msg, always),
|
||||
SettingsUiSubGroup(
|
||||
null,
|
||||
@@ -426,11 +440,10 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
null,
|
||||
l10n.s_extras_desc,
|
||||
),
|
||||
SettingsUiPadding(20, always),
|
||||
SettingsUiHeaderSmall(l10n.s_other, always),
|
||||
SettingsUiSubGroup(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.mapMarkerAreaSolid,
|
||||
Majesticon.mapSimpleDestinationSolid,
|
||||
l10n.s_sticker_map,
|
||||
const [],
|
||||
always,
|
||||
@@ -451,7 +464,8 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
"wrenchSolid",
|
||||
l10n.s_developer,
|
||||
[
|
||||
SettingsUiBackHeader(l10n.s_settings, always),
|
||||
SettingsUiBackHeader(l10n.s_developer, always),
|
||||
SettingsUiPadding(20, always),
|
||||
SettingsUiBoolean(
|
||||
FirkaIconType.majesticonsLocal,
|
||||
"wrenchSolid",
|
||||
@@ -486,7 +500,6 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
timetableToastTree(l10n),
|
||||
never,
|
||||
),
|
||||
SettingsUiPadding(20, always),
|
||||
SettingsUiHeaderSmall(l10n.s_about, always),
|
||||
SettingsUiSubGroup(
|
||||
FirkaIconType.majesticons,
|
||||
@@ -509,8 +522,8 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
Majesticon.awardSolid,
|
||||
l10n.licensesLabel,
|
||||
[
|
||||
SettingsUiBackHeader(l10n.s_settings, always),
|
||||
SettingsUiMediumHeader(l10n.licensesLabel, always),
|
||||
SettingsUiBackHeader(l10n.licensesLabel, always),
|
||||
SettingsUiPadding(10, always),
|
||||
SettingsUiHeaderSmall(l10n.licenseDescription, always),
|
||||
SettingsUiLicensePage(always),
|
||||
],
|
||||
@@ -518,12 +531,11 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
),
|
||||
SettingsUiSubGroup(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.phoneSolid,
|
||||
Majesticon.phoneRetroSolid,
|
||||
l10n.s_feedback,
|
||||
const [],
|
||||
always,
|
||||
null,
|
||||
l10n.s_todo,
|
||||
"feedback",
|
||||
),
|
||||
SettingsUiBoolean(
|
||||
null,
|
||||
@@ -538,8 +550,8 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
SettingsUiGroup buildProfileSettingsTree(AppLocalizations l10n) {
|
||||
return SettingsUiGroup([
|
||||
SettingsUiBackHeader(l10n.s_your_account, always),
|
||||
SettingsUiPadding(10, always),
|
||||
SettingsUiHeaderSmall(l10n.s_acc_kreta, always),
|
||||
SettingsUiPadding(8, always),
|
||||
SettingsUiKretaAccountPicker(always),
|
||||
], never);
|
||||
}
|
||||
|
||||
@@ -6,10 +6,17 @@ 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/services/watch_sync_helper.dart";
|
||||
import "package:firka/services/progress_notification_service.dart";
|
||||
import "package:firka/services/wear_sync_helper.dart";
|
||||
import "package:firka/core/theme_palette.dart";
|
||||
import "package:firka/core/theme_sync.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";
|
||||
import "package:firka_common/core/subject_overrides.dart";
|
||||
|
||||
/// Registers the side effects that used to live as `postUpdate` closures on
|
||||
/// each SettingsItem. Called once after the repository is loaded at startup.
|
||||
@@ -20,9 +27,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();
|
||||
@@ -38,6 +50,92 @@ 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();
|
||||
// Other devices of the account follow the switch
|
||||
await pushThemeSelection(repo);
|
||||
}
|
||||
|
||||
// Turned back on, the account's theme comes back right away
|
||||
repo.onChange(SettingsRegistry.syncAccountTheme, (on) async {
|
||||
if (on) await syncThemeFromServer(repo);
|
||||
});
|
||||
|
||||
repo.onChange(SettingsRegistry.subjectOverrides, (json) async {
|
||||
loadSubjectOverrides(json);
|
||||
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();
|
||||
// persist the new colors into the selected user theme
|
||||
scheduleActiveThemeSave(repo);
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -56,12 +154,17 @@ void registerSettingsEffects(
|
||||
|
||||
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 NotificationDeliveryService.handleWakeupIntervalChange();
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import "package:isar_community/isar.dart";
|
||||
import "package:firka/core/bloc/settings_cubit.dart";
|
||||
import "package:firka_common/core/grade_helper.dart" as grade_helper;
|
||||
import "package:firka_common/data/database.dart";
|
||||
import "package:firka_common/data/isar_writes.dart";
|
||||
import "package:firka_common/data/models/app_settings_model.dart";
|
||||
import "package:firka_common/data/models/token_model.dart";
|
||||
import "package:firka_common/ui/theme/style.dart";
|
||||
@@ -33,6 +34,10 @@ class SilentlySettable<T> {
|
||||
|
||||
const SilentlySettable(this._repo, this._setting);
|
||||
|
||||
/// The typed key behind this accessor, so callers can identify the setting
|
||||
/// (by [Setting.id]) without reaching for the registry entry separately.
|
||||
Setting<T> get setting => _setting;
|
||||
|
||||
T get value => _repo.get(_setting);
|
||||
|
||||
Future<void> set(T value) => _repo.set(_setting, value);
|
||||
@@ -80,9 +85,7 @@ class SettingsRepository {
|
||||
case String v:
|
||||
row.valueString = v;
|
||||
}
|
||||
await isar.writeTxn(() async {
|
||||
await box.put(row);
|
||||
});
|
||||
await isarWrite(() => isar.writeTxn(() => box.put(row)));
|
||||
|
||||
cubit?.notifyChanged();
|
||||
}
|
||||
@@ -116,13 +119,14 @@ class SettingsRepository {
|
||||
);
|
||||
}
|
||||
|
||||
Color getGradeColor(num grade) {
|
||||
Color getGradeColor(num grade, {FirkaStyle? style}) {
|
||||
final colors = (style ?? appStyle).colors;
|
||||
return switch (roundGrade(grade)) {
|
||||
2 => appStyle.colors.grade2,
|
||||
3 => appStyle.colors.grade3,
|
||||
4 => appStyle.colors.grade4,
|
||||
5 => appStyle.colors.grade5,
|
||||
_ => appStyle.colors.grade1,
|
||||
2 => colors.grade2,
|
||||
3 => colors.grade3,
|
||||
4 => colors.grade4,
|
||||
5 => colors.grade5,
|
||||
_ => colors.grade1,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -130,13 +134,15 @@ class SettingsRepository {
|
||||
box.getSync(_selectedAccountId)?.valueIndex ?? 0;
|
||||
|
||||
Future<void> setSelectedAccountKey(int key) async {
|
||||
await isar.writeTxn(() async {
|
||||
await box.put(
|
||||
AppSettingsModel()
|
||||
..id = _selectedAccountId
|
||||
..valueIndex = key,
|
||||
);
|
||||
});
|
||||
await isarWrite(
|
||||
() => isar.writeTxn(
|
||||
() => box.put(
|
||||
AppSettingsModel()
|
||||
..id = _selectedAccountId
|
||||
..valueIndex = key,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
TokenModel? getSelectedToken() {
|
||||
|
||||
@@ -170,6 +170,24 @@ abstract class SettingsSchema {
|
||||
@StringSetting(id: 1044, defaultValue: "[]")
|
||||
String get notifyMutedSubjects;
|
||||
|
||||
/// Per subject renames, icon, rounding and notification switches, as JSON
|
||||
/// keyed by the subject's cache key, see firka_common's subject_overrides
|
||||
@StringSetting(id: 1089, defaultValue: "{}")
|
||||
String get subjectOverrides;
|
||||
|
||||
/// Which pages sit in the bottom bar and which in "Több", in order, and
|
||||
/// the "Több" ones that are hidden, as JSON
|
||||
@StringSetting(id: 1090, defaultValue: "{}")
|
||||
String get navLayout;
|
||||
|
||||
/// The name the app greets the user with, empty for the one from KRÉTA
|
||||
@StringSetting(id: 1091, defaultValue: "")
|
||||
String get profileNickname;
|
||||
|
||||
/// The account's theme follows it to every device it is logged in on
|
||||
@BoolSetting(id: 1092, defaultValue: true)
|
||||
bool get syncAccountTheme;
|
||||
|
||||
@EnumSetting(
|
||||
id: 1045,
|
||||
defaultValue: NotifyWakeupInterval.hourly,
|
||||
@@ -186,4 +204,133 @@ abstract class SettingsSchema {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -42,12 +42,57 @@ class SettingsRegistry {
|
||||
static const notifyLessons = BoolSetting(id: 1042, defaultValue: true);
|
||||
static const notifyMessages = BoolSetting(id: 1043, defaultValue: true);
|
||||
static const notifyMutedSubjects = StringSetting(id: 1044, defaultValue: "[]");
|
||||
static const subjectOverrides = StringSetting(id: 1089, defaultValue: "{}");
|
||||
static const navLayout = StringSetting(id: 1090, defaultValue: "{}");
|
||||
static const profileNickname = StringSetting(id: 1091, defaultValue: "");
|
||||
static const syncAccountTheme = BoolSetting(id: 1092, defaultValue: true);
|
||||
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, notificationDeliveryMethod,
|
||||
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, subjectOverrides, navLayout, profileNickname, syncAccountTheme, 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,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -91,7 +136,52 @@ extension SettingsAccessors on SettingsRepository {
|
||||
SilentlySettable<bool> get notifyLessons => SilentlySettable(this, SettingsRegistry.notifyLessons);
|
||||
SilentlySettable<bool> get notifyMessages => SilentlySettable(this, SettingsRegistry.notifyMessages);
|
||||
SilentlySettable<String> get notifyMutedSubjects => SilentlySettable(this, SettingsRegistry.notifyMutedSubjects);
|
||||
SilentlySettable<String> get subjectOverrides => SilentlySettable(this, SettingsRegistry.subjectOverrides);
|
||||
SilentlySettable<String> get navLayout => SilentlySettable(this, SettingsRegistry.navLayout);
|
||||
SilentlySettable<String> get profileNickname => SilentlySettable(this, SettingsRegistry.profileNickname);
|
||||
SilentlySettable<bool> get syncAccountTheme => SilentlySettable(this, SettingsRegistry.syncAccountTheme);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,14 @@ class SettingsUiHeaderSmall extends SettingsUiNode {
|
||||
: super(visible);
|
||||
}
|
||||
|
||||
/// A line of body text under a page's header
|
||||
class SettingsUiSubtitle extends SettingsUiNode {
|
||||
final String title;
|
||||
|
||||
const SettingsUiSubtitle(this.title, bool Function() visible)
|
||||
: super(visible);
|
||||
}
|
||||
|
||||
class SettingsUiSubGroup extends SettingsUiNode {
|
||||
final FirkaIconType? iconType;
|
||||
final Object? iconData;
|
||||
|
||||
263
firka/lib/core/theme_palette.dart
Normal file
263
firka/lib/core/theme_palette.dart
Normal file
@@ -0,0 +1,263 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:firka_common/data/isar_writes.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/core/snowflake.dart';
|
||||
import 'package:firka/core/theme_sync.dart';
|
||||
import 'package:firka/ui/phone/screens/themes/builtin_theme_id.dart';
|
||||
import 'package:firka/ui/phone/screens/themes/user_theme.dart';
|
||||
import 'package:firka_common/data/database.dart';
|
||||
import 'package:firka_common/data/models/user_theme_model.dart';
|
||||
import 'package:firka_common/ui/theme/grade_theme.dart';
|
||||
import 'package:firka_common/ui/theme/theme_binary_format.dart';
|
||||
import 'package:flutter/painting.dart';
|
||||
|
||||
/// the settings that hold a slot's light and dark color
|
||||
(StringSetting, StringSetting) themeSlotSettings(ThemeColorSlot slot) {
|
||||
switch (slot) {
|
||||
case ThemeColorSlot.accent:
|
||||
return (
|
||||
SettingsRegistry.customAccentColorLight,
|
||||
SettingsRegistry.customAccentColorDark,
|
||||
);
|
||||
case ThemeColorSlot.background:
|
||||
return (
|
||||
SettingsRegistry.customBackgroundColorLight,
|
||||
SettingsRegistry.customBackgroundColorDark,
|
||||
);
|
||||
case ThemeColorSlot.card:
|
||||
return (
|
||||
SettingsRegistry.customCardColorLight,
|
||||
SettingsRegistry.customCardColorDark,
|
||||
);
|
||||
case ThemeColorSlot.button:
|
||||
return (
|
||||
SettingsRegistry.customButtonColorLight,
|
||||
SettingsRegistry.customButtonColorDark,
|
||||
);
|
||||
case ThemeColorSlot.secondary:
|
||||
return (
|
||||
SettingsRegistry.customSecondaryColorLight,
|
||||
SettingsRegistry.customSecondaryColorDark,
|
||||
);
|
||||
case ThemeColorSlot.textPrimary:
|
||||
return (
|
||||
SettingsRegistry.customTextColorLight,
|
||||
SettingsRegistry.customTextColorDark,
|
||||
);
|
||||
case ThemeColorSlot.textSecondary:
|
||||
return (
|
||||
SettingsRegistry.customTextSecondaryColorLight,
|
||||
SettingsRegistry.customTextSecondaryColorDark,
|
||||
);
|
||||
case ThemeColorSlot.textTertiary:
|
||||
return (
|
||||
SettingsRegistry.customTextTertiaryColorLight,
|
||||
SettingsRegistry.customTextTertiaryColorDark,
|
||||
);
|
||||
case ThemeColorSlot.shadowColor:
|
||||
return (
|
||||
SettingsRegistry.customShadowColorLight,
|
||||
SettingsRegistry.customShadowColorDark,
|
||||
);
|
||||
case ThemeColorSlot.success:
|
||||
return (
|
||||
SettingsRegistry.customSuccessColorLight,
|
||||
SettingsRegistry.customSuccessColorDark,
|
||||
);
|
||||
case ThemeColorSlot.warningAccent:
|
||||
return (
|
||||
SettingsRegistry.customWarningAccentColorLight,
|
||||
SettingsRegistry.customWarningAccentColorDark,
|
||||
);
|
||||
case ThemeColorSlot.warningText:
|
||||
return (
|
||||
SettingsRegistry.customWarningTextColorLight,
|
||||
SettingsRegistry.customWarningTextColorDark,
|
||||
);
|
||||
case ThemeColorSlot.warningCard:
|
||||
return (
|
||||
SettingsRegistry.customWarningCardColorLight,
|
||||
SettingsRegistry.customWarningCardColorDark,
|
||||
);
|
||||
case ThemeColorSlot.errorAccent:
|
||||
return (
|
||||
SettingsRegistry.customErrorAccentColorLight,
|
||||
SettingsRegistry.customErrorAccentColorDark,
|
||||
);
|
||||
case ThemeColorSlot.errorText:
|
||||
return (
|
||||
SettingsRegistry.customErrorTextColorLight,
|
||||
SettingsRegistry.customErrorTextColorDark,
|
||||
);
|
||||
case ThemeColorSlot.errorCard:
|
||||
return (
|
||||
SettingsRegistry.customErrorCardColorLight,
|
||||
SettingsRegistry.customErrorCardColorDark,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// the grade color settings, grade 1 first, the order of the share format
|
||||
final _gradeSettings = [
|
||||
SettingsRegistry.customGradeColor1,
|
||||
SettingsRegistry.customGradeColor2,
|
||||
SettingsRegistry.customGradeColor3,
|
||||
SettingsRegistry.customGradeColor4,
|
||||
SettingsRegistry.customGradeColor5,
|
||||
];
|
||||
|
||||
/// the colors the app has right now as a share code: every slot, the grade
|
||||
/// colors and both background gradients
|
||||
String captureThemeCode(SettingsRepository settings) {
|
||||
Color read(StringSetting setting) =>
|
||||
settings.get(setting).toColorFromHexSetting();
|
||||
|
||||
final bytes = ThemeBinaryFormat.encodeFullTheme(
|
||||
light: {
|
||||
for (final slot in ThemeColorSlot.values)
|
||||
slot: read(themeSlotSettings(slot).$1),
|
||||
},
|
||||
dark: {
|
||||
for (final slot in ThemeColorSlot.values)
|
||||
slot: read(themeSlotSettings(slot).$2),
|
||||
},
|
||||
gradeColors: [for (final setting in _gradeSettings) read(setting)],
|
||||
gradientLight: settings
|
||||
.get(SettingsRegistry.customBackgroundGradientLight)
|
||||
.toColorListFromHexSetting(),
|
||||
gradientDark: settings
|
||||
.get(SettingsRegistry.customBackgroundGradientDark)
|
||||
.toColorListFromHexSetting(),
|
||||
);
|
||||
return ThemeBinaryFormat.toBase64(bytes);
|
||||
}
|
||||
|
||||
/// Puts the colors of a share code into the settings. Everything is written
|
||||
/// quietly except the last one, so the app refreshes once and not forty times.
|
||||
/// throws a [FormatException] when the code is not a theme.
|
||||
Future<void> applyThemeCode(SettingsRepository settings, String code) async {
|
||||
final data = ThemeBinaryFormat.decodeFromBase64(code);
|
||||
final slots = data.toThemeSlots();
|
||||
|
||||
for (final slot in ThemeColorSlot.values) {
|
||||
final (light, dark) = themeSlotSettings(slot);
|
||||
await settings.setSilently(light, slots.light[slot]!.toHexSetting());
|
||||
await settings.setSilently(dark, slots.dark[slot]!.toHexSetting());
|
||||
}
|
||||
for (var i = 0; i < _gradeSettings.length; i++) {
|
||||
await settings.setSilently(
|
||||
_gradeSettings[i],
|
||||
data.gradeColors[i].toHexSetting(),
|
||||
);
|
||||
}
|
||||
await settings.setSilently(
|
||||
SettingsRegistry.customBackgroundGradientLight,
|
||||
data.gradientLight.toHexSettingJson(),
|
||||
);
|
||||
await settings.set(
|
||||
SettingsRegistry.customBackgroundGradientDark,
|
||||
data.gradientDark.toHexSettingJson(),
|
||||
);
|
||||
}
|
||||
|
||||
/// Writes the grade colors of a preset into the custom grade color settings,
|
||||
/// so a custom theme picks up the preset the user scrolled to
|
||||
Future<void> applyGradeColors(
|
||||
SettingsRepository settings,
|
||||
GradeThemeColors colors,
|
||||
) async {
|
||||
final values = [
|
||||
colors.grade1,
|
||||
colors.grade2,
|
||||
colors.grade3,
|
||||
colors.grade4,
|
||||
colors.grade5,
|
||||
];
|
||||
for (var i = 0; i < _gradeSettings.length - 1; i++) {
|
||||
await settings.setSilently(_gradeSettings[i], values[i].toHexSetting());
|
||||
}
|
||||
await settings.set(_gradeSettings.last, values.last.toHexSetting());
|
||||
}
|
||||
|
||||
/// Editing a built-in theme saves the result as a new own theme and selects
|
||||
/// it, the built-ins themselves never change. Does nothing for a custom theme.
|
||||
Future<void> forkBuiltinTheme(SettingsRepository settings, String name) async {
|
||||
if (!isBuiltinThemeId(settings.get(SettingsRegistry.selectedThemeId))) {
|
||||
return;
|
||||
}
|
||||
final theme = UserTheme(
|
||||
id: Snowflake.nextId(),
|
||||
name: name,
|
||||
origin: ThemeOrigin.own,
|
||||
swatch: UserTheme.swatchFromAppStyle(),
|
||||
code: captureThemeCode(settings),
|
||||
);
|
||||
await isarWrite(
|
||||
() => isarInit.writeTxn(
|
||||
() => isarInit.userThemeModels.putByThemeId(theme.toModel()),
|
||||
),
|
||||
);
|
||||
await settings.set(SettingsRegistry.selectedThemeId, theme.id);
|
||||
}
|
||||
|
||||
/// Decodes [code] into the override map [buildStyleForBrightness] renders
|
||||
/// from, so a theme can be previewed without writing it to the settings.
|
||||
/// Keyed by [Setting.id]. Throws a [FormatException] when the code is not a
|
||||
/// theme, same as [applyThemeCode].
|
||||
Map<int, String> themeCodeOverrides(String code) {
|
||||
final data = ThemeBinaryFormat.decodeFromBase64(code);
|
||||
final slots = data.toThemeSlots();
|
||||
|
||||
final overrides = <int, String>{};
|
||||
for (final slot in ThemeColorSlot.values) {
|
||||
final (light, dark) = themeSlotSettings(slot);
|
||||
overrides[light.id] = slots.light[slot]!.toHexSetting();
|
||||
overrides[dark.id] = slots.dark[slot]!.toHexSetting();
|
||||
}
|
||||
for (var i = 0; i < _gradeSettings.length; i++) {
|
||||
overrides[_gradeSettings[i].id] = data.gradeColors[i].toHexSetting();
|
||||
}
|
||||
overrides[SettingsRegistry.customBackgroundGradientLight.id] = data
|
||||
.gradientLight
|
||||
.toHexSettingJson();
|
||||
overrides[SettingsRegistry.customBackgroundGradientDark.id] = data
|
||||
.gradientDark
|
||||
.toHexSettingJson();
|
||||
return overrides;
|
||||
}
|
||||
|
||||
/// writes the colors being edited back into the selected theme, so each theme
|
||||
/// keeps its own. Nothing to do while a built-in theme is selected.
|
||||
Future<void> saveActiveThemeCode(SettingsRepository settings) async {
|
||||
final id = settings.get(SettingsRegistry.selectedThemeId);
|
||||
if (isBuiltinThemeId(id)) return;
|
||||
|
||||
final stored = await isarInit.userThemeModels.getByThemeId(id);
|
||||
if (stored == null) return;
|
||||
|
||||
stored.code = captureThemeCode(settings);
|
||||
stored.swatchArgb = [
|
||||
for (final color in UserTheme.swatchFromAppStyle()) color.toARGB32(),
|
||||
];
|
||||
await isarWrite(
|
||||
() =>
|
||||
isarInit.writeTxn(() => isarInit.userThemeModels.putByThemeId(stored)),
|
||||
);
|
||||
await pushThemeToServer(settings);
|
||||
}
|
||||
|
||||
Timer? _saveTimer;
|
||||
|
||||
/// saves the selected theme a moment after the last change, dragging a slider
|
||||
/// changes a color many times a second
|
||||
void scheduleActiveThemeSave(SettingsRepository settings) {
|
||||
_saveTimer?.cancel();
|
||||
_saveTimer = Timer(
|
||||
const Duration(milliseconds: 300),
|
||||
() => saveActiveThemeCode(settings),
|
||||
);
|
||||
}
|
||||
342
firka/lib/core/theme_sync.dart
Normal file
342
firka/lib/core/theme_sync.dart
Normal file
@@ -0,0 +1,342 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:firka_common/data/isar_writes.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:isar_community/isar.dart';
|
||||
|
||||
import 'package:firka/api/theme_sync_api.dart' as api;
|
||||
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/core/theme_palette.dart';
|
||||
import 'package:firka/ui/phone/screens/themes/builtin_theme_id.dart';
|
||||
import 'package:firka/ui/phone/screens/themes/user_theme.dart';
|
||||
import 'package:firka_common/data/database.dart';
|
||||
import 'package:firka_common/data/models/token_model.dart';
|
||||
import 'package:firka_common/data/models/user_theme_model.dart';
|
||||
import 'package:firka_common/ui/theme/theme_binary_format.dart';
|
||||
|
||||
/// Identifies the account's row. Baked into the app so the vault can't be
|
||||
/// worked out from a student's institute code and id alone.
|
||||
const _vaultSalt = 'firka-theme-sync-2026';
|
||||
|
||||
/// a different secret for the write key, so seeing a vault never tells
|
||||
/// anyone what it takes to change what is in it
|
||||
const _writeSalt = 'firka-theme-write-2026';
|
||||
|
||||
/// The account's row id. The only thing that leaves the device is this hash,
|
||||
/// never the institute code or the student id behind it. Both survive a token
|
||||
/// refresh, so the vault stays the same for the life of the account.
|
||||
String computeVault(TokenModel token) => sha256
|
||||
.convert(utf8.encode('$_vaultSalt:${token.iss}:${token.studentId}'))
|
||||
.toString();
|
||||
|
||||
/// Proves to the server that this client owns the vault. The server only
|
||||
/// ever stores a hash of it, and it never goes into a share link.
|
||||
String computeWriteKey(TokenModel token) => Hmac(
|
||||
sha256,
|
||||
utf8.encode(_writeSalt),
|
||||
).convert(utf8.encode('${token.iss}:${token.studentId}')).toString();
|
||||
|
||||
/// the local id of the theme mirroring the account's vault
|
||||
String syncedThemeId(String vault) => 'sync-${vault.substring(0, 24)}';
|
||||
|
||||
/// What the server holds as the account's pick: a built-in theme id, a
|
||||
/// `shared-` share id, or empty for the own theme in the vault. Kept so a
|
||||
/// switch is only sent once.
|
||||
String? _lastSelection;
|
||||
|
||||
/// Set while the account's pick is being applied here, so the settings it
|
||||
/// changes on the way are not sent back as a new pick.
|
||||
var _applyingRemote = false;
|
||||
|
||||
/// Pulls this account's theme down and switches to the one the account has
|
||||
/// on, so every device it is logged in on shows the same theme. Quietly does
|
||||
/// nothing while nobody is logged in or the network is down.
|
||||
Future<void> syncThemeFromServer(SettingsRepository settings) async {
|
||||
try {
|
||||
final token = settings.getSelectedToken();
|
||||
if (token == null) return;
|
||||
// Turned off, this device keeps its own theme
|
||||
if (!settings.get(SettingsRegistry.syncAccountTheme)) return;
|
||||
|
||||
final vault = computeVault(token);
|
||||
final remote = await api.fetchTheme(vault);
|
||||
if (remote == null) return;
|
||||
_lastSelection = remote.selected ?? '';
|
||||
|
||||
final own = remote.code.isEmpty
|
||||
? null
|
||||
: await _storeOwnTheme(vault, remote);
|
||||
|
||||
final selected = remote.selected;
|
||||
_applyingRemote = true;
|
||||
try {
|
||||
if (selected == null) {
|
||||
if (own != null) await _wear(settings, own);
|
||||
} else if (isBuiltinThemeId(selected)) {
|
||||
await _wearBuiltin(settings, selected);
|
||||
} else if (selected.startsWith('shared-')) {
|
||||
final shared = await _storeSharedTheme(selected.substring(7));
|
||||
if (shared != null) await _wear(settings, shared);
|
||||
}
|
||||
} finally {
|
||||
_applyingRemote = false;
|
||||
}
|
||||
} catch (e) {
|
||||
_applyingRemote = false;
|
||||
logger.warning('[ThemeSync] fetch failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
/// The vault's own theme as a local one, reusing the copy already here.
|
||||
Future<UserThemeModel> _storeOwnTheme(
|
||||
String vault,
|
||||
({String code, String name, String shareId, String? selected}) remote,
|
||||
) async {
|
||||
final local = await isarInit.userThemeModels.where().findAll();
|
||||
|
||||
// the server's copy is usually a theme of ours pushed from another
|
||||
// device, so match on the colors before making a second one
|
||||
final stored =
|
||||
local.where((t) => t.code == remote.code).firstOrNull ??
|
||||
local.where((t) => t.themeId == syncedThemeId(vault)).firstOrNull;
|
||||
|
||||
if (stored != null &&
|
||||
stored.code == remote.code &&
|
||||
stored.shareId == remote.shareId) {
|
||||
return stored;
|
||||
}
|
||||
|
||||
final model = (stored ?? UserThemeModel())
|
||||
..themeId = stored?.themeId ?? syncedThemeId(vault)
|
||||
..name = remote.name.isNotEmpty ? remote.name : (stored?.name ?? 'Firka')
|
||||
..origin = stored?.origin ?? 'own'
|
||||
..code = remote.code
|
||||
..shareId = remote.shareId
|
||||
..swatchArgb = _swatchOf(remote.code) ?? stored?.swatchArgb ?? const [];
|
||||
|
||||
await isarWrite(
|
||||
() => isarInit.writeTxn(() => isarInit.userThemeModels.putByThemeId(model)),
|
||||
);
|
||||
|
||||
// applying the code makes the app save the theme, which would otherwise
|
||||
// push this very theme straight back up
|
||||
_lastPushed = '${remote.code}:${model.name}';
|
||||
return model;
|
||||
}
|
||||
|
||||
/// Someone else's theme the account has on, imported like from a link when
|
||||
/// this device does not have it yet. Null when the link is dead.
|
||||
Future<UserThemeModel?> _storeSharedTheme(String shareId) async {
|
||||
final local = await isarInit.userThemeModels.where().findAll();
|
||||
final stored = local
|
||||
.where((t) => t.origin == 'downloaded' && t.shareId == shareId)
|
||||
.firstOrNull;
|
||||
if (stored != null) return stored;
|
||||
|
||||
final remote = await api.fetchSharedTheme(shareId);
|
||||
if (remote == null) return null;
|
||||
|
||||
final model = UserThemeModel()
|
||||
..themeId = 'shared-$shareId'
|
||||
..name = remote.name.isNotEmpty ? remote.name : 'Firka'
|
||||
..origin = 'downloaded'
|
||||
..code = remote.code
|
||||
..shareId = shareId
|
||||
..swatchArgb = _swatchOf(remote.code) ?? const [];
|
||||
await isarWrite(
|
||||
() => isarInit.writeTxn(() => isarInit.userThemeModels.putByThemeId(model)),
|
||||
);
|
||||
return model;
|
||||
}
|
||||
|
||||
Future<void> _wear(SettingsRepository settings, UserThemeModel theme) async {
|
||||
if (settings.get(SettingsRegistry.selectedThemeId) == theme.themeId &&
|
||||
captureThemeCode(settings) == theme.code) {
|
||||
return;
|
||||
}
|
||||
await settings.setSilently(SettingsRegistry.selectedThemeId, theme.themeId);
|
||||
await applyThemeCode(settings, theme.code);
|
||||
}
|
||||
|
||||
Future<void> _wearBuiltin(SettingsRepository settings, String id) async {
|
||||
if (settings.get(SettingsRegistry.selectedThemeId) == id) return;
|
||||
final (coreId, gradeId) = parseBuiltinThemeId(id);
|
||||
await settings.setSilently(SettingsRegistry.selectedCoreThemeId, coreId);
|
||||
await settings.setSilently(SettingsRegistry.selectedGradeThemeId, gradeId);
|
||||
// The last one is not silent, it repaints the app in the new theme
|
||||
await settings.set(
|
||||
SettingsRegistry.selectedThemeId,
|
||||
composeBuiltinThemeId(coreId, gradeId),
|
||||
);
|
||||
}
|
||||
|
||||
/// Tells the server which theme this device just switched to, so the
|
||||
/// account's other devices follow. The own theme goes up as its colors.
|
||||
Future<void> pushThemeSelection(SettingsRepository settings) async {
|
||||
if (_applyingRemote) return;
|
||||
if (!settings.get(SettingsRegistry.syncAccountTheme)) return;
|
||||
try {
|
||||
final token = settings.getSelectedToken();
|
||||
if (token == null) return;
|
||||
|
||||
final id = settings.get(SettingsRegistry.selectedThemeId);
|
||||
final String selection;
|
||||
if (isBuiltinThemeId(id)) {
|
||||
selection = normalizeSelectedThemeId(id);
|
||||
} else {
|
||||
final stored = await isarInit.userThemeModels.getByThemeId(id);
|
||||
if (stored == null) return;
|
||||
if (stored.origin != 'downloaded') {
|
||||
// Pushing the own theme also makes it the account's pick again
|
||||
await _push(
|
||||
settings,
|
||||
stored,
|
||||
captureThemeCode(settings),
|
||||
force: _lastSelection != '',
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (stored.shareId.isEmpty) return;
|
||||
selection = 'shared-${stored.shareId}';
|
||||
}
|
||||
|
||||
if (selection == _lastSelection) return;
|
||||
await api.pushSelected(
|
||||
computeVault(token),
|
||||
writeKey: computeWriteKey(token),
|
||||
selected: selection,
|
||||
);
|
||||
_lastSelection = selection;
|
||||
} catch (e) {
|
||||
logger.warning('[ThemeSync] selection push failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
/// Re-reads every theme imported from a share link. The owner of a shared
|
||||
/// theme keeps editing it, so these follow along on their own.
|
||||
Future<void> refreshSharedThemes(SettingsRepository settings) async {
|
||||
try {
|
||||
final local = await isarInit.userThemeModels.where().findAll();
|
||||
final followed = local.where(
|
||||
(t) => t.origin == 'downloaded' && t.shareId.isNotEmpty,
|
||||
);
|
||||
|
||||
final selected = settings.get(SettingsRegistry.selectedThemeId);
|
||||
var changedSelected = false;
|
||||
|
||||
for (final theme in followed) {
|
||||
final remote = await api.fetchSharedTheme(theme.shareId);
|
||||
// a dead link keeps the copy that was imported, rather than losing it
|
||||
if (remote == null || remote.code == theme.code) continue;
|
||||
|
||||
theme.code = remote.code;
|
||||
theme.swatchArgb = _swatchOf(remote.code) ?? theme.swatchArgb;
|
||||
await isarWrite(
|
||||
() => isarInit.writeTxn(
|
||||
() => isarInit.userThemeModels.putByThemeId(theme),
|
||||
),
|
||||
);
|
||||
if (theme.themeId == selected) changedSelected = true;
|
||||
}
|
||||
|
||||
// repaint right away when the theme being worn is the one that moved
|
||||
if (changedSelected) {
|
||||
final theme = await isarInit.userThemeModels.getByThemeId(selected);
|
||||
if (theme != null) await applyThemeCode(settings, theme.code);
|
||||
}
|
||||
} catch (e) {
|
||||
logger.warning('[ThemeSync] shared refresh failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
/// what the server was last told, so dragging a colour slider and pulling a
|
||||
/// theme back down don't each cost a request that changes nothing
|
||||
String? _lastPushed;
|
||||
|
||||
/// Pushes the selected theme up. A shared theme is pushed like any other —
|
||||
/// that is how everyone following the link sees the edit.
|
||||
Future<void> pushThemeToServer(SettingsRepository settings) async {
|
||||
if (!settings.get(SettingsRegistry.syncAccountTheme)) return;
|
||||
final id = settings.get(SettingsRegistry.selectedThemeId);
|
||||
if (isBuiltinThemeId(id)) return;
|
||||
|
||||
final stored = await isarInit.userThemeModels.getByThemeId(id);
|
||||
// someone else's theme is theirs to change, we only follow it
|
||||
if (stored == null || stored.origin == 'downloaded') return;
|
||||
|
||||
await _push(settings, stored, captureThemeCode(settings));
|
||||
}
|
||||
|
||||
/// publishes [theme] and returns the share id to put in the link, or an
|
||||
/// empty string when it couldn't be published. The theme stays editable:
|
||||
/// later edits reach everyone holding the link on their own.
|
||||
Future<String> publishTheme(
|
||||
SettingsRepository settings,
|
||||
UserTheme theme,
|
||||
) async {
|
||||
try {
|
||||
final token = settings.getSelectedToken();
|
||||
if (token == null || theme.isBuiltin) return '';
|
||||
|
||||
final stored = await isarInit.userThemeModels.getByThemeId(theme.id);
|
||||
if (stored == null) return '';
|
||||
|
||||
// the link has to point at the colours it was made from
|
||||
await _push(settings, stored, theme.code, force: true);
|
||||
|
||||
final shareId = await api.shareTheme(
|
||||
computeVault(token),
|
||||
writeKey: computeWriteKey(token),
|
||||
);
|
||||
|
||||
stored.shareId = shareId;
|
||||
await isarWrite(
|
||||
() => isarInit.writeTxn(
|
||||
() => isarInit.userThemeModels.putByThemeId(stored),
|
||||
),
|
||||
);
|
||||
return shareId;
|
||||
} catch (e) {
|
||||
logger.warning('[ThemeSync] publish failed: $e');
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _push(
|
||||
SettingsRepository settings,
|
||||
UserThemeModel stored,
|
||||
String code, {
|
||||
bool force = false,
|
||||
}) async {
|
||||
try {
|
||||
final token = settings.getSelectedToken();
|
||||
if (token == null) return;
|
||||
|
||||
final sent = '$code:${stored.name}';
|
||||
if (!force && sent == _lastPushed) return;
|
||||
|
||||
await api.pushTheme(
|
||||
computeVault(token),
|
||||
writeKey: computeWriteKey(token),
|
||||
code: code,
|
||||
name: stored.name,
|
||||
);
|
||||
_lastPushed = sent;
|
||||
// The server makes a pushed own theme the account's pick
|
||||
_lastSelection = '';
|
||||
} catch (e) {
|
||||
logger.warning('[ThemeSync] push failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
List<int>? _swatchOf(String code) {
|
||||
final data = code.tryDecodeThemeData();
|
||||
if (data == null) return null;
|
||||
return [
|
||||
data.lightSlot(ThemeColorSlot.accent).toARGB32(),
|
||||
data.lightSlot(ThemeColorSlot.textPrimary).toARGB32(),
|
||||
data.lightSlot(ThemeColorSlot.background).toARGB32(),
|
||||
];
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
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';
|
||||
@@ -13,6 +16,7 @@ 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 {
|
||||
@@ -29,6 +33,7 @@ class WidgetCacheHelper {
|
||||
'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(),
|
||||
@@ -48,7 +53,18 @@ class WidgetCacheHelper {
|
||||
final colors = style != null
|
||||
? _colorsMap(style)
|
||||
: (existingColors ?? _defaultColors());
|
||||
return {'colors': colors, 'timetable': timetableJson};
|
||||
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(
|
||||
@@ -196,7 +212,10 @@ class WidgetCacheHelper {
|
||||
.sortByStart()
|
||||
.findAll();
|
||||
if (lessons.isEmpty) {
|
||||
lessons = await isarInit.lessonCacheModels.where().sortByStart().findAll();
|
||||
lessons = await isarInit.lessonCacheModels
|
||||
.where()
|
||||
.sortByStart()
|
||||
.findAll();
|
||||
}
|
||||
await updateWidgetCacheFromLessons(
|
||||
lessons,
|
||||
|
||||
Submodule firka/lib/l10n deleted from d064196553
448
firka/lib/l10n/app_de.arb
Normal file
448
firka/lib/l10n/app_de.arb
Normal file
@@ -0,0 +1,448 @@
|
||||
{
|
||||
"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_restart_notice": "Bei manchen Launchern erscheint das neue Symbol erst, wenn die App neu geöffnet wird.",
|
||||
"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"
|
||||
}
|
||||
656
firka/lib/l10n/app_en.arb
Normal file
656
firka/lib/l10n/app_en.arb
Normal file
@@ -0,0 +1,656 @@
|
||||
{
|
||||
"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_sync_theme": "Sync theme with account",
|
||||
"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_restart_notice": "Some launchers only show the new icon once the app is reopened.",
|
||||
"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_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_custom_colors": "Custom colors",
|
||||
"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",
|
||||
"fb_intro": "Found a bug or have an idea? Tell us! If you add your e-mail address, we will reply.",
|
||||
"fb_email": "E-mail address (optional)",
|
||||
"fb_message": "Message",
|
||||
"fb_attach_logs": "Attach logs and debug data",
|
||||
"fb_attach_logs_desc": "We send the app's log and your device details (model, Android and app version) so it is easier to find the problem. The log can contain personal data.",
|
||||
"fb_send": "Send feedback",
|
||||
"fb_sending": "Sending…",
|
||||
"fb_sent": "We got your message and will reply by e-mail soon.",
|
||||
"fb_err_email_invalid": "Sorry, we can't reply to an invalid e-mail address yet.",
|
||||
"fb_err_message_empty": "Tell us how we can help.",
|
||||
"fb_err_send": "The message could not be sent, please try again later.",
|
||||
"fb_add_images": "Attach pictures",
|
||||
"fb_images_hint": "Up to 5 pictures, 5 MB each.",
|
||||
"fb_remove_image": "Remove picture",
|
||||
"fb_err_image_big": "A picture can be 5 MB at most.",
|
||||
"fb_err_images_total": "The pictures can be 8 MB together at most.",
|
||||
"fb_sent_no_reply": "We got your message, thank you!",
|
||||
"fb_sent_title": "Sent!",
|
||||
"coming_soon": "Coming soon!",
|
||||
"s_subj_customize": "Customize subject",
|
||||
"s_subj_rename": "Rename subject",
|
||||
"s_subj_rename_teacher": "Rename teacher",
|
||||
"s_subj_rounding": "Rounding",
|
||||
"s_subj_icon": "Icon",
|
||||
"s_subj_notify_all": "All",
|
||||
"s_subj_reset": "Reset",
|
||||
"s_acc_personal_info": "Personal information",
|
||||
"s_profile_crop": "Adjust photo",
|
||||
"s_profile_edit": "Customize profile",
|
||||
"s_profile_photo_change": "Change photo",
|
||||
"s_profile_photo_remove": "Remove photo",
|
||||
"s_profile_name_edit": "Edit name",
|
||||
"s_profile_name_reset": "Original name",
|
||||
"s_profile_birthday": "Birthday",
|
||||
"om_tab_absences": "Absences",
|
||||
"om_tab_lates": "Lates",
|
||||
"om_tab_missing": "Missing items"
|
||||
}
|
||||
656
firka/lib/l10n/app_hu.arb
Normal file
656
firka/lib/l10n/app_hu.arb
Normal file
@@ -0,0 +1,656 @@
|
||||
{
|
||||
"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_sync_theme": "Téma szinkronizálása a fiókkal",
|
||||
"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_restart_notice": "Néhány indítón az új ikon csak az alkalmazás újranyitása után jelenik meg.",
|
||||
"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_custom_colors": "Saját színek",
|
||||
"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_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",
|
||||
"fb_intro": "Hibát találtál, vagy van egy ötleted? Írd meg nekünk! Ha megadod az e-mail címed, válaszolunk is rá.",
|
||||
"fb_email": "E-mail cím (nem kötelező)",
|
||||
"fb_message": "Üzenet",
|
||||
"fb_attach_logs": "Naplók és hibakeresési adatok csatolása",
|
||||
"fb_attach_logs_desc": "Elküldjük az alkalmazás naplóját és az eszközöd adatait (modell, Android és app verzió), így könnyebben megtaláljuk a hibát. A naplóban személyes adatok is lehetnek.",
|
||||
"fb_send": "Visszajelzés küldése",
|
||||
"fb_sending": "Küldés…",
|
||||
"fb_sent": "Megkaptuk az üzeneted, hamarosan válaszolunk e-mailben.",
|
||||
"fb_err_email_invalid": "Sajnos még nem tudunk hibás e-mail címre válaszolni.",
|
||||
"fb_err_message_empty": "Írd le, miben segíthetünk.",
|
||||
"fb_err_send": "Nem sikerült elküldeni az üzenetet, próbáld újra később.",
|
||||
"fb_add_images": "Képek csatolása",
|
||||
"fb_images_hint": "Legfeljebb 5 kép, egyenként 5 MB-ig.",
|
||||
"fb_remove_image": "Kép eltávolítása",
|
||||
"fb_err_image_big": "Egy kép legfeljebb 5 MB lehet.",
|
||||
"fb_err_images_total": "A képek együtt legfeljebb 8 MB-ot tehetnek ki.",
|
||||
"fb_sent_no_reply": "Megkaptuk az üzeneted, köszönjük!",
|
||||
"fb_sent_title": "Elküldtük!",
|
||||
"coming_soon": "Hamarosan érkezik!",
|
||||
"s_subj_customize": "Tantárgy személyre szabása",
|
||||
"s_subj_rename": "Tantárgy átnevezése",
|
||||
"s_subj_rename_teacher": "Tanár átnevezése",
|
||||
"s_subj_rounding": "Kerekítés",
|
||||
"s_subj_icon": "Ikon",
|
||||
"s_subj_notify_all": "Összes",
|
||||
"s_subj_reset": "Visszaállítás",
|
||||
"s_acc_personal_info": "Személyes információk",
|
||||
"s_profile_crop": "Kép igazítása",
|
||||
"s_profile_edit": "Profil személyre szabása",
|
||||
"s_profile_photo_change": "Profilkép cseréje",
|
||||
"s_profile_photo_remove": "Profilkép törlése",
|
||||
"s_profile_name_edit": "Név szerkesztése",
|
||||
"s_profile_name_reset": "Eredeti név",
|
||||
"s_profile_birthday": "Születésnap",
|
||||
"om_tab_absences": "Hiányzások",
|
||||
"om_tab_lates": "Késések",
|
||||
"om_tab_missing": "Hiányok"
|
||||
}
|
||||
2937
firka/lib/l10n/app_localizations.dart
Normal file
2937
firka/lib/l10n/app_localizations.dart
Normal file
File diff suppressed because it is too large
Load Diff
1463
firka/lib/l10n/app_localizations_de.dart
Normal file
1463
firka/lib/l10n/app_localizations_de.dart
Normal file
File diff suppressed because it is too large
Load Diff
1469
firka/lib/l10n/app_localizations_en.dart
Normal file
1469
firka/lib/l10n/app_localizations_en.dart
Normal file
File diff suppressed because it is too large
Load Diff
1463
firka/lib/l10n/app_localizations_hu.dart
Normal file
1463
firka/lib/l10n/app_localizations_hu.dart
Normal file
File diff suppressed because it is too large
Load Diff
1463
firka/lib/l10n/app_localizations_pl.dart
Normal file
1463
firka/lib/l10n/app_localizations_pl.dart
Normal file
File diff suppressed because it is too large
Load Diff
407
firka/lib/l10n/app_pl.arb
Normal file
407
firka/lib/l10n/app_pl.arb
Normal file
@@ -0,0 +1,407 @@
|
||||
{
|
||||
"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",
|
||||
"s_ci_restart_notice": "W niektórych launcherach nowa ikona pojawi się dopiero po ponownym otwarciu 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
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:firka/ui/phone/pages/home/home_omissions.dart';
|
||||
import 'package:firka_common/data/models/message_cache_model.dart';
|
||||
import 'package:firka_common/data/models/subject_cache_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:firka/core/firka_bundle.dart';
|
||||
@@ -16,10 +15,16 @@ import 'package:firka/ui/phone/pages/home/home_timetable_mo.dart';
|
||||
import 'package:firka/ui/phone/screens/debug/debug_screen.dart';
|
||||
import 'package:firka/ui/phone/screens/home/beta_screen.dart';
|
||||
import 'package:firka/ui/phone/pages/error/error_page.dart';
|
||||
import 'package:firka/ui/phone/screens/feedback/feedback_screen.dart';
|
||||
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/subjects/subject_customize_screen.dart';
|
||||
import 'package:firka/ui/phone/screens/account/account_screen.dart';
|
||||
import 'package:firka/ui/phone/screens/messages/messages_screen.dart';
|
||||
import 'package:firka/ui/phone/screens/subjects/subjects_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';
|
||||
@@ -79,6 +84,17 @@ GoRouter createAppRouter() {
|
||||
child: BetaScreen(initData, key: state.pageKey),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/feedback',
|
||||
builder: (context, state) => DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: FeedbackScreen(
|
||||
initData,
|
||||
error: state.extra as String?,
|
||||
key: state.pageKey,
|
||||
),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/debug',
|
||||
builder: (context, state) => DefaultAssetBundle(
|
||||
@@ -108,7 +124,16 @@ GoRouter createAppRouter() {
|
||||
GoRoute(
|
||||
path: '/theme',
|
||||
builder: (context, state) {
|
||||
final args = state.extra as ThemeScreenArgs;
|
||||
// go_router drops `extra` on a rebuild without one (a hot restart,
|
||||
// or toggling the inspector), and there is no theme to show without
|
||||
// it — fall back to the list rather than throwing a type error.
|
||||
final args = state.extra;
|
||||
if (args is! ThemeScreenArgs) {
|
||||
return DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: ThemesScreen(initData, key: state.pageKey),
|
||||
);
|
||||
}
|
||||
return DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: ThemeScreen(initData, args, key: state.pageKey),
|
||||
@@ -116,17 +141,50 @@ GoRouter createAppRouter() {
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: '/message',
|
||||
builder: (context, state) {
|
||||
final info = state.extra as MessageCacheModel?;
|
||||
if (info == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: MessageScreen(initData, info, key: state.pageKey),
|
||||
);
|
||||
},
|
||||
path: '/account',
|
||||
builder: (context, state) => DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: AccountScreen(initData, key: state.pageKey),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/messages',
|
||||
builder: (context, state) => DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: MessagesScreen(initData, key: state.pageKey),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/subjects',
|
||||
builder: (context, state) => DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: SubjectsScreen(initData, key: state.pageKey),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/subject-customize',
|
||||
builder: (context, state) => DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: SubjectCustomizeScreen(
|
||||
initData,
|
||||
state.extra as SubjectCacheModel,
|
||||
key: state.pageKey,
|
||||
),
|
||||
),
|
||||
),
|
||||
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),
|
||||
),
|
||||
),
|
||||
StatefulShellRoute(
|
||||
builder: (context, state, navigationShell) => DefaultAssetBundle(
|
||||
@@ -218,6 +276,53 @@ GoRouter createAppRouter() {
|
||||
),
|
||||
],
|
||||
),
|
||||
// The pages below are tabs only while they are in the bottom bar
|
||||
StatefulShellBranch(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/tab/messages',
|
||||
pageBuilder: (context, state) => NoTransitionPage(
|
||||
key: state.pageKey,
|
||||
child: DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: MessagesScreen(initData, tab: true),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
StatefulShellBranch(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/tab/account',
|
||||
pageBuilder: (context, state) => NoTransitionPage(
|
||||
key: state.pageKey,
|
||||
child: DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: AccountScreen(initData, tab: true),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
StatefulShellBranch(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/tab/settings',
|
||||
pageBuilder: (context, state) => NoTransitionPage(
|
||||
key: state.pageKey,
|
||||
child: DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: SettingsScreen(
|
||||
initData,
|
||||
buildSettingsTree(initData.l10n).children,
|
||||
tab: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -235,6 +340,8 @@ String get _initialLocation {
|
||||
String? _redirect(BuildContext context, GoRouterState state) {
|
||||
if (!initDone) return null;
|
||||
final location = state.matchedLocation;
|
||||
// people who can not log in need it the most
|
||||
if (location == '/feedback') return null;
|
||||
final hasTokens = initData.client != null;
|
||||
final betaWarning = Settings.betaWarning.value;
|
||||
|
||||
|
||||
117
firka/lib/routing/nav_layout.dart
Normal file
117
firka/lib/routing/nav_layout.dart
Normal file
@@ -0,0 +1,117 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
/// A page that can sit in the bottom bar or in the "Több" panel.
|
||||
enum NavItem { home, grades, timetable, absences, messages, account, settings }
|
||||
|
||||
extension NavItemBranch on NavItem {
|
||||
/// The shell branch of the page. Messages, account and settings are only
|
||||
/// opened as a tab from the bar, from "Több" they are pushed with a back
|
||||
/// header.
|
||||
int get branch => switch (this) {
|
||||
NavItem.home => 0,
|
||||
NavItem.grades => 1,
|
||||
NavItem.timetable => 2,
|
||||
NavItem.absences => 3,
|
||||
NavItem.messages => 4,
|
||||
NavItem.account => 5,
|
||||
NavItem.settings => 6,
|
||||
};
|
||||
|
||||
bool get alwaysTab => branch < 4;
|
||||
}
|
||||
|
||||
/// Which pages are in the bar and which in "Több", in order, and the "Több"
|
||||
/// ones the user hid.
|
||||
class NavLayout {
|
||||
static const maxBar = 4;
|
||||
|
||||
final List<NavItem> bar;
|
||||
final List<NavItem> more;
|
||||
final Set<NavItem> hidden;
|
||||
|
||||
const NavLayout(this.bar, this.more, this.hidden);
|
||||
|
||||
static const fallback = NavLayout(
|
||||
[NavItem.home, NavItem.grades, NavItem.timetable],
|
||||
[NavItem.account, NavItem.messages, NavItem.absences, NavItem.settings],
|
||||
{},
|
||||
);
|
||||
|
||||
List<NavItem> get shownMore =>
|
||||
more.where((i) => !hidden.contains(i)).toList();
|
||||
|
||||
/// [item] taken out of where it is and put at [index] of the bar or of
|
||||
/// "Több". Null when that is not allowed: the bar holds at most [maxBar]
|
||||
/// and never ends up empty.
|
||||
NavLayout? move(NavItem item, {required bool toBar, required int index}) {
|
||||
final bar = [...this.bar]..remove(item);
|
||||
final more = [...this.more]..remove(item);
|
||||
final target = toBar ? bar : more;
|
||||
target.insert(index.clamp(0, target.length), item);
|
||||
if (bar.isEmpty || bar.length > maxBar) return null;
|
||||
// A page brought into the bar is visible again
|
||||
final hidden = {...this.hidden}..remove(toBar ? item : null);
|
||||
return NavLayout(bar, more, hidden);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
other is NavLayout &&
|
||||
listEquals(other.bar, bar) &&
|
||||
listEquals(other.more, more) &&
|
||||
setEquals(other.hidden, hidden);
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
Object.hashAll(bar),
|
||||
Object.hashAll(more),
|
||||
Object.hashAllUnordered(hidden),
|
||||
);
|
||||
}
|
||||
|
||||
NavLayout _read() {
|
||||
try {
|
||||
final decoded = jsonDecode(Settings.navLayout.value);
|
||||
if (decoded is Map) {
|
||||
final names = NavItem.values.asNameMap();
|
||||
List<NavItem> items(String key) => [
|
||||
for (final n in (decoded[key] as List? ?? const [])) ?names[n],
|
||||
];
|
||||
final bar = items('bar');
|
||||
final more = items('more');
|
||||
// A page added in an update goes to the end of "Több"
|
||||
for (final item in NavItem.values) {
|
||||
if (!bar.contains(item) && !more.contains(item)) more.add(item);
|
||||
}
|
||||
if (bar.isNotEmpty) {
|
||||
return NavLayout(bar, more, items('hidden').toSet());
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
return NavLayout.fallback;
|
||||
}
|
||||
|
||||
/// Kept here so the bar and the panel redraw the moment it changes.
|
||||
late final navLayout = ValueNotifier<NavLayout>(_read());
|
||||
|
||||
Future<void> saveNavLayout(NavLayout layout) async {
|
||||
navLayout.value = layout;
|
||||
await Settings.navLayout.set(
|
||||
jsonEncode({
|
||||
'bar': [for (final i in layout.bar) i.name],
|
||||
'more': [for (final i in layout.more) i.name],
|
||||
'hidden': [for (final i in layout.hidden) i.name],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> toggleNavItemHidden(NavItem item) {
|
||||
final layout = navLayout.value;
|
||||
final hidden = {...layout.hidden};
|
||||
hidden.contains(item) ? hidden.remove(item) : hidden.add(item);
|
||||
return saveNavLayout(NavLayout(layout.bar, layout.more, hidden));
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/core/settings.dart';
|
||||
import 'package:firka/routing/nav_layout.dart';
|
||||
import 'package:firka/ui/phone/pages/extras/extras.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:firka/ui/phone/widgets/bottom_nav_icon.dart';
|
||||
|
||||
class ShellWithNavBar extends StatelessWidget {
|
||||
class ShellWithNavBar extends StatefulWidget {
|
||||
const ShellWithNavBar({
|
||||
super.key,
|
||||
required this.navigationShell,
|
||||
@@ -17,78 +17,200 @@ class ShellWithNavBar extends StatelessWidget {
|
||||
final StatefulNavigationShell navigationShell;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
State<ShellWithNavBar> createState() => _ShellWithNavBarState();
|
||||
}
|
||||
|
||||
class _ShellWithNavBarState extends State<ShellWithNavBar> {
|
||||
bool _panelOpen = false;
|
||||
bool _editing = false;
|
||||
|
||||
/// The layout as it would be if the dragged page were dropped where the
|
||||
/// finger is, so everything moves out of its way while dragging.
|
||||
NavLayout? _preview;
|
||||
|
||||
/// How far the panel is pulled down, as a part of its height
|
||||
double _pull = 0;
|
||||
bool _pulling = false;
|
||||
final _panelKey = GlobalKey();
|
||||
|
||||
void _onPull(DragUpdateDetails d) {
|
||||
final height = _panelKey.currentContext?.size?.height ?? 1;
|
||||
setState(() {
|
||||
_pulling = true;
|
||||
_pull = (_pull + d.delta.dy / height).clamp(0.0, 1.0);
|
||||
});
|
||||
}
|
||||
|
||||
void _onPullEnd(DragEndDetails d) {
|
||||
final close = _pull > 0.3 || (d.primaryVelocity ?? 0) > 700;
|
||||
setState(() {
|
||||
_pulling = false;
|
||||
_pull = 0;
|
||||
if (close) {
|
||||
_panelOpen = false;
|
||||
_editing = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
StatefulNavigationShell get _shell => widget.navigationShell;
|
||||
|
||||
void _setPanel(bool open) {
|
||||
setState(() {
|
||||
_panelOpen = open;
|
||||
if (!open) _editing = false;
|
||||
});
|
||||
}
|
||||
|
||||
void _open(NavItem item) {
|
||||
_setPanel(false);
|
||||
if (item.alwaysTab || navLayout.value.bar.contains(item)) {
|
||||
if (_shell.currentIndex != item.branch) _shell.goBranch(item.branch);
|
||||
return;
|
||||
}
|
||||
context.push(switch (item) {
|
||||
NavItem.messages => '/messages',
|
||||
NavItem.account => '/account',
|
||||
_ => '/settings',
|
||||
});
|
||||
}
|
||||
|
||||
late final _drag = NavDragCallbacks(
|
||||
onStart: (_) {},
|
||||
onHover: (item, {required toBar, required index}) {
|
||||
final next = navLayout.value.move(item, toBar: toBar, index: index);
|
||||
if (next != null && next != _preview) setState(() => _preview = next);
|
||||
},
|
||||
onDrop: () {
|
||||
final preview = _preview;
|
||||
if (preview == null) return;
|
||||
saveNavLayout(preview);
|
||||
// A tab-only page taken out of the bar while open has no back header,
|
||||
// so the user is taken home
|
||||
final current = NavItem.values.firstWhere(
|
||||
(i) => i.branch == _shell.currentIndex,
|
||||
);
|
||||
if (!current.alwaysTab && !preview.bar.contains(current)) {
|
||||
_shell.goBranch(NavItem.home.branch);
|
||||
}
|
||||
},
|
||||
onEnd: () => setState(() => _preview = null),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final data = initData;
|
||||
final currentIndex = navigationShell.currentIndex;
|
||||
final bottomBg =
|
||||
appStyle.colors.backgroundGradient?.last ?? appStyle.colors.background;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: appStyle.colors.background,
|
||||
body: child,
|
||||
bottomNavigationBar: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.bottomCenter,
|
||||
end: Alignment.topCenter,
|
||||
colors: [
|
||||
appStyle.colors.background,
|
||||
appStyle.colors.background.withValues(alpha: 0.0),
|
||||
],
|
||||
stops: const [0.0, 1.0],
|
||||
),
|
||||
),
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
...[
|
||||
(data.l10n.home, Majesticon.homeSolid, Majesticon.homeLine),
|
||||
(
|
||||
data.l10n.grades,
|
||||
Majesticon.bookmarkSolid,
|
||||
Majesticon.bookmarkLine,
|
||||
return PopScope(
|
||||
// Back closes the panel first
|
||||
canPop: !_panelOpen,
|
||||
onPopInvokedWithResult: (didPop, _) {
|
||||
if (!didPop) _setPanel(false);
|
||||
},
|
||||
child: ValueListenableBuilder(
|
||||
valueListenable: navLayout,
|
||||
builder: (context, saved, _) {
|
||||
final layout = _preview ?? saved;
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
// The closed panel is only slid down, so it has to be cut off
|
||||
// here or it shows under the bar
|
||||
body: ClipRect(
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.backgroundLinearGradient == null
|
||||
? appStyle.colors.background
|
||||
: null,
|
||||
gradient: appStyle.colors.backgroundLinearGradient,
|
||||
),
|
||||
child: widget.child,
|
||||
),
|
||||
),
|
||||
(
|
||||
data.l10n.timetable,
|
||||
Majesticon.calendarSolid,
|
||||
Majesticon.calendarLine,
|
||||
// The page dims behind the panel, a tap on it closes the panel
|
||||
Positioned.fill(
|
||||
child: IgnorePointer(
|
||||
ignoring: !_panelOpen,
|
||||
child: AnimatedOpacity(
|
||||
duration: navAnim,
|
||||
opacity: _panelOpen ? 1 : 0,
|
||||
child: GestureDetector(
|
||||
onTap: () => _setPanel(false),
|
||||
child: ColoredBox(color: appStyle.colors.a15p),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
(
|
||||
initData.l10n.omissions,
|
||||
Majesticon.timerSolid,
|
||||
Majesticon.timerLine,
|
||||
// The panel ends where the bar starts, so the bar stays
|
||||
// visible below it
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: AnimatedSlide(
|
||||
duration: _pulling
|
||||
? Duration.zero
|
||||
: const Duration(milliseconds: 280),
|
||||
curve: Curves.easeOutCubic,
|
||||
offset: _panelOpen
|
||||
? Offset(0, _pull)
|
||||
: const Offset(0, 1.1),
|
||||
child: MorePanel(
|
||||
key: _panelKey,
|
||||
onPull: _onPull,
|
||||
onPullEnd: _onPullEnd,
|
||||
data: data,
|
||||
layout: layout,
|
||||
editing: _editing,
|
||||
onToggleEdit: () =>
|
||||
setState(() => _editing = !_editing),
|
||||
onClose: () => _setPanel(false),
|
||||
onOpen: _open,
|
||||
drag: _drag,
|
||||
),
|
||||
),
|
||||
),
|
||||
].indexed.map(
|
||||
(nav) => BottomNavIconWidget(
|
||||
() {
|
||||
if (currentIndex != nav.$1) {
|
||||
navigationShell.goBranch(nav.$1);
|
||||
}
|
||||
},
|
||||
currentIndex == nav.$1,
|
||||
currentIndex == nav.$1 ? nav.$2.$2 : nav.$2.$3,
|
||||
nav.$2.$1,
|
||||
),
|
||||
),
|
||||
BottomNavIconWidget(
|
||||
() {
|
||||
showExtrasBottomSheet(context, data);
|
||||
},
|
||||
false,
|
||||
data.profilePicture != null
|
||||
? data.profilePicture!
|
||||
: Majesticon.menuLine,
|
||||
data.l10n.other,
|
||||
isProfilePicture: data.profilePicture != null,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.bottomCenter,
|
||||
end: Alignment.topCenter,
|
||||
colors: [bottomBg, bottomBg, bottomBg.withValues(alpha: 0.0)],
|
||||
stops: const [0.0, 0.66, 1.0],
|
||||
),
|
||||
),
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 12),
|
||||
child: NavBarRow(
|
||||
data: data,
|
||||
layout: layout,
|
||||
currentIndex: _shell.currentIndex,
|
||||
panelOpen: _panelOpen,
|
||||
editing: _editing,
|
||||
onOpen: _open,
|
||||
onMore: () => _setPanel(!_panelOpen),
|
||||
// The developer menu has no tile, holding "Több" opens it
|
||||
onMoreLongPress: isDeveloper()
|
||||
? () => context.push('/debug')
|
||||
: null,
|
||||
drag: _drag,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:firka/routing/chart_interaction_scope.dart';
|
||||
import 'package:firka/routing/nav_layout.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -24,12 +26,35 @@ class _SwipableNavigatorContainerState
|
||||
bool _isAnimating = false;
|
||||
bool _isFirstBuild = true;
|
||||
|
||||
/// Branches in the order of the bottom bar, swiping goes through these.
|
||||
/// A page opened from "Több" is added at the end while it is open.
|
||||
late List<int> _order = _readOrder();
|
||||
|
||||
int get _currentPage => _order.indexOf(widget.navigationShell.currentIndex);
|
||||
|
||||
List<int> _readOrder() {
|
||||
final order = [for (final item in navLayout.value.bar) item.branch];
|
||||
final current = widget.navigationShell.currentIndex;
|
||||
if (!order.contains(current)) order.add(current);
|
||||
return order;
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_pageController = PageController(
|
||||
initialPage: widget.navigationShell.currentIndex,
|
||||
);
|
||||
_pageController = PageController(initialPage: _currentPage);
|
||||
navLayout.addListener(_onLayoutChanged);
|
||||
}
|
||||
|
||||
void _onLayoutChanged() {
|
||||
final order = _readOrder();
|
||||
if (listEquals(order, _order)) return;
|
||||
setState(() => _order = order);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted && _pageController.hasClients) {
|
||||
_pageController.jumpToPage(_currentPage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -37,6 +62,18 @@ class _SwipableNavigatorContainerState
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.navigationShell.currentIndex !=
|
||||
widget.navigationShell.currentIndex) {
|
||||
final order = _readOrder();
|
||||
if (!listEquals(order, _order)) {
|
||||
// A page from "Több" came or went, jump instead of sliding past
|
||||
// the pages in between
|
||||
_order = order;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted && _pageController.hasClients) {
|
||||
_pageController.jumpToPage(_currentPage);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
_syncToShellIndex();
|
||||
}
|
||||
}
|
||||
@@ -45,20 +82,19 @@ class _SwipableNavigatorContainerState
|
||||
if (_isFirstBuild) {
|
||||
_isFirstBuild = false;
|
||||
if (_pageController.hasClients &&
|
||||
_pageController.page?.round() !=
|
||||
widget.navigationShell.currentIndex) {
|
||||
_pageController.jumpToPage(widget.navigationShell.currentIndex);
|
||||
_pageController.page?.round() != _currentPage) {
|
||||
_pageController.jumpToPage(_currentPage);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!_pageController.hasClients) return;
|
||||
if (_pageController.page?.round() == widget.navigationShell.currentIndex) {
|
||||
if (_pageController.page?.round() == _currentPage) {
|
||||
return;
|
||||
}
|
||||
_isAnimating = true;
|
||||
_pageController
|
||||
.animateToPage(
|
||||
widget.navigationShell.currentIndex,
|
||||
_currentPage,
|
||||
duration: const Duration(milliseconds: 175),
|
||||
curve: Curves.easeInOut,
|
||||
)
|
||||
@@ -69,14 +105,16 @@ class _SwipableNavigatorContainerState
|
||||
|
||||
void _onPageChanged(int index) {
|
||||
if (_isAnimating) return;
|
||||
if (index != widget.navigationShell.currentIndex) {
|
||||
final branch = _order[index];
|
||||
if (branch != widget.navigationShell.currentIndex) {
|
||||
HapticFeedback.heavyImpact();
|
||||
widget.navigationShell.goBranch(index);
|
||||
widget.navigationShell.goBranch(branch);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
navLayout.removeListener(_onLayoutChanged);
|
||||
_pageController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
@@ -93,7 +131,7 @@ class _SwipableNavigatorContainerState
|
||||
? const NeverScrollableScrollPhysics()
|
||||
: const ClampingScrollPhysics(),
|
||||
onPageChanged: _onPageChanged,
|
||||
children: widget.children,
|
||||
children: [for (final branch in _order) widget.children[branch]],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -41,7 +41,11 @@ class AlarmNotificationService {
|
||||
_isInitialized = true;
|
||||
_logger.info('AlarmNotificationService initialized');
|
||||
} catch (e, st) {
|
||||
_logger.severe('Failed to initialize AlarmNotificationService: $e', e, st);
|
||||
_logger.severe(
|
||||
'Failed to initialize AlarmNotificationService: $e',
|
||||
e,
|
||||
st,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,8 @@ class FcmService {
|
||||
static Future<AuthorizationStatus?> permissionStatus() async {
|
||||
if (!_isInitialized) return null;
|
||||
try {
|
||||
final settings = await FirebaseMessaging.instance.getNotificationSettings();
|
||||
final settings = await FirebaseMessaging.instance
|
||||
.getNotificationSettings();
|
||||
return settings.authorizationStatus;
|
||||
} catch (e) {
|
||||
_logger.warning('Error reading notification permission status: $e');
|
||||
@@ -88,15 +89,14 @@ class FcmService {
|
||||
options: DefaultFirebaseOptions.currentPlatform,
|
||||
);
|
||||
|
||||
FirebaseMessaging.onBackgroundMessage(
|
||||
firebaseMessagingBackgroundHandler,
|
||||
);
|
||||
FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler);
|
||||
|
||||
await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(
|
||||
alert: true,
|
||||
badge: true,
|
||||
sound: true,
|
||||
);
|
||||
await FirebaseMessaging.instance
|
||||
.setForegroundNotificationPresentationOptions(
|
||||
alert: true,
|
||||
badge: true,
|
||||
sound: true,
|
||||
);
|
||||
|
||||
FirebaseMessaging.instance.onTokenRefresh.listen((token) {
|
||||
_cachedToken = token;
|
||||
@@ -147,7 +147,11 @@ class FcmService {
|
||||
body: '${DateTime.now().toIso8601String()} - ${_channelLabel(message)}',
|
||||
);
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to show debug FCM message notification: $e', e, st);
|
||||
_logger.warning(
|
||||
'Failed to show debug FCM message notification: $e',
|
||||
e,
|
||||
st,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +222,8 @@ class FcmService {
|
||||
|
||||
static Future<void> _register({required String studentId}) async {
|
||||
try {
|
||||
final token = _cachedToken ??= await FirebaseMessaging.instance.getToken();
|
||||
final token = _cachedToken ??= await FirebaseMessaging.instance
|
||||
.getToken();
|
||||
if (token == null) {
|
||||
_logger.warning('No FCM token available to register');
|
||||
return;
|
||||
@@ -329,7 +334,11 @@ class FcmService {
|
||||
notifyMessages: Settings.notifyMessages.value,
|
||||
);
|
||||
} catch (e, st) {
|
||||
_logger.severe('Failed to update FCM notification preferences: $e', e, st);
|
||||
_logger.severe(
|
||||
'Failed to update FCM notification preferences: $e',
|
||||
e,
|
||||
st,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ class LocalNotificationService {
|
||||
FlutterLocalNotificationsPlugin();
|
||||
static bool _initialized = false;
|
||||
|
||||
static final List<({int id, String title, String body})> postedNotifications = [];
|
||||
static final List<({int id, String title, String body})> postedNotifications =
|
||||
[];
|
||||
|
||||
static Future<void> init() async {
|
||||
if (_initialized) return;
|
||||
|
||||
@@ -12,6 +12,7 @@ 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');
|
||||
@@ -59,14 +60,18 @@ class NotificationDeliveryService {
|
||||
return configured;
|
||||
}
|
||||
final gms = await isGmsAvailable();
|
||||
return gms ? NotificationDeliveryMethod.fcm : NotificationDeliveryMethod.alarm;
|
||||
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)');
|
||||
_logger.info(
|
||||
'Initializing NotificationDeliveryService (GMS available: $gms)',
|
||||
);
|
||||
|
||||
await AlarmNotificationService.initialize();
|
||||
|
||||
@@ -82,14 +87,18 @@ class NotificationDeliveryService {
|
||||
|
||||
try {
|
||||
if (!Settings.notifyAll.value) {
|
||||
_logger.info('Push notifications disabled, tearing down delivery backends');
|
||||
_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');
|
||||
_logger.info(
|
||||
'Syncing delivery backend for effective method: $effectiveMethod',
|
||||
);
|
||||
|
||||
switch (effectiveMethod) {
|
||||
case NotificationDeliveryMethod.fcm:
|
||||
@@ -103,6 +112,8 @@ class NotificationDeliveryService {
|
||||
case NotificationDeliveryMethod.auto:
|
||||
break;
|
||||
}
|
||||
|
||||
await ProgressNotificationService.sync();
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to sync delivery backend: $e', e, st);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ 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';
|
||||
import 'package:firka_common/data/models/subject_cache_model.dart';
|
||||
import 'package:firka_common/core/subject_overrides.dart';
|
||||
|
||||
/// Runs on a silent FCM wakeup: for every locally logged-in account, fetches
|
||||
/// grades/homework/tests/absences/lessons/messages, diffs each against what
|
||||
@@ -32,6 +35,8 @@ class NotificationDiffService {
|
||||
await bootstrapHeadless();
|
||||
await LocalNotificationService.init();
|
||||
|
||||
loadSubjectOverrides(Settings.subjectOverrides.value);
|
||||
|
||||
if (!Settings.notifyAll.value) {
|
||||
_logger.info('checkAll: push disabled, skipping');
|
||||
return;
|
||||
@@ -43,9 +48,15 @@ class NotificationDiffService {
|
||||
final client = KretaClient(token);
|
||||
await _checkAccount(client, token.key, token.username);
|
||||
} catch (e, st) {
|
||||
_logger.warning('checkAll: account ${token.username} failed: $e', e, st);
|
||||
_logger.warning(
|
||||
'checkAll: account ${token.username} failed: $e',
|
||||
e,
|
||||
st,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
await ProgressNotificationService.checkAndStartIfActive();
|
||||
}
|
||||
|
||||
static Future<void> _checkAccount(
|
||||
@@ -59,10 +70,22 @@ class NotificationDiffService {
|
||||
await _diffAndNotify(
|
||||
accountKey: accountKey,
|
||||
kind: LastSeenHelper.notifGrades,
|
||||
items: _excludeMuted(await client.getGrades(), mutedSubjects, (g) => g.subject.value?.name),
|
||||
title: (n) => n.length == 1 ? 'Új jegy érkezett' : '${n.length} új jegy érkezett',
|
||||
items: _bySubject(
|
||||
_excludeMuted(
|
||||
await client.getGrades(),
|
||||
mutedSubjects,
|
||||
(g) => g.subject.value?.name,
|
||||
),
|
||||
(g) => g.subject.value,
|
||||
SubjectNotify.grades,
|
||||
),
|
||||
title: (n) =>
|
||||
n.length == 1 ? 'Új jegy érkezett' : '${n.length} új jegy érkezett',
|
||||
body: (n) => n
|
||||
.map((g) => '${g.subject.value?.name ?? "?"}: ${g.textValue} (${_fmtDate(g.writtenAt)})')
|
||||
.map(
|
||||
(g) =>
|
||||
'${g.subject.value?.displayName ?? "?"}: ${g.textValue} (${_fmtDate(g.writtenAt)})',
|
||||
)
|
||||
.take(5)
|
||||
.join(', '),
|
||||
notificationId: _notificationId(accountKey, LastSeenHelper.notifGrades),
|
||||
@@ -73,17 +96,38 @@ class NotificationDiffService {
|
||||
await _diffAndNotify(
|
||||
accountKey: accountKey,
|
||||
kind: LastSeenHelper.notifHomework,
|
||||
items: _excludeMuted(await client.getHomework(), mutedSubjects, (h) => h.subject.value?.name),
|
||||
title: (n) => n.length == 1 ? 'Új házi feladat' : '${n.length} új házi feladat',
|
||||
body: (n) => n.map((h) => h.subject.value?.name ?? "?").take(5).join(', '),
|
||||
notificationId: _notificationId(accountKey, LastSeenHelper.notifHomework),
|
||||
items: _bySubject(
|
||||
_excludeMuted(
|
||||
await client.getHomework(),
|
||||
mutedSubjects,
|
||||
(h) => h.subject.value?.name,
|
||||
),
|
||||
(h) => h.subject.value,
|
||||
SubjectNotify.homeworkTests,
|
||||
),
|
||||
title: (n) =>
|
||||
n.length == 1 ? 'Új házi feladat' : '${n.length} új házi feladat',
|
||||
body: (n) => n
|
||||
.map((h) => h.subject.value?.displayName ?? "?")
|
||||
.take(5)
|
||||
.join(', '),
|
||||
notificationId: _notificationId(
|
||||
accountKey,
|
||||
LastSeenHelper.notifHomework,
|
||||
),
|
||||
);
|
||||
|
||||
await _diffAndNotify(
|
||||
accountKey: accountKey,
|
||||
kind: LastSeenHelper.notifTests,
|
||||
items: await client.getTests(),
|
||||
title: (n) => n.length == 1 ? 'Új témazáró/dolgozat' : '${n.length} új témazáró/dolgozat',
|
||||
items: _bySubject(
|
||||
await client.getTests(),
|
||||
(t) => t.lesson.value?.subject.value,
|
||||
SubjectNotify.homeworkTests,
|
||||
),
|
||||
title: (n) => n.length == 1
|
||||
? 'Új témazáró/dolgozat'
|
||||
: '${n.length} új témazáró/dolgozat',
|
||||
body: (n) => n.map((t) => t.topic ?? t.method).take(5).join(', '),
|
||||
notificationId: _notificationId(accountKey, LastSeenHelper.notifTests),
|
||||
);
|
||||
@@ -93,28 +137,46 @@ class NotificationDiffService {
|
||||
await _diffAndNotify(
|
||||
accountKey: accountKey,
|
||||
kind: LastSeenHelper.notifAbsences,
|
||||
items: await client.getOmissions(),
|
||||
title: (n) => n.length == 1 ? 'Új hiányzás/késés' : '${n.length} új hiányzás/késés',
|
||||
items: _bySubject(
|
||||
await client.getOmissions(),
|
||||
(o) => o.lesson.value?.subject.value,
|
||||
SubjectNotify.absences,
|
||||
),
|
||||
title: (n) => n.length == 1
|
||||
? 'Új hiányzás/késés'
|
||||
: '${n.length} új hiányzás/késés',
|
||||
body: (n) => n.map((o) => o.state.name).take(5).join(', '),
|
||||
notificationId: _notificationId(accountKey, LastSeenHelper.notifAbsences),
|
||||
notificationId: _notificationId(
|
||||
accountKey,
|
||||
LastSeenHelper.notifAbsences,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final now = DateTime.now();
|
||||
final lessons = await client.getLessons(now, now.add(const Duration(days: 7)));
|
||||
final lessons = await client.getLessons(
|
||||
now,
|
||||
now.add(const Duration(days: 7)),
|
||||
);
|
||||
|
||||
final selectedToken = Settings.getSelectedToken();
|
||||
final isActiveAccount = selectedToken == null || selectedToken.key == accountKey;
|
||||
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
|
||||
final notified = _bySubject(
|
||||
lessons,
|
||||
(l) => l.subject.value,
|
||||
SubjectNotify.lessons,
|
||||
);
|
||||
final cancelled = notified.where(_isCancelledLesson).toList();
|
||||
final substituted = notified
|
||||
.where((l) => !_isCancelledLesson(l) && l.substituteTeacher != null)
|
||||
.toList();
|
||||
final otherChanges = lessons
|
||||
final otherChanges = notified
|
||||
.where((l) => !_isCancelledLesson(l) && l.substituteTeacher == null)
|
||||
.toList();
|
||||
|
||||
@@ -126,46 +188,59 @@ class NotificationDiffService {
|
||||
accountKey: accountKey,
|
||||
kind: LastSeenHelper.notifLessonsCancelled,
|
||||
items: cancelled,
|
||||
title: (n) => n.length == 1 ? 'Elmaradt óra' : '${n.length} elmaradt óra',
|
||||
title: (n) =>
|
||||
n.length == 1 ? 'Elmaradt óra' : '${n.length} elmaradt óra',
|
||||
body: (n) => n
|
||||
.map(
|
||||
(l) =>
|
||||
'${l.subject.value?.name ?? l.name} - ${l.teacher ?? "?"} '
|
||||
'${l.subject.value?.displayName ?? l.name} - ${l.teacher ?? "?"} '
|
||||
'(${_fmtDateTime(l.start)})',
|
||||
)
|
||||
.take(5)
|
||||
.join(', '),
|
||||
notificationId: _notificationId(accountKey, LastSeenHelper.notifLessonsCancelled),
|
||||
notificationId: _notificationId(
|
||||
accountKey,
|
||||
LastSeenHelper.notifLessonsCancelled,
|
||||
),
|
||||
);
|
||||
|
||||
await _diffAndNotify(
|
||||
accountKey: accountKey,
|
||||
kind: LastSeenHelper.notifLessonsSubstituted,
|
||||
items: substituted,
|
||||
title: (n) => n.length == 1 ? 'Helyettesítés' : '${n.length} helyettesítés',
|
||||
title: (n) =>
|
||||
n.length == 1 ? 'Helyettesítés' : '${n.length} helyettesítés',
|
||||
body: (n) => n
|
||||
.map(
|
||||
(l) =>
|
||||
'${l.subject.value?.name ?? l.name}: ${l.teacher ?? "?"} -> '
|
||||
'${l.subject.value?.displayName ?? l.name}: ${l.teacher ?? "?"} -> '
|
||||
'${l.substituteTeacher} (${_fmtDateTime(l.start)})',
|
||||
)
|
||||
.take(5)
|
||||
.join(', '),
|
||||
notificationId: _notificationId(accountKey, LastSeenHelper.notifLessonsSubstituted),
|
||||
notificationId: _notificationId(
|
||||
accountKey,
|
||||
LastSeenHelper.notifLessonsSubstituted,
|
||||
),
|
||||
);
|
||||
|
||||
await _diffAndNotify(
|
||||
accountKey: accountKey,
|
||||
kind: LastSeenHelper.notifLessons,
|
||||
items: otherChanges,
|
||||
title: (n) => n.length == 1
|
||||
? 'Órarendváltozás'
|
||||
: '${n.length} órarendváltozás',
|
||||
title: (n) =>
|
||||
n.length == 1 ? 'Órarendváltozás' : '${n.length} órarendváltozás',
|
||||
body: (n) => n
|
||||
.map((l) => '${l.subject.value?.name ?? l.name} (${l.roomName ?? "?"})')
|
||||
.map(
|
||||
(l) =>
|
||||
'${l.subject.value?.displayName ?? l.name} (${l.roomName ?? "?"})',
|
||||
)
|
||||
.take(5)
|
||||
.join(', '),
|
||||
notificationId: _notificationId(accountKey, LastSeenHelper.notifLessons),
|
||||
notificationId: _notificationId(
|
||||
accountKey,
|
||||
LastSeenHelper.notifLessons,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -180,7 +255,10 @@ class NotificationDiffService {
|
||||
items: combined,
|
||||
title: (n) => n.length == 1 ? 'Új üzenet' : '${n.length} új üzenet',
|
||||
body: (n) => n.map((m) => m.title).take(5).join(', '),
|
||||
notificationId: _notificationId(accountKey, LastSeenHelper.notifMessages),
|
||||
notificationId: _notificationId(
|
||||
accountKey,
|
||||
LastSeenHelper.notifMessages,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -235,6 +313,17 @@ class NotificationDiffService {
|
||||
return items.where((i) => !mutedSubjects.contains(subjectOf(i))).toList();
|
||||
}
|
||||
|
||||
/// Drops what a subject has had its notifications of [kind] switched off
|
||||
static List<T> _bySubject<T>(
|
||||
List<T> items,
|
||||
SubjectCacheModel? Function(T) subjectOf,
|
||||
String kind,
|
||||
) {
|
||||
return items
|
||||
.where((i) => subjectOf(i)?.override?.notifies(kind) ?? true)
|
||||
.toList();
|
||||
}
|
||||
|
||||
static Set<String> _mutedSubjects() {
|
||||
try {
|
||||
final decoded = jsonDecode(Settings.notifyMutedSubjects.value);
|
||||
@@ -246,7 +335,9 @@ class NotificationDiffService {
|
||||
static int _notificationId(int accountKey, String kind) =>
|
||||
Object.hash(accountKey, kind) & 0x7fffffff;
|
||||
|
||||
static Future<void> _checkAndUpdateWidget(List<LessonCacheModel> lessons) async {
|
||||
static Future<void> _checkAndUpdateWidget(
|
||||
List<LessonCacheModel> lessons,
|
||||
) async {
|
||||
try {
|
||||
final dataDir = await getApplicationDocumentsDirectory();
|
||||
final widgetFile = File(p.join(dataDir.path, "widget_state.json"));
|
||||
@@ -259,7 +350,10 @@ class NotificationDiffService {
|
||||
}
|
||||
}
|
||||
|
||||
static bool _hasTimetableChanged(List<LessonCacheModel> lessons, File widgetFile) {
|
||||
static bool _hasTimetableChanged(
|
||||
List<LessonCacheModel> lessons,
|
||||
File widgetFile,
|
||||
) {
|
||||
if (!widgetFile.existsSync()) return true;
|
||||
try {
|
||||
final content = jsonDecode(widgetFile.readAsStringSync());
|
||||
@@ -341,7 +435,8 @@ class NotificationDiffService {
|
||||
LastSeenHelper.notifMessages: (
|
||||
titleSingle: 'Új üzeneted érkezett',
|
||||
titleMulti: 'Új üzenet érkezett',
|
||||
body: 'Nulladik óra átnevezése első órára - Müller Attila (2026-01-15 07:42)',
|
||||
body:
|
||||
'Nulladik óra átnevezése első órára - Müller Attila (2026-01-15 07:42)',
|
||||
),
|
||||
};
|
||||
|
||||
|
||||
269
firka/lib/services/progress_notification_service.dart
Normal file
269
firka/lib/services/progress_notification_service.dart
Normal file
@@ -0,0 +1,269 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
56
firka/lib/services/shake_detector.dart
Normal file
56
firka/lib/services/shake_detector.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:sensors_plus/sensors_plus.dart';
|
||||
|
||||
/// calls [onShake] when the phone is shaken: a few hard jolts within a second.
|
||||
class ShakeDetector {
|
||||
static const _gravity = 9.81;
|
||||
|
||||
/// how far the pull may be from gravity (m/s²) before it counts as a jolt
|
||||
static const _joltThreshold = 14.0;
|
||||
static const _joltsNeeded = 3;
|
||||
static const _window = Duration(milliseconds: 1000);
|
||||
|
||||
/// two samples of one jolt are one jolt
|
||||
static const _minGap = Duration(milliseconds: 120);
|
||||
static const _cooldown = Duration(seconds: 3);
|
||||
|
||||
final VoidCallback onShake;
|
||||
final _jolts = <DateTime>[];
|
||||
StreamSubscription<AccelerometerEvent>? _subscription;
|
||||
DateTime? _lastShake;
|
||||
|
||||
ShakeDetector(this.onShake);
|
||||
|
||||
void start() {
|
||||
_subscription ??= accelerometerEventStream(
|
||||
samplingPeriod: SensorInterval.gameInterval,
|
||||
).listen((event) => handle(event.x, event.y, event.z, DateTime.now()));
|
||||
}
|
||||
|
||||
void stop() {
|
||||
_subscription?.cancel();
|
||||
_subscription = null;
|
||||
_jolts.clear();
|
||||
}
|
||||
|
||||
@visibleForTesting
|
||||
void handle(double x, double y, double z, DateTime now) {
|
||||
final pull = math.sqrt(x * x + y * y + z * z);
|
||||
if ((pull - _gravity).abs() < _joltThreshold) return;
|
||||
final last = _lastShake;
|
||||
if (last != null && now.difference(last) < _cooldown) return;
|
||||
if (_jolts.isNotEmpty && now.difference(_jolts.last) < _minGap) return;
|
||||
|
||||
_jolts
|
||||
..add(now)
|
||||
..removeWhere((jolt) => now.difference(jolt) > _window);
|
||||
if (_jolts.length >= _joltsNeeded) {
|
||||
_jolts.clear();
|
||||
_lastShake = now;
|
||||
onShake();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
91
firka/lib/ui/components/color_slider.dart
Normal file
91
firka/lib/ui/components/color_slider.dart
Normal file
@@ -0,0 +1,91 @@
|
||||
import "package:flutter/material.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 = 32.0;
|
||||
static const _thumbSize = 28.0;
|
||||
static const _thumbRadius = _thumbSize / 2;
|
||||
static const _edgePad = 2.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 SizedBox(
|
||||
width: double.infinity,
|
||||
height: _trackHeight,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(_trackHeight / 2),
|
||||
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,
|
||||
alignment: Alignment.center,
|
||||
child: Container(
|
||||
width: 18,
|
||||
height: 18,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: thumbColor,
|
||||
border: Border.all(color: Colors.white, width: 2),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x1A000000),
|
||||
offset: Offset(0, 1),
|
||||
blurRadius: 3.7,
|
||||
),
|
||||
BoxShadow(
|
||||
color: Color(0x1A000000),
|
||||
offset: Offset(0, 5),
|
||||
blurRadius: 9.6,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:firka_common/data/isar_writes.dart';
|
||||
import 'package:firka_common/core/consts.dart';
|
||||
import 'package:firka/core/bloc/home_refresh_cubit.dart';
|
||||
import 'package:firka_common/core/grade_helper.dart';
|
||||
import 'package:firka_common/core/subject_overrides.dart';
|
||||
import 'package:firka_common/data/models/grade_cache_model.dart';
|
||||
import 'package:firka_common/data/models/lesson_cache_model.dart';
|
||||
import 'package:firka_common/data/models/omission_cache_model.dart';
|
||||
@@ -12,6 +14,8 @@ import 'package:firka_common/ui/components/filled_circle.dart';
|
||||
import 'package:firka_common/ui/shared/grade_small_card.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:firka_common/data/models/homework_cache_model.dart';
|
||||
import 'package:firka_common/data/models/message_cache_model.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
import 'package:firka/core/extensions.dart';
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
@@ -28,6 +32,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 +52,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: 20),
|
||||
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: 44),
|
||||
...children,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -100,15 +111,47 @@ 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 +185,56 @@ 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.subject.loadAndGet()?.override?.name ?? 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.subject.loadAndGet()?.displayTeacher(lesson.teacher!) ??
|
||||
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 +270,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()!),
|
||||
@@ -386,7 +454,7 @@ Future<void> showTestBottomSheet(
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
subject.name,
|
||||
subject.displayName,
|
||||
style: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
@@ -456,7 +524,7 @@ Future<void> showGradeBottomSheet(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"${data.l10n.grade_teacherName}${grade.teacherName}",
|
||||
"${data.l10n.grade_teacherName}${grade.subject.loadAndGet()?.displayTeacher(grade.teacherName) ?? grade.teacherName}",
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
@@ -501,7 +569,7 @@ Future<void> showHomeworkBottomSheet(
|
||||
final subject = homework.subject.loadAndGet()!;
|
||||
showFirkaBottomSheet(context, [
|
||||
Text(
|
||||
data.l10n.homework,
|
||||
headingText(data.l10n.homework),
|
||||
style: appStyle.fonts.H_18px.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
@@ -546,11 +614,14 @@ Future<void> showHomeworkBottomSheet(
|
||||
],
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
onTap: () {
|
||||
data.isar.writeTxnSync(() {
|
||||
homework.isDone = true;
|
||||
data.isar.homeworkCacheModels.putSync(homework);
|
||||
onTap: () async {
|
||||
await isarWrite(() {
|
||||
data.isar.writeTxnSync(() {
|
||||
homework.isDone = true;
|
||||
data.isar.homeworkCacheModels.putSync(homework);
|
||||
});
|
||||
});
|
||||
if (!context.mounted) return;
|
||||
context.read<HomeRefreshCubit>().requestRefresh();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
@@ -579,6 +650,115 @@ Future<void> showHomeworkBottomSheet(
|
||||
]);
|
||||
}
|
||||
|
||||
Future<void> showMessageBottomSheet(
|
||||
BuildContext context,
|
||||
AppInitialization data,
|
||||
MessageCacheModel message,
|
||||
) async {
|
||||
Widget? statsForNerds;
|
||||
if (Settings.statsForNerds.value) {
|
||||
final y2k = DateTime(2000, 1);
|
||||
String fmt(DateTime? dt) => (dt != null && dt.isAfter(y2k))
|
||||
? dt.format(data.l10n, FormatMode.yyyymmddhhmmss)
|
||||
: '-';
|
||||
final student = message.student.loadAndGet();
|
||||
statsForNerds = StatsForNerdsTable(
|
||||
rows: [
|
||||
('id (cache key)', message.cacheKey.toString()),
|
||||
('uid (kréta)', message.uid ?? '-'),
|
||||
('type', message.type ?? '-'),
|
||||
('title', message.title),
|
||||
('author', message.author),
|
||||
('date', fmt(message.createdAt)),
|
||||
if (message.itemCreatedAt != null)
|
||||
('created at', fmt(message.itemCreatedAt)),
|
||||
if (message.validFrom != null) ('valid from', fmt(message.validFrom)),
|
||||
if (message.validTo != null) ('valid to', fmt(message.validTo)),
|
||||
('student', student?.name ?? '-'),
|
||||
('student id', student?.cacheKey.toString() ?? '-'),
|
||||
('html length', '${message.contentHtml.length} chars'),
|
||||
if (message.contentText != null && message.contentText!.isNotEmpty)
|
||||
('text length', '${message.contentText!.length} chars'),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
showFirkaBottomSheet(context, [
|
||||
Text(
|
||||
message.title,
|
||||
style: appStyle.fonts.H_18px.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Text(
|
||||
message.createdAt.format(data.l10n, FormatMode.yyyymmdd),
|
||||
style: appStyle.fonts.B_14R.apply(color: appStyle.colors.textSecondary),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
spacing: 12,
|
||||
children: [
|
||||
FilledCircle(
|
||||
diameter: 40,
|
||||
color: appStyle.colors.accent,
|
||||
child: Text(
|
||||
message.author.isNotEmpty ? message.author[0] : '?',
|
||||
style: appStyle.fonts.H_H2.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
message.author,
|
||||
style: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
FirkaCard.single(
|
||||
margin: EdgeInsets.zero,
|
||||
padding: EdgeInsets.all(12),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Html(
|
||||
data: message.contentHtml.withoutFontFeatureSettings(),
|
||||
onLinkTap: (url, map, element) {
|
||||
if (url != null) launchUrlString(url);
|
||||
},
|
||||
style: {
|
||||
"*": Style.fromTextStyle(
|
||||
appStyle.fonts.B_16R.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
if (statsForNerds != null) ...[
|
||||
SizedBox(height: 20),
|
||||
FirkaCard.single(
|
||||
margin: EdgeInsets.zero,
|
||||
padding: EdgeInsets.all(14),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 10,
|
||||
children: [
|
||||
Text(
|
||||
'Debug info',
|
||||
style: appStyle.fonts.H_14px.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
statsForNerds,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
Future<void> showGradeCalculatorBottomSheet(
|
||||
BuildContext context,
|
||||
AppInitialization data,
|
||||
@@ -627,7 +807,7 @@ class _GradeCalculatorSheetContentState
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.data.l10n.grade_calculator,
|
||||
headingText(widget.data.l10n.grade_calculator),
|
||||
style: appStyle.fonts.H_H2.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
@@ -638,6 +818,7 @@ class _GradeCalculatorSheetContentState
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -649,8 +830,9 @@ class _GradeCalculatorSheetContentState
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.closeLine,
|
||||
size: 20,
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
@@ -765,7 +947,7 @@ class _GradeCalculatorSheetContentState
|
||||
widget.onAdd?.call(selectedGrade, weightPercent);
|
||||
},
|
||||
child: Text(
|
||||
widget.data.l10n.grade_calculator_add,
|
||||
headingText(widget.data.l10n.grade_calculator_add),
|
||||
style: appStyle.fonts.H_18px.apply(
|
||||
color: appStyle.colors.textPrimaryLight,
|
||||
),
|
||||
@@ -785,7 +967,7 @@ Future<void> showSubjectBottomSheetSettings(
|
||||
}) async {
|
||||
showFirkaBottomSheet(context, [
|
||||
Text(
|
||||
data.l10n.subject,
|
||||
headingText(data.l10n.subject),
|
||||
style: appStyle.fonts.H_H2.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
@@ -822,5 +1004,34 @@ Future<void> showSubjectBottomSheetSettings(
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
context.push('/subject-customize', extra: subject);
|
||||
},
|
||||
child: FirkaCard.single(
|
||||
margin: EdgeInsets.all(0),
|
||||
height: 56,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.flower2Solid,
|
||||
size: 24,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
data.l10n.s_subj_customize,
|
||||
style: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -7,28 +7,34 @@ class FirkaIconButton extends StatelessWidget {
|
||||
final VoidCallback? onTap;
|
||||
final Color? color;
|
||||
|
||||
/// Renders from this style instead of the global one, so a preview can
|
||||
/// show a theme the user has not applied.
|
||||
final FirkaStyle? style;
|
||||
|
||||
const FirkaIconButton({
|
||||
required this.child,
|
||||
this.onTap,
|
||||
this.color,
|
||||
this.style,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final style = this.style ?? appStyle;
|
||||
final button = Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
padding: const EdgeInsets.all(6),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: color ?? appStyle.colors.buttonSecondaryFill,
|
||||
color: color ?? style.colors.buttonSecondaryFill,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: appStyle.colors.shadowColor,
|
||||
color: style.colors.shadowColor,
|
||||
offset: const Offset(0, 1),
|
||||
blurRadius: appStyle.colors.shadowBlur.toDouble(),
|
||||
blurRadius: style.colors.shadowBlur.toDouble(),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
237
firka/lib/ui/components/firka_popup.dart
Normal file
237
firka/lib/ui/components/firka_popup.dart
Normal file
@@ -0,0 +1,237 @@
|
||||
import 'package:firka/ui/shared/firka_icon.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:firka_common/ui/components/firka_card.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// The round accent badge at the top of a sheet or popup.
|
||||
Widget popupIcon(Object icon) {
|
||||
return Container(
|
||||
width: 56,
|
||||
height: 56,
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.accent.withValues(alpha: 0.25),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.accent,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Center(
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
icon,
|
||||
size: 20,
|
||||
color: appStyle.colors.textPrimaryLight,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// The small round-ended button of the design ("button/small"), the accent
|
||||
/// one is the main action.
|
||||
Widget pillButton(
|
||||
String label, {
|
||||
required bool primary,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: 36,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: primary
|
||||
? appStyle.colors.accent
|
||||
: appStyle.colors.buttonSecondaryFill,
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: appStyle.colors.shadowColor,
|
||||
offset: const Offset(0, 1),
|
||||
blurRadius: appStyle.colors.shadowBlur.toDouble(),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Text(
|
||||
label,
|
||||
style: primary
|
||||
? appStyle.fonts.B_14SB.apply(
|
||||
color: appStyle.colors.textPrimaryLight,
|
||||
)
|
||||
: appStyle.fonts.B_14R.apply(color: appStyle.colors.textSecondary),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// A full width button of a sheet or popup.
|
||||
Widget popupButton({
|
||||
required String label,
|
||||
required Color color,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
child: FirkaCard(
|
||||
color: color,
|
||||
left: const [],
|
||||
center: [
|
||||
Text(
|
||||
label,
|
||||
style: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// A card in the middle of the screen. Unlike a bottom sheet it moves up
|
||||
/// with the keyboard, so a text field in it stays visible.
|
||||
Future<T?> showFirkaPopup<T>(
|
||||
BuildContext context, {
|
||||
required Object icon,
|
||||
required String title,
|
||||
String? subtitle,
|
||||
required List<Widget> children,
|
||||
}) {
|
||||
return showDialog<T>(
|
||||
context: context,
|
||||
barrierColor: appStyle.colors.a15p,
|
||||
builder: (context) => Dialog(
|
||||
backgroundColor: appStyle.colors.background,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
insetPadding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 24, 20, 16),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
popupIcon(icon),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
headingText(title),
|
||||
textAlign: TextAlign.center,
|
||||
style: appStyle.fonts.H_H2.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
if (subtitle != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
subtitle,
|
||||
textAlign: TextAlign.center,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 20),
|
||||
...children,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// The result of [showInputPopup]: the text saved, or [reset] when the user
|
||||
/// asked for the original back.
|
||||
class InputPopupResult {
|
||||
final String? value;
|
||||
final bool reset;
|
||||
|
||||
const InputPopupResult.save(String this.value) : reset = false;
|
||||
const InputPopupResult.reset() : value = null, reset = true;
|
||||
}
|
||||
|
||||
/// A text field in a popup, filled with [initialValue]. Null when cancelled.
|
||||
Future<InputPopupResult?> showInputPopup(
|
||||
BuildContext context, {
|
||||
required Object icon,
|
||||
required String title,
|
||||
String? subtitle,
|
||||
required String initialValue,
|
||||
required String saveLabel,
|
||||
required String resetLabel,
|
||||
required String cancelLabel,
|
||||
}) {
|
||||
final controller = TextEditingController(text: initialValue);
|
||||
|
||||
void save(BuildContext context) {
|
||||
final value = controller.text.trim();
|
||||
if (value.isEmpty) return;
|
||||
Navigator.of(context).pop(InputPopupResult.save(value));
|
||||
}
|
||||
|
||||
return showFirkaPopup<InputPopupResult>(
|
||||
context,
|
||||
icon: icon,
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
children: [
|
||||
Builder(
|
||||
builder: (context) => Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.card,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
autofocus: true,
|
||||
textAlign: TextAlign.center,
|
||||
textInputAction: TextInputAction.done,
|
||||
onSubmitted: (_) => save(context),
|
||||
cursorColor: appStyle.colors.accent,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
border: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
popupButton(
|
||||
label: saveLabel,
|
||||
color: appStyle.colors.accent,
|
||||
onTap: () => save(context),
|
||||
),
|
||||
popupButton(
|
||||
label: resetLabel,
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
onTap: () =>
|
||||
Navigator.of(context).pop(const InputPopupResult.reset()),
|
||||
),
|
||||
popupButton(
|
||||
label: cancelLabel,
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
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,21 +23,7 @@ class ErrorPage extends StatelessWidget {
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(height: 48),
|
||||
Container(
|
||||
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(),
|
||||
),
|
||||
),
|
||||
const DaveMascot.error(width: 50, height: 50),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 24,
|
||||
@@ -125,8 +112,8 @@ class ErrorPage extends StatelessWidget {
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
ElevatedButton(
|
||||
// TODO: report bug
|
||||
onPressed: () => Navigator.pop(context),
|
||||
onPressed: () =>
|
||||
appRouter?.push('/feedback', extra: exception),
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: appStyle.colors.textPrimary,
|
||||
backgroundColor: appStyle.colors.accent,
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||
@@ -6,200 +9,654 @@ import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/core/settings.dart';
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:firka/l10n/app_localizations.dart';
|
||||
import 'package:firka/routing/nav_layout.dart';
|
||||
import 'package:firka/ui/phone/widgets/bottom_nav_icon.dart';
|
||||
import 'package:firka_common/ui/components/firka_card.dart';
|
||||
import 'package:firka/ui/shared/firka_icon.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
|
||||
Widget _extrasActionTile({
|
||||
required double width,
|
||||
required VoidCallback onTap,
|
||||
required Widget icon,
|
||||
required String label,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: FirkaCard.single(
|
||||
width: width,
|
||||
height: 60,
|
||||
margin: EdgeInsets.zero,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
icon,
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
label,
|
||||
textAlign: TextAlign.right,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const navAnim = Duration(milliseconds: 220);
|
||||
|
||||
/// Icons and name of a page, the same in the bar and in "Több".
|
||||
({Uint8List solid, Uint8List line, String label}) navItemInfo(
|
||||
NavItem item,
|
||||
AppLocalizations l10n,
|
||||
) {
|
||||
return switch (item) {
|
||||
NavItem.home => (
|
||||
solid: Majesticon.homeSolid,
|
||||
line: Majesticon.homeLine,
|
||||
label: l10n.home,
|
||||
),
|
||||
);
|
||||
NavItem.grades => (
|
||||
solid: Majesticon.bookmarkSolid,
|
||||
line: Majesticon.bookmarkLine,
|
||||
label: l10n.grades,
|
||||
),
|
||||
NavItem.timetable => (
|
||||
solid: Majesticon.calendarSolid,
|
||||
line: Majesticon.calendarLine,
|
||||
label: l10n.timetable,
|
||||
),
|
||||
NavItem.absences => (
|
||||
solid: Majesticon.timerSolid,
|
||||
line: Majesticon.timerLine,
|
||||
label: l10n.omissions,
|
||||
),
|
||||
NavItem.messages => (
|
||||
solid: Majesticon.sendSolid,
|
||||
line: Majesticon.sendLine,
|
||||
label: l10n.s_n_messages,
|
||||
),
|
||||
NavItem.account => (
|
||||
solid: Majesticon.userSolid,
|
||||
line: Majesticon.userLine,
|
||||
label: l10n.s_your_account,
|
||||
),
|
||||
NavItem.settings => (
|
||||
solid: Majesticon.settingsCogSolid,
|
||||
line: Majesticon.settingsCogLine,
|
||||
label: l10n.settings_screen,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
void showExtrasBottomSheet(BuildContext context, AppInitialization data) {
|
||||
Widget Function(double) debugBtn = (_) => const SizedBox();
|
||||
/// What the bar and the panel tell the shell while the user rearranges.
|
||||
class NavDragCallbacks {
|
||||
final void Function(NavItem item) onStart;
|
||||
final void Function(NavItem item, {required bool toBar, required int index})
|
||||
onHover;
|
||||
final VoidCallback onDrop;
|
||||
final VoidCallback onEnd;
|
||||
|
||||
logger.finest("showExtrasBottomSheet() developer mode: ${isDeveloper()}");
|
||||
const NavDragCallbacks({
|
||||
required this.onStart,
|
||||
required this.onHover,
|
||||
required this.onDrop,
|
||||
required this.onEnd,
|
||||
});
|
||||
}
|
||||
|
||||
if (isDeveloper()) {
|
||||
debugBtn = (double itemWidth) => _extrasActionTile(
|
||||
// Fejlesztői menü
|
||||
width: itemWidth,
|
||||
onTap: () {
|
||||
context.pop();
|
||||
context.push('/debug');
|
||||
},
|
||||
icon: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.bug2Solid,
|
||||
size: 22.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
label: data.l10n.debug_screen,
|
||||
/// The six dot grip of the design, the handle a tile is dragged by.
|
||||
class GripHandle extends StatelessWidget {
|
||||
const GripHandle({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomPaint(
|
||||
size: const Size(16, 16),
|
||||
painter: _GripPainter(appStyle.colors.secondary),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var debugCounter = 0;
|
||||
class _GripPainter extends CustomPainter {
|
||||
final Color color;
|
||||
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
elevation: 100,
|
||||
isScrollControlled: true,
|
||||
enableDrag: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
barrierColor: appStyle.colors.a15p,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.of(context).size.height * 0.3,
|
||||
),
|
||||
builder: (BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
onTap: () => Navigator.pop(context),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(color: Colors.transparent),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.background,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
_GripPainter(this.color);
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final paint = Paint()..color = color;
|
||||
const radius = 1.15;
|
||||
for (final x in const [6.15, 9.85]) {
|
||||
for (final y in const [3.45, 8.0, 12.55]) {
|
||||
canvas.drawCircle(Offset(x, y), radius, paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(_GripPainter old) => old.color != color;
|
||||
}
|
||||
|
||||
/// The edit mode shake: a fast, scared tremble, each item a little out of
|
||||
/// step with the others so they do not move as one block.
|
||||
class Wiggle extends StatefulWidget {
|
||||
final int seed;
|
||||
final Widget child;
|
||||
|
||||
const Wiggle({required this.seed, required this.child, super.key});
|
||||
|
||||
@override
|
||||
State<Wiggle> createState() => _WiggleState();
|
||||
}
|
||||
|
||||
class _WiggleState extends State<Wiggle> with SingleTickerProviderStateMixin {
|
||||
late final _controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: Duration(milliseconds: 90 + widget.seed % 3 * 15),
|
||||
)..repeat(reverse: true);
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final direction = widget.seed.isEven ? 1.0 : -1.0;
|
||||
return AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, child) => Transform.translate(
|
||||
offset: Offset(direction * (0.5 - _controller.value) * 1.2, 0),
|
||||
child: Transform.rotate(
|
||||
angle: direction * (_controller.value - 0.5) * 0.05,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
child: widget.child,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Grows and fades in, so a tile's row does not jump when it changes.
|
||||
class _AppearingIcon extends StatelessWidget {
|
||||
final bool visible;
|
||||
final Widget child;
|
||||
|
||||
const _AppearingIcon({required this.visible, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedSize(
|
||||
duration: navAnim,
|
||||
curve: Curves.easeOutCubic,
|
||||
child: AnimatedOpacity(
|
||||
duration: navAnim,
|
||||
opacity: visible ? 1 : 0,
|
||||
// The gap comes and goes with the icon, a hidden one takes no room
|
||||
child: visible
|
||||
? Padding(padding: const EdgeInsets.only(left: 8), child: child)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A page's tile in "Több".
|
||||
class MoreTileView extends StatelessWidget {
|
||||
final Uint8List icon;
|
||||
final String label;
|
||||
final bool hidden;
|
||||
final bool editing;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
const MoreTileView({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
this.hidden = false,
|
||||
this.editing = false,
|
||||
this.onTap,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
// The card, the dimming and the eye all ease between shown and hidden
|
||||
child: TweenAnimationBuilder<Color?>(
|
||||
duration: navAnim,
|
||||
tween: ColorTween(
|
||||
end: hidden
|
||||
? appStyle.colors.card.withAlpha(128)
|
||||
: appStyle.colors.card,
|
||||
),
|
||||
builder: (context, cardColor, child) => FirkaCard.single(
|
||||
height: 56,
|
||||
margin: EdgeInsets.zero,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
color: cardColor,
|
||||
child: child!,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
AnimatedOpacity(
|
||||
duration: navAnim,
|
||||
opacity: hidden ? 0.5 : 1,
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
icon,
|
||||
size: 24.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
data.l10n.other,
|
||||
style: appStyle.fonts.H_H2.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final itemWidth = (constraints.maxWidth - 8) / 2;
|
||||
return Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
debugBtn(itemWidth),
|
||||
_extrasActionTile(
|
||||
// Fiókod
|
||||
width: itemWidth,
|
||||
onTap: () {
|
||||
context.pop();
|
||||
context.push(
|
||||
'/settings',
|
||||
extra: buildProfileSettingsTree(
|
||||
data.l10n,
|
||||
).children,
|
||||
);
|
||||
},
|
||||
icon: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.userSolid,
|
||||
size: 22.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
label: data.l10n.s_your_account,
|
||||
),
|
||||
_extrasActionTile(
|
||||
// Beállítás
|
||||
width: itemWidth,
|
||||
onTap: () {
|
||||
context.pop();
|
||||
context.push('/settings');
|
||||
},
|
||||
icon: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.settingsCogSolid,
|
||||
size: 22.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
label: data.l10n.settings_screen,
|
||||
),
|
||||
// Ide jön a többi gomb majd
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 32),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(),
|
||||
GestureDetector(
|
||||
child: Text(
|
||||
"v${data.packageInfo.version} ${isBeta ? "beta" : ""}",
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textTertiary,
|
||||
),
|
||||
),
|
||||
onTap: () async {
|
||||
if (isDebug()) return;
|
||||
if (debugCounter == 10) {
|
||||
final navigator = Navigator.of(context);
|
||||
final router = GoRouter.of(context);
|
||||
await Settings.developerOptsEnabled.set(
|
||||
!Settings.developerOptsEnabled.value,
|
||||
);
|
||||
|
||||
navigator.pop();
|
||||
router.go('/home');
|
||||
} else if (debugCounter < 10) {
|
||||
debugCounter++;
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: AnimatedOpacity(
|
||||
duration: navAnim,
|
||||
opacity: hidden ? 0.5 : 1,
|
||||
child: Text(
|
||||
label,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
_AppearingIcon(
|
||||
visible: hidden,
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.eyeOffSolid,
|
||||
size: 24,
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
_AppearingIcon(visible: editing, child: const GripHandle()),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A drag that starts at once in edit mode, the dragged copy centered under
|
||||
/// the finger so the drop zones can read the finger's position.
|
||||
Widget _draggable({
|
||||
required NavItem item,
|
||||
required Size size,
|
||||
required Widget child,
|
||||
required NavDragCallbacks drag,
|
||||
}) {
|
||||
return Draggable<NavItem>(
|
||||
data: item,
|
||||
dragAnchorStrategy: pointerDragAnchorStrategy,
|
||||
feedback: Transform.translate(
|
||||
offset: Offset(-size.width / 2, -size.height / 2),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: SizedBox.fromSize(
|
||||
size: size,
|
||||
child: Transform.scale(scale: 1.05, child: child),
|
||||
),
|
||||
),
|
||||
),
|
||||
childWhenDragging: Opacity(opacity: 0.3, child: child),
|
||||
onDragStarted: () => drag.onStart(item),
|
||||
onDragEnd: (_) => drag.onEnd(),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
/// The "Több" panel. It slides up above the bottom bar, which stays visible,
|
||||
/// so pages can be dragged between the two.
|
||||
class MorePanel extends StatefulWidget {
|
||||
final AppInitialization data;
|
||||
final NavLayout layout;
|
||||
final bool editing;
|
||||
final VoidCallback onToggleEdit;
|
||||
final VoidCallback onClose;
|
||||
final void Function(NavItem item) onOpen;
|
||||
final NavDragCallbacks drag;
|
||||
|
||||
/// Pulling the handle or the title moves the whole panel
|
||||
final GestureDragUpdateCallback onPull;
|
||||
final GestureDragEndCallback onPullEnd;
|
||||
|
||||
const MorePanel({
|
||||
required this.data,
|
||||
required this.layout,
|
||||
required this.editing,
|
||||
required this.onToggleEdit,
|
||||
required this.onClose,
|
||||
required this.onOpen,
|
||||
required this.drag,
|
||||
required this.onPull,
|
||||
required this.onPullEnd,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MorePanel> createState() => _MorePanelState();
|
||||
}
|
||||
|
||||
class _MorePanelState extends State<MorePanel> {
|
||||
static const _gap = 8.0;
|
||||
static const _tileHeight = 56.0;
|
||||
|
||||
final _gridKey = GlobalKey();
|
||||
var _debugCounter = 0;
|
||||
|
||||
/// The slot under the finger, row by row, two to a row.
|
||||
int _slotAt(Offset global, double tileWidth) {
|
||||
final box = _gridKey.currentContext?.findRenderObject() as RenderBox?;
|
||||
if (box == null) return 0;
|
||||
final local = box.globalToLocal(global);
|
||||
final col = local.dx < tileWidth + _gap / 2 ? 0 : 1;
|
||||
final row = max(0, (local.dy / (_tileHeight + _gap)).floor());
|
||||
return row * 2 + col;
|
||||
}
|
||||
|
||||
Widget _pullArea(Widget child) => GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onVerticalDragUpdate: widget.onPull,
|
||||
onVerticalDragEnd: widget.onPullEnd,
|
||||
child: child,
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = widget.data.l10n;
|
||||
final items = widget.editing ? widget.layout.more : widget.layout.shownMore;
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.background,
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
|
||||
),
|
||||
child: AnimatedSize(
|
||||
duration: navAnim,
|
||||
curve: Curves.easeOutCubic,
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
spacing: 16,
|
||||
children: [
|
||||
_pullArea(
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.shadowColor,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
spacing: 16,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _pullArea(
|
||||
Text(
|
||||
headingText(l10n.other),
|
||||
style: appStyle.fonts.H_H2.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: widget.onToggleEdit,
|
||||
child: AnimatedSwitcher(
|
||||
duration: navAnim,
|
||||
transitionBuilder: (child, animation) => ScaleTransition(
|
||||
scale: animation,
|
||||
child: FadeTransition(opacity: animation, child: child),
|
||||
),
|
||||
child: FirkaIconWidget(
|
||||
key: ValueKey(widget.editing),
|
||||
FirkaIconType.majesticons,
|
||||
widget.editing
|
||||
? Majesticon.saveSolid
|
||||
: Majesticon.editPen2Solid,
|
||||
size: 24,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final tileWidth = (constraints.maxWidth - _gap) / 2;
|
||||
final rows = max(1, (items.length / 2).ceil());
|
||||
final height = rows * _tileHeight + (rows - 1) * _gap;
|
||||
return DragTarget<NavItem>(
|
||||
onWillAcceptWithDetails: (_) => widget.editing,
|
||||
onMove: (d) => widget.drag.onHover(
|
||||
d.data,
|
||||
toBar: false,
|
||||
index: _slotAt(d.offset, tileWidth),
|
||||
),
|
||||
onAcceptWithDetails: (_) => widget.drag.onDrop(),
|
||||
builder: (context, _, _) => AnimatedContainer(
|
||||
key: _gridKey,
|
||||
duration: navAnim,
|
||||
curve: Curves.easeOutCubic,
|
||||
height: height,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
for (final (i, item) in items.indexed)
|
||||
AnimatedPositioned(
|
||||
key: ValueKey(item),
|
||||
duration: navAnim,
|
||||
curve: Curves.easeOutCubic,
|
||||
left: i % 2 * (tileWidth + _gap),
|
||||
top: i ~/ 2 * (_tileHeight + _gap),
|
||||
width: tileWidth,
|
||||
height: _tileHeight,
|
||||
child: _tile(item, tileWidth),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: GestureDetector(
|
||||
child: Text(
|
||||
"v${widget.data.packageInfo.version} ${isBeta ? "beta" : ""}",
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textTertiary,
|
||||
),
|
||||
),
|
||||
onTap: () async {
|
||||
if (isDebug()) return;
|
||||
if (_debugCounter == 10) {
|
||||
final router = GoRouter.of(context);
|
||||
await Settings.developerOptsEnabled.set(
|
||||
!Settings.developerOptsEnabled.value,
|
||||
);
|
||||
widget.onClose();
|
||||
router.go('/home');
|
||||
} else if (_debugCounter < 10) {
|
||||
_debugCounter++;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _tile(NavItem item, double tileWidth) {
|
||||
final info = navItemInfo(item, widget.data.l10n);
|
||||
if (!widget.editing) {
|
||||
return MoreTileView(
|
||||
icon: info.solid,
|
||||
label: info.label,
|
||||
onTap: () => widget.onOpen(item),
|
||||
);
|
||||
}
|
||||
final view = MoreTileView(
|
||||
icon: info.solid,
|
||||
label: info.label,
|
||||
hidden: widget.layout.hidden.contains(item),
|
||||
editing: true,
|
||||
onTap: () => toggleNavItemHidden(item),
|
||||
);
|
||||
return Wiggle(
|
||||
seed: item.index,
|
||||
child: _draggable(
|
||||
item: item,
|
||||
size: Size(tileWidth, _tileHeight),
|
||||
drag: widget.drag,
|
||||
child: view,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The bottom bar: the user's pages and "Több" last. In edit mode the pages
|
||||
/// tremble and can be dragged around, or out to "Több".
|
||||
class NavBarRow extends StatefulWidget {
|
||||
final AppInitialization data;
|
||||
final NavLayout layout;
|
||||
final int currentIndex;
|
||||
final bool panelOpen;
|
||||
final bool editing;
|
||||
final void Function(NavItem item) onOpen;
|
||||
final VoidCallback onMore;
|
||||
final VoidCallback? onMoreLongPress;
|
||||
final NavDragCallbacks drag;
|
||||
|
||||
const NavBarRow({
|
||||
required this.data,
|
||||
required this.layout,
|
||||
required this.currentIndex,
|
||||
required this.panelOpen,
|
||||
required this.editing,
|
||||
required this.onOpen,
|
||||
required this.onMore,
|
||||
required this.onMoreLongPress,
|
||||
required this.drag,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
State<NavBarRow> createState() => _NavBarRowState();
|
||||
}
|
||||
|
||||
class _NavBarRowState extends State<NavBarRow> {
|
||||
static const _gap = 20.0;
|
||||
static const _height = 50.0;
|
||||
|
||||
final _rowKey = GlobalKey();
|
||||
|
||||
double _labelWidth(String text) {
|
||||
final painter = TextPainter(
|
||||
text: TextSpan(text: text, style: appStyle.fonts.B_14R),
|
||||
textDirection: TextDirection.ltr,
|
||||
maxLines: 1,
|
||||
)..layout();
|
||||
return painter.width;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = widget.data.l10n;
|
||||
final bar = widget.layout.bar;
|
||||
// "Több" counts as where the user is while its panel is open, or on a
|
||||
// page that is not in the bar
|
||||
final onBarPage = bar.any((i) => i.branch == widget.currentIndex);
|
||||
final moreActive = widget.panelOpen || !onBarPage;
|
||||
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
// Each item as wide as its label, 48 at least, 20 apart, centered
|
||||
final widths = [
|
||||
for (final i in bar)
|
||||
max(48.0, _labelWidth(navItemInfo(i, l10n).label)),
|
||||
max(48.0, _labelWidth(l10n.other)),
|
||||
];
|
||||
final groupWidth =
|
||||
widths.reduce((a, b) => a + b) + (widths.length - 1) * _gap;
|
||||
final lefts = <double>[];
|
||||
var x = (constraints.maxWidth - groupWidth) / 2;
|
||||
for (final w in widths) {
|
||||
lefts.add(x);
|
||||
x += w + _gap;
|
||||
}
|
||||
|
||||
/// The bar position closest to [dx], "Több" excluded.
|
||||
int indexAt(double dx) {
|
||||
for (var i = 0; i < bar.length; i++) {
|
||||
if (dx < lefts[i] + widths[i] / 2) return i;
|
||||
}
|
||||
return bar.length;
|
||||
}
|
||||
|
||||
return DragTarget<NavItem>(
|
||||
onWillAcceptWithDetails: (_) => widget.editing,
|
||||
onMove: (d) {
|
||||
final box =
|
||||
_rowKey.currentContext?.findRenderObject() as RenderBox?;
|
||||
if (box == null) return;
|
||||
widget.drag.onHover(
|
||||
d.data,
|
||||
toBar: true,
|
||||
index: indexAt(box.globalToLocal(d.offset).dx),
|
||||
);
|
||||
},
|
||||
onAcceptWithDetails: (_) => widget.drag.onDrop(),
|
||||
builder: (context, _, _) => SizedBox(
|
||||
key: _rowKey,
|
||||
height: _height,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
for (final (i, item) in bar.indexed)
|
||||
AnimatedPositioned(
|
||||
key: ValueKey(item),
|
||||
duration: navAnim,
|
||||
curve: Curves.easeOutCubic,
|
||||
left: lefts[i],
|
||||
top: 0,
|
||||
width: widths[i],
|
||||
height: _height,
|
||||
child: _item(item, widths[i]),
|
||||
),
|
||||
AnimatedPositioned(
|
||||
key: const ValueKey('more'),
|
||||
duration: navAnim,
|
||||
curve: Curves.easeOutCubic,
|
||||
left: lefts.last,
|
||||
top: 0,
|
||||
width: widths.last,
|
||||
height: _height,
|
||||
child: BottomNavIconWidget(
|
||||
widget.onMore,
|
||||
moreActive,
|
||||
widget.data.profilePicture ?? Majesticon.menuLine,
|
||||
l10n.other,
|
||||
isProfilePicture: widget.data.profilePicture != null,
|
||||
onLongPress: widget.editing ? null : widget.onMoreLongPress,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _item(NavItem item, double slot) {
|
||||
final info = navItemInfo(item, widget.data.l10n);
|
||||
final active = !widget.panelOpen && item.branch == widget.currentIndex;
|
||||
final view = BottomNavIconWidget(
|
||||
widget.editing ? () {} : () => widget.onOpen(item),
|
||||
active,
|
||||
active ? info.solid : info.line,
|
||||
info.label,
|
||||
);
|
||||
if (!widget.editing) return view;
|
||||
return Wiggle(
|
||||
seed: item.index,
|
||||
child: _draggable(
|
||||
item: item,
|
||||
size: Size(slot, _height),
|
||||
drag: widget.drag,
|
||||
child: view,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class FirkaToastWidget extends StatefulWidget {
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.questionCircleSolid,
|
||||
color: appStyle.colors.errorAccent,
|
||||
size: 24,
|
||||
size: 20,
|
||||
),
|
||||
onTap: () {
|
||||
showErrorBottomSheet(
|
||||
@@ -76,6 +76,7 @@ class FirkaToastWidget extends StatefulWidget {
|
||||
return FirkaToastWidget(
|
||||
backgroundColor: appStyle.colors.errorCard,
|
||||
onTap: () {
|
||||
initData.toastCubit.clear();
|
||||
showReauthBottomSheet(context, initData, initData.l10n.reauth);
|
||||
},
|
||||
onDismiss: () {
|
||||
@@ -132,7 +133,7 @@ class _FirkaToastWidgetState extends State<FirkaToastWidget> {
|
||||
}
|
||||
},
|
||||
child: Card(
|
||||
color: appStyle.colors.errorCard,
|
||||
color: widget.backgroundColor,
|
||||
shadowColor: Colors.transparent,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
@@ -150,3 +151,28 @@ class _FirkaToastWidgetState extends State<FirkaToastWidget> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A short note over whatever page is open, for places outside the home
|
||||
/// screen that has the toast cubit's own host
|
||||
void showInfoToast(BuildContext context, String text) {
|
||||
final overlay = Overlay.of(context);
|
||||
late final OverlayEntry entry;
|
||||
entry = OverlayEntry(
|
||||
builder: (context) => FirkaToastWidget(
|
||||
backgroundColor: appStyle.colors.card,
|
||||
onTap: () => entry.remove(),
|
||||
children: [
|
||||
Text(
|
||||
text,
|
||||
style: appStyle.fonts.B_16SB.copyWith(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
overlay.insert(entry);
|
||||
Future.delayed(const Duration(seconds: 2), () {
|
||||
if (entry.mounted) entry.remove();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ void showReauthBottomSheet(
|
||||
AppInitialization data,
|
||||
String message,
|
||||
) {
|
||||
data.toastCubit.clear();
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
elevation: 100,
|
||||
@@ -16,36 +17,41 @@ void showReauthBottomSheet(
|
||||
enableDrag: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.background,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.errorCard,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
child: Text(
|
||||
message,
|
||||
style: appStyle.fonts.B_16R.copyWith(
|
||||
color: appStyle.colors.errorText,
|
||||
final height = MediaQuery.of(context).size.height * 0.92;
|
||||
return SizedBox(
|
||||
height: height,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.background,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.errorCard,
|
||||
borderRadius:
|
||||
BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
child: Text(
|
||||
message,
|
||||
style: appStyle.fonts.B_16R.copyWith(
|
||||
color: appStyle.colors.errorText,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: LoginWebviewWidget(
|
||||
data,
|
||||
username: data.client!.cache.token.username,
|
||||
schoolId: data.client!.cache.token.iss,
|
||||
Expanded(
|
||||
child: LoginWebviewWidget(
|
||||
data,
|
||||
username: data.client!.cache.token.username,
|
||||
schoolId: data.client!.cache.token.iss,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user