forked from firka/firka
Compare commits
9 Commits
dev
...
feat/themi
| Author | SHA1 | Date | |
|---|---|---|---|
| e865df27ca | |||
| 57037357c1 | |||
| d2b26f3152 | |||
| 511fd18363 | |||
| 3dc28b7f2d | |||
| dd3ffa3fd4 | |||
| 2118884905 | |||
| 55318d738a | |||
| 8062024e1c |
8
.gitmodules
vendored
8
.gitmodules
vendored
@@ -0,0 +1,8 @@
|
||||
[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,8 +122,6 @@ 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
|
||||
@@ -159,23 +157,6 @@ 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
10
CLAUDE.md
@@ -1,10 +0,0 @@
|
||||
# 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,12 +6,7 @@
|
||||
<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
|
||||
@@ -23,24 +18,6 @@
|
||||
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"
|
||||
|
||||
@@ -7,9 +7,8 @@ import org.json.JSONObject
|
||||
|
||||
fun JSONObject.getStringOrNull(key: String): String? {
|
||||
return try {
|
||||
if (has(key) && !isNull(key)) {
|
||||
val v = getString(key)
|
||||
if (v == "null" || v.isBlank()) null else v
|
||||
if (has(key)) {
|
||||
getString(key)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package app.firka.naplo
|
||||
|
||||
import android.app.NotificationManager
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
@@ -26,7 +25,6 @@ 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 {
|
||||
@@ -94,67 +92,6 @@ 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) {
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,649 +0,0 @@
|
||||
package app.firka.naplo
|
||||
|
||||
import android.app.AlarmManager
|
||||
import android.app.Notification
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.app.PendingIntent
|
||||
import android.app.Service
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.pm.ServiceInfo
|
||||
import android.graphics.drawable.Icon
|
||||
import android.os.Build
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import app.firka.naplo.glance.WidgetLesson
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
import java.time.Duration
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
import java.time.ZoneId
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
class ProgressNotificationForegroundService : Service() {
|
||||
|
||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
||||
private var tickerJob: Job? = null
|
||||
private var isForegroundStarted = false
|
||||
private var transitionPendingIntent: PendingIntent? = null
|
||||
|
||||
private val timeReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
when (intent?.action) {
|
||||
Intent.ACTION_TIME_TICK,
|
||||
Intent.ACTION_SCREEN_ON,
|
||||
Intent.ACTION_USER_PRESENT -> {
|
||||
refreshAndPostNotification()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val channelId = "firka_progress_notification_v3"
|
||||
private val notificationId = 4002
|
||||
|
||||
private val hhmm = DateTimeFormatter.ofPattern("HH:mm")
|
||||
|
||||
private fun formatTemplate(template: String, vararg replacements: Pair<String, String>): String {
|
||||
var res = template
|
||||
for ((key, value) in replacements) {
|
||||
res = res.replace("{$key}", value)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
isRunning = true
|
||||
createNotificationChannel()
|
||||
val filter = IntentFilter().apply {
|
||||
addAction(Intent.ACTION_TIME_TICK)
|
||||
addAction(Intent.ACTION_SCREEN_ON)
|
||||
addAction(Intent.ACTION_USER_PRESENT)
|
||||
}
|
||||
ContextCompat.registerReceiver(
|
||||
this,
|
||||
timeReceiver,
|
||||
filter,
|
||||
ContextCompat.RECEIVER_NOT_EXPORTED
|
||||
)
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
createNotificationChannel()
|
||||
when (intent?.action) {
|
||||
ACTION_START, ACTION_UPDATE -> {
|
||||
isRunning = true
|
||||
refreshAndPostNotification()
|
||||
startTicker()
|
||||
}
|
||||
ACTION_STOP -> {
|
||||
isRunning = false
|
||||
stopForegroundService()
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
else -> {
|
||||
isRunning = true
|
||||
refreshAndPostNotification()
|
||||
startTicker()
|
||||
}
|
||||
}
|
||||
return START_STICKY
|
||||
}
|
||||
|
||||
override fun onBind(intent: Intent?): IBinder? = null
|
||||
|
||||
override fun onDestroy() {
|
||||
isRunning = false
|
||||
cancelTransitionAlarm()
|
||||
try {
|
||||
unregisterReceiver(timeReceiver)
|
||||
} catch (_: Exception) {}
|
||||
tickerJob?.cancel()
|
||||
scope.cancel()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
private fun startTicker() {
|
||||
tickerJob?.cancel()
|
||||
tickerJob = scope.launch {
|
||||
while (isActive) {
|
||||
val currentMillis = System.currentTimeMillis()
|
||||
val millisIntoMinute = currentMillis % 60_000
|
||||
// Target next :00 or :30 second boundary
|
||||
val delayMillis = if (millisIntoMinute < 30_000) {
|
||||
30_000 - millisIntoMinute
|
||||
} else {
|
||||
60_000 - millisIntoMinute
|
||||
}.coerceIn(1_000, 30_000)
|
||||
|
||||
delay(delayMillis)
|
||||
refreshAndPostNotification()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun refreshAndPostNotification() {
|
||||
val widgetData = loadTodayTimetable(applicationContext)
|
||||
|
||||
if (widgetData == null || widgetData.lessons.isEmpty()) {
|
||||
Log.d(TAG, "No lessons for today; stopping progress service")
|
||||
stopForegroundService()
|
||||
return
|
||||
}
|
||||
|
||||
val lessons = widgetData.lessons.sortedBy { it.start }
|
||||
val now = LocalDateTime.now()
|
||||
val lastLesson = lessons.last()
|
||||
|
||||
// If today's last lesson has ended, stop notification & foreground service
|
||||
if (now.isAfter(lastLesson.end) || now.isEqual(lastLesson.end)) {
|
||||
Log.d(TAG, "Last lesson of the day ended (${lastLesson.end}); stopping progress service")
|
||||
stopForegroundService()
|
||||
return
|
||||
}
|
||||
|
||||
val notification = buildProgressNotification(widgetData, now)
|
||||
if (notification == null) {
|
||||
stopForegroundService()
|
||||
return
|
||||
}
|
||||
|
||||
if (!isForegroundStarted) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
startForeground(
|
||||
notificationId,
|
||||
notification,
|
||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE
|
||||
)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
startForeground(notificationId, notification)
|
||||
}
|
||||
isForegroundStarted = true
|
||||
}
|
||||
|
||||
val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||
nm.notify(notificationId, notification)
|
||||
|
||||
// Schedule exact alarm for next transition (lesson start/end or break end)
|
||||
val firstLesson = lessons.first()
|
||||
val targetTransitionTime: LocalDateTime? = when {
|
||||
now.isBefore(firstLesson.start) -> firstLesson.start
|
||||
else -> {
|
||||
val currentLesson = lessons.find { !now.isBefore(it.start) && now.isBefore(it.end) }
|
||||
if (currentLesson != null) {
|
||||
currentLesson.end
|
||||
} else {
|
||||
val nextLesson = lessons.firstOrNull { it.start.isAfter(now) }
|
||||
nextLesson?.start
|
||||
}
|
||||
}
|
||||
}
|
||||
if (targetTransitionTime != null) {
|
||||
scheduleNextTransitionAlarm(targetTransitionTime)
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildProgressNotification(data: TimetableProgressData, now: LocalDateTime): Notification? {
|
||||
val strings = getStrings(this)
|
||||
val lessons = data.lessons.sortedBy { it.start }
|
||||
val firstLesson = lessons.first()
|
||||
val lastLesson = lessons.last()
|
||||
|
||||
val pendingIntent = PendingIntent.getActivity(
|
||||
this,
|
||||
0,
|
||||
packageManager.getLaunchIntentForPackage(packageName),
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
|
||||
val accentColor = data.accentColor
|
||||
val breakColor = data.breakColor
|
||||
|
||||
val remainingLessonsCount = lessons.count { !now.isAfter(it.end) }
|
||||
val remainingSuffix = if (remainingLessonsCount == 1) {
|
||||
strings["progress_notif_remaining_lessons_one"] ?: ""
|
||||
} else {
|
||||
val template = strings["progress_notif_remaining_lessons_other"] ?: ""
|
||||
formatTemplate(template, "count" to remainingLessonsCount.toString())
|
||||
}
|
||||
|
||||
if (now.isBefore(firstLesson.start)) {
|
||||
val minutesLeft = minutesRemaining(now, firstLesson.start)
|
||||
val firstLessonIconRes = resolveSubjectIcon(firstLesson)
|
||||
|
||||
val title = if (firstLesson.lessonNumber != null) {
|
||||
val template = strings["progress_notif_lesson_title"] ?: ""
|
||||
if (template.isNotEmpty()) {
|
||||
formatTemplate(template, "number" to firstLesson.lessonNumber.toString(), "name" to firstLesson.name)
|
||||
} else {
|
||||
firstLesson.name
|
||||
}
|
||||
} else {
|
||||
firstLesson.name
|
||||
}
|
||||
|
||||
val room = firstLesson.roomName?.trim()
|
||||
val roomSuffix = if (!room.isNullOrBlank() && room != "null") "\n$room" else ""
|
||||
val subSuffix = if (!firstLesson.substituteTeacher.isNullOrBlank() && firstLesson.substituteTeacher != "null" && firstLesson.substituteTeacher != "-") {
|
||||
strings["progress_notif_substitution"] ?: ""
|
||||
} else ""
|
||||
val timeRange = "${firstLesson.start.format(hhmm)}-${firstLesson.end.format(hhmm)}"
|
||||
val templateCase1 = strings["progress_notif_case1_text"] ?: ""
|
||||
val text = formatTemplate(
|
||||
templateCase1,
|
||||
"minutes" to minutesLeft.toString(),
|
||||
"timeRange" to timeRange,
|
||||
"room" to roomSuffix,
|
||||
"substitution" to subSuffix,
|
||||
"remaining" to remainingSuffix
|
||||
)
|
||||
val criticalTemplate = strings["progress_notif_critical_text"] ?: ""
|
||||
val criticalText = formatTemplate(criticalTemplate, "minutes" to minutesLeft.toString())
|
||||
|
||||
val morningStart = firstLesson.start.toLocalDate().atTime(6, 0)
|
||||
val baseStart = if (now.isBefore(morningStart)) now else morningStart
|
||||
val totalMinutes = Duration.between(baseStart, firstLesson.start).toMinutes().coerceAtLeast(15)
|
||||
val elapsed = Duration.between(baseStart, now).toMinutes().coerceIn(0, totalMinutes)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 36) {
|
||||
val progressStyle = Notification.ProgressStyle()
|
||||
.setProgress(elapsed.toInt())
|
||||
.setProgressSegments(listOf(
|
||||
Notification.ProgressStyle.Segment(totalMinutes.toInt()).setColor(accentColor)
|
||||
))
|
||||
.setProgressEndIcon(Icon.createWithResource(this, firstLessonIconRes))
|
||||
.setProgressTrackerIcon(Icon.createWithResource(this, R.drawable.ic_subject_break))
|
||||
|
||||
val builder = Notification.Builder(this, channelId)
|
||||
.setStyle(progressStyle)
|
||||
.setContentTitle(title)
|
||||
.setContentText(text)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setLargeIcon(Icon.createWithResource(this, firstLessonIconRes))
|
||||
.setContentIntent(pendingIntent)
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true)
|
||||
.setRequestPromotedOngoing(true)
|
||||
.setShortCriticalText(criticalText.take(7))
|
||||
|
||||
return builder.build()
|
||||
} else {
|
||||
return NotificationCompat.Builder(this, channelId)
|
||||
.setContentTitle(title)
|
||||
.setContentText(text)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setProgress(totalMinutes.toInt(), elapsed.toInt(), false)
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
val currentLesson = lessons.find { !now.isBefore(it.start) && now.isBefore(it.end) }
|
||||
|
||||
val title: String
|
||||
val text: String
|
||||
val criticalText: String
|
||||
val trackerIconRes: Int
|
||||
val largeIconRes: Int
|
||||
val endIconRes: Int
|
||||
val itemDuration: Int
|
||||
val itemElapsed: Int
|
||||
val itemColor: Int
|
||||
|
||||
if (currentLesson != null) {
|
||||
val lessonDuration = Duration.between(currentLesson.start, currentLesson.end).toMinutes().coerceAtLeast(1).toInt()
|
||||
val elapsed = Duration.between(currentLesson.start, now).toMinutes().coerceIn(0, lessonDuration.toLong()).toInt()
|
||||
val timeLeft = minutesRemaining(now, currentLesson.end)
|
||||
|
||||
itemDuration = lessonDuration
|
||||
itemElapsed = elapsed
|
||||
itemColor = accentColor
|
||||
|
||||
trackerIconRes = resolveSubjectIcon(currentLesson)
|
||||
largeIconRes = trackerIconRes
|
||||
endIconRes = R.drawable.ic_subject_break
|
||||
|
||||
val prefix = if (currentLesson.lessonNumber != null) {
|
||||
val template = strings["progress_notif_lesson_title"] ?: ""
|
||||
if (template.isNotEmpty()) {
|
||||
formatTemplate(template, "number" to currentLesson.lessonNumber.toString(), "name" to currentLesson.name)
|
||||
} else {
|
||||
currentLesson.name
|
||||
}
|
||||
} else {
|
||||
currentLesson.name
|
||||
}
|
||||
title = prefix
|
||||
val room = currentLesson.roomName?.trim()
|
||||
val roomSuffix = if (!room.isNullOrBlank() && room != "null") "\n$room" else ""
|
||||
val subSuffix = if (!currentLesson.substituteTeacher.isNullOrBlank() && currentLesson.substituteTeacher != "null" && currentLesson.substituteTeacher != "-") {
|
||||
strings["progress_notif_substitution"] ?: ""
|
||||
} else ""
|
||||
val timeRange = "${currentLesson.start.format(hhmm)}-${currentLesson.end.format(hhmm)}"
|
||||
val templateLesson = strings["progress_notif_case2_lesson_text"] ?: ""
|
||||
text = formatTemplate(
|
||||
templateLesson,
|
||||
"minutes" to timeLeft.toString(),
|
||||
"timeRange" to timeRange,
|
||||
"room" to roomSuffix,
|
||||
"substitution" to subSuffix,
|
||||
"remaining" to remainingSuffix
|
||||
)
|
||||
val criticalTemplate = strings["progress_notif_critical_text"] ?: ""
|
||||
criticalText = formatTemplate(criticalTemplate, "minutes" to timeLeft.toString())
|
||||
} else {
|
||||
val previousLesson = lessons.lastOrNull { !now.isBefore(it.end) }
|
||||
val nextLesson = lessons.firstOrNull { it.start.isAfter(now) }
|
||||
val breakStart = previousLesson?.end ?: now
|
||||
val breakEnd = nextLesson?.start ?: lastLesson.end
|
||||
|
||||
val breakDuration = Duration.between(breakStart, breakEnd).toMinutes().coerceAtLeast(1).toInt()
|
||||
val elapsed = Duration.between(breakStart, now).toMinutes().coerceIn(0, breakDuration.toLong()).toInt()
|
||||
val timeLeft = minutesRemaining(now, breakEnd)
|
||||
|
||||
itemDuration = breakDuration
|
||||
itemElapsed = elapsed
|
||||
itemColor = breakColor
|
||||
|
||||
trackerIconRes = R.drawable.ic_subject_break
|
||||
largeIconRes = if (nextLesson != null) resolveSubjectIcon(nextLesson) else trackerIconRes
|
||||
endIconRes = if (nextLesson != null) resolveSubjectIcon(nextLesson) else trackerIconRes
|
||||
|
||||
title = strings["progress_notif_case2_break_title"] ?: ""
|
||||
val templateBreak = strings["progress_notif_case2_break_text"] ?: ""
|
||||
text = formatTemplate(
|
||||
templateBreak,
|
||||
"minutes" to timeLeft.toString(),
|
||||
"remaining" to remainingSuffix
|
||||
)
|
||||
val criticalTemplate = strings["progress_notif_critical_text"] ?: ""
|
||||
criticalText = formatTemplate(criticalTemplate, "minutes" to timeLeft.toString())
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 36) {
|
||||
val progressStyle = Notification.ProgressStyle()
|
||||
.setProgress(itemElapsed)
|
||||
.setProgressSegments(listOf(
|
||||
Notification.ProgressStyle.Segment(itemDuration).setColor(itemColor)
|
||||
))
|
||||
.setProgressTrackerIcon(Icon.createWithResource(this, trackerIconRes))
|
||||
.setProgressEndIcon(Icon.createWithResource(this, endIconRes))
|
||||
|
||||
val builder = Notification.Builder(this, channelId)
|
||||
.setStyle(progressStyle)
|
||||
.setContentTitle(title)
|
||||
.setContentText(text)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setLargeIcon(Icon.createWithResource(this, largeIconRes))
|
||||
.setContentIntent(pendingIntent)
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true)
|
||||
.setRequestPromotedOngoing(true)
|
||||
.setShortCriticalText(criticalText.take(7))
|
||||
|
||||
return builder.build()
|
||||
} else {
|
||||
return NotificationCompat.Builder(this, channelId)
|
||||
.setContentTitle(title)
|
||||
.setContentText(text)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setProgress(itemDuration, itemElapsed, false)
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
private fun resolveSubjectIcon(lesson: WidgetLesson): Int {
|
||||
if (!lesson.icon.isNullOrEmpty()) {
|
||||
val res = getSubjectIconRes(lesson.icon)
|
||||
if (res != R.drawable.ic_notification) return res
|
||||
}
|
||||
val name = lesson.name.lowercase()
|
||||
return when {
|
||||
Regex("mate(k|matika)").containsMatchIn(name) -> R.drawable.ic_subject_mathematics
|
||||
Regex("magyar nyelv|nyelvtan").containsMatchIn(name) -> R.drawable.ic_subject_grammar
|
||||
Regex("irodalom").containsMatchIn(name) -> R.drawable.ic_subject_literature
|
||||
Regex("tor(i|tenelem)").containsMatchIn(name) -> R.drawable.ic_subject_history
|
||||
Regex("foldrajz").containsMatchIn(name) -> R.drawable.ic_subject_geography
|
||||
Regex("rajz|muvtori|muveszet|vizualis").containsMatchIn(name) -> R.drawable.ic_subject_art
|
||||
Regex("fizika").containsMatchIn(name) -> R.drawable.ic_subject_physics
|
||||
Regex("^enek|zene|szolfezs|zongora|korus").containsMatchIn(name) -> R.drawable.ic_subject_music
|
||||
Regex("^tes(i|tneveles)|sport|edzeselmelet").containsMatchIn(name) -> R.drawable.ic_subject_pe
|
||||
Regex("kemia").containsMatchIn(name) -> R.drawable.ic_subject_chemistry
|
||||
Regex("biologia").containsMatchIn(name) -> R.drawable.ic_subject_biology
|
||||
Regex("angol|nemet|francia|olasz|orosz|spanyol|latin|kinai|idegen|nyelv").containsMatchIn(name) -> R.drawable.ic_subject_language
|
||||
Regex("informatika|szoftver|digitalis").containsMatchIn(name) -> R.drawable.ic_subject_it
|
||||
Regex("prog|alkalmazas").containsMatchIn(name) -> R.drawable.ic_subject_code
|
||||
Regex("halozat").containsMatchIn(name) -> R.drawable.ic_subject_networking
|
||||
Regex("filozofia").containsMatchIn(name) -> R.drawable.ic_subject_philosophy
|
||||
Regex("osztaly(fonoki|kozosseg)").containsMatchIn(name) -> R.drawable.ic_subject_ofo
|
||||
Regex("penzugy|gazdasag").containsMatchIn(name) -> R.drawable.ic_subject_economics
|
||||
Regex("kornyezet|termeszet").containsMatchIn(name) -> R.drawable.ic_subject_env
|
||||
Regex("(hit|erkolcs)tan|vallas|etika").containsMatchIn(name) -> R.drawable.ic_subject_religion
|
||||
Regex("adatbazis").containsMatchIn(name) -> R.drawable.ic_subject_database
|
||||
else -> R.drawable.ic_subject_unknown
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSubjectIconRes(iconName: String?): Int {
|
||||
if (iconName == null) return R.drawable.ic_subject_unknown
|
||||
return when (iconName.lowercase()) {
|
||||
"mathematics" -> R.drawable.ic_subject_mathematics
|
||||
"grammar" -> R.drawable.ic_subject_grammar
|
||||
"literature" -> R.drawable.ic_subject_literature
|
||||
"history" -> R.drawable.ic_subject_history
|
||||
"geography" -> R.drawable.ic_subject_geography
|
||||
"art" -> R.drawable.ic_subject_art
|
||||
"physics" -> R.drawable.ic_subject_physics
|
||||
"music" -> R.drawable.ic_subject_music
|
||||
"pe" -> R.drawable.ic_subject_pe
|
||||
"chemistry" -> R.drawable.ic_subject_chemistry
|
||||
"biology" -> R.drawable.ic_subject_biology
|
||||
"env" -> R.drawable.ic_subject_env
|
||||
"religion" -> R.drawable.ic_subject_religion
|
||||
"economics" -> R.drawable.ic_subject_economics
|
||||
"it" -> R.drawable.ic_subject_it
|
||||
"code" -> R.drawable.ic_subject_code
|
||||
"networking" -> R.drawable.ic_subject_networking
|
||||
"theatre" -> R.drawable.ic_subject_theatre
|
||||
"film" -> R.drawable.ic_subject_film
|
||||
"electricalengineering" -> R.drawable.ic_subject_electricalengineering
|
||||
"mechanicalengineering" -> R.drawable.ic_subject_mechanicalengineering
|
||||
"technika" -> R.drawable.ic_subject_technika
|
||||
"dance" -> R.drawable.ic_subject_dance
|
||||
"philosophy" -> R.drawable.ic_subject_philosophy
|
||||
"erettsegi" -> R.drawable.ic_subject_erettsegi
|
||||
"ofo" -> R.drawable.ic_subject_ofo
|
||||
"diligence" -> R.drawable.ic_subject_diligence
|
||||
"attitude" -> R.drawable.ic_subject_attitude
|
||||
"language" -> R.drawable.ic_subject_language
|
||||
"linux" -> R.drawable.ic_subject_linux
|
||||
"database" -> R.drawable.ic_subject_database
|
||||
"applications" -> R.drawable.ic_subject_applications
|
||||
"project" -> R.drawable.ic_subject_project
|
||||
"break" -> R.drawable.ic_subject_break
|
||||
else -> R.drawable.ic_subject_unknown
|
||||
}
|
||||
}
|
||||
|
||||
private fun createNotificationChannel() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||
try {
|
||||
nm.deleteNotificationChannel("firka_progress_notification")
|
||||
nm.deleteNotificationChannel("firka_progress_notification_v2")
|
||||
} catch (_: Exception) {}
|
||||
|
||||
val strings = getStrings(this)
|
||||
val channelName = strings["progress_notif_channel_name"]?.takeIf { it.isNotBlank() } ?: "Firka"
|
||||
val channelDesc = strings["progress_notif_channel_desc"] ?: ""
|
||||
|
||||
val channel = NotificationChannel(
|
||||
channelId,
|
||||
channelName,
|
||||
NotificationManager.IMPORTANCE_DEFAULT
|
||||
).apply {
|
||||
setShowBadge(false)
|
||||
setSound(null, null)
|
||||
enableVibration(false)
|
||||
description = channelDesc
|
||||
}
|
||||
nm.createNotificationChannel(channel)
|
||||
}
|
||||
}
|
||||
|
||||
private fun scheduleNextTransitionAlarm(targetTime: LocalDateTime) {
|
||||
val alarmManager = getSystemService(ALARM_SERVICE) as? AlarmManager ?: return
|
||||
cancelTransitionAlarm()
|
||||
|
||||
val intent = Intent(this, ProgressNotificationForegroundService::class.java).apply {
|
||||
action = ACTION_UPDATE
|
||||
}
|
||||
val pendingIntent = PendingIntent.getService(
|
||||
this,
|
||||
1001,
|
||||
intent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
transitionPendingIntent = pendingIntent
|
||||
|
||||
val epochMillis = targetTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()
|
||||
if (epochMillis > System.currentTimeMillis()) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, epochMillis, pendingIntent)
|
||||
} else {
|
||||
alarmManager.setExact(AlarmManager.RTC_WAKEUP, epochMillis, pendingIntent)
|
||||
}
|
||||
} catch (e: SecurityException) {
|
||||
Log.w(TAG, "Cannot schedule transition alarm", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun cancelTransitionAlarm() {
|
||||
val alarmManager = getSystemService(ALARM_SERVICE) as? AlarmManager ?: return
|
||||
transitionPendingIntent?.let {
|
||||
alarmManager.cancel(it)
|
||||
transitionPendingIntent = null
|
||||
}
|
||||
}
|
||||
|
||||
private fun stopForegroundService() {
|
||||
isRunning = false
|
||||
cancelTransitionAlarm()
|
||||
tickerJob?.cancel()
|
||||
isForegroundStarted = false
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
stopForeground(STOP_FOREGROUND_REMOVE)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
stopForeground(true)
|
||||
}
|
||||
stopSelf()
|
||||
}
|
||||
|
||||
private fun minutesRemaining(from: LocalDateTime, to: LocalDateTime): Int {
|
||||
val seconds = Duration.between(from, to).seconds
|
||||
return if (seconds <= 0) 1 else ((seconds + 59) / 60).toInt().coerceAtLeast(1)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "ProgressNotifService"
|
||||
const val ACTION_START = "app.firka.naplo.ProgressNotificationForegroundService.START"
|
||||
const val ACTION_UPDATE = "app.firka.naplo.ProgressNotificationForegroundService.UPDATE"
|
||||
const val ACTION_STOP = "app.firka.naplo.ProgressNotificationForegroundService.STOP"
|
||||
|
||||
private const val PREFS_STRINGS = "firka_progress_strings"
|
||||
|
||||
@Volatile
|
||||
var isRunning: Boolean = false
|
||||
|
||||
fun saveStrings(context: Context, strings: Map<String, String>) {
|
||||
val prefs = context.applicationContext.getSharedPreferences(PREFS_STRINGS, Context.MODE_PRIVATE)
|
||||
val editor = prefs.edit()
|
||||
for ((k, v) in strings) {
|
||||
editor.putString(k, v)
|
||||
}
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
fun getStrings(context: Context): Map<String, String> {
|
||||
val prefs = context.applicationContext.getSharedPreferences(PREFS_STRINGS, Context.MODE_PRIVATE)
|
||||
val all = prefs.all
|
||||
val result = mutableMapOf<String, String>()
|
||||
for ((k, v) in all) {
|
||||
if (v is String) {
|
||||
result[k] = v
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
fun loadTodayTimetable(context: Context): TimetableProgressData? {
|
||||
return try {
|
||||
val appFlutter = File(context.applicationContext.dataDir, "app_flutter")
|
||||
val widgetStateFile = File(appFlutter, "widget_state.json")
|
||||
if (!widgetStateFile.exists()) return null
|
||||
val text = widgetStateFile.readText(Charsets.UTF_8)
|
||||
val json = JSONObject(text)
|
||||
|
||||
val tt = json.getJSONArray("timetable")
|
||||
val allLessons = mutableListOf<WidgetLesson>()
|
||||
for (i in 0 until tt.length()) {
|
||||
allLessons.add(WidgetLesson(tt.getJSONObject(i)))
|
||||
}
|
||||
|
||||
val today = LocalDate.now()
|
||||
var todayLessons = allLessons.filter { it.start.toLocalDate() == today }
|
||||
if (todayLessons.isEmpty()) {
|
||||
val displayDateStr = json.optString("displayDate", "")
|
||||
if (displayDateStr.isNotEmpty()) {
|
||||
try {
|
||||
val displayDate = LocalDate.parse(displayDateStr)
|
||||
todayLessons = allLessons.filter { it.start.toLocalDate() == displayDate }
|
||||
} catch (_: Exception) {}
|
||||
}
|
||||
}
|
||||
|
||||
val colorsObj = json.optJSONObject("colors")
|
||||
val accent = colorsObj?.optInt("accent", 0xFF4C662B.toInt()) ?: 0xFF4C662B.toInt()
|
||||
val secondary = colorsObj?.optInt("secondary", 0xFF586249.toInt()) ?: 0xFF586249.toInt()
|
||||
val language = json.optString("language", null)
|
||||
|
||||
TimetableProgressData(todayLessons, accent, secondary, language)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Error reading timetable data", e)
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class TimetableProgressData(
|
||||
val lessons: List<WidgetLesson>,
|
||||
val accentColor: Int,
|
||||
val breakColor: Int,
|
||||
val language: String? = null,
|
||||
)
|
||||
@@ -41,9 +41,6 @@ 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"))
|
||||
?.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")
|
||||
val roomName: String? = data.getStringOrNull("roomName") ?: data.getStringOrNull("TeremNeve")
|
||||
val substituteTeacher: String? = data.getStringOrNull("substituteTeacher") ?: data.getStringOrNull("HelyettesTanarNeve")
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,27 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,20 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,20 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,20 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,27 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,34 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -38,22 +38,6 @@ 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;
|
||||
@@ -91,27 +75,6 @@ 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,
|
||||
@@ -166,15 +129,13 @@ class KretaClient {
|
||||
int waitAfter = 5;
|
||||
while (date.isBefore(to)) {
|
||||
DateTime tmpTo = date.add(Duration(days: 14));
|
||||
// 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));
|
||||
final alreadyFetched =
|
||||
skipFrom != null &&
|
||||
skipTo != null &&
|
||||
!date.isBefore(skipFrom) &&
|
||||
!tmpTo.isAfter(skipTo);
|
||||
if (!alreadyFetched) {
|
||||
requests.add(getLessons(date, tmpTo));
|
||||
i++;
|
||||
}
|
||||
date = tmpTo;
|
||||
@@ -200,47 +161,12 @@ class KretaClient {
|
||||
await getNoticeBoard(from: from);
|
||||
}
|
||||
|
||||
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 {
|
||||
Future<void> init() async {
|
||||
await getStudent();
|
||||
await getClassGroups();
|
||||
}
|
||||
|
||||
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 {
|
||||
Future<void> renewCache({bool reInit = false}) async {
|
||||
_toastCubit.setActiveToast(.fetching);
|
||||
try {
|
||||
if (reInit) {
|
||||
@@ -530,20 +456,11 @@ class KretaClient {
|
||||
}
|
||||
}
|
||||
|
||||
/// Upserts [caches]. Deletes stale rows in [staleScope]. Queued behind
|
||||
/// [_writeQueue] — see its doc comment.
|
||||
/// Upserts [caches]. Deletes stale rows in [staleScope].
|
||||
Future<List<C>> _save<C extends GenericCacheModel<I>, I extends Identifiable>(
|
||||
List<C> caches, [
|
||||
QueryBuilder<C, C, QAfterFilterCondition>? staleScope,
|
||||
]) {
|
||||
return _enqueueWrite(() => _saveImpl(caches, staleScope));
|
||||
}
|
||||
|
||||
Future<List<C>>
|
||||
_saveImpl<C extends GenericCacheModel<I>, I extends Identifiable>(
|
||||
List<C> caches,
|
||||
QueryBuilder<C, C, QAfterFilterCondition>? staleScope,
|
||||
) async {
|
||||
]) async {
|
||||
isarInit.writeTxnSync(() {
|
||||
if (staleScope != null) {
|
||||
final freshKeys = caches.map((c) => c.cacheKey).toSet();
|
||||
@@ -572,40 +489,19 @@ class KretaClient {
|
||||
}
|
||||
|
||||
Future<StudentCacheModel> getStudent() async {
|
||||
final list = await _renewCache<StudentCacheModel, Student>(
|
||||
return (await _renewCache<StudentCacheModel, Student>(
|
||||
KretaEndpoints.getStudent(cache.token.iss),
|
||||
StudentCacheModel.new,
|
||||
(cache) => Student.fromJson(cache),
|
||||
).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");
|
||||
).then(_save)).first;
|
||||
}
|
||||
|
||||
Future<List<ClassGroupCacheModel>> getClassGroups() async {
|
||||
final list = await _renewCache(
|
||||
return 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({
|
||||
@@ -652,67 +548,19 @@ class KretaClient {
|
||||
).then((caches) => _save(caches, cache.getHomeworks()));
|
||||
}
|
||||
|
||||
/// Wipes and replaces every cached lesson in [from]..[to], no Uid diffing.
|
||||
Future<List<LessonCacheModel>> _replaceTimetableRange(
|
||||
DateTime from,
|
||||
DateTime to,
|
||||
List<LessonCacheModel> caches,
|
||||
) async {
|
||||
late int existingCount;
|
||||
late int deletedCount;
|
||||
isarInit.writeTxnSync(() {
|
||||
// NOT between(from, to): it's inclusive of `to`'s whole day, but
|
||||
// `to` here is exclusive (matches what was actually fetched) — the
|
||||
// inclusive version deleted a day beyond what `caches` covers.
|
||||
final scope = cache.getTimeTable().and().startBetween(
|
||||
from.getMidnight(),
|
||||
to.getMidnight(),
|
||||
includeUpper: false,
|
||||
);
|
||||
existingCount = scope.countSync();
|
||||
deletedCount = scope.deleteAllSync();
|
||||
isarInit.lessonCacheModels.putAllSync(caches);
|
||||
});
|
||||
|
||||
logger.fine(
|
||||
"[RenewCache] _replaceTimetableRange $from..$to: "
|
||||
"existing=$existingCount deleted=$deletedCount inserting=${caches.length}",
|
||||
);
|
||||
initData.homeRefreshCubit.requestRefresh();
|
||||
return caches;
|
||||
}
|
||||
|
||||
/// Automatically aligns requests to start at Monday and end at Sunday.
|
||||
/// Queued behind [_writeQueue] so overlapping ranges can't race.
|
||||
Future<List<LessonCacheModel>> getLessons(DateTime from, DateTime to) {
|
||||
return _enqueueWrite(() => _getLessonsImpl(from, to));
|
||||
}
|
||||
|
||||
Future<List<LessonCacheModel>> _getLessonsImpl(
|
||||
DateTime from,
|
||||
DateTime to,
|
||||
) async {
|
||||
/// Automatically aligns requests to start at Monday and end at Sunday
|
||||
Future<List<LessonCacheModel>> getLessons(DateTime from, DateTime to) async {
|
||||
assert(from.difference(to).inDays < 30);
|
||||
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))
|
||||
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)),
|
||||
))
|
||||
..sort((a, b) => a.start.compareTo(b.start));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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";
|
||||
@@ -18,10 +17,9 @@ Future<void> completeLogin(
|
||||
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!,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
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})?> 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?) ?? '',
|
||||
);
|
||||
} 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),
|
||||
);
|
||||
}
|
||||
|
||||
/// 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;
|
||||
}
|
||||
@@ -2,7 +2,6 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'dart:ui' as ui;
|
||||
import 'package:firka_common/data/database.dart';
|
||||
import 'package:firka_common/data/models/lesson_cache_model.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -10,7 +9,6 @@ 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';
|
||||
@@ -25,7 +23,6 @@ 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';
|
||||
@@ -143,12 +140,11 @@ void _applyCustomColors(
|
||||
colors.a10p = colors.accent.withAlpha(0x1a);
|
||||
colors.a15p = colors.accent.withAlpha(0x26);
|
||||
|
||||
final bgGrad =
|
||||
(isLight
|
||||
? Settings.customBackgroundGradientLight
|
||||
: Settings.customBackgroundGradientDark)
|
||||
.value
|
||||
.toColorListFromHexSetting();
|
||||
final bgGrad = (isLight
|
||||
? Settings.customBackgroundGradientLight
|
||||
: Settings.customBackgroundGradientDark)
|
||||
.value
|
||||
.toColorListFromHexSetting();
|
||||
|
||||
if (bgGrad.isNotEmpty) {
|
||||
colors.backgroundGradient = bgGrad;
|
||||
@@ -165,7 +161,9 @@ void _applyCustomColors(
|
||||
colors.background0p = colors.background.withAlpha(0);
|
||||
|
||||
colors.card =
|
||||
(isLight ? Settings.customCardColorLight : Settings.customCardColorDark)
|
||||
(isLight
|
||||
? Settings.customCardColorLight
|
||||
: Settings.customCardColorDark)
|
||||
.value
|
||||
.toColorFromHexSetting();
|
||||
colors.cardTranslucent = colors.card.withAlpha(0x80);
|
||||
@@ -198,58 +196,54 @@ void _applyCustomColors(
|
||||
|
||||
final customSecLight = Settings.customTextSecondaryColorLight.value;
|
||||
final customSecDark = Settings.customTextSecondaryColorDark.value;
|
||||
final isCustomSecLight =
|
||||
customSecLight !=
|
||||
final isCustomSecLight = customSecLight !=
|
||||
SettingsRegistry.customTextSecondaryColorLight.defaultValue;
|
||||
final isCustomSecDark =
|
||||
customSecDark !=
|
||||
final isCustomSecDark = customSecDark !=
|
||||
SettingsRegistry.customTextSecondaryColorDark.defaultValue;
|
||||
|
||||
colors.textSecondary = isLight
|
||||
? (isCustomSecLight
|
||||
? customSecLight.toColorFromHexSetting()
|
||||
: (isCustomTextLight
|
||||
? textLight.withAlpha(0xCC)
|
||||
: customSecLight.toColorFromHexSetting()))
|
||||
? customSecLight.toColorFromHexSetting()
|
||||
: (isCustomTextLight
|
||||
? textLight.withAlpha(0xCC)
|
||||
: customSecLight.toColorFromHexSetting()))
|
||||
: (isCustomSecDark
|
||||
? customSecDark.toColorFromHexSetting()
|
||||
: (isCustomTextDark
|
||||
? textDark.withAlpha(0xB3)
|
||||
: customSecDark.toColorFromHexSetting()));
|
||||
? customSecDark.toColorFromHexSetting()
|
||||
: (isCustomTextDark
|
||||
? textDark.withAlpha(0xB3)
|
||||
: customSecDark.toColorFromHexSetting()));
|
||||
|
||||
final customTertLight = Settings.customTextTertiaryColorLight.value;
|
||||
final customTertDark = Settings.customTextTertiaryColorDark.value;
|
||||
final isCustomTertLight =
|
||||
customTertLight !=
|
||||
final isCustomTertLight = customTertLight !=
|
||||
SettingsRegistry.customTextTertiaryColorLight.defaultValue;
|
||||
final isCustomTertDark =
|
||||
customTertDark !=
|
||||
final isCustomTertDark = customTertDark !=
|
||||
SettingsRegistry.customTextTertiaryColorDark.defaultValue;
|
||||
|
||||
colors.textTertiary = isLight
|
||||
? (isCustomTertLight
|
||||
? customTertLight.toColorFromHexSetting()
|
||||
: (isCustomTextLight
|
||||
? textLight.withAlpha(0x80)
|
||||
: customTertLight.toColorFromHexSetting()))
|
||||
? customTertLight.toColorFromHexSetting()
|
||||
: (isCustomTextLight
|
||||
? textLight.withAlpha(0x80)
|
||||
: customTertLight.toColorFromHexSetting()))
|
||||
: (isCustomTertDark
|
||||
? customTertDark.toColorFromHexSetting()
|
||||
: (isCustomTextDark
|
||||
? textDark.withAlpha(0x80)
|
||||
: customTertDark.toColorFromHexSetting()));
|
||||
? 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());
|
||||
? textLight.withAlpha(0xCC)
|
||||
: customSecLight.toColorFromHexSetting());
|
||||
colors.textTertiaryLight = isCustomTertLight
|
||||
? customTertLight.toColorFromHexSetting()
|
||||
: (isCustomTextLight
|
||||
? textLight.withAlpha(0x80)
|
||||
: customTertLight.toColorFromHexSetting());
|
||||
? textLight.withAlpha(0x80)
|
||||
: customTertLight.toColorFromHexSetting());
|
||||
|
||||
colors.shadowColor =
|
||||
(isLight
|
||||
@@ -310,25 +304,8 @@ void _applyCustomColors(
|
||||
.toColorFromHexSetting();
|
||||
}
|
||||
|
||||
DateTime? _lastInitDataAt;
|
||||
String? _lastInitDataUsername;
|
||||
|
||||
Future<void> _initData(AppInitialization init) async {
|
||||
await init.settings.loadAll();
|
||||
|
||||
// Old cacheKey scheme could collide across dates; wipe once so stale
|
||||
// rows don't linger until their date range naturally resyncs.
|
||||
if (!Settings.lessonCacheKeyMigrationDone.value) {
|
||||
await isarInit.writeTxn(() async {
|
||||
await isarInit.lessonCacheModels.clear();
|
||||
});
|
||||
await Settings.lessonCacheKeyMigrationDone.set(true);
|
||||
logger.info(
|
||||
"[Init] One-time migration: cleared the lesson cache to drop rows "
|
||||
"keyed under the pre-fix cacheKey scheme",
|
||||
);
|
||||
}
|
||||
|
||||
final selectedThemeId = Settings.selectedThemeId.value;
|
||||
final normalized = normalizeSelectedThemeId(selectedThemeId);
|
||||
if (normalized != selectedThemeId) {
|
||||
@@ -359,7 +336,6 @@ 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();
|
||||
}());
|
||||
@@ -371,29 +347,6 @@ 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));
|
||||
|
||||
// _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);
|
||||
|
||||
@@ -406,7 +359,6 @@ 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.
|
||||
@@ -423,7 +375,6 @@ Future<void> _initData(AppInitialization init) async {
|
||||
|
||||
await init.client!.renewCache(reInit: false);
|
||||
await WidgetCacheHelper.updateWidgetCacheFromIsar();
|
||||
unawaited(ProgressNotificationService.checkAndStartIfActive());
|
||||
init.homeRefreshCubit.requestRefresh();
|
||||
}());
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import 'package:firka/core/bloc/settings_cubit.dart';
|
||||
import 'package:firka/core/bloc/theme_cubit.dart';
|
||||
import 'package:firka/core/firka_bundle.dart';
|
||||
import 'package:firka/routing/app_router.dart';
|
||||
import 'package:firka/services/wear_sync_helper.dart';
|
||||
import 'package:firka/services/watch_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';
|
||||
|
||||
@@ -293,13 +293,6 @@ SettingsUiGroup buildSettingsTree(AppLocalizations l10n) {
|
||||
SettingsRegistry.notifyAll,
|
||||
always,
|
||||
),
|
||||
SettingsUiBoolean(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.clockSolid,
|
||||
l10n.s_progress_notification,
|
||||
SettingsRegistry.progressNotificationEnabled,
|
||||
isPushNotificationsEnabled,
|
||||
),
|
||||
SettingsUiHeaderSmall(l10n.s_notif_delivery_method_header, isPushNotificationsEnabled),
|
||||
SettingsUiEnum(SettingsRegistry.notificationDeliveryMethod, [
|
||||
l10n.s_notif_delivery_auto,
|
||||
|
||||
@@ -6,13 +6,10 @@ 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/progress_notification_service.dart";
|
||||
import "package:firka/services/wear_sync_helper.dart";
|
||||
import "package:firka/core/theme_palette.dart";
|
||||
import "package:firka/services/watch_sync_helper.dart";
|
||||
import "package:firka/ui/phone/screens/themes/builtin_theme_id.dart";
|
||||
import "package:firka_common/ui/theme/core_theme.dart";
|
||||
|
||||
import "package:firka/data/widget.dart";
|
||||
import "settings_repository.dart";
|
||||
import "settings_schema.dart";
|
||||
|
||||
@@ -25,8 +22,6 @@ 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 {
|
||||
@@ -74,8 +69,6 @@ void registerSettingsEffects(
|
||||
initTheme(initData);
|
||||
initData.themeCubit.refresh();
|
||||
initData.homeRefreshCubit.requestRefresh();
|
||||
// persist the new colors into the selected user theme
|
||||
scheduleActiveThemeSave(repo);
|
||||
}
|
||||
|
||||
for (final setting in [
|
||||
@@ -140,17 +133,12 @@ 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();
|
||||
});
|
||||
|
||||
@@ -187,137 +187,129 @@ abstract class SettingsSchema {
|
||||
)
|
||||
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")
|
||||
@StringSetting(id: 1048, defaultValue: "0xFF22CCAD")
|
||||
String get customGradeColor5;
|
||||
|
||||
@StringSetting(id: 1051, defaultValue: "0xFF92EA3B")
|
||||
@StringSetting(id: 1049, defaultValue: "0xFF92EA3B")
|
||||
String get customGradeColor4;
|
||||
|
||||
@StringSetting(id: 1052, defaultValue: "0xFFF9CF00")
|
||||
@StringSetting(id: 1050, defaultValue: "0xFFF9CF00")
|
||||
String get customGradeColor3;
|
||||
|
||||
@StringSetting(id: 1053, defaultValue: "0xFFFFA046")
|
||||
@StringSetting(id: 1051, defaultValue: "0xFFFFA046")
|
||||
String get customGradeColor2;
|
||||
|
||||
@StringSetting(id: 1054, defaultValue: "0xFFFF54A1")
|
||||
@StringSetting(id: 1052, defaultValue: "0xFFFF54A1")
|
||||
String get customGradeColor1;
|
||||
|
||||
// Custom theme colors stored as 0xAARRGGBB hex strings.
|
||||
// Defaults match the firka core theme.
|
||||
@StringSetting(id: 1055, defaultValue: "0xFFA7DC22")
|
||||
@StringSetting(id: 1053, defaultValue: "0xFFA7DC22")
|
||||
String get customAccentColorLight;
|
||||
|
||||
@StringSetting(id: 1056, defaultValue: "0xFFA7DC22")
|
||||
@StringSetting(id: 1054, defaultValue: "0xFFA7DC22")
|
||||
String get customAccentColorDark;
|
||||
|
||||
@StringSetting(id: 1057, defaultValue: "0xFFFAFFF0")
|
||||
@StringSetting(id: 1055, defaultValue: "0xFFFAFFF0")
|
||||
String get customBackgroundColorLight;
|
||||
|
||||
@StringSetting(id: 1058, defaultValue: "0xFF0D1202")
|
||||
@StringSetting(id: 1056, defaultValue: "0xFF0D1202")
|
||||
String get customBackgroundColorDark;
|
||||
|
||||
@StringSetting(id: 1059, defaultValue: "0xFFF3FBDE")
|
||||
@StringSetting(id: 1057, defaultValue: "0xFFF3FBDE")
|
||||
String get customCardColorLight;
|
||||
|
||||
@StringSetting(id: 1060, defaultValue: "0xFF141905")
|
||||
@StringSetting(id: 1058, defaultValue: "0xFF141905")
|
||||
String get customCardColorDark;
|
||||
|
||||
@StringSetting(id: 1061, defaultValue: "0xFFFEFFFD")
|
||||
@StringSetting(id: 1059, defaultValue: "0xFFFEFFFD")
|
||||
String get customButtonColorLight;
|
||||
|
||||
@StringSetting(id: 1062, defaultValue: "0xFF20290B")
|
||||
@StringSetting(id: 1060, defaultValue: "0xFF20290B")
|
||||
String get customButtonColorDark;
|
||||
|
||||
@StringSetting(id: 1063, defaultValue: "0xFF6E8F1B")
|
||||
@StringSetting(id: 1061, defaultValue: "0xFF6E8F1B")
|
||||
String get customSecondaryColorLight;
|
||||
|
||||
@StringSetting(id: 1064, defaultValue: "0xFFCBEE71")
|
||||
@StringSetting(id: 1062, defaultValue: "0xFFCBEE71")
|
||||
String get customSecondaryColorDark;
|
||||
|
||||
@StringSetting(id: 1065, defaultValue: "0xFF394C0A")
|
||||
@StringSetting(id: 1063, defaultValue: "0xFF394C0A")
|
||||
String get customTextColorLight;
|
||||
|
||||
@StringSetting(id: 1066, defaultValue: "0xFFEAF7CC")
|
||||
@StringSetting(id: 1064, defaultValue: "0xFFEAF7CC")
|
||||
String get customTextColorDark;
|
||||
|
||||
@StringSetting(id: 1067, defaultValue: "0xCC394C0A")
|
||||
@StringSetting(id: 1065, defaultValue: "0xCC394C0A")
|
||||
String get customTextSecondaryColorLight;
|
||||
|
||||
@StringSetting(id: 1068, defaultValue: "0xB3EAF7CC")
|
||||
@StringSetting(id: 1066, defaultValue: "0xB3EAF7CC")
|
||||
String get customTextSecondaryColorDark;
|
||||
|
||||
@StringSetting(id: 1069, defaultValue: "0x80394C0A")
|
||||
@StringSetting(id: 1067, defaultValue: "0x80394C0A")
|
||||
String get customTextTertiaryColorLight;
|
||||
|
||||
@StringSetting(id: 1070, defaultValue: "0x80EAF7CC")
|
||||
@StringSetting(id: 1068, defaultValue: "0x80EAF7CC")
|
||||
String get customTextTertiaryColorDark;
|
||||
|
||||
@StringSetting(id: 1071, defaultValue: "0x33647E22")
|
||||
@StringSetting(id: 1069, defaultValue: "0x33647E22")
|
||||
String get customShadowColorLight;
|
||||
|
||||
@StringSetting(id: 1072, defaultValue: "0x26CBEE71")
|
||||
@StringSetting(id: 1070, defaultValue: "0x26CBEE71")
|
||||
String get customShadowColorDark;
|
||||
|
||||
@StringSetting(id: 1073, defaultValue: "0xFF92EA3B")
|
||||
@StringSetting(id: 1071, defaultValue: "0xFF92EA3B")
|
||||
String get customSuccessColorLight;
|
||||
|
||||
@StringSetting(id: 1074, defaultValue: "0xFF92EA3B")
|
||||
@StringSetting(id: 1072, defaultValue: "0xFF92EA3B")
|
||||
String get customSuccessColorDark;
|
||||
|
||||
@StringSetting(id: 1075, defaultValue: "0xFFFFA046")
|
||||
@StringSetting(id: 1073, defaultValue: "0xFFFFA046")
|
||||
String get customWarningAccentColorLight;
|
||||
|
||||
@StringSetting(id: 1076, defaultValue: "0xFFFFA046")
|
||||
@StringSetting(id: 1074, defaultValue: "0xFFFFA046")
|
||||
String get customWarningAccentColorDark;
|
||||
|
||||
@StringSetting(id: 1077, defaultValue: "0xFF8F531B")
|
||||
@StringSetting(id: 1075, defaultValue: "0xFF8F531B")
|
||||
String get customWarningTextColorLight;
|
||||
|
||||
@StringSetting(id: 1078, defaultValue: "0xFFF0B37A")
|
||||
@StringSetting(id: 1076, defaultValue: "0xFFF0B37A")
|
||||
String get customWarningTextColorDark;
|
||||
|
||||
@StringSetting(id: 1079, defaultValue: "0xFFFAEBDC")
|
||||
@StringSetting(id: 1077, defaultValue: "0xFFFAEBDC")
|
||||
String get customWarningCardColorLight;
|
||||
|
||||
@StringSetting(id: 1080, defaultValue: "0xFF201203")
|
||||
@StringSetting(id: 1078, defaultValue: "0xFF201203")
|
||||
String get customWarningCardColorDark;
|
||||
|
||||
@StringSetting(id: 1081, defaultValue: "0xFFFF54A1")
|
||||
@StringSetting(id: 1079, defaultValue: "0xFFFF54A1")
|
||||
String get customErrorAccentColorLight;
|
||||
|
||||
@StringSetting(id: 1082, defaultValue: "0xFFFF54A1")
|
||||
@StringSetting(id: 1080, defaultValue: "0xFFFF54A1")
|
||||
String get customErrorAccentColorDark;
|
||||
|
||||
@StringSetting(id: 1083, defaultValue: "0xFF8F1B4F")
|
||||
@StringSetting(id: 1081, defaultValue: "0xFF8F1B4F")
|
||||
String get customErrorTextColorLight;
|
||||
|
||||
@StringSetting(id: 1084, defaultValue: "0xFFF59EC5")
|
||||
@StringSetting(id: 1082, defaultValue: "0xFFF59EC5")
|
||||
String get customErrorTextColorDark;
|
||||
|
||||
@StringSetting(id: 1085, defaultValue: "0xFFFADCE9")
|
||||
@StringSetting(id: 1083, defaultValue: "0xFFFADCE9")
|
||||
String get customErrorCardColorLight;
|
||||
|
||||
@StringSetting(id: 1086, defaultValue: "0xFF1E030F")
|
||||
@StringSetting(id: 1084, defaultValue: "0xFF1E030F")
|
||||
String get customErrorCardColorDark;
|
||||
|
||||
@StringSetting(
|
||||
id: 1087,
|
||||
id: 1085,
|
||||
defaultValue: "[\"0xFFFAFFF0\",\"0xFFE8F7C8\"]",
|
||||
)
|
||||
String get customBackgroundGradientLight;
|
||||
|
||||
@StringSetting(
|
||||
id: 1088,
|
||||
id: 1086,
|
||||
defaultValue: "[\"0xFF0D1202\",\"0xFF1A2405\"]",
|
||||
)
|
||||
String get customBackgroundGradientDark;
|
||||
|
||||
@@ -45,50 +45,48 @@ class SettingsRegistry {
|
||||
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 customGradeColor5 = StringSetting(id: 1048, defaultValue: "0xFF22CCAD");
|
||||
static const customGradeColor4 = StringSetting(id: 1049, defaultValue: "0xFF92EA3B");
|
||||
static const customGradeColor3 = StringSetting(id: 1050, defaultValue: "0xFFF9CF00");
|
||||
static const customGradeColor2 = StringSetting(id: 1051, defaultValue: "0xFFFFA046");
|
||||
static const customGradeColor1 = StringSetting(id: 1052, defaultValue: "0xFFFF54A1");
|
||||
static const customAccentColorLight = StringSetting(id: 1053, defaultValue: "0xFFA7DC22");
|
||||
static const customAccentColorDark = StringSetting(id: 1054, defaultValue: "0xFFA7DC22");
|
||||
static const customBackgroundColorLight = StringSetting(id: 1055, defaultValue: "0xFFFAFFF0");
|
||||
static const customBackgroundColorDark = StringSetting(id: 1056, defaultValue: "0xFF0D1202");
|
||||
static const customCardColorLight = StringSetting(id: 1057, defaultValue: "0xFFF3FBDE");
|
||||
static const customCardColorDark = StringSetting(id: 1058, defaultValue: "0xFF141905");
|
||||
static const customButtonColorLight = StringSetting(id: 1059, defaultValue: "0xFFFEFFFD");
|
||||
static const customButtonColorDark = StringSetting(id: 1060, defaultValue: "0xFF20290B");
|
||||
static const customSecondaryColorLight = StringSetting(id: 1061, defaultValue: "0xFF6E8F1B");
|
||||
static const customSecondaryColorDark = StringSetting(id: 1062, defaultValue: "0xFFCBEE71");
|
||||
static const customTextColorLight = StringSetting(id: 1063, defaultValue: "0xFF394C0A");
|
||||
static const customTextColorDark = StringSetting(id: 1064, defaultValue: "0xFFEAF7CC");
|
||||
static const customTextSecondaryColorLight = StringSetting(id: 1065, defaultValue: "0xCC394C0A");
|
||||
static const customTextSecondaryColorDark = StringSetting(id: 1066, defaultValue: "0xB3EAF7CC");
|
||||
static const customTextTertiaryColorLight = StringSetting(id: 1067, defaultValue: "0x80394C0A");
|
||||
static const customTextTertiaryColorDark = StringSetting(id: 1068, defaultValue: "0x80EAF7CC");
|
||||
static const customShadowColorLight = StringSetting(id: 1069, defaultValue: "0x33647E22");
|
||||
static const customShadowColorDark = StringSetting(id: 1070, defaultValue: "0x26CBEE71");
|
||||
static const customSuccessColorLight = StringSetting(id: 1071, defaultValue: "0xFF92EA3B");
|
||||
static const customSuccessColorDark = StringSetting(id: 1072, defaultValue: "0xFF92EA3B");
|
||||
static const customWarningAccentColorLight = StringSetting(id: 1073, defaultValue: "0xFFFFA046");
|
||||
static const customWarningAccentColorDark = StringSetting(id: 1074, defaultValue: "0xFFFFA046");
|
||||
static const customWarningTextColorLight = StringSetting(id: 1075, defaultValue: "0xFF8F531B");
|
||||
static const customWarningTextColorDark = StringSetting(id: 1076, defaultValue: "0xFFF0B37A");
|
||||
static const customWarningCardColorLight = StringSetting(id: 1077, defaultValue: "0xFFFAEBDC");
|
||||
static const customWarningCardColorDark = StringSetting(id: 1078, defaultValue: "0xFF201203");
|
||||
static const customErrorAccentColorLight = StringSetting(id: 1079, defaultValue: "0xFFFF54A1");
|
||||
static const customErrorAccentColorDark = StringSetting(id: 1080, defaultValue: "0xFFFF54A1");
|
||||
static const customErrorTextColorLight = StringSetting(id: 1081, defaultValue: "0xFF8F1B4F");
|
||||
static const customErrorTextColorDark = StringSetting(id: 1082, defaultValue: "0xFFF59EC5");
|
||||
static const customErrorCardColorLight = StringSetting(id: 1083, defaultValue: "0xFFFADCE9");
|
||||
static const customErrorCardColorDark = StringSetting(id: 1084, defaultValue: "0xFF1E030F");
|
||||
static const customBackgroundGradientLight = StringSetting(id: 1085, defaultValue: "[\"0xFFFAFFF0\",\"0xFFE8F7C8\"]");
|
||||
static const customBackgroundGradientDark = StringSetting(id: 1086, 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, 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,
|
||||
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, 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,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -135,8 +133,6 @@ extension SettingsAccessors on SettingsRepository {
|
||||
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);
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
import 'dart:async';
|
||||
|
||||
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/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/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 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 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),
|
||||
);
|
||||
}
|
||||
@@ -1,213 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
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)}';
|
||||
|
||||
/// pulls this account's own theme down, so signing in on another device
|
||||
/// brings the theme along. 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;
|
||||
|
||||
final vault = computeVault(token);
|
||||
final remote = await api.fetchTheme(vault);
|
||||
if (remote == null) return;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
final id = stored?.themeId ?? syncedThemeId(vault);
|
||||
final model = (stored ?? UserThemeModel())
|
||||
..themeId = id
|
||||
..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 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}';
|
||||
|
||||
// only take the colors over while the user is still on a built-in theme
|
||||
final selected = settings.get(SettingsRegistry.selectedThemeId);
|
||||
if (isBuiltinThemeId(selected) || selected == id) {
|
||||
await settings.setSilently(SettingsRegistry.selectedThemeId, id);
|
||||
await applyThemeCode(settings, remote.code);
|
||||
}
|
||||
} catch (e) {
|
||||
logger.warning('[ThemeSync] fetch 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 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 {
|
||||
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 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;
|
||||
} 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,9 +1,6 @@
|
||||
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';
|
||||
@@ -16,7 +13,6 @@ 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 {
|
||||
@@ -33,7 +29,6 @@ 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(),
|
||||
@@ -53,18 +48,7 @@ class WidgetCacheHelper {
|
||||
final colors = style != null
|
||||
? _colorsMap(style)
|
||||
: (existingColors ?? _defaultColors());
|
||||
String? languageCode;
|
||||
try {
|
||||
final lang = Settings.language.value;
|
||||
languageCode = lang == AppLanguage.auto
|
||||
? ui.PlatformDispatcher.instance.locale.languageCode
|
||||
: lang.name;
|
||||
} catch (_) {}
|
||||
return {
|
||||
'colors': colors,
|
||||
'timetable': timetableJson,
|
||||
if (languageCode != null) 'language': languageCode,
|
||||
};
|
||||
return {'colors': colors, 'timetable': timetableJson};
|
||||
}
|
||||
|
||||
static Map<String, dynamic> toAndroidWidgetJson(
|
||||
|
||||
1
firka/lib/l10n
Submodule
1
firka/lib/l10n
Submodule
Submodule firka/lib/l10n added at 44801bea9c
@@ -1,447 +0,0 @@
|
||||
{
|
||||
"restart_title": "App neu starten",
|
||||
"restart_body": "Klicke hier, um die App zu öffnen.",
|
||||
"loginBtn": "Login mit E-Kréta",
|
||||
"privacyLabel": "Datenschutzerklärung",
|
||||
"title1": "Alles auf einen Blick",
|
||||
"subtitle1": "Oben auf der Startseite findest du nützliche Informationen zu deinem Tag.",
|
||||
"title2": "Hier finden deine Fächer Platz",
|
||||
"subtitle2": "Hier findest du Statistiken, bevorstehende Prüfungen und sogar deine Noten aus früheren Schuljahren.",
|
||||
"title3": "Individuell anpassbarer Stundenplan",
|
||||
"subtitle3": "Wähle auf der Stundenplanseite aus, was du sehen möchtest, und schalte Tests, Hausaufgaben, Pausen und Freistunden ein oder aus.",
|
||||
"title4": "Viele Extras, die du in Kreta niemals finden wirst",
|
||||
"subtitle4": "",
|
||||
"yesterday": "Gestern",
|
||||
"today": "Heute",
|
||||
"tomorrow": "Morgen",
|
||||
"debug_screen": "Entwicklermenü",
|
||||
"settings_screen": "Einstellungen",
|
||||
"home": "Startseite",
|
||||
"grades": "Noten",
|
||||
"timetable": "Stundenplan",
|
||||
"other": "Andere",
|
||||
"refreshing": "Daten werden aktualisiert...",
|
||||
"reauth": "Login notwendig",
|
||||
"api_error": "Kréta API Fehler",
|
||||
"pairing": "Koppel deine Uhr",
|
||||
"pairing_description": "Möchtest du diese Uhr mit der Firka App koppeln?\nNach der Kopplung kannst du deinen Stundenplan, neue Noten, Tests und Aufgaben einsehen.",
|
||||
"cancel": "Abbrechen",
|
||||
"save": "Speichern",
|
||||
"okay": "Okay",
|
||||
"pair": "Kopplung",
|
||||
"beta_title": "Firka - öffentliche Beta",
|
||||
"beta_body": "Die Anwendung befindet sich noch in der Entwicklung; einige Funktionen sind möglicherweise noch nicht fertiggestellt, funktionieren nicht richtig oder weisen Fehler auf.",
|
||||
"good_morning": "Guten Morgen, {p}!",
|
||||
"@good_morning": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"good_day": "Guten Tag, {p}!",
|
||||
"@good_day": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"n_left_subtitle": "Halte durch, es sind nur noch {n} Stunden übrig!",
|
||||
"@n_left_subtitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"suffering_almost_over_subtitle": "Du hast es fast geschafft. Pass weiterhin bei deinem Lehrer gut auf.",
|
||||
"school_ending": "Bist du nervös, {p}?",
|
||||
"@school_ending": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tomorrow_subtitle": "So sieht dein morgiger Tag aus.",
|
||||
"good_afternoon": "Guten Nachmittag, {p}!",
|
||||
"@good_afternoon": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"good_night": "Guten Abend, {p}!",
|
||||
"@good_night": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"starting_soon": "Deine erste Unterrichtstunde beginnt gleich!",
|
||||
"starting_hour": "Stunde",
|
||||
"starting_hour_plural": "Stunden",
|
||||
"starting_min": "Minute",
|
||||
"starting_min_plural": "Minuten",
|
||||
"starting_sec": "Sekunde",
|
||||
"starting_sec_plural": "Sekunden",
|
||||
"subjects": "Fächer",
|
||||
"your_subjects": "Deine Fächer",
|
||||
"data": "Details",
|
||||
"subject_avg": "Notendurchschnitt",
|
||||
"subject_avg_rounded": "Notendurchschnitt nach Rundung",
|
||||
"class_avg": "Klassendurchschnitt",
|
||||
"class_n": "Wöchentliche Stundenzahl",
|
||||
"tt_no_classes_l1": "Diese Woche hast du keinen Unterricht!",
|
||||
"tt_no_classes_l2": "Yippee!",
|
||||
"class_dismissed": "Abgesagte Unterrichtsstunde",
|
||||
"class_substitution": "Vertretung",
|
||||
"lesson_subject": "Thema der Stunde",
|
||||
"tt_settings_toast": "Stundenplan Einstellungen",
|
||||
"tt_settings_toast_lesson_nos": "Anzahl von Stunden",
|
||||
"tt_settings_toast_lesson_tests": "Tests & Sonstiges",
|
||||
"tt_settings_toast_lesson_breaks": "Pausen",
|
||||
"a_week": "A Woche",
|
||||
"b_week": "B Woche",
|
||||
"stats_date": "Datum",
|
||||
"stats_created_at": "Erstellt am",
|
||||
"stats_last_mod": "Zuletzt bearbeitet",
|
||||
"s_developer": "Entwicklereinstellungen",
|
||||
"s_stats_for_nerds": "Statistiken für Nerds",
|
||||
"s_settings": "Einstellungen",
|
||||
"s_a": "Applikation",
|
||||
"s_ag": "Allgemein",
|
||||
"s_ag_bell_delay": "Glockenverzögerung",
|
||||
"s_ag_rounding": "Standardmäßige Rundung",
|
||||
"s_customization": "Personalisierung",
|
||||
"s_ag_r1": "1 → 2",
|
||||
"s_ag_r2": "2 → 3",
|
||||
"s_ag_r3": "3 → 4",
|
||||
"s_ag_r4": "4 → 5",
|
||||
"s_ag_class_avg_on_graph": "Klassendurchschnitt in der Grafik",
|
||||
"s_ag_navbar": "Navigationsleiste",
|
||||
"s_ag_left_handed_mode": "Linkshänder Modus",
|
||||
"s_ag_language_header": "Sprache",
|
||||
"s_ag_language_auto": "Automatisch",
|
||||
"s_ag_language_hu": "Ungarisch",
|
||||
"s_ag_language_en": "Englisch",
|
||||
"s_ag_language_de": "Deutsch",
|
||||
"s_c": "Personalisierung",
|
||||
"s_c_icon_header": "App Symbole",
|
||||
"s_c_replace_icon": "Symbol ersetzen",
|
||||
"s_ci_icon_header": "App Symbol",
|
||||
"s_ci_warning_header": "[!] Im Debug-Modus funktioniert das Ändern des Symbols nicht",
|
||||
"s_ci_icon_subtitle": "Such dir ein hübsches App-Symbol aus, wenn du das grüne satt hast.",
|
||||
"s_ci_icon_g1": "Catboy domain",
|
||||
"s_ci_icon_g2": "Filc-Stift",
|
||||
"s_ci_icon_g3": "Nostalgie",
|
||||
"s_ci_icon_g4": "Neu gedacht",
|
||||
"s_ci_icon_g5": "Referenz",
|
||||
"s_ci_icon_g6": "Weihnachtslogo-Wettbewerb 2024",
|
||||
"s_ci_icon_g6_desc": "Von @emilia6_6",
|
||||
"s_ci_icon_g7": "Pride",
|
||||
"s_ci_icon_g8": "Pride ",
|
||||
"s_c_theme_header": "Thema",
|
||||
"s_c_theme_auto": "Automatisch",
|
||||
"s_c_theme_light": "Hell",
|
||||
"s_c_theme_dark": "Dunkel",
|
||||
"s_ci_child_protection": "Kinderschutz",
|
||||
"ic_ace": "Asexuell",
|
||||
"ic_ace_f": "Asexuell",
|
||||
"ic_bi": "Bisexuell",
|
||||
"ic_bi_f": "Bisexuell",
|
||||
"ic_cactus": "Kaktusgarten",
|
||||
"ic_cc": "Kreative Wolke",
|
||||
"ic_enby": "Nicht-binär",
|
||||
"ic_enby_f": "Nicht-binär",
|
||||
"ic_fidesz": "Orange",
|
||||
"ic_filc": "Filc Tagebuch",
|
||||
"ic_filco": "Filc . O",
|
||||
"ic_galaxy": "Galaxie",
|
||||
"ic_gay": "Schwul",
|
||||
"ic_gay_f": "Schwul",
|
||||
"ic_half_firka_2": "Revolution",
|
||||
"ic_kreta": "eFirka",
|
||||
"ic_lesb": "Lesbisch",
|
||||
"ic_lesb_f": "Lesbisch",
|
||||
"ic_lgbtq": "LGBTQ+",
|
||||
"ic_lgbtq_f": "LGBTQ+",
|
||||
"ic_lgbtqp": "Progression",
|
||||
"ic_lgbtqp_f": "Progression",
|
||||
"ic_lidl": "Einkaufen",
|
||||
"ic_mkkp": "Freikarten",
|
||||
"ic_nuke": "Nuklear",
|
||||
"ic_modern": "Modern",
|
||||
"ic_o1g": "Orbán ist ein Arschloch",
|
||||
"ic_old": "Domain David",
|
||||
"ic_original": "Original",
|
||||
"ic_paper": "Papier",
|
||||
"ic_pear": "Birne",
|
||||
"ic_pixel": "Pixel",
|
||||
"ic_pixelized": "Verpixelt",
|
||||
"ic_pride": "Weltraumregenbogen",
|
||||
"ic_proto": "Prototyp",
|
||||
"ic_refilc": "reFilc",
|
||||
"ic_refulc": "firk’a",
|
||||
"ic_repont": "Fünfzig Forint",
|
||||
"ic_szivacs": "Schwamm",
|
||||
"ic_tisza": "Árad a firka",
|
||||
"ic_trans": "Trans",
|
||||
"ic_trans_f": "Trans",
|
||||
"ic_void_icon": "Leere",
|
||||
"ic_xmas1": "Liste der Bösen",
|
||||
"ic_xmas2": "Geschenk",
|
||||
"ic_xmas3": "FirWeihnachten",
|
||||
"wear_phone_unpaired": "Deine Uhr ist nicht mit deinem Handy gekoppelt!",
|
||||
"wear_phone_disconnected": "Deine Uhr ist nicht mit deinem Handy verbunden!",
|
||||
"wear_pairing_request_sent": "Die Kopplung läuft, öffne die App auf deinem Smartphone",
|
||||
"wear_pairing_check_phone": "Setze die Kopplung auf deinem Smartphone fort",
|
||||
"wear_try_again": "Erneut versuchen",
|
||||
"breakTxt": "Pause",
|
||||
"empty_class": "Freistunde",
|
||||
"timeLeft": "{mins} Minuten übrig",
|
||||
"@timeLeft": {
|
||||
"placeholders": {
|
||||
"mins": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"noClasses": "Heute ist Schulfrei, ruh dich aus!",
|
||||
"noMoreClasses": "Du hast heute keinen Unterricht mehr",
|
||||
"firstIn": "Deine erste Stunde: {t}",
|
||||
"@firstIn": {
|
||||
"placeholders": {
|
||||
"t": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"wearTitle": "{n}. Stunde",
|
||||
"@wearTitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"view_subject_btn": "Fach anzeigen",
|
||||
"view_lesson_btn": "Stunde anzeigen",
|
||||
"date": "Datum",
|
||||
"tt_settings_toast_lesson_substitution": "Vertretungen",
|
||||
"tt_settings_toast_lesson_ab_timetable": "Zweiwöchiger Stundenplan",
|
||||
"s_ag_navbar_desc": "Wähle aus, was in der Navigationsleiste angezeigt werden soll, und ordne die Elemente an. Die übrigen Seiten sind über die Schaltfläche „Mehr“ erreichbar. Du kannst maximal 4 Seiten festlegen.",
|
||||
"s_ag_navbar_home": "Startseite",
|
||||
"s_ag_navbar_visible": "Erscheint",
|
||||
"s_ag_navbar_hidden": "Versteckt",
|
||||
"tests_tomorrow": "Du hast {tests} Prüfungen",
|
||||
"@tests_tomorrow": {
|
||||
"placeholders": {
|
||||
"tests": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"no_tests_tomorrow": "Du hast morgen keine Prüfungen",
|
||||
"get_ready": "Entspann dich und mach dich bereit für morgen",
|
||||
"mark_as_done": "Als erledigt markieren",
|
||||
"mark_as_not_done": "Als unvollständig markieren",
|
||||
"grade_teacherName": "Name des Lehrers: ",
|
||||
"grade_strValue": "Textbasierte Bewertung: ",
|
||||
"no_grades": "Du hast noch keine Noten für dieses Fach.",
|
||||
"unknown_teacher": "Unbekannter Lehrer",
|
||||
"s_your_account": "Dein Konto",
|
||||
"s_acc_kreta": "eKRÉTA Konto",
|
||||
"s_acc_add": "Neues Konto hinzufügen",
|
||||
"s_acc_logout": "Abmelden",
|
||||
"close": "Schließen",
|
||||
"licensesLabel": "Lizenzen",
|
||||
"tt_added": "Eingetragen: ",
|
||||
"happy_birthday": "Alles Gute zum Geburtstag, {p}!",
|
||||
"@happy_birthday": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"licenseDescription": "Lizenzen für die von der Applikation verwendeten externen Bibliotheken",
|
||||
"homework": "Hausaufgaben",
|
||||
"tt_non_instructional_day": "Unterrichtsfreier Schultag",
|
||||
"tt_public_holiday": "Feiertag",
|
||||
"tt_spring_break": "Frühlingsferien",
|
||||
"tt_winter_break": "Winterferien",
|
||||
"tt_autumn_break": "Herbstferien",
|
||||
"tt_instructional_day": "Unterrichtstag",
|
||||
"tt_first_semester_end": "Ende des ersten Semesters",
|
||||
"tt_holiday": "Ferien",
|
||||
"tt_rest_day": "Ruhetag",
|
||||
"tt_first_instructional_day": "Erster Schultag",
|
||||
"tt_last_instructional_day": "Letzter Schultag",
|
||||
"tt_last_instructional_day_graduates": "Letzter Schultag für die Absolventen",
|
||||
"tt_full_day_trip": "Ganztägiger Ausflug",
|
||||
"tt_quarter_end": "Quartalsende",
|
||||
"lessons_tomorrow": "{lessons} Stunden morgen",
|
||||
"@lessons_tomorrow": {
|
||||
"placeholders": {
|
||||
"lessons": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subject": "Fach",
|
||||
"grade_calculator": "Notenrechner",
|
||||
"grade_calculator_add": "Hinzufügen",
|
||||
"ghost_grade": "Geist-Note",
|
||||
"ghost_grades": "Geist-Noten",
|
||||
"gradesCount": "{count} Note(n)",
|
||||
"@gradesCount": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"overall_avg": "Gesamtdurchschnitt",
|
||||
"now": "Jetzt",
|
||||
"s_n": "Benachrichtigungen",
|
||||
"s_n_morning": "Morgendliche Benachrichtigung",
|
||||
"s_n_morning_time": "Zeitpunkt der Benachrichtigung vor Schulbeginn",
|
||||
"s_n_live_activity": "Live Aktivität",
|
||||
"s_n_test": "Testbenachrichtigung senden",
|
||||
"s_wear": "Wear OS",
|
||||
"s_wear_os_support": "Wear OS Unterstützung",
|
||||
"wearSyncNotificationTitle": "Mit Uhr synchronisieren",
|
||||
"wearSyncNotificationText": "Daten mit Uhr synchronisieren",
|
||||
"wear_sync_with_phone": "Öffne die Smartphone App, um die Synchronisierung durchzuführen",
|
||||
"wear_syncing": "Synchronisieren...",
|
||||
"la_privacy_header": "Datenschutzerklärung für Live Aktivität",
|
||||
"la_privacy_intro": "Um die Funktion „Live Aktivität“ nutzen zu können, müssen wir bestimmte Daten speichern und verarbeiten. Bitte lies dir die folgenden Informationen sorgfältig durch.",
|
||||
"la_privacy_section1_title": "Welche Daten speichern wir?",
|
||||
"la_privacy_section1_body": "Für den Betrieb von Live Aktivität speichern wir die folgenden Daten zusammen mit deiner Gerätekennung:\n\n• Gerätekennung (UUID)\n• Gerätetoken\n• Live-Aktivität-Push-Token\n• APNs-Push-Token\n• Geräte-Hash\n• Spracheinstellung\n• Glockenverzögerung\n\nDeine Stundenplandaten (Tabelle „lessons“) enthalten Folgendes:\n• Fach und Uhrzeit der Unterrichtsstunde\n• Name des Lehrers\n• Name des Raums\n• Nummer der Unterrichtsstunde\n• Thema der Unterrichtsstunde\n• Daten zur Vertretung\n• Kennzeichnung einer ausgefallenen Unterrichtsstunde\n\nDie zeitgesteuerten Benachrichtigungen (Tabelle „scheduled_notifications“) enthalten Folgendes:\n• ID\n• Geräte-ID\n• Zeitpunkt der Benachrichtigung\n• Status und Zeitpunkt der Übermittlung\n• Erstellungs- und Aktualisierungszeitpunkt",
|
||||
"la_privacy_section2_title": "Wie schützen wir deine Daten?",
|
||||
"la_privacy_section2_body": "Wir nehmen die Sicherheit deiner Daten ernst:\n\n• Alle Daten in den Tabellen „Geräte“ und „Stunden“ sind verschlüsselt\n• Die Daten werden auf einem sicheren Server gespeichert\n• Wir speichern die Daten nur so lange, wie es erforderlich ist",
|
||||
"la_privacy_section3_title": "Wie lange speichern wir die Daten?",
|
||||
"la_privacy_section3_body": "Die Speicherung der Daten ist auf einen minimalen Zeitraum beschränkt:\n\n• Live-Aktivität-Push-Token: Wird so lange gespeichert, wie du an diesem Tag Stunden hast (einschließlich des Zeitraums von zwei Stunden vor der ersten Stunde). Wenn du keine Stunden mehr hast, wird der Wert auf Null gesetzt.\n\n• Stundenplan-Daten: Sie werden nur für die Dauer der Stunden gespeichert und anschließend automatisch gelöscht. Am Freitag nach der letzten Stunde ist die Tabelle mit dem Stundenplan vollständig leer.\n\n• Gerätedaten (Token, Identifikatoren): Sie werden so lange gespeichert, wie die Live-Aktivität-Funktion aktiviert ist. Beim Deaktivieren der Funktion werden diese Daten sofort gelöscht.",
|
||||
"la_privacy_section4_title": "Wofür verwenden wir die Daten?",
|
||||
"la_privacy_section4_body": "Wir verwenden die Daten ausschließlich für den Betrieb der Live-Aktivität-Funktion:\n\n• Anzeige des Live-Stundenplans auf dem Sperrbildschirm\n• Versand von Push-Benachrichtigungen bei Stundenwechseln\n• Synchronisierung des Stundenplans auf deinem Gerät\n• Sicherstellung der Zustellung der Benachrichtigungen am Montagmorgen auch nach der wöchentlichen Datenbankbereinigung\n\nWir geben deine Daten nicht an Dritte weiter und verwenden sie nicht für Marketingzwecke.",
|
||||
"la_privacy_section5_title": "Deine Rechte",
|
||||
"la_privacy_section5_body": "Gemäß der DSGVO stehen dir folgende Rechte zu:\n\n• Recht auf Auskunft: Die Art der gespeicherten Daten kannst du in dieser Datenschutzerklärung einsehen.\n• Recht auf Löschung: Durch das Deaktivieren der Live-Aktivität-Funktion werden alle mit dieser Funktion verbundenen Daten (Geräte-IDs, Stundenplan) sofort und endgültig von unseren Servern gelöscht.\n• Recht auf Berichtigung: Die Änderung der Stundenplandaten erfolgt im Kréta-System durch die dazu berechtigten Personen (z. B. Lehrkräfte).\n• Widerspruchsrecht: Du kannst der Datenverarbeitung jederzeit widersprechen, indem du die Live-Aktivität-Funktion deaktivierst.",
|
||||
"la_privacy_footer": "Letzte Aktualisierung der Datenschutzerklärung: November 2025",
|
||||
"la_privacy_contact": "Hast du eine Frage? Schreib uns an support@firka.app.",
|
||||
"la_privacy_summary1": "Gerätetoken, Live-Aktivität-Token, Stundenplandaten",
|
||||
"la_privacy_summary2": "Verschlüsselte Speicherung, sichere Server",
|
||||
"la_privacy_summary3": "Die Daten werden automatisch gelöscht, sobald sie nicht mehr benötigt werden",
|
||||
"la_title": "Live Aktivität",
|
||||
"la_subtitle": "Live-Anzeige des Stundenplans auf dem Sperrbildschirm des Geräts",
|
||||
"la_privacy_title": "Datenschutzerklärung",
|
||||
"la_privacy_required": "Um Live Aktivität nutzen zu können, musst du der Datenschutzerklärung zustimmen",
|
||||
"la_learn_more": "Mehr dazu",
|
||||
"la_accept": "Ich stimme zu",
|
||||
"la_decline": "Ich lehne ab",
|
||||
"runningInDomainBrowser": "Domain-Browser",
|
||||
"copied": "Kopiert",
|
||||
"view_day_btn": "Tag anzeigen",
|
||||
"omission": "Abwesenheit",
|
||||
"omissions": "Abwesenheiten",
|
||||
"omission_state_excused": "Entschuldigt",
|
||||
"omission_state_unexcused": "Unentschuldigt",
|
||||
"omission_state_pending": "Ausstehend",
|
||||
"omissions_count": "{state, select, unexcused{{count} unentschuldigt} pending{{count} zu entschuldigen} other{{count}}} Fehlzeiten",
|
||||
"@omissions_count": {
|
||||
"placeholders": {
|
||||
"state": {
|
||||
"type": "String"
|
||||
},
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_beta_warning": "Beta-Warnung",
|
||||
"s_ag_privacy_ever_declined": "Datenschutz zuvor abgelehnt",
|
||||
"s_c_tab_appearance": "App-Design",
|
||||
"s_c_tab_subjects": "Fächer",
|
||||
"s_c_tab_fonts": "Schriftarten",
|
||||
"s_c_my_themes": "Meine Themes",
|
||||
"s_c_manage_subjects": "Fächer verwalten",
|
||||
"s_c_change_app_icon": "App-Icon ändern",
|
||||
"s_c_colors_header": "Farben",
|
||||
"s_c_grade_colors_header": "Notenfarben",
|
||||
"s_c_title_style_header": "Titelstil",
|
||||
"s_c_title_weight_header": "Titelstärke",
|
||||
"s_c_title_weight_subtitle": "Wird nicht von allen Schriftarten unterstützt",
|
||||
"s_c_title_weight_thin": "Dünn",
|
||||
"s_c_title_weight_thick": "Fett",
|
||||
"s_c_capitalization_header": "Groß-/Kleinschreibung",
|
||||
"s_c_capitalization_lower": "kleinbuchstaben",
|
||||
"s_c_capitalization_normal": "Normal",
|
||||
"s_c_capitalization_upper": "GROSSBUCHSTABEN",
|
||||
"s_c_change": "Ändern",
|
||||
"s_c_customize": "Anpassen",
|
||||
"s_c_themes_current": "Aktuell",
|
||||
"s_c_themes_own": "Eigene",
|
||||
"s_c_themes_downloaded": "Heruntergeladen",
|
||||
"s_c_themes_share_current": "Aktuelles Theme teilen",
|
||||
"s_c_themes_create_new": "Neues Theme erstellen",
|
||||
"s_c_themes_import": "Theme importieren",
|
||||
"s_c_themes_use": "Verwenden",
|
||||
"s_c_themes_continue": "Weiter",
|
||||
"s_c_themes_own_label": "Eigenes Theme",
|
||||
"s_c_themes_imported_label": "Importiertes Theme",
|
||||
"s_c_themes_builtin_label": "Integriertes Theme",
|
||||
"s_c_themes_builtin_name": "Standard",
|
||||
"s_c_themes_create_title": "Neues Theme erstellen",
|
||||
"s_c_themes_create_subtitle": "Gib einen Namen für das Theme ein",
|
||||
"s_c_themes_create_placeholder": "Themename",
|
||||
"s_c_themes_delete_title": "Theme löschen",
|
||||
"s_c_themes_delete_subtitle": "Möchtest du dieses Theme wirklich löschen? Diese Aktion kann rückgängig gemacht werden.",
|
||||
"s_c_themes_delete_confirm": "Löschen",
|
||||
"s_about": "Über die App",
|
||||
"s_extras": "Extras",
|
||||
"s_other": "Sonstiges",
|
||||
"grade_weight_x1": "einfache Gewichtung",
|
||||
"grade_weight_x2": "doppelte Gewichtung",
|
||||
"grade_weight_x3": "dreifache Gewichtung",
|
||||
"grade_weight_x4": "vierfache Gewichtung",
|
||||
"grade_weight_x5": "fünffache Gewichtung",
|
||||
"grade_weight_percent": "{percent}%ige Gewichtung",
|
||||
"@grade_weight_percent": {
|
||||
"placeholders": {
|
||||
"percent": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"surprise_grade_rank_5": "LEGENDÄR",
|
||||
"surprise_grade_rank_4": "AUSGEZEICHNET",
|
||||
"surprise_grade_rank_3": "OKAY",
|
||||
"surprise_grade_rank_2": "SCHWACH",
|
||||
"surprise_grade_rank_1": "KATASTROPHE",
|
||||
"new_grades_card": "Du hast neue Noten",
|
||||
"s_notifications": "Benachrichtigungen",
|
||||
"s_sticker_map": "Stickerkarte",
|
||||
"s_qr_reader": "QR-Code-Scanner",
|
||||
"s_feedback": "Feedback",
|
||||
"s_a_desc": "Navigation, Sprache, Glocke, Rundung",
|
||||
"s_c_desc": "Notenfarben, Thema, App-Symbol",
|
||||
"s_todo": "túdú: program this",
|
||||
"s_surprise_grades": "Überraschungsnoten",
|
||||
"s_seasonal_icons": "Saisonale App-Symbole",
|
||||
"s_uwu_mode": "UwU-Modus",
|
||||
"s_calendar_sync": "Kalendersynchronisierung",
|
||||
"s_save_grades": "Noten speichern",
|
||||
"s_welcome_msg": "Begrüßungsnachricht",
|
||||
"s_extras_desc": "Überraschungsnoten, Kalendersynchronisierung",
|
||||
"s_notifications_desc": "Noten, Stundenplanänderungen, Fehlzeiten",
|
||||
"s_n_all": "Alle",
|
||||
"s_n_grades": "Neue Noten",
|
||||
"s_n_homework_tests": "Hausaufgaben & Prüfungen",
|
||||
"s_n_absences": "Fehlzeiten",
|
||||
"s_n_lessons": "Stunden",
|
||||
"s_n_messages": "Nachrichten",
|
||||
"s_n_by_subject": "Nach Fach"
|
||||
}
|
||||
@@ -1,585 +0,0 @@
|
||||
{
|
||||
"restart_title": "Restart application",
|
||||
"restart_body": "Click here to open the app again.",
|
||||
"loginBtn": "Login with E-Kréta",
|
||||
"privacyLabel": "Privacy policy",
|
||||
"title1": "Know everything at a glance",
|
||||
"subtitle1": "You can see useful info about your day on the top of your home screen.",
|
||||
"title2": "Your classes fit here comfortably",
|
||||
"subtitle2": "See statistics, upcoming tests, and even your grades from previous school years.",
|
||||
"title3": "Customizable timetable",
|
||||
"subtitle3": "Decide what you want to see on your timetable page. Turn tests, assignments, breaks, and even free periods on or off.",
|
||||
"title4": "Many extras you will never find in Kréta",
|
||||
"subtitle4": "",
|
||||
"yesterday": "Yesterday",
|
||||
"today": "Today",
|
||||
"tomorrow": "Tomorrow",
|
||||
"debug_screen": "Developer options",
|
||||
"settings_screen": "Settings",
|
||||
"home": "Home",
|
||||
"grades": "Grades",
|
||||
"timetable": "Timetable",
|
||||
"other": "Other",
|
||||
"refreshing": "Refreshing...",
|
||||
"reauth": "Reauthentication required",
|
||||
"api_error": "Kréta API error",
|
||||
"pairing": "Pair your watch",
|
||||
"pairing_description": "Would you like to pair this watch with the Firka app?\nAfter pairing, you will be able to see your timetable, new grades, tests and tasks.",
|
||||
"cancel": "Cancel",
|
||||
"save": "Save",
|
||||
"okay": "Okay",
|
||||
"pair": "Pair",
|
||||
"beta_title": "Firka - Public Beta",
|
||||
"beta_body": "The application is still in development; some features may be unfinished, not work correctly, or be buggy.",
|
||||
"good_morning": "Good morning, {p}!",
|
||||
"@good_morning": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"good_day": "Good day, {p}!",
|
||||
"@good_day": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"n_left_subtitle": "Hang in there, there's only {n} lessons left!",
|
||||
"@n_left_subtitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"suffering_almost_over_subtitle": "You're almost free. Keep paying attention to your teacher.",
|
||||
"school_ending": "Are you anxious, {p}?",
|
||||
"@school_ending": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tomorrow_subtitle": "Your next day",
|
||||
"good_afternoon": "Good afternoon, {p}!",
|
||||
"@good_afternoon": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"good_night": "Good evening, {p}!",
|
||||
"@good_night": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"starting_soon": "Your first lesson will start soon!",
|
||||
"starting_hour": "hour",
|
||||
"starting_hour_plural": "hours",
|
||||
"starting_min": "min",
|
||||
"starting_min_plural": "mins",
|
||||
"starting_sec": "sec",
|
||||
"starting_sec_plural": "secs",
|
||||
"subjects": "Subjects",
|
||||
"your_subjects": "Your Subjects",
|
||||
"data": "Info",
|
||||
"subject_avg": "Subject average",
|
||||
"subject_avg_rounded": "Subject average after rounding",
|
||||
"class_avg": "Class average",
|
||||
"class_n": "Weekly lesson number",
|
||||
"tt_no_classes_l1": "You don't have any lessons on this day!",
|
||||
"tt_no_classes_l2": "Yippee!",
|
||||
"class_dismissed": "Dismissed lesson",
|
||||
"catalog_lesson_btn": "Catalog lesson",
|
||||
"catalog_lesson_title": "Catalog lesson",
|
||||
"catalog_lesson_topic_hint": "Topic covered",
|
||||
"catalog_lesson_submit_btn": "Save",
|
||||
"class_substitution": "Substitution",
|
||||
"lesson_subject": "Lesson subject",
|
||||
"tt_settings_toast": "Timetable settings",
|
||||
"tt_settings_toast_lesson_nos": "Number of lessons",
|
||||
"tt_settings_toast_lesson_tests": "Tests & others",
|
||||
"tt_settings_toast_lesson_breaks": "Breaks",
|
||||
"a_week": "A week",
|
||||
"b_week": "B week",
|
||||
"stats_date": "Date",
|
||||
"stats_created_at": "Created at",
|
||||
"stats_last_mod": "Last modified",
|
||||
"s_developer": "Developer settings",
|
||||
"s_stats_for_nerds": "Stats for nerds",
|
||||
"s_settings": "Settings",
|
||||
"s_a": "Application",
|
||||
"s_ag": "General",
|
||||
"s_ag_bell_delay": "Bell delay",
|
||||
"s_ag_rounding": "Default rounding",
|
||||
"s_shortened_timetable": "Shortened timetable",
|
||||
"s_shortened_timetable_enable": "Enable shortened timetable",
|
||||
"s_shortened_timetable_start": "Starts",
|
||||
"s_shortened_timetable_end": "Ends",
|
||||
"s_shortened_timetable_no_lessons": "No lessons to show in the cache. Refresh the timetable and try again.",
|
||||
"s_shortened_timetable_reset": "Reset to original times",
|
||||
"s_shortened_timetable_invalid_time": "The end must be after the start",
|
||||
"s_shortened_timetable_lesson": "Lesson {n}",
|
||||
"@s_shortened_timetable_lesson": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_customization": "Customization",
|
||||
"s_ag_r1": "1 → 2",
|
||||
"s_ag_r2": "2 → 3",
|
||||
"s_ag_r3": "3 → 4",
|
||||
"s_ag_r4": "4 → 5",
|
||||
"s_ag_class_avg_on_graph": "Class's average on the graph",
|
||||
"s_ag_navbar": "Navbar",
|
||||
"s_ag_left_handed_mode": "Left-handed mode",
|
||||
"s_ag_language_header": "Language",
|
||||
"s_ag_language_auto": "Automatic",
|
||||
"s_ag_language_hu": "Hungarian",
|
||||
"s_ag_language_en": "English",
|
||||
"s_ag_language_de": "German",
|
||||
"s_c": "Customization",
|
||||
"s_c_icon_header": "App icons",
|
||||
"s_c_replace_icon": "Replace icon",
|
||||
"s_ci_icon_header": "App icon",
|
||||
"s_ci_warning_header": "[!] Changing the app's icon in debug mode won't work",
|
||||
"s_ci_icon_subtitle": "Choose a pretty app icon if you're already tired of the green one.",
|
||||
"s_ci_icon_g1": "Catboy domain",
|
||||
"s_ci_icon_g2": "Felt pen",
|
||||
"s_ci_icon_g3": "Nostalgia",
|
||||
"s_ci_icon_g4": "Reimagined",
|
||||
"s_ci_icon_g5": "Reference",
|
||||
"s_ci_icon_g6": "Christmas logo competition 2024",
|
||||
"s_ci_icon_g6_desc": "By @emilia6_6",
|
||||
"s_ci_icon_g7": "Pride",
|
||||
"s_ci_icon_g8": "Pride ",
|
||||
"s_c_theme_header": "Theme",
|
||||
"s_c_theme_auto": "Auto",
|
||||
"s_c_theme_light": "Light",
|
||||
"s_c_theme_dark": "Dark",
|
||||
"s_ci_child_protection": "Child protection",
|
||||
"ic_ace": "Asexual",
|
||||
"ic_ace_f": "Asexual",
|
||||
"ic_bi": "Bisexual",
|
||||
"ic_bi_f": "Bisexual",
|
||||
"ic_cactus": "Cactus grove",
|
||||
"ic_cc": "Creative Cloud",
|
||||
"ic_enby": "Non-binary",
|
||||
"ic_enby_f": "Non-binary",
|
||||
"ic_fidesz": "Fidesz",
|
||||
"ic_filc": "Firka",
|
||||
"ic_filco": "Filc . O",
|
||||
"ic_galaxy": "Galaxy",
|
||||
"ic_gay": "Gay",
|
||||
"ic_gay_f": "Gay",
|
||||
"ic_half_firka_2": "Revolution",
|
||||
"ic_kreta": "eFirka",
|
||||
"ic_lesb": "Lesbian",
|
||||
"ic_lesb_f": "Lesbian",
|
||||
"ic_lgbtq": "LGBTQ+",
|
||||
"ic_lgbtq_f": "LGBTQ+",
|
||||
"ic_lgbtqp": "Progression",
|
||||
"ic_lgbtqp_f": "Progression",
|
||||
"ic_lidl": "Shopping",
|
||||
"ic_mkkp": "Free grades",
|
||||
"ic_nuke": "Nuclear",
|
||||
"ic_modern": "Modern",
|
||||
"ic_o1g": "Orbán is a cunt",
|
||||
"ic_old": "Domain Dave",
|
||||
"ic_original": "Original",
|
||||
"ic_paper": "Paper",
|
||||
"ic_pear": "Pear",
|
||||
"ic_pixel": "Pixel",
|
||||
"ic_pixelized": "Pixelified",
|
||||
"ic_pride": "Space rainbow",
|
||||
"ic_proto": "Prototype",
|
||||
"ic_refilc": "reFilc",
|
||||
"ic_refulc": "firk'a",
|
||||
"ic_repont": "Repont",
|
||||
"ic_szivacs": "sponge",
|
||||
"ic_tisza": "árad a firka",
|
||||
"ic_trans": "Trans",
|
||||
"ic_trans_f": "Trans",
|
||||
"ic_void_icon": "Nothing",
|
||||
"ic_xmas1": "naughty list",
|
||||
"ic_xmas2": "gift",
|
||||
"ic_xmas3": "FirCristmas",
|
||||
"wear_phone_unpaired": "Your watch isn't paired with your phone!",
|
||||
"wear_phone_disconnected": "Your watch isn't connected to your phone!",
|
||||
"wear_pairing_request_sent": "Open the app on your phone",
|
||||
"wear_pairing_check_phone": "Check your phone",
|
||||
"wear_try_again": "Try again",
|
||||
"breakTxt": "Break",
|
||||
"empty_class": "Empty class",
|
||||
"timeLeft": "{mins, plural, =1{1 min left} other{{mins} mins left}}",
|
||||
"@timeLeft": {
|
||||
"placeholders": {
|
||||
"mins": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"noClasses": "School's out today, take it easy!",
|
||||
"noMoreClasses": "No more classes for you today",
|
||||
"firstIn": "First class in: {t}",
|
||||
"@firstIn": {
|
||||
"placeholders": {
|
||||
"t": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"wearTitle": "{n}. class",
|
||||
"@wearTitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"licensesLabel": "Licenses",
|
||||
"licenseDescription": "Licenses for external libraries used by the application",
|
||||
"view_subject_btn": "View subject",
|
||||
"date": "Time of the class",
|
||||
"tt_settings_toast_lesson_substitution": "Substitutions",
|
||||
"tt_settings_toast_lesson_ab_timetable": "Two-week class schedule",
|
||||
"s_ag_navbar_desc": "Choose which items appear in the navigation bar and arrange them. The other pages are accessible via the “More” button. You can display up to 4 pages.",
|
||||
"s_ag_navbar_home": "Home",
|
||||
"s_ag_navbar_visible": "Appears",
|
||||
"happy_birthday": "Happy birthday, {p}!",
|
||||
"@happy_birthday": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tests_tomorrow": "You'll have {tests} exams",
|
||||
"@tests_tomorrow": {
|
||||
"placeholders": {
|
||||
"tests": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"no_tests_tomorrow": "You don't have any exams tomorrow",
|
||||
"get_ready": "Relax, and prepare for tomorrow",
|
||||
"homework": "Homework",
|
||||
"mark_as_done": "Mark as finished",
|
||||
"mark_as_not_done": "Mark as unfinished",
|
||||
"grade_teacherName": "Teacher's name: ",
|
||||
"grade_strValue": "Text-based rating: ",
|
||||
"no_grades": "You don't have any grades for this subject yet.",
|
||||
"unknown_teacher": "Unknown teacher",
|
||||
"tt_added": "Created at: ",
|
||||
"view_lesson_btn": "View lesson",
|
||||
"s_ag_navbar_hidden": "Hidden",
|
||||
"s_your_account": "Your account",
|
||||
"s_acc_kreta": "eKRÉTA accounts",
|
||||
"s_acc_accounts": "Accounts",
|
||||
"s_neptun_title": "ELTE Neptun",
|
||||
"s_neptun_user_hint": "ID (e.g. abc123)",
|
||||
"s_neptun_password_hint": "Password",
|
||||
"s_neptun_totp_code_hint": "Enter the 6-digit code",
|
||||
"s_neptun_code_by_email": "code sent by e-mail",
|
||||
"s_neptun_confirm_code": "Confirm code",
|
||||
"s_neptun_login_btn": "Log in",
|
||||
"s_neptun_seed_hint": "Authenticator key (optional)",
|
||||
"s_neptun_seed_help": "Enter your 2FA authenticator's secret key. NOT the 6 digit code.",
|
||||
"s_neptun_login_with_elte": "Log in with ELTE Neptun",
|
||||
"s_neptun_seed_failed": "Automatic 2FA code generation failed — check your authenticator key.",
|
||||
"s_neptun_2fa_rejected": "2FA code rejected — if the code is correct, restart the login and enter a fresh code.",
|
||||
"s_neptun_login_failed": "Login failed",
|
||||
"s_acc_accounts": "Accounts",
|
||||
"s_acc_add": "Add new student account",
|
||||
"s_acc_add_teacher": "Add new teacher account",
|
||||
"s_acc_logout": "Log out",
|
||||
"close": "Close",
|
||||
"tt_non_instructional_day": "Non-instructional workday",
|
||||
"tt_public_holiday": "Non-instructional day",
|
||||
"tt_spring_break": "Spring break",
|
||||
"tt_winter_break": "Winter break",
|
||||
"tt_autumn_break": "Autumn break",
|
||||
"tt_instructional_day": "Instructional day",
|
||||
"tt_first_semester_end": "End of first semester",
|
||||
"tt_holiday": "Holiday",
|
||||
"tt_rest_day": "Rest day",
|
||||
"tt_first_instructional_day": "First instructional day",
|
||||
"tt_last_instructional_day": "Last instructional day",
|
||||
"tt_last_instructional_day_graduates": "Last instructional day for graduates",
|
||||
"tt_full_day_trip": "Full-day trip",
|
||||
"tt_quarter_end": "end of quarter",
|
||||
"lessons_tomorrow": "You'll have {lessons} lessons",
|
||||
"@lessons_tomorrow": {
|
||||
"placeholders": {
|
||||
"lessons": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subject": "Subject",
|
||||
"grade_calculator": "Grade calculator",
|
||||
"grade_calculator_add": "Add",
|
||||
"ghost_grade": "Ghost grade",
|
||||
"ghost_grades": "Ghost grades",
|
||||
"gradesCount": "{count} grade(s)",
|
||||
"@gradesCount": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"overall_avg": "Overall average",
|
||||
"now": "Now",
|
||||
"s_n": "Notifications",
|
||||
"s_n_morning": "Morning notification",
|
||||
"s_n_morning_time": "Time of notification before school",
|
||||
"s_n_live_activity": "Live Activity",
|
||||
"s_n_test": "Send test notification",
|
||||
"s_wear": "Wear OS",
|
||||
"s_wear_os_support": "Wear OS support",
|
||||
"wearSyncNotificationTitle": "Synchronize with watch",
|
||||
"wearSyncNotificationText": "Keep watch's data in sync",
|
||||
"wear_sync_with_phone": "Open the mobile app to sync",
|
||||
"wear_syncing": "Syncing...",
|
||||
"la_privacy_header": "Live Activity privacy policy",
|
||||
"la_privacy_intro": "We have to store and process certain data for use in the Live Activity function. Please, read the disclosure below.",
|
||||
"la_privacy_section1_title": "What data do we store?",
|
||||
"la_privacy_section1_body": "For the Live Activity to function, we store the below data with your device identifier:\n\n• Device Identifier (UUID)\n• Device token\n• Live Activity push token\n• APNs push token\n• Device hash\n• Language setting\n• Bell delay\n\nYour timetable data (lessons table) contains the following:\n• The subject and time of the lesson\n• The name of the teacher\n• The name of the classroom\n• Period number of the lesson\n• The topic of the lesson\n• Details of a substitution\n• Indication of dismissed lesson\n\nThe scheduled notifications (scheduled_notifications table) contains the following:\n• Identifier\n• Device identifier\n• Scheduled time\n• Status and time of notification\n• Time of creation and update",
|
||||
"la_privacy_section2_title": "How do we protect your data?",
|
||||
"la_privacy_section2_body": "We take the security of your data seriously:\n\n• The data in the \"devices\" and \"lessons\" tables are encrypted\n• We store the data on secure servers\n• We only store data for as long as we need it",
|
||||
"la_privacy_section3_title": "How long do we store data for?",
|
||||
"la_privacy_section3_body": "We store data for the least amount of time possible:\n\n• Live Activity push token: Only stored as long as you have lessons on the given day (including the 2-hour period before). If you don't have any lessons left, the value becomes zero.\n\n• Timetable data: Only stored for the length of the lessons and they're deleted automatically. On Fridays, the table containing the timetable will be completely empty after the last lesson.\n\n• Device data (token, identifiers): Stored for as long as the Live Activity function is enabled. This data gets deleted when disabling the function.",
|
||||
"la_privacy_section4_title": "What do we use the data for?",
|
||||
"la_privacy_section4_body": "We use the data exclusively for the Live Activity function:\n\n• Displaying a live timetable on your lockscreen\n• Sending push notifications when lessons change\n• Synchronizing the timetable on your device\n• Ensuring the Monday morning notifications get delivered even after the weekly database-clearing.\n\nWe don't share your data with third parties and we don't use them for marketing.",
|
||||
"la_privacy_section5_title": "Your rights",
|
||||
"la_privacy_section5_body": "Under the GDPR, you have the following rights:\n\n• Right of access: You can view the type of data stored in this privacy policy.\n• Right to erasure: By disabling the Live Activity function, all data related to the function (device identifiers, timetable) will be immediately and permanently deleted from our servers.\n• Right to modification: The timetable data is modified in the Kréta system by authorized persons (e.g. teachers).\n• Right to object: You can object to data processing at any time by disabling the Live Activity function.",
|
||||
"la_privacy_footer": "This privacy policy was last updated on: November 2025",
|
||||
"la_privacy_contact": "Do you have any questions? Contact us at support@firka.app.",
|
||||
"la_privacy_summary1": "Device tokens, Live Activity tokens, timetable data",
|
||||
"la_privacy_summary2": "Encrypted storage, secure servers",
|
||||
"la_privacy_summary3": "Data is automatically deleted when it is no longer needed.",
|
||||
"la_title": "Live Activity",
|
||||
"la_subtitle": "Show your schedule live on your device's lock screen",
|
||||
"la_privacy_title": "Privacy Policy",
|
||||
"la_privacy_required": "To use Live Activity you must accept the privacy policy",
|
||||
"la_learn_more": "Learn More",
|
||||
"la_accept": "Accept",
|
||||
"la_decline": "Decline",
|
||||
"runningInDomainBrowser": "Domain Böngésző",
|
||||
"copied": "Copied",
|
||||
"view_day_btn": "View day",
|
||||
"omission": "Absence",
|
||||
"omissions": "Absences",
|
||||
"omission_state_excused": "Verified",
|
||||
"omission_state_unexcused": "Unverified",
|
||||
"omission_state_pending": "Pending",
|
||||
"omissions_count": "{state, select, unexcused{{count} igazolatlan} pending{{count} igazolandó} other{{count}}} hiányzás",
|
||||
"@omissions_count": {
|
||||
"placeholders": {
|
||||
"state": {
|
||||
"type": "String"
|
||||
},
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_beta_warning": "Beta warning",
|
||||
"s_ag_privacy_ever_declined": "Privacy previously declined",
|
||||
"s_c_tab_appearance": "Appearance",
|
||||
"s_c_tab_subjects": "Subjects",
|
||||
"s_c_tab_fonts": "Fonts",
|
||||
"s_c_my_themes": "My themes",
|
||||
"s_c_manage_subjects": "Manage subjects",
|
||||
"s_c_change_app_icon": "Change app icon",
|
||||
"s_c_colors_header": "Colors",
|
||||
"s_c_grade_colors_header": "Grade colors",
|
||||
"s_c_colors_theme_header": "Colors & Theme",
|
||||
"s_c_slot_accent": "Accent",
|
||||
"s_c_slot_background": "Background",
|
||||
"s_c_slot_cards": "Cards",
|
||||
"s_c_slot_buttons": "Buttons",
|
||||
"s_c_mode_both": "Both",
|
||||
"s_c_slot_secondary": "Secondary",
|
||||
"s_c_slot_text": "Text",
|
||||
"s_c_slot_text_secondary": "Secondary text",
|
||||
"s_c_slot_text_tertiary": "Tertiary text",
|
||||
"s_c_slot_shadow": "Shadow",
|
||||
"s_c_slot_success": "Success",
|
||||
"s_c_slot_warning": "Warning",
|
||||
"s_c_slot_warning_text": "Warning text",
|
||||
"s_c_slot_warning_card": "Warning card",
|
||||
"s_c_slot_error": "Error",
|
||||
"s_c_slot_error_text": "Error text",
|
||||
"s_c_slot_error_card": "Error card",
|
||||
"s_c_title_style_header": "Title style",
|
||||
"s_c_title_weight_header": "Title weight",
|
||||
"s_c_title_weight_subtitle": "Not all fonts support this",
|
||||
"s_c_title_weight_thin": "Thin",
|
||||
"s_c_title_weight_thick": "Bold",
|
||||
"s_c_capitalization_header": "Capitalization",
|
||||
"s_c_capitalization_lower": "lowercase",
|
||||
"s_c_capitalization_normal": "Normal",
|
||||
"s_c_capitalization_upper": "UPPERCASE",
|
||||
"s_c_change": "Change",
|
||||
"s_c_customize": "Customize",
|
||||
"s_c_themes_current": "Current",
|
||||
"s_c_themes_own": "Mine",
|
||||
"s_c_themes_downloaded": "Downloaded",
|
||||
"s_c_themes_share_current": "Share current theme",
|
||||
"s_c_themes_create_new": "Create new theme",
|
||||
"s_c_themes_import": "Import theme",
|
||||
"s_c_themes_use": "Use",
|
||||
"s_c_themes_continue": "Continue",
|
||||
"s_c_themes_own_label": "My theme",
|
||||
"s_c_themes_imported_label": "Imported theme",
|
||||
"s_c_themes_builtin_label": "Built-in theme",
|
||||
"s_c_themes_builtin_name": "Default",
|
||||
"s_c_themes_create_title": "Create new theme",
|
||||
"s_c_themes_create_subtitle": "Enter a name for the theme",
|
||||
"s_c_themes_create_placeholder": "Theme name",
|
||||
"s_c_themes_delete_title": "Delete theme",
|
||||
"s_c_themes_delete_subtitle": "Are you sure you want to delete this theme? This action can be undone.",
|
||||
"s_c_themes_delete_confirm": "Delete",
|
||||
"s_about": "About",
|
||||
"s_extras": "Extras",
|
||||
"s_other": "Other",
|
||||
"grade_weight_x1": "single weight",
|
||||
"grade_weight_x2": "double weight",
|
||||
"grade_weight_x3": "triple weight",
|
||||
"grade_weight_x4": "quadruple weight",
|
||||
"grade_weight_x5": "quintuple weight",
|
||||
"grade_weight_percent": "{percent}% weight",
|
||||
"@grade_weight_percent": {
|
||||
"placeholders": {
|
||||
"percent": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"surprise_grade_rank_5": "LEGENDARY",
|
||||
"surprise_grade_rank_4": "EXCELLENT",
|
||||
"surprise_grade_rank_3": "OKAY",
|
||||
"surprise_grade_rank_2": "WEAK",
|
||||
"surprise_grade_rank_1": "CATASTROPHE",
|
||||
"new_grades_card": "You have new grades",
|
||||
"s_notifications": "Notifications",
|
||||
"s_sticker_map": "Sticker map",
|
||||
"s_qr_reader": "QR code reader",
|
||||
"s_feedback": "Feedback",
|
||||
"s_a_desc": "Navigation, language, bell, rounding",
|
||||
"s_c_desc": "Grade colors, theme, app icon",
|
||||
"s_todo": "túdú: program this",
|
||||
"s_surprise_grades": "Surprise grades",
|
||||
"s_seasonal_icons": "Seasonal app icons",
|
||||
"s_uwu_mode": "UwU mode",
|
||||
"s_calendar_sync": "Calendar sync",
|
||||
"s_save_grades": "Save grades",
|
||||
"s_welcome_msg": "Welcome message",
|
||||
"s_extras_desc": "Surprise grades, calendar sync",
|
||||
"s_notifications_desc": "Grades, timetable changes, absences",
|
||||
"s_notif_push_enabled": "Enable push notifications",
|
||||
"s_notif_delivery_method_header": "Delivery method",
|
||||
"s_notif_delivery_auto": "Automatic",
|
||||
"s_notif_delivery_fcm": "Firebase Cloud Messaging (FCM)",
|
||||
"s_notif_delivery_alarm": "Alarm (background check)",
|
||||
"s_notif_wakeup_interval_header": "Check frequency",
|
||||
"s_notif_wakeup_hourly": "Hourly",
|
||||
"s_notif_wakeup_two_hourly": "Every 2 hours",
|
||||
"s_notif_categories_header": "Categories",
|
||||
"s_notif_grades": "Grades",
|
||||
"s_notif_homework_tests": "Homework & tests",
|
||||
"s_notif_absences": "Absences",
|
||||
"s_notif_lessons": "Lesson changes",
|
||||
"s_notif_lessons_cancelled": "Cancelled lessons",
|
||||
"s_notif_lessons_substituted": "Substitutions",
|
||||
"s_notif_messages": "Messages",
|
||||
"s_progress_notification": "Progress-centric notification",
|
||||
"s_progress_notification_desc": "Live progress notification for lessons and breaks throughout the school day",
|
||||
"progress_notif_channel_name": "School day progress",
|
||||
"progress_notif_channel_desc": "Live progress notification for today's lessons and breaks",
|
||||
"progress_notif_lesson_title": "Lesson {number}: {name}",
|
||||
"@progress_notif_lesson_title": {
|
||||
"placeholders": {
|
||||
"number": {"type": "String"},
|
||||
"name": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_substitution": " (Substitution)",
|
||||
"progress_notif_case1_text": "In {minutes} min ({timeRange}){room}{substitution}{remaining}",
|
||||
"@progress_notif_case1_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"},
|
||||
"timeRange": {"type": "String"},
|
||||
"room": {"type": "String"},
|
||||
"substitution": {"type": "String"},
|
||||
"remaining": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_case2_lesson_text": "{minutes} min left ({timeRange}){room}{substitution}{remaining}",
|
||||
"@progress_notif_case2_lesson_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"},
|
||||
"timeRange": {"type": "String"},
|
||||
"room": {"type": "String"},
|
||||
"substitution": {"type": "String"},
|
||||
"remaining": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_case2_break_title": "Break",
|
||||
"progress_notif_case2_break_text": "{minutes} min left{remaining}",
|
||||
"@progress_notif_case2_break_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"},
|
||||
"remaining": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_critical_text": "{minutes}m",
|
||||
"@progress_notif_critical_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_remaining_lessons_one": " - 1 lesson remaining",
|
||||
"progress_notif_remaining_lessons_other": " - {count} lessons remaining",
|
||||
"@progress_notif_remaining_lessons_other": {
|
||||
"placeholders": {
|
||||
"count": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"s_fcm_status_title": "FCM status",
|
||||
"s_fcm_status_initialized": "Initialized",
|
||||
"s_fcm_status_not_initialized": "Not initialized",
|
||||
"s_fcm_status_token_present": "Token present",
|
||||
"s_fcm_status_token_missing": "No token",
|
||||
"s_fcm_status_permission_label": "Notification permission",
|
||||
"s_fcm_status_permission_granted": "Granted",
|
||||
"s_fcm_status_permission_denied": "Denied",
|
||||
"s_fcm_status_permission_unknown": "Unknown",
|
||||
"s_fcm_status_topic_label": "Subscribed topic",
|
||||
"s_fcm_status_last_refresh_label": "Last token refresh",
|
||||
"s_fcm_status_last_refresh_never": "Never",
|
||||
"s_fcm_status_refresh_button": "Refresh",
|
||||
"s_fcm_notify_on_message": "Notify on FCM message",
|
||||
"s_fcm_test_notifications_title": "Test notifications",
|
||||
"s_fcm_test_notifications_multi_title": "Simulate multi-account",
|
||||
"s_n_all": "All",
|
||||
"s_n_grades": "New grades",
|
||||
"s_n_homework_tests": "Homework & Tests",
|
||||
"s_n_absences": "Absences",
|
||||
"s_n_lessons": "Lessons",
|
||||
"s_n_messages": "Messages",
|
||||
"s_n_by_subject": "By subject"
|
||||
}
|
||||
@@ -1,585 +0,0 @@
|
||||
{
|
||||
"restart_title": "Alkalmazás újraindítása",
|
||||
"restart_body": "Kattints ide az alkalmazás megnyitásához.",
|
||||
"loginBtn": "Bejelentkezés E-Kréta fiókkal",
|
||||
"privacyLabel": "Adatvédelmi tájékoztató",
|
||||
"title1": "Egy pillantásra tudhatsz mindent",
|
||||
"subtitle1": "A főoldal tetején hasznos információkat láthatsz a napodról.",
|
||||
"title2": "A tantárgyaid kényelmesen elférnek itt",
|
||||
"subtitle2": "Láss statisztikákat, közelgő számonkéréseket, és akár a régebbi tanéves jegyeidet is.",
|
||||
"title3": "Személyre szabható órarend",
|
||||
"subtitle3": "Válaszd ki, mit szeretnél látni az órarend oldalon, kapcsold ki vagy be a számonkéréseket, házi feladatokat, szüneteket és lyukas órákat is.",
|
||||
"title4": "Sok extra dolog, amit a Krétában sosem fogsz megtalálni",
|
||||
"subtitle4": "",
|
||||
"yesterday": "Tegnap",
|
||||
"today": "Ma",
|
||||
"runningInDomainBrowser": "Doméjn böngésző",
|
||||
"tomorrow": "Holnap",
|
||||
"debug_screen": "Fejlesztői menü",
|
||||
"settings_screen": "Beállítások",
|
||||
"home": "Kezdőlap",
|
||||
"grades": "Jegyek",
|
||||
"timetable": "Órarend",
|
||||
"other": "Több",
|
||||
"refreshing": "Adatok frissítése...",
|
||||
"reauth": "Bejelentkezés szükséges",
|
||||
"api_error": "Kréta API hiba",
|
||||
"pairing": "Óra párosítása",
|
||||
"pairing_description": "Szeretnéd ezt az órát párosítani a Firka appal?\nPárosítás láthatod az órarendet, és a legújabb jegyeidet, számonkéréseidet, és a feladataidat.",
|
||||
"cancel": "Mégse",
|
||||
"save": "Mentés",
|
||||
"okay": "Rendben",
|
||||
"pair": "Párosítás",
|
||||
"beta_title": "Firka - Publikus béta",
|
||||
"beta_body": "Az alkalmazás fejlesztés alatt áll; egyes funkciók hibásan működhetnek, nem működnek, vagy még nem készültek el.",
|
||||
"good_morning": "Jó reggelt, {p}!",
|
||||
"@good_morning": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"happy_birthday": "Boldog születésnapot, {p}!",
|
||||
"@happy_birthday": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"good_day": "Szép napot, {p}!",
|
||||
"@good_day": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"n_left_subtitle": "Tarts ki, már csak {n} óra!",
|
||||
"@n_left_subtitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"suffering_almost_over_subtitle": "Mindjárt szabad vagy. Figyelj oda a tanárra.",
|
||||
"school_ending": "Izgulsz, {p}?",
|
||||
"@school_ending": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tomorrow_subtitle": "Itt a holnapi napod.",
|
||||
"good_afternoon": "Szép délutánt, {p}!",
|
||||
"@good_afternoon": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"good_night": "Szép estét, {p}!",
|
||||
"@good_night": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tests_tomorrow": "{tests} dolgozatod lesz",
|
||||
"@tests_tomorrow": {
|
||||
"placeholders": {
|
||||
"tests": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"no_tests_tomorrow": "Holnap nincs dolgozatod",
|
||||
"get_ready": "Pihend ki magad, és készülj fel",
|
||||
"homework": "Házi feladat",
|
||||
"mark_as_done": "Megjelölés befejezettként",
|
||||
"mark_as_not_done": "Megjelölés befejezetlenként",
|
||||
"starting_soon": "Hamarosan kezdődik az első órád!",
|
||||
"starting_hour": "óra",
|
||||
"starting_hour_plural": "óra",
|
||||
"starting_min": "perc",
|
||||
"starting_min_plural": "perc",
|
||||
"starting_sec": "másodperc",
|
||||
"starting_sec_plural": "másodperc",
|
||||
"subjects": "Tantárgyak",
|
||||
"your_subjects": "Tantárgyaid",
|
||||
"data": "Adatok",
|
||||
"subject_avg": "Tantárgyi átlag",
|
||||
"subject_avg_rounded": "Tantárgyi átlag kerekítés után",
|
||||
"class_avg": "Osztályátlag",
|
||||
"class_n": "Heti óraszám",
|
||||
"grade_teacherName": "Tanár neve: ",
|
||||
"grade_strValue": "Szöveges értékelés: ",
|
||||
"no_grades": "Ebből a tantárgyból még nincsen jegyed.",
|
||||
"unknown_teacher": "Ismeretlen tanár",
|
||||
"tt_no_classes_l1": "Ezen a napon nincsenek óráid!",
|
||||
"tt_no_classes_l2": "Yippee!",
|
||||
"tt_non_instructional_day": "Tanítás nélküli munkanap",
|
||||
"tt_public_holiday": "Munkaszüneti nap",
|
||||
"tt_spring_break": "Tavaszi szünet",
|
||||
"tt_winter_break": "Téli szünet",
|
||||
"tt_autumn_break": "Őszi szünet",
|
||||
"tt_instructional_day": "Tanítási nap",
|
||||
"tt_first_semester_end": "Első félév vége",
|
||||
"tt_holiday": "Ünnepnap",
|
||||
"tt_rest_day": "Pihenőnap",
|
||||
"tt_first_instructional_day": "Első tanítási nap",
|
||||
"tt_last_instructional_day": "Utolsó tanítási nap",
|
||||
"tt_last_instructional_day_graduates": "Utolsó tanítási nap a végzős évfolyamokon",
|
||||
"tt_full_day_trip": "Egész napos kirándulás",
|
||||
"tt_quarter_end": "negyedév vége",
|
||||
"tt_added": "Létrehozva: ",
|
||||
"class_dismissed": "Elmaradt óra",
|
||||
"catalog_lesson_btn": "Óra naplózása",
|
||||
"catalog_lesson_title": "Óra naplózása",
|
||||
"catalog_lesson_topic_hint": "Az óra témája",
|
||||
"catalog_lesson_submit_btn": "Mentés",
|
||||
"class_substitution": "Helyettesítés",
|
||||
"lesson_subject": "Az óra tárgya",
|
||||
"view_subject_btn": "Tantárgy megtekintése",
|
||||
"view_lesson_btn": "Óra megtekintése",
|
||||
"view_day_btn": "Nap megtekintése",
|
||||
"date": "Időpont",
|
||||
"tt_settings_toast": "Órarend beállításai",
|
||||
"tt_settings_toast_lesson_nos": "Óraszámok",
|
||||
"tt_settings_toast_lesson_tests": "Számonkérések & egyéb",
|
||||
"tt_settings_toast_lesson_breaks": "Szünetek",
|
||||
"tt_settings_toast_lesson_substitution": "Helyettesítések",
|
||||
"tt_settings_toast_lesson_ab_timetable": "Kéthetes órarend",
|
||||
"a_week": "A hét",
|
||||
"b_week": "B hét",
|
||||
"stats_date": "Dátum",
|
||||
"stats_created_at": "Létrehozva",
|
||||
"stats_last_mod": "Utoljára módosítva",
|
||||
"s_developer": "Fejlesztői beállítások",
|
||||
"s_stats_for_nerds": "Extra információ mutatása",
|
||||
"s_beta_warning": "Béta figyelmeztetés",
|
||||
"s_settings": "Beállítások",
|
||||
"s_a": "Alkalmazás",
|
||||
"s_ag": "Általános",
|
||||
"s_ag_bell_delay": "Csengő eltolódása",
|
||||
"s_ag_rounding": "Alapértelmezett kerekítés",
|
||||
"s_shortened_timetable": "Rövidített órák",
|
||||
"s_shortened_timetable_enable": "Rövidített órák engedélyezése",
|
||||
"s_shortened_timetable_start": "Kezdete",
|
||||
"s_shortened_timetable_end": "Vége",
|
||||
"s_shortened_timetable_no_lessons": "Nincs megjeleníthető óra a gyorsítótárban. Frissítsd az órarendet, majd próbáld újra.",
|
||||
"s_shortened_timetable_reset": "Eredeti időpontok visszaállítása",
|
||||
"s_shortened_timetable_invalid_time": "A végének a kezdete után kell lennie",
|
||||
"s_shortened_timetable_lesson": "{n}. óra",
|
||||
"@s_shortened_timetable_lesson": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_customization": "Személyre szabás",
|
||||
"s_ag_r1": "1 → 2",
|
||||
"s_ag_r2": "2 → 3",
|
||||
"s_ag_r3": "3 → 4",
|
||||
"s_ag_r4": "4 → 5",
|
||||
"s_ag_class_avg_on_graph": "Osztályátlag a grafikonon",
|
||||
"s_ag_navbar": "Navigációs sáv",
|
||||
"s_ag_navbar_desc": "Válaszd ki, mik jelenjenek meg a navigációs sávon, és rendezd el őket. A többi oldal elérhető a “több” gombon keresztül. Maximum 4 oldalt tudsz kitűzni.",
|
||||
"s_ag_navbar_home": "Kezdőlap",
|
||||
"s_ag_navbar_visible": "Megjelenik",
|
||||
"s_ag_navbar_hidden": "Elrejtve",
|
||||
"s_ag_left_handed_mode": "Balkezes mód",
|
||||
"s_ag_privacy_ever_declined": "Adatvédelem korábban elutasítva",
|
||||
"s_ag_language_header": "Nyelv",
|
||||
"s_ag_language_auto": "Automatikus",
|
||||
"s_ag_language_hu": "Magyar",
|
||||
"s_ag_language_en": "Angol",
|
||||
"s_ag_language_de": "Német",
|
||||
"s_c": "Személyre szabás",
|
||||
"s_c_icon_header": "App ikonok",
|
||||
"s_c_replace_icon": "Ikon cseréje",
|
||||
"s_ci_icon_header": "App ikon",
|
||||
"s_ci_warning_header": "[!] Debug módban nem fog működni az ikon megváltoztatása",
|
||||
"s_ci_icon_subtitle": "Válassz egy csodaszép app ikont, ha már unod a zöldet.",
|
||||
"s_ci_icon_g1": "Catboy domain",
|
||||
"s_ci_icon_g2": "Filctoll",
|
||||
"s_ci_icon_g3": "Nosztalgia",
|
||||
"s_ci_icon_g4": "Újragondolt",
|
||||
"s_ci_icon_g5": "Referencia",
|
||||
"s_ci_icon_g6": "Karácsonyi logó verseny 2024",
|
||||
"s_ci_icon_g6_desc": "@emilia6_6 által",
|
||||
"s_ci_icon_g7": "Pride",
|
||||
"s_ci_icon_g8": "Pride ",
|
||||
"s_c_theme_header": "Téma",
|
||||
"s_c_theme_auto": "Automatikus",
|
||||
"s_c_theme_light": "Világos",
|
||||
"s_c_theme_dark": "Sötét",
|
||||
"s_c_tab_appearance": "App kinézete",
|
||||
"s_c_tab_subjects": "Tantárgyak",
|
||||
"s_c_tab_fonts": "Betűk",
|
||||
"s_c_my_themes": "Témáim",
|
||||
"s_c_manage_subjects": "Tantárgyak kezelése",
|
||||
"s_c_change_app_icon": "App ikon cseréje",
|
||||
"s_c_colors_header": "Színek",
|
||||
"s_c_grade_colors_header": "Jegyek színei",
|
||||
"s_c_colors_theme_header": "Színek & téma",
|
||||
"s_c_slot_accent": "Accent",
|
||||
"s_c_slot_background": "Háttér",
|
||||
"s_c_slot_cards": "Kártyák",
|
||||
"s_c_slot_buttons": "Gombok",
|
||||
"s_c_mode_both": "Mindkettő",
|
||||
"s_c_slot_secondary": "Másodlagos",
|
||||
"s_c_slot_text": "Szöveg",
|
||||
"s_c_slot_text_secondary": "Másodlagos szöveg",
|
||||
"s_c_slot_text_tertiary": "Harmadlagos szöveg",
|
||||
"s_c_slot_shadow": "Árnyék",
|
||||
"s_c_slot_success": "Siker",
|
||||
"s_c_slot_warning": "Figyelmeztetés",
|
||||
"s_c_slot_warning_text": "Figyelmeztető szöveg",
|
||||
"s_c_slot_warning_card": "Figyelmeztető kártya",
|
||||
"s_c_slot_error": "Hiba",
|
||||
"s_c_slot_error_text": "Hiba szöveg",
|
||||
"s_c_slot_error_card": "Hiba kártya",
|
||||
"s_c_title_style_header": "Címek stílusa",
|
||||
"s_c_title_weight_header": "Címek vastagsága",
|
||||
"s_c_title_weight_subtitle": "Ezt nem mindegyik betűtípus támogatja",
|
||||
"s_c_title_weight_thin": "Vékony",
|
||||
"s_c_title_weight_thick": "Vastag",
|
||||
"s_c_capitalization_header": "Kapitalizáció",
|
||||
"s_c_capitalization_lower": "kisbetűs",
|
||||
"s_c_capitalization_normal": "Normál",
|
||||
"s_c_capitalization_upper": "NAGYBETŰS",
|
||||
"s_c_change": "Csere",
|
||||
"s_c_customize": "Személyre szabás",
|
||||
"s_c_themes_current": "Jelenlegi",
|
||||
"s_c_themes_own": "Saját",
|
||||
"s_c_themes_downloaded": "Letöltött",
|
||||
"s_c_themes_share_current": "Jelenlegi téma megosztása",
|
||||
"s_c_themes_create_new": "Új téma létrehozása",
|
||||
"s_c_themes_import": "Téma importálása",
|
||||
"s_c_themes_use": "Használat",
|
||||
"s_c_themes_continue": "Folytatás",
|
||||
"s_c_themes_own_label": "Saját téma",
|
||||
"s_c_themes_imported_label": "Importált téma",
|
||||
"s_c_themes_builtin_label": "Beépített téma",
|
||||
"s_c_themes_builtin_name": "Alapértelmezett",
|
||||
"s_c_themes_create_title": "Új téma létrehozása",
|
||||
"s_c_themes_create_subtitle": "Add meg a téma nevét",
|
||||
"s_c_themes_create_placeholder": "A téma neve",
|
||||
"s_c_themes_delete_title": "Téma törlése",
|
||||
"s_c_themes_delete_subtitle": "Biztosan törölni szeretnéd ezt a témát? Ez a művelet visszavonható.",
|
||||
"s_c_themes_delete_confirm": "Törlés",
|
||||
"s_ci_child_protection": "Gyermekvédelem",
|
||||
"ic_ace": "Aszexuális",
|
||||
"ic_ace_f": "Aszexuális",
|
||||
"ic_bi": "Biszexuális",
|
||||
"ic_bi_f": "Biszexuális",
|
||||
"ic_cactus": "Kaktuszliget",
|
||||
"ic_cc": "Kreatív Felhő",
|
||||
"ic_enby": "Nembináris",
|
||||
"ic_enby_f": "Nembináris",
|
||||
"ic_fidesz": "Narancs",
|
||||
"ic_filc": "Filc Napló",
|
||||
"ic_filco": "Filc . O",
|
||||
"ic_galaxy": "Galaxis",
|
||||
"ic_gay": "Meleg",
|
||||
"ic_gay_f": "Meleg",
|
||||
"ic_half_firka_2": "Revolution",
|
||||
"ic_kreta": "eFIRKA",
|
||||
"ic_lesb": "Leszbikus",
|
||||
"ic_lesb_f": "Leszbikus",
|
||||
"ic_lgbtq": "LMGBTQ+",
|
||||
"ic_lgbtq_f": "LMGBTQ+",
|
||||
"ic_lgbtqp": "Progresszió",
|
||||
"ic_lgbtqp_f": "Progresszió",
|
||||
"ic_lidl": "Bevásárlás",
|
||||
"ic_mkkp": "Ingyen jegyek",
|
||||
"ic_nuke": "Nukleáris",
|
||||
"ic_modern": "Modern",
|
||||
"ic_o1g": "O1G",
|
||||
"ic_old": "Domain Dév Dévid",
|
||||
"ic_original": "Az eredeti",
|
||||
"ic_paper": "Papír",
|
||||
"ic_pear": "Körte",
|
||||
"ic_pixel": "Pixel",
|
||||
"ic_pixelized": "Pixelizált",
|
||||
"ic_pride": "Űrszívárvány",
|
||||
"ic_proto": "Prototípus",
|
||||
"ic_refilc": "reFilc",
|
||||
"ic_refulc": "firk’a",
|
||||
"ic_repont": "Ötven forint",
|
||||
"ic_szivacs": "Szivacs",
|
||||
"ic_tisza": "Árad a firka",
|
||||
"ic_trans": "Transz",
|
||||
"ic_trans_f": "Transz",
|
||||
"ic_void_icon": "Semmi",
|
||||
"ic_xmas1": "Rosszak listája",
|
||||
"ic_xmas2": "Ajándék",
|
||||
"ic_xmas3": "reKarácsony",
|
||||
"s_your_account": "Fiókod",
|
||||
"s_acc_kreta": "eKRÉTA Fiókok",
|
||||
"s_acc_accounts": "Fiókok",
|
||||
"s_neptun_title": "ELTE Neptun",
|
||||
"s_neptun_user_hint": "Azonosító (pl. abc123)",
|
||||
"s_neptun_password_hint": "Jelszó",
|
||||
"s_neptun_totp_code_hint": "Add meg a 6-jegyős kódot",
|
||||
"s_neptun_code_by_email": "e-mailben elküldve",
|
||||
"s_neptun_confirm_code": "Kód megerősítése",
|
||||
"s_neptun_login_btn": "Bejelentkezés",
|
||||
"s_neptun_seed_hint": "Hitelesítő kulcs (opcionális)",
|
||||
"s_neptun_seed_help": "Add meg a 2FA hitelesítőd titkos kulcsát. NEM a 6 jegyű kódot.",
|
||||
"s_neptun_login_with_elte": "Bejelentkezés ELTE Neptunnal",
|
||||
"s_neptun_seed_failed": "A 2FA automatikus kódgenerálás sikertelen — ellenőrizd a hitelesítő kulcsot.",
|
||||
"s_neptun_2fa_rejected": "A 2FA kódot elutasította a rendszer — ha a kód helyes, indítsd újra a bejelentkezést és adj meg egy friss kódot.",
|
||||
"s_neptun_login_failed": "Bejelentkezés sikertelen",
|
||||
"s_acc_accounts": "Fiókok",
|
||||
"s_acc_add": "Új diákfiók hozzáadása",
|
||||
"s_acc_add_teacher": "Új tanárfiók hozzáadása",
|
||||
"s_acc_logout": "Kijelentkezés",
|
||||
"close": "Bezárás",
|
||||
"s_about": "Névjegy",
|
||||
"licensesLabel": "Licencek",
|
||||
"licenseDescription": "Az alkalmazás által használt külső könyvtárak licencei",
|
||||
"wear_phone_unpaired": "Az órád nincs párosítva a telefonoddal!",
|
||||
"wear_phone_disconnected": "Az órád nincs csatlakoztatva a telefonoddal!",
|
||||
"wear_pairing_request_sent": "Párosítás folyamatban, nyisd meg az appot a telefonodon",
|
||||
"wear_pairing_check_phone": "Folytasd a párosítást a telefonodon",
|
||||
"wear_try_again": "Újra",
|
||||
"copied": "Másolva",
|
||||
"breakTxt": "Szünet",
|
||||
"empty_class": "Lyukasóra",
|
||||
"timeLeft": "Még {mins} perc",
|
||||
"@timeLeft": {
|
||||
"placeholders": {
|
||||
"mins": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"noClasses": "Nincs ma iskola, pihend ki magad!",
|
||||
"noMoreClasses": "Nincs több órád ma",
|
||||
"firstIn": "Első órád: {t}",
|
||||
"@firstIn": {
|
||||
"placeholders": {
|
||||
"t": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"wearTitle": "{n}. óra",
|
||||
"@wearTitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lessons_tomorrow": "{lessons} órád lesz",
|
||||
"@lessons_tomorrow": {
|
||||
"placeholders": {
|
||||
"lessons": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subject": "Tantárgy",
|
||||
"grade_calculator": "Jegy kalkulátor",
|
||||
"grade_calculator_add": "Hozzáadás",
|
||||
"ghost_grade": "Szellem jegy",
|
||||
"ghost_grades": "Szellem jegyek",
|
||||
"gradesCount": "{count} jegy",
|
||||
"@gradesCount": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"overall_avg": "Összesített átlag",
|
||||
"now": "Most",
|
||||
"s_n": "Értesítések",
|
||||
"s_n_morning": "Reggeli értesítés",
|
||||
"s_n_morning_time": "Értesítés ideje iskola előtt",
|
||||
"s_n_live_activity": "Live Activity",
|
||||
"s_n_test": "Teszt értesítés küldése",
|
||||
"s_wear": "Wear OS",
|
||||
"s_wear_os_support": "Wear OS támogatás",
|
||||
"s_extras": "Extrák",
|
||||
"s_other": "Egyéb",
|
||||
"wearSyncNotificationTitle": "Szinkronizálás az órával",
|
||||
"wearSyncNotificationText": "Óra adatainak szinkronban tartása",
|
||||
"wear_sync_with_phone": "Nyisd meg a telefonos appot a szinkronizáláshoz",
|
||||
"wear_syncing": "Szinkronizálás...",
|
||||
"la_privacy_header": "Live Activity adatvédelmi tájékoztató",
|
||||
"la_privacy_intro": "A Live Activity funkció használatához bizonyos adatokat kell tárolnunk és feldolgoznunk. Kérjük, olvasd el figyelmesen az alábbi tájékoztatót.",
|
||||
"la_privacy_section1_title": "Milyen adatokat tárolunk?",
|
||||
"la_privacy_section1_body": "A Live Activity működéséhez az alábbi adatokat tároljuk eszközazonosítóddal együtt:\n\n• Eszköz azonosító (UUID)\n• Eszköz token\n• Live Activity push token\n• APNs push token\n• Eszköz hash\n• Nyelvi beállítás\n• Csengő eltolódása\n\nAz órarendi adataid (lessons tábla) a következőket tartalmazzák:\n• Óra tárgya és időpontja\n• Tanár neve\n• Terem neve\n• Óra sorszáma\n• Óra témája\n• Helyettesítés adatai\n• Elmaradt óra jelzése\n\nAz időzített értesítések (scheduled_notifications tábla) a következőket tartalmazzák:\n• Azonosító\n• Eszköz azonosító\n• Időzített időpont\n• Küldés állapota és ideje\n• Létrehozás és frissítés ideje",
|
||||
"la_privacy_section2_title": "Hogyan védjük az adataidat?",
|
||||
"la_privacy_section2_body": "Komolyan vesszük az adataid biztonságát:\n\n• A devices és lessons táblákban lévő összes adat titkosítva van\n• Az adatokat biztonságos szerveren tároljuk\n• Csak a szükséges időtartamig tároljuk az adatokat",
|
||||
"la_privacy_section3_title": "Meddig tároljuk az adatokat?",
|
||||
"la_privacy_section3_body": "Az adatok tárolása minimális időtartamra korlátozódik:\n\n• Live Activity push token: Addig van tárolva, amíg óráid vannak az adott napon (beleértve az első óra előtti 2 órás időszakot is). Ha nincs több órád, az érték null lesz.\n\n• Órarendi adatok: Csak az órák időtartamára tárolódnak, majd automatikusan törlődnek. Pénteken az utolsó óra után az órarendet tartalmazó tábla teljesen üres lesz.\n\n• Eszközadatok (token, azonosítók): Addig van tárolva, amíg a Live Activity funkció engedélyezve van. A funkció kikapcsolásakor ezek az adatok azonnal törlésre kerülnek.",
|
||||
"la_privacy_section4_title": "Mire használjuk az adatokat?",
|
||||
"la_privacy_section4_body": "Az adatokat kizárólag a Live Activity funkció működtetésére használjuk:\n\n• Élő órarend megjelenítése a lezárási képernyőn\n• Push értesítések küldése óraváltásokkor\n• Az órarend szinkronizálása az eszközödön\n• A hétfő reggeli értesítések kézbesítésének biztosítása a heti adatbázis-ürítés után is\n\nAz adataidat nem adjuk át harmadik félnek, és nem használjuk marketing célokra.",
|
||||
"la_privacy_section5_title": "Jogaid",
|
||||
"la_privacy_section5_body": "A GDPR alapján az alábbi jogokkal rendelkezel:\n\n• Hozzáférési jog: A tárolt adatok típusát ebben az adatvédelmi tájékoztatóban tekintheted meg.\n• Törlési jog: A Live Activity funkció kikapcsolásával minden, a funkcióhoz kapcsolódó adat (eszközazonosítók, órarend) azonnal és véglegesen törlődik a szervereinkről.\n• Módosítási jog: Az órarendi adatok módosítása a Kréta rendszerben történik, az arra jogosult személyek (pl. tanárok) által.\n• Tiltakozási jog: Az adatkezelés ellen bármikor tiltakozhatsz a Live Activity funkció kikapcsolásával.",
|
||||
"la_privacy_footer": "Az adatvédelmi tájékoztató utolsó frissítése: 2025. november",
|
||||
"la_privacy_contact": "Kérdésed van? Keress minket a support @firka.app címen.",
|
||||
"la_privacy_summary1": "Eszköz tokenek, Live Activity tokenek, órarendi adatok",
|
||||
"la_privacy_summary2": "Titkosított tárolás, biztonságos szerverek",
|
||||
"la_privacy_summary3": "Az adatok automatikusan törlődnek, ha már nincs rájuk szükség",
|
||||
"la_title": "Live Activity",
|
||||
"la_subtitle": "Az órarended élő megjelenítése az eszköz lezárási képernyőjén",
|
||||
"la_privacy_title": "Adatvédelmi tájékoztató",
|
||||
"la_privacy_required": "A Live Activity használatához el kell fogadnod az adatvédelmi tájékoztatót",
|
||||
"la_learn_more": "Bővebben",
|
||||
"la_accept": "Elfogadom",
|
||||
"la_decline": "Elutasítom",
|
||||
"omission": "Hiányzás",
|
||||
"omissions": "Hiányzások",
|
||||
"omission_state_excused": "Igazolt",
|
||||
"omission_state_unexcused": "Igazolatlan",
|
||||
"omission_state_pending": "Függőben",
|
||||
"omissions_count": "{state, select, unexcused{{count} igazolatlan} pending{{count} igazolandó} other{{count}}} hiányzás",
|
||||
"@omissions_count": {
|
||||
"placeholders": {
|
||||
"state": {
|
||||
"type": "String"
|
||||
},
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"grade_weight_x1": "egyszeres súllyal",
|
||||
"grade_weight_x2": "dupla súllyal",
|
||||
"grade_weight_x3": "tripla súllyal",
|
||||
"grade_weight_x4": "négyszeres súllyal",
|
||||
"grade_weight_x5": "ötszörös súllyal",
|
||||
"grade_weight_percent": "{percent}%-os súllyal",
|
||||
"@grade_weight_percent": {
|
||||
"placeholders": {
|
||||
"percent": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"surprise_grade_rank_5": "LEGENDÁS",
|
||||
"surprise_grade_rank_4": "KIVÁLÓ",
|
||||
"surprise_grade_rank_3": "RENDBEN",
|
||||
"surprise_grade_rank_2": "GYENGE",
|
||||
"surprise_grade_rank_1": "KATASZTRÓFA",
|
||||
"new_grades_card": "Új jegyeid vannak",
|
||||
"s_notifications": "Értesítések",
|
||||
"s_sticker_map": "Matrica térkép",
|
||||
"s_qr_reader": "QR-kód olvasó",
|
||||
"s_feedback": "Visszajelzés",
|
||||
"s_a_desc": "Navigáció, nyelv, csengő, kerekítés",
|
||||
"s_c_desc": "Jegyek színe, téma, app ikon",
|
||||
"s_todo": "túdú: program this",
|
||||
"s_surprise_grades": "Meglepetés jegyek",
|
||||
"s_seasonal_icons": "Szezonális app ikonok",
|
||||
"s_uwu_mode": "UwU mód",
|
||||
"s_calendar_sync": "Naptár szinkronizálás",
|
||||
"s_save_grades": "Jegyek mentése",
|
||||
"s_welcome_msg": "Üdvözlő üzenet",
|
||||
"s_extras_desc": "Meglepetés jegyek, naptár szinkronizálás",
|
||||
"s_notifications_desc": "Jegyek, órarend változások, hiányok",
|
||||
"s_notif_push_enabled": "Push értesítések engedélyezése",
|
||||
"s_notif_delivery_method_header": "Kézbesítési mód",
|
||||
"s_notif_delivery_auto": "Automatikus",
|
||||
"s_notif_delivery_fcm": "Firebase Cloud Messaging (FCM)",
|
||||
"s_notif_delivery_alarm": "Ébresztő (háttérellenőrzés)",
|
||||
"s_notif_wakeup_interval_header": "Ellenőrzési gyakoriság",
|
||||
"s_notif_wakeup_hourly": "Óránként",
|
||||
"s_notif_wakeup_two_hourly": "Kétóránként",
|
||||
"s_notif_categories_header": "Kategóriák",
|
||||
"s_notif_grades": "Jegyek",
|
||||
"s_notif_homework_tests": "Házi feladatok és dolgozatok",
|
||||
"s_notif_absences": "Hiányzások",
|
||||
"s_notif_lessons": "Órarendváltozások",
|
||||
"s_notif_lessons_cancelled": "Elmaradt órák",
|
||||
"s_notif_lessons_substituted": "Helyettesítések",
|
||||
"s_notif_messages": "Üzenetek",
|
||||
"s_progress_notification": "Folyamatjelző értesítés",
|
||||
"s_progress_notification_desc": "Élő folyamatjelző értesítés a tanítási nap óráiról és szüneteiről",
|
||||
"progress_notif_channel_name": "Tanítási nap folyamata",
|
||||
"progress_notif_channel_desc": "Élő értesítés a mai órák és szünetek állapotáról",
|
||||
"progress_notif_lesson_title": "{number}. óra: {name}",
|
||||
"@progress_notif_lesson_title": {
|
||||
"placeholders": {
|
||||
"number": {"type": "String"},
|
||||
"name": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_substitution": " (Helyettesítés)",
|
||||
"progress_notif_case1_text": "{minutes} perc múlva ({timeRange}){room}{substitution}{remaining}",
|
||||
"@progress_notif_case1_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"},
|
||||
"timeRange": {"type": "String"},
|
||||
"room": {"type": "String"},
|
||||
"substitution": {"type": "String"},
|
||||
"remaining": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_case2_lesson_text": "{minutes} perc van hátra ({timeRange}){room}{substitution}{remaining}",
|
||||
"@progress_notif_case2_lesson_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"},
|
||||
"timeRange": {"type": "String"},
|
||||
"room": {"type": "String"},
|
||||
"substitution": {"type": "String"},
|
||||
"remaining": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_case2_break_title": "Szünet",
|
||||
"progress_notif_case2_break_text": "{minutes} perc van hátra{remaining}",
|
||||
"@progress_notif_case2_break_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"},
|
||||
"remaining": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_critical_text": "{minutes}p",
|
||||
"@progress_notif_critical_text": {
|
||||
"placeholders": {
|
||||
"minutes": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"progress_notif_remaining_lessons_one": " - Még 1 óra van hátra",
|
||||
"progress_notif_remaining_lessons_other": " - Még {count} óra van hátra",
|
||||
"@progress_notif_remaining_lessons_other": {
|
||||
"placeholders": {
|
||||
"count": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"s_fcm_status_title": "FCM állapot",
|
||||
"s_fcm_status_initialized": "Inicializálva",
|
||||
"s_fcm_status_not_initialized": "Nincs inicializálva",
|
||||
"s_fcm_status_token_present": "Token megvan",
|
||||
"s_fcm_status_token_missing": "Nincs token",
|
||||
"s_fcm_status_permission_label": "Értesítési engedély",
|
||||
"s_fcm_status_permission_granted": "Engedélyezve",
|
||||
"s_fcm_status_permission_denied": "Elutasítva",
|
||||
"s_fcm_status_permission_unknown": "Ismeretlen",
|
||||
"s_fcm_status_topic_label": "Feliratkozott téma",
|
||||
"s_fcm_status_last_refresh_label": "Utolsó token frissítés",
|
||||
"s_fcm_status_last_refresh_never": "Még nem történt",
|
||||
"s_fcm_status_refresh_button": "Frissítés",
|
||||
"s_fcm_notify_on_message": "Értesítés FCM üzenetkor",
|
||||
"s_fcm_test_notifications_title": "Teszt értesítések",
|
||||
"s_fcm_test_notifications_multi_title": "Több fiók szimulálása",
|
||||
"s_n_all": "Összes",
|
||||
"s_n_grades": "Új jegyek",
|
||||
"s_n_homework_tests": "Feladatok & Számonkérések",
|
||||
"s_n_absences": "Hiányzások",
|
||||
"s_n_lessons": "Órák",
|
||||
"s_n_messages": "Üzenetek",
|
||||
"s_n_by_subject": "Tantárgyak szerint"
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,406 +0,0 @@
|
||||
{
|
||||
"tt_settings_toast_lesson_ab_timetable": "Dwutygodniowy plan lekcji",
|
||||
"restart_title": "Uruchom ponownie aplikację",
|
||||
"s_wear": "Wear OS",
|
||||
"s_ag_navbar_home": "Strona główna",
|
||||
"tt_holiday": "Dzień świąteczny",
|
||||
"pairing": "Łączenie lekcji",
|
||||
"s_c_replace_icon": "Zmiana ikony",
|
||||
"close": "Zamknij",
|
||||
"ghost_grade": "Szellem jegy",
|
||||
"la_privacy_required": "A Live Activity használatához el kell fogadnod az adatvédelmi tájékoztatót",
|
||||
"debug_screen": "Menu deweloperskie",
|
||||
"save": "Zapisz",
|
||||
"starting_hour_plural": "godzina",
|
||||
"ic_void_icon": "Nic",
|
||||
"wearSyncNotificationText": "Óra adatainak szinkronban tartása",
|
||||
"wear_pairing_check_phone": "Folytasd a párosítást a telefonodon",
|
||||
"la_privacy_section2_body": "Komolyan vesszük az adataid biztonságát:\n\n• A devices és lessons táblákban lévő összes adat titkosítva van\n• Az adatokat biztonságos szerveren tároljuk\n• Csak a szükséges időtartamig tároljuk az adatokat",
|
||||
"unknown_teacher": "Nieznany nauczyciel",
|
||||
"la_privacy_header": "Live Activity adatvédelmi tájékoztató",
|
||||
"title4": "Wiele dodatkowych rzeczy, których nigdy nie znajdziesz w Kréta.",
|
||||
"gradesCount": "{count} jegy",
|
||||
"@gradesCount": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_ag_rounding": "Domyślne zaokrąglanie",
|
||||
"wear_syncing": "Szinkronizálás...",
|
||||
"s_ci_icon_g8": "Pride ",
|
||||
"ic_lgbtq_f": "LGBTQ+",
|
||||
"licensesLabel": "Licencek",
|
||||
"s_c": "Dostosowanie",
|
||||
"starting_hour": "godzina",
|
||||
"wear_try_again": "Újra",
|
||||
"title1": "Poznaj wszystko na pierwszy rzut oka",
|
||||
"subtitle1": "Na górze strony głównej możesz zobaczyć przydatne informacje o swoim dniu.",
|
||||
"subject_avg": "Średnia z przedmiotu",
|
||||
"view_subject_btn": "Zobacz przedmiot",
|
||||
"tt_winter_break": "Zimowa przerwa",
|
||||
"stats_created_at": "Utworzono",
|
||||
"s_n": "Értesítések",
|
||||
"tt_settings_toast": "Ustawienia planu lekcji",
|
||||
"refreshing": "Aktualizowanie danych...",
|
||||
"la_privacy_footer": "Az adatvédelmi tájékoztató utolsó frissítése: 2025. november",
|
||||
"la_privacy_section5_body": "A GDPR alapján az alábbi jogokkal rendelkezel:\n\n• Hozzáférési jog: A tárolt adatok típusát ebben az adatvédelmi tájékoztatóban tekintheted meg.\n• Törlési jog: A Live Activity funkció kikapcsolásával minden, a funkcióhoz kapcsolódó adat (eszközazonosítók, órarend) azonnal és véglegesen törlődik a szervereinkről.\n• Módosítási jog: Az órarendi adatok módosítása a Kréta rendszerben történik, az arra jogosult személyek (pl. tanárok) által.\n• Tiltakozási jog: Az adatkezelés ellen bármikor tiltakozhatsz a Live Activity funkció kikapcsolásával.",
|
||||
"grades": "Oceny",
|
||||
"good_afternoon": "Miłego popołudnia, {p}!",
|
||||
"@good_afternoon": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tt_last_instructional_day_graduates": "Ostatni dzień zajęć dla klas kończących szkołę",
|
||||
"s_ci_icon_g3": "Nostalgia",
|
||||
"tt_first_instructional_day": "Pierwszy dzień nauki",
|
||||
"ic_gay": "Gej",
|
||||
"ic_nuke": "Nuklearny",
|
||||
"noMoreClasses": "Nincs több órád ma",
|
||||
"ic_lesb_f": "Lesbijka",
|
||||
"s_acc_add": "Dodaj nowe konto",
|
||||
"ic_old": "Domain Dave",
|
||||
"licenseDescription": "Az alkalmazás által használt külső könyvtárak licencei",
|
||||
"tt_autumn_break": "Jesienna przerwa",
|
||||
"s_ci_icon_header": "Ikona aplikacji",
|
||||
"empty_class": "Lyukasóra",
|
||||
"lesson_subject": "Przedmiot lekcji",
|
||||
"pairing_description": "Czy chcesz połączyć tę lekcję z aplikacją Firka?\nPo połączeniu zobaczysz plan lekcji oraz swoje najnowsze oceny, sprawdziany i zadania.",
|
||||
"date": "Godzina lekcji",
|
||||
"ic_szivacs": "Gąbka",
|
||||
"starting_sec_plural": "sekunda",
|
||||
"s_ci_icon_g6_desc": "przez @emilia6_6",
|
||||
"ic_filco": "Filc . O",
|
||||
"good_day": "Miłego dnia, {p}!",
|
||||
"@good_day": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tt_full_day_trip": "Całodniowa wycieczka",
|
||||
"wear_pairing_request_sent": "Párosítás folyamatban, nyisd meg az appot a telefonodon",
|
||||
"grade_calculator_add": "Hozzáadás",
|
||||
"ic_kreta": "eFIRKA",
|
||||
"subtitle2": "Zobacz statystyki, nadchodzące sprawdziany, a nawet oceny z poprzednich lat szkolnych.",
|
||||
"s_n_live_activity": "Live Activity",
|
||||
"wear_phone_disconnected": "Az órád nincs csatlakoztatva a telefonoddal!",
|
||||
"la_privacy_section3_body": "Az adatok tárolása minimális időtartamra korlátozódik:\n\n• Live Activity push token: Addig van tárolva, amíg óráid vannak az adott napon (beleértve az első óra előtti 2 órás időszakot is). Ha nincs több órád, az érték null lesz.\n\n• Órarendi adatok: Csak az órák időtartamára tárolódnak, majd automatikusan törlődnek. Pénteken az utolsó óra után az órarendet tartalmazó tábla teljesen üres lesz.\n\n• Eszközadatok (token, azonosítók): Addig van tárolva, amíg a Live Activity funkció engedélyezve van. A funkció kikapcsolásakor ezek az adatok azonnal törlésre kerülnek.",
|
||||
"tt_last_instructional_day": "Ostatni dzień nauki",
|
||||
"tt_settings_toast_lesson_nos": "Numery lekcji",
|
||||
"s_ci_icon_g5": "Referencja",
|
||||
"tt_settings_toast_lesson_substitution": "Zastępstwa",
|
||||
"tt_added": "Utworzono: ",
|
||||
"la_privacy_section3_title": "Meddig tároljuk az adatokat?",
|
||||
"school_ending": "Denerwujesz się, {p}?",
|
||||
"@school_ending": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_wear_os_support": "Wear OS támogatás",
|
||||
"ic_enby": "Niebinarna",
|
||||
"tt_settings_toast_lesson_tests": "Sprawdziany i inne",
|
||||
"happy_birthday": "Wszystkiego najlepszego, {p}!",
|
||||
"@happy_birthday": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"api_error": "Błąd API Kréta",
|
||||
"ic_trans_f": "Trans",
|
||||
"ic_enby_f": "Niebinarna",
|
||||
"ic_lidl": "Zakupy",
|
||||
"tests_tomorrow": "Masz {tests} sprawdzianów",
|
||||
"@tests_tomorrow": {
|
||||
"placeholders": {
|
||||
"tests": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ic_trans": "Trans",
|
||||
"s_ci_icon_g4": "Przeprojektowany",
|
||||
"tt_public_holiday": "Dzień wolny od pracy",
|
||||
"s_ag_language_header": "Język",
|
||||
"tt_instructional_day": "Dzień zajęć szkolnych",
|
||||
"ic_cc": "Chmura Kreatywna",
|
||||
"la_privacy_title": "Adatvédelmi tájékoztató",
|
||||
"s_ag_r1": "1 → 2",
|
||||
"s_c_theme_light": "Jasny",
|
||||
"title2": "Twoje przedmioty wygodnie się tutaj mieszczą",
|
||||
"tomorrow_subtitle": "Oto Twój jutrzejszy dzień.",
|
||||
"s_n_test": "Teszt értesítés küldése",
|
||||
"starting_min_plural": "minuta",
|
||||
"ic_mkkp": "Darmowe oceny",
|
||||
"subjects": "Przedmioty",
|
||||
"s_c_theme_header": "Motyw",
|
||||
"s_a": "Aplikacja",
|
||||
"loginBtn": "Zaloguj się za pomocą konta E-Kréta",
|
||||
"mark_as_not_done": "Oznacz jako nieukończone",
|
||||
"wearSyncNotificationTitle": "Szinkronizálás az órával",
|
||||
"mark_as_done": "Oznacz jako ukończone",
|
||||
"s_ag": "Ogólne",
|
||||
"ic_xmas3": "FirŚwięta",
|
||||
"data": "Dane",
|
||||
"la_learn_more": "Bővebben",
|
||||
"ic_pixelized": "Spikselizowany",
|
||||
"other": "Więcej",
|
||||
"ic_o1g": "Orbán to pizda",
|
||||
"la_privacy_section2_title": "Hogyan védjük az adataidat?",
|
||||
"good_night": "Miłego wieczoru, {p}!",
|
||||
"@good_night": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_ag_r4": "4 → 5",
|
||||
"s_ci_icon_g1": "Catboy domain",
|
||||
"starting_min": "minuta",
|
||||
"ic_pride": "Kosmiczna tęcza",
|
||||
"suffering_almost_over_subtitle": "Już niedługo będziesz wolny. Uważaj na nauczyciela.",
|
||||
"la_privacy_section5_title": "Jogaid",
|
||||
"ghost_grades": "Szellem jegyek",
|
||||
"s_customization": "Personalizacja",
|
||||
"tomorrow": "Jutro",
|
||||
"breakTxt": "Szünet",
|
||||
"la_privacy_section1_title": "Milyen adatokat tárolunk?",
|
||||
"s_ci_warning_header": "[!] W trybie debug zmiana ikony nie będzie działać",
|
||||
"tt_spring_break": "Wiosenna przerwa",
|
||||
"s_ag_language_hu": "Węgierski",
|
||||
"tt_no_classes_l2": "Yippee!",
|
||||
"class_n": "Liczba godzin tygodniowo",
|
||||
"s_settings": "Ustawienia",
|
||||
"subject_avg_rounded": "Średnia z przedmiotu po zaokrągleniu",
|
||||
"class_dismissed": "Odwołana lekcja",
|
||||
"s_ci_icon_subtitle": "Wybierz piękną ikonę aplikacji, jeśli znudził Ci się zielony kolor.",
|
||||
"s_ci_icon_g6": "Konkurs na świąteczne logo 2024",
|
||||
"ic_lgbtqp": "Postęp",
|
||||
"beta_title": "Firka – publiczna beta",
|
||||
"la_title": "Live Activity",
|
||||
"n_left_subtitle": "Wytrzymaj, zostało tylko {n} godzin!",
|
||||
"@n_left_subtitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pair": "Parowanie",
|
||||
"grade_strValue": "Ocena opisowa: ",
|
||||
"s_acc_kreta": "Konta eKRÉTA",
|
||||
"ic_pear": "Gruszka",
|
||||
"s_ag_bell_delay": "Przesunięcie dzwonka",
|
||||
"s_your_account": "Twoje konto",
|
||||
"wear_phone_unpaired": "Az órád nincs párosítva a telefonoddal!",
|
||||
"tt_non_instructional_day": "Dzień wolny od zajęć dydaktycznych",
|
||||
"b_week": "Tydzień B",
|
||||
"home": "Strona główna",
|
||||
"subject": "Tantárgy",
|
||||
"s_c_icon_header": "Ikony aplikacji",
|
||||
"cancel": "Anuluj",
|
||||
"yesterday": "Wczoraj",
|
||||
"ic_repont": "Pięćdziesiąt groszy",
|
||||
"ic_cactus": "Kaktusowy zagajnik",
|
||||
"get_ready": "Odpocznij i przygotuj się",
|
||||
"ic_lesb": "Lesbijka",
|
||||
"s_acc_logout": "Wyloguj się",
|
||||
"stats_date": "Data",
|
||||
"your_subjects": "Twoje przedmioty",
|
||||
"reauth": "Wymagane logowanie",
|
||||
"good_morning": "Dzień dobry, {p}!",
|
||||
"@good_morning": {
|
||||
"placeholders": {
|
||||
"p": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"firstIn": "Első órád: {t}",
|
||||
"@firstIn": {
|
||||
"placeholders": {
|
||||
"t": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"la_privacy_section4_title": "Mire használjuk az adatokat?",
|
||||
"ic_xmas2": "Prezent",
|
||||
"settings_screen": "Ustawienia",
|
||||
"la_privacy_summary1": "Eszköz tokenek, Live Activity tokenek, órarendi adatok",
|
||||
"title3": "Personalizowany plan lekcji",
|
||||
"ic_filc": "Filc Dziennik",
|
||||
"s_c_theme_dark": "Ciemny",
|
||||
"grade_calculator": "Jegy kalkulátor",
|
||||
"la_accept": "Elfogadom",
|
||||
"s_stats_for_nerds": "Pokaż dodatkowe informacje",
|
||||
"s_ag_r3": "3 → 4",
|
||||
"ic_tisza": "Árad a firka",
|
||||
"okay": "Ok",
|
||||
"s_developer": "Ustawienia deweloperskie",
|
||||
"privacyLabel": "Polityka prywatności",
|
||||
"stats_last_mod": "Ostatnio zmodyfikowano",
|
||||
"s_ag_navbar_desc": "Wybierz, co ma się wyświetlać na pasku nawigacyjnym, i uporządkuj elementy. Pozostałe strony są dostępne przez przycisk „więcej”. Możesz przypiąć maksymalnie 4 strony.",
|
||||
"a_week": "Tydzień",
|
||||
"s_ag_r2": "2 → 3",
|
||||
"wearTitle": "{n}. óra",
|
||||
"@wearTitle": {
|
||||
"placeholders": {
|
||||
"n": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timetable": "Plan lekcji",
|
||||
"ic_ace": "Aseksualny",
|
||||
"s_ci_icon_g2": "Pisak",
|
||||
"s_ci_child_protection": "Ochrona dzieci",
|
||||
"s_ag_navbar_hidden": "Ukryte",
|
||||
"runningInDomainBrowser": "Przeglądarka domen",
|
||||
"noClasses": "Nincs ma iskola, pihend ki magad!",
|
||||
"ic_bi": "Biseksualny",
|
||||
"ic_proto": "Prototyp",
|
||||
"tt_first_semester_end": "Koniec pierwszego semestru",
|
||||
"la_decline": "Elutasítom",
|
||||
"s_c_theme_auto": "Automatyczny",
|
||||
"ic_paper": "Papier",
|
||||
"ic_xmas1": "Lista złych",
|
||||
"s_ci_icon_g7": "Pride",
|
||||
"lessons_tomorrow": "{lessons} órád lesz",
|
||||
"@lessons_tomorrow": {
|
||||
"placeholders": {
|
||||
"lessons": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ic_lgbtq": "LGBTQ+",
|
||||
"subtitle3": "Wybierz, co chcesz widzieć na stronie planu lekcji. Włącz lub wyłącz sprawdziany, prace domowe, przerwy oraz okienka.",
|
||||
"ic_original": "Oryginał",
|
||||
"ic_refilc": "reFilc",
|
||||
"la_privacy_contact": "Kérdésed van? Keress minket a support @firka.app címen.",
|
||||
"tt_no_classes_l1": "W tym dniu nie masz lekcji!",
|
||||
"s_ag_class_avg_on_graph": "Średnia klasy na wykresie",
|
||||
"class_substitution": "Zastępstwo",
|
||||
"ic_half_firka_2": "Rewolucja",
|
||||
"no_tests_tomorrow": "Jutro nie masz sprawdzianu",
|
||||
"overall_avg": "Összesített átlag",
|
||||
"s_n_morning_time": "Értesítés ideje iskola előtt",
|
||||
"ic_ace_f": "Aseksualny",
|
||||
"wear_sync_with_phone": "Nyisd meg a telefonos appot a szinkronizáláshoz",
|
||||
"s_ag_navbar": "Pasek nawigacyjny",
|
||||
"class_avg": "Średnia klasy",
|
||||
"tt_quarter_end": "koniec kwartału",
|
||||
"la_privacy_section4_body": "Az adatokat kizárólag a Live Activity funkció működtetésére használjuk:\n\n• Élő órarend megjelenítése a lezárási képernyőn\n• Push értesítések küldése óraváltásokkor\n• Az órarend szinkronizálása az eszközödön\n• A hétfő reggeli értesítések kézbesítésének biztosítása a heti adatbázis-ürítés után is\n\nAz adataidat nem adjuk át harmadik félnek, és nem használjuk marketing célokra.",
|
||||
"no_grades": "Z tego przedmiotu nie masz jeszcze ocen.",
|
||||
"la_privacy_summary2": "Titkosított tárolás, biztonságos szerverek",
|
||||
"ic_lgbtqp_f": "Postęp",
|
||||
"ic_bi_f": "Biseksualny",
|
||||
"now": "Most",
|
||||
"la_privacy_section1_body": "A Live Activity működéséhez az alábbi adatokat tároljuk eszközazonosítóddal együtt:\n\n• Eszköz azonosító (UUID)\n• Eszköz token\n• Live Activity push token\n• APNs push token\n• Eszköz hash\n• Nyelvi beállítás\n• Csengő eltolódása\n\nAz órarendi adataid (lessons tábla) a következőket tartalmazzák:\n• Óra tárgya és időpontja\n• Tanár neve\n• Terem neve\n• Óra sorszáma\n• Óra témája\n• Helyettesítés adatai\n• Elmaradt óra jelzése\n\nAz időzített értesítések (scheduled_notifications tábla) a következőket tartalmazzák:\n• Azonosító\n• Eszköz azonosító\n• Időzített időpont\n• Küldés állapota és ideje\n• Létrehozás és frissítés ideje",
|
||||
"starting_soon": "Już wkrótce zaczyna się Twoja pierwsza lekcja!",
|
||||
"ic_refulc": "firk’a",
|
||||
"s_ag_left_handed_mode": "Tryb dla leworęcznych",
|
||||
"tt_rest_day": "Dzień wolny",
|
||||
"la_privacy_summary3": "Az adatok automatikusan törlődnek, ha már nincs rájuk szükség",
|
||||
"tt_settings_toast_lesson_breaks": "Przerwy",
|
||||
"s_ag_language_auto": "Automatyczny",
|
||||
"s_ag_navbar_visible": "Wyświetlane",
|
||||
"starting_sec": "sekunda",
|
||||
"la_subtitle": "Az órarended élő megjelenítése az eszköz lezárási képernyőjén",
|
||||
"grade_teacherName": "Imię i nazwisko nauczyciela: ",
|
||||
"ic_modern": "Nowoczesny",
|
||||
"timeLeft": "Még {mins} perc",
|
||||
"@timeLeft": {
|
||||
"placeholders": {
|
||||
"mins": {
|
||||
"type": "num"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_ag_language_de": "Niemiecki",
|
||||
"today": "Dziś",
|
||||
"ic_gay_f": "Gej",
|
||||
"ic_fidesz": "Fidesz",
|
||||
"s_n_morning": "Reggeli értesítés",
|
||||
"restart_body": "Kliknij tutaj, aby otworzyć aplikację.",
|
||||
"s_ag_language_en": "Angielski",
|
||||
"homework": "Praca domowa",
|
||||
"ic_pixel": "Pixel",
|
||||
"view_lesson_btn": "Zobacz lekcję",
|
||||
"la_privacy_intro": "A Live Activity funkció használatához bizonyos adatokat kell tárolnunk és feldolgoznunk. Kérjük, olvasd el figyelmesen az alábbi tájékoztatót.",
|
||||
"beta_body": "Aplikacja jest w trakcie rozwoju; niektóre funkcje mogą działać nieprawidłowo, nie działać lub jeszcze nie być ukończone.",
|
||||
"ic_galaxy": "Galaktyka",
|
||||
"copied": "Másolva",
|
||||
"view_day_btn": "Zobacz dzień",
|
||||
"omission": "Hiányzás",
|
||||
"omissions": "Hiányzások",
|
||||
"omission_state_excused": "Igazolt",
|
||||
"omission_state_unexcused": "Igazolatlan",
|
||||
"omission_state_pending": "Függőben",
|
||||
"omissions_count": "{state, select, unexcused{{count} igazolatlan} pending{{count} igazolandó} other{{count}}} hiányzás",
|
||||
"@omissions_count": {
|
||||
"placeholders": {
|
||||
"state": {
|
||||
"type": "String"
|
||||
},
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"s_beta_warning": "Ostrzeżenie beta",
|
||||
"s_ag_privacy_ever_declined": "Wcześniej odrzucono politykę prywatności",
|
||||
"s_c_tab_appearance": "Wygląd aplikacji",
|
||||
"s_c_tab_subjects": "Przedmioty",
|
||||
"s_c_tab_fonts": "Czcionki",
|
||||
"s_c_my_themes": "Moje motywy",
|
||||
"s_c_manage_subjects": "Zarządzaj przedmiotami",
|
||||
"s_c_change_app_icon": "Zmień ikonę aplikacji",
|
||||
"s_c_colors_header": "Kolory",
|
||||
"s_c_grade_colors_header": "Kolory ocen",
|
||||
"s_c_title_style_header": "Styl tytułów",
|
||||
"s_c_title_weight_header": "Grubość tytułów",
|
||||
"s_c_title_weight_subtitle": "Nie wszystkie czcionki to obsługują",
|
||||
"s_c_title_weight_thin": "Cienka",
|
||||
"s_c_title_weight_thick": "Gruba",
|
||||
"s_c_capitalization_header": "Wielkość liter",
|
||||
"s_c_capitalization_lower": "małe litery",
|
||||
"s_c_capitalization_normal": "Normalna",
|
||||
"s_c_capitalization_upper": "WIELKIE LITERY",
|
||||
"s_c_change": "Zmień",
|
||||
"s_c_customize": "Dostosuj",
|
||||
"s_c_themes_current": "Bieżący",
|
||||
"s_c_themes_own": "Własne",
|
||||
"s_c_themes_downloaded": "Pobrane",
|
||||
"s_c_themes_share_current": "Udostępnij bieżący motyw",
|
||||
"s_c_themes_create_new": "Utwórz nowy motyw",
|
||||
"s_c_themes_import": "Importuj motyw",
|
||||
"s_c_themes_use": "Użyj",
|
||||
"s_c_themes_continue": "Kontynuuj",
|
||||
"s_c_themes_own_label": "Własny motyw",
|
||||
"s_c_themes_imported_label": "Zaimportowany motyw",
|
||||
"s_c_themes_builtin_label": "Wbudowany motyw",
|
||||
"s_c_themes_builtin_name": "Domyślny",
|
||||
"s_c_themes_create_title": "Utwórz nowy motyw",
|
||||
"s_c_themes_create_subtitle": "Podaj nazwę motywu",
|
||||
"s_c_themes_create_placeholder": "Nazwa motywu",
|
||||
"s_c_themes_delete_title": "Usuń motyw",
|
||||
"s_c_themes_delete_subtitle": "Czy na pewno chcesz usunąć ten motyw? Tę czynność można cofnąć.",
|
||||
"s_c_themes_delete_confirm": "Usuń",
|
||||
"s_about": "O aplikacji",
|
||||
"s_extras": "Dodatki",
|
||||
"s_other": "Inne",
|
||||
"subtitle4": ""
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
files:
|
||||
- source: app_hu.arb
|
||||
translation: /app_%two_letters_code%.arb
|
||||
bundles:
|
||||
- 3
|
||||
@@ -12,7 +12,6 @@ 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');
|
||||
@@ -104,8 +103,6 @@ class NotificationDeliveryService {
|
||||
case NotificationDeliveryMethod.auto:
|
||||
break;
|
||||
}
|
||||
|
||||
await ProgressNotificationService.sync();
|
||||
} catch (e, st) {
|
||||
_logger.warning('Failed to sync delivery backend: $e', e, st);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:firka/data/widget.dart';
|
||||
import 'package:firka/services/fcm_headless_bootstrap.dart';
|
||||
import 'package:firka/services/local_notification_service.dart';
|
||||
import 'package:firka/services/progress_notification_service.dart';
|
||||
|
||||
/// Runs on a silent FCM wakeup: for every locally logged-in account, fetches
|
||||
/// grades/homework/tests/absences/lessons/messages, diffs each against what
|
||||
@@ -47,8 +46,6 @@ class NotificationDiffService {
|
||||
_logger.warning('checkAll: account ${token.username} failed: $e', e, st);
|
||||
}
|
||||
}
|
||||
|
||||
await ProgressNotificationService.checkAndStartIfActive();
|
||||
}
|
||||
|
||||
static Future<void> _checkAccount(
|
||||
|
||||
@@ -1,227 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
114
firka/lib/services/watch_sync_helper.dart
Normal file
114
firka/lib/services/watch_sync_helper.dart
Normal file
@@ -0,0 +1,114 @@
|
||||
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,6 +5,7 @@ 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).
|
||||
@@ -27,15 +28,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();
|
||||
final lessons = await client.getLessons(start, end);
|
||||
final grades = await client.getGrades();
|
||||
await client.getLessons(start, end);
|
||||
await client.getGrades();
|
||||
final now = timeNow();
|
||||
final timetable = lessons.map((l) => l.toJson()).toList();
|
||||
final gradesJson = grades.map((g) => g.toJson()).toList();
|
||||
final timetable = (<Lesson>[]).map((l) => l.toJson()).toList();
|
||||
final grades = (<Grade>[]).map((g) => g.toJson()).toList();
|
||||
return {
|
||||
'lastSyncAt': now.toUtc().toIso8601String(),
|
||||
'timetable': timetable,
|
||||
'grades': gradesJson,
|
||||
'grades': grades,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
@@ -6,33 +5,30 @@ 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';
|
||||
import 'package:firka/services/wear_sync_cache.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? _androidWatchConnectivity;
|
||||
static WatchConnectivity get _watchConnectivityAndroid {
|
||||
_androidWatchConnectivity ??= WatchConnectivity();
|
||||
return _androidWatchConnectivity!;
|
||||
static WatchConnectivity? _watchConnectivity;
|
||||
static WatchConnectivity get _watchConnectivityInstance {
|
||||
_watchConnectivity ??= WatchConnectivity();
|
||||
return _watchConnectivity!;
|
||||
}
|
||||
|
||||
/// 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.
|
||||
/// Sends a fire-and-forget message to the Wear OS watch (payload sent as JSON string).
|
||||
static Future<void> sendMessageToWatch(Map<String, dynamic> message) async {
|
||||
if (!Platform.isAndroid) return;
|
||||
await _watchConnectivityAndroid.sendMessage(<String, dynamic>{
|
||||
await _watchConnectivityInstance.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).
|
||||
/// Starts the Wear sync foreground service (Android only).
|
||||
static Future<void> startWearSyncService(
|
||||
String cachePath,
|
||||
String appDirPath,
|
||||
@@ -45,7 +41,6 @@ class WatchSyncHelper {
|
||||
}
|
||||
|
||||
/// 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,
|
||||
@@ -90,8 +85,8 @@ class WatchSyncHelper {
|
||||
}
|
||||
|
||||
/// 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();
|
||||
@@ -99,10 +94,10 @@ class WatchSyncHelper {
|
||||
await sendMessageToWatch(<String, dynamic>{'id': 'sync_data', ...payload});
|
||||
}
|
||||
|
||||
/// Stream of messages from the watch (Android: watch_connectivity). Use for request_sync etc.
|
||||
/// Stream of messages from the Wear OS watch. Empty when not on Android.
|
||||
static Stream<Map<String, dynamic>> get watchMessageStream {
|
||||
if (!Platform.isAndroid) return const Stream.empty();
|
||||
return _watchConnectivityAndroid.messageStream.map((m) {
|
||||
return _watchConnectivityInstance.messageStream.map((m) {
|
||||
final map = Map<String, dynamic>.from(m);
|
||||
final data = map['data'];
|
||||
if (data is String) {
|
||||
|
||||
@@ -28,7 +28,6 @@ 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(
|
||||
@@ -48,40 +47,34 @@ 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: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Align(
|
||||
heightFactor: 0,
|
||||
alignment: Alignment.topCenter,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 18),
|
||||
width: 40,
|
||||
height: 4,
|
||||
foregroundDecoration: ShapeDecoration(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadiusGeometry.circular(2),
|
||||
),
|
||||
color: appStyle.colors.shadowColor,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Align(
|
||||
heightFactor: 0,
|
||||
alignment: Alignment.topCenter,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 18),
|
||||
width: 40,
|
||||
height: 4,
|
||||
foregroundDecoration: ShapeDecoration(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadiusGeometry.circular(2),
|
||||
),
|
||||
color: appStyle.colors.shadowColor,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
...children,
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
...children,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -91,7 +84,6 @@ Future<void> showFirkaBottomSheet(
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Future<void> showLessonBottomSheet(
|
||||
BuildContext context,
|
||||
AppInitialization data,
|
||||
@@ -108,43 +100,15 @@ 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 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);
|
||||
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),
|
||||
);
|
||||
}
|
||||
showFirkaBottomSheet(context, [
|
||||
Row(
|
||||
@@ -178,55 +142,49 @@ Future<void> showLessonBottomSheet(
|
||||
size: 26,
|
||||
),
|
||||
),
|
||||
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,
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"${lesson.name} ${statsForNerdsEnabled ? "(${lesson.subject.loadAndGet()!.name})" : ""}",
|
||||
style: appStyle.fonts.H_18px.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
softWrap: true,
|
||||
Text(
|
||||
"${lesson.name} ${statsForNerdsEnabled ? "(${lesson.subject.loadAndGet()!.name})" : ""}",
|
||||
style: appStyle.fonts.H_18px.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
if (lesson.teacher != null && lesson.teacher!.isNotEmpty)
|
||||
Text(
|
||||
lesson.teacher!,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
decoration: lesson.substituteTeacher != null
|
||||
? TextDecoration.lineThrough
|
||||
: TextDecoration.none,
|
||||
),
|
||||
Text(
|
||||
lesson.teacher!,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
decoration: lesson.substituteTeacher != null
|
||||
? TextDecoration.lineThrough
|
||||
: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
if (lesson.substituteTeacher != null)
|
||||
Text(
|
||||
lesson.substituteTeacher!,
|
||||
@@ -262,29 +220,11 @@ 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()!),
|
||||
@@ -310,8 +250,6 @@ Future<void> showLessonBottomSheet(
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Future<void> showOmissionBottomSheet(
|
||||
BuildContext context,
|
||||
AppInitialization data,
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/services/wear_sync_helper.dart';
|
||||
import 'package:firka/services/watch_sync_helper.dart';
|
||||
import 'package:firka/services/wear_sync_cache.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
@@ -167,16 +167,12 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
||||
return TimeTableDayWidget(
|
||||
lessons,
|
||||
events,
|
||||
onRefresh: () async {
|
||||
await widget.data.client!.pullRefresh(
|
||||
() => widget.data.client!.getLessonsCovering(
|
||||
_currentTabWeekMonday,
|
||||
_currentTabWeekMonday.add(const Duration(days: 7)),
|
||||
),
|
||||
);
|
||||
_lessonsCache.clear();
|
||||
if (mounted) setState(() {});
|
||||
},
|
||||
onRefresh: () => widget.data.client!.pullRefresh(
|
||||
() => widget.data.client!.getLessonsCovering(
|
||||
_currentTabWeekMonday,
|
||||
_currentTabWeekMonday.add(const Duration(days: 7)),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -342,9 +338,6 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
||||
listenWhen: (previous, current) =>
|
||||
current.refreshTrigger != previous.refreshTrigger,
|
||||
listener: (context, state) {
|
||||
// Underlying writes are correct now (see kreta_client.dart), so
|
||||
// a plain clear()+reread is reliable and needs no stale-value
|
||||
// workaround.
|
||||
_lessonsCache.clear();
|
||||
setState(() {});
|
||||
},
|
||||
|
||||
@@ -360,14 +360,10 @@ class _HomeTimetableMonthlyScreen
|
||||
right: 20,
|
||||
),
|
||||
child: RefreshIndicator(
|
||||
// NOT currentMonthStart/End: End is built inclusive for
|
||||
// display, but getLessonsCovering treats `to` as
|
||||
// exclusive, so the last day of the month was never
|
||||
// actually refreshed. Use the visible grid's own bounds.
|
||||
onRefresh: () => widget.data.client!.pullRefresh(
|
||||
() => widget.data.client!.getLessonsCovering(
|
||||
dates.first,
|
||||
dates.last.add(const Duration(days: 1)),
|
||||
currentMonthStart,
|
||||
currentMonthEnd,
|
||||
),
|
||||
),
|
||||
child: GridView.count(
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'package:firka/core/bloc/toast_cubit.dart';
|
||||
import 'package:firka/core/firka_bundle.dart';
|
||||
import 'package:firka/core/settings.dart';
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/services/progress_notification_service.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
@@ -18,11 +16,6 @@ import 'package:firka/core/image_preloader.dart';
|
||||
|
||||
bool _fetching = false;
|
||||
bool _prefetched = false;
|
||||
DateTime? _lastPrefetchAt;
|
||||
|
||||
// A brief resume->pause->resume blip (screenshot, notification shade, etc.)
|
||||
// used to re-trigger a full year-long resync every time. Cooldown avoids it.
|
||||
const _prefetchCooldown = Duration(minutes: 2);
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
final Widget child;
|
||||
@@ -81,7 +74,6 @@ class _HomeScreenState extends FirkaState<HomeScreen>
|
||||
(context);
|
||||
} finally {
|
||||
_hasCompletedFirstPrefetch = true;
|
||||
_lastPrefetchAt = DateTime.now();
|
||||
if (!_disposed) {
|
||||
setState(() {
|
||||
_prefetched = true;
|
||||
@@ -172,23 +164,12 @@ class _HomeScreenState extends FirkaState<HomeScreen>
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
super.didChangeAppLifecycleState(state);
|
||||
if (state != AppLifecycleState.resumed || _disposed) return;
|
||||
|
||||
unawaited(ProgressNotificationService.checkAndStartOnAppOpen());
|
||||
|
||||
final lastPrefetch = _lastPrefetchAt;
|
||||
if (lastPrefetch != null &&
|
||||
DateTime.now().difference(lastPrefetch) < _prefetchCooldown) {
|
||||
logger.info(
|
||||
'[Home] App resumed to foreground, skipping prefetch (within cooldown)',
|
||||
);
|
||||
return;
|
||||
if (state == AppLifecycleState.resumed && !_disposed) {
|
||||
logger.info('[Home] App resumed to foreground, re-running prefetch');
|
||||
_prefetched = false;
|
||||
prefetch();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
logger.info('[Home] App resumed to foreground, re-running prefetch');
|
||||
_prefetched = false;
|
||||
prefetch();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import 'package:firka/core/extensions.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/ui/components/stats_table.dart';
|
||||
import 'package:firka_common/data/models/message_cache_model.dart';
|
||||
import 'package:firka_common/data/util.dart';
|
||||
import 'package:firka_common/ui/components/firka_card.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_html/flutter_html.dart';
|
||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||
@@ -23,38 +18,6 @@ class MessageScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final statsForNerdsEnabled = Settings.statsForNerds.value;
|
||||
final y2k = DateTime(2000, 1);
|
||||
String fmt(DateTime? dt) =>
|
||||
(dt != null && dt.isAfter(y2k))
|
||||
? dt.format(data.l10n, FormatMode.yyyymmddhhmmss)
|
||||
: '-';
|
||||
|
||||
Widget? statsForNerds;
|
||||
if (statsForNerdsEnabled) {
|
||||
final student = message.student.loadAndGet();
|
||||
final rows = <(String, String)>[
|
||||
('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'),
|
||||
];
|
||||
statsForNerds = StatsForNerdsTable(rows: rows);
|
||||
}
|
||||
|
||||
return DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: Scaffold(
|
||||
@@ -101,146 +64,116 @@ class MessageScreen extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 36),
|
||||
Row(
|
||||
SizedBox(height: 56),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.85,
|
||||
child: Text(
|
||||
message.title,
|
||||
textAlign: TextAlign.center,
|
||||
style: appStyle.fonts.H_H2.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
message.createdAt.format(
|
||||
data.l10n,
|
||||
FormatMode.yyyymmdd,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 56),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: appStyle.colors.accent,
|
||||
shape: CircleBorder(eccentricity: 1),
|
||||
),
|
||||
child: SizedBox(
|
||||
width: 28,
|
||||
height: 28,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.85,
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: Text(
|
||||
message.title,
|
||||
textAlign: TextAlign.center,
|
||||
style: appStyle.fonts.H_H2.apply(
|
||||
message.author[0],
|
||||
style: appStyle.fonts.H_18px.copyWith(
|
||||
fontSize: 20,
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
message.createdAt.format(
|
||||
data.l10n,
|
||||
FormatMode.yyyymmdd,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: appStyle.colors.accent,
|
||||
shape: CircleBorder(eccentricity: 1),
|
||||
),
|
||||
child: SizedBox(
|
||||
width: 28,
|
||||
height: 28,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: Text(
|
||||
message.author.isNotEmpty
|
||||
? message.author[0]
|
||||
: '?',
|
||||
style: appStyle.fonts.H_18px.copyWith(
|
||||
fontSize: 20,
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width / 1.4,
|
||||
child: Text(
|
||||
message.author,
|
||||
style: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.card,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(16),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
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,
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width:
|
||||
MediaQuery.of(context).size.width / 1.4,
|
||||
child: Text(
|
||||
message.author,
|
||||
style: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (statsForNerds != null) ...[
|
||||
SizedBox(height: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: 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: 24),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Flexible(
|
||||
fit: FlexFit.loose,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.card,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(16),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: SingleChildScrollView(
|
||||
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,
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -10,7 +10,6 @@ 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/ui/components/color_slider.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/preview/theme_preview_data.dart";
|
||||
import "package:firka/ui/phone/screens/themes/preview/theme_preview_pages.dart";
|
||||
@@ -20,7 +19,6 @@ import "package:firka/ui/theme/style.dart";
|
||||
import "package:firka_common/data/database.dart";
|
||||
import "package:firka_common/data/models/user_theme_model.dart";
|
||||
import "package:firka_common/ui/components/firka_card.dart";
|
||||
import "package:firka_common/ui/theme/theme_binary_format.dart";
|
||||
import "package:firka_common/ui/theme/style.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter/services.dart";
|
||||
@@ -82,9 +80,90 @@ const _defaultGradients = (
|
||||
dark: [Color(0xFF0D1202), Color(0xFF1A2405)],
|
||||
);
|
||||
|
||||
/// delegates to [themeSlotSettings] via the matching [ThemeColorSlot]
|
||||
(StringSetting, StringSetting) _settingsFor(_ThemeSlot slot) =>
|
||||
themeSlotSettings(ThemeColorSlot.values[slot.index]);
|
||||
(StringSetting, StringSetting) _settingsFor(_ThemeSlot slot) {
|
||||
switch (slot) {
|
||||
case _ThemeSlot.accent:
|
||||
return (
|
||||
SettingsRegistry.customAccentColorLight,
|
||||
SettingsRegistry.customAccentColorDark,
|
||||
);
|
||||
case _ThemeSlot.background:
|
||||
return (
|
||||
SettingsRegistry.customBackgroundColorLight,
|
||||
SettingsRegistry.customBackgroundColorDark,
|
||||
);
|
||||
case _ThemeSlot.card:
|
||||
return (
|
||||
SettingsRegistry.customCardColorLight,
|
||||
SettingsRegistry.customCardColorDark,
|
||||
);
|
||||
case _ThemeSlot.button:
|
||||
return (
|
||||
SettingsRegistry.customButtonColorLight,
|
||||
SettingsRegistry.customButtonColorDark,
|
||||
);
|
||||
case _ThemeSlot.secondary:
|
||||
return (
|
||||
SettingsRegistry.customSecondaryColorLight,
|
||||
SettingsRegistry.customSecondaryColorDark,
|
||||
);
|
||||
case _ThemeSlot.text:
|
||||
return (
|
||||
SettingsRegistry.customTextColorLight,
|
||||
SettingsRegistry.customTextColorDark,
|
||||
);
|
||||
case _ThemeSlot.textSecondary:
|
||||
return (
|
||||
SettingsRegistry.customTextSecondaryColorLight,
|
||||
SettingsRegistry.customTextSecondaryColorDark,
|
||||
);
|
||||
case _ThemeSlot.textTertiary:
|
||||
return (
|
||||
SettingsRegistry.customTextTertiaryColorLight,
|
||||
SettingsRegistry.customTextTertiaryColorDark,
|
||||
);
|
||||
case _ThemeSlot.shadow:
|
||||
return (
|
||||
SettingsRegistry.customShadowColorLight,
|
||||
SettingsRegistry.customShadowColorDark,
|
||||
);
|
||||
case _ThemeSlot.success:
|
||||
return (
|
||||
SettingsRegistry.customSuccessColorLight,
|
||||
SettingsRegistry.customSuccessColorDark,
|
||||
);
|
||||
case _ThemeSlot.warningAccent:
|
||||
return (
|
||||
SettingsRegistry.customWarningAccentColorLight,
|
||||
SettingsRegistry.customWarningAccentColorDark,
|
||||
);
|
||||
case _ThemeSlot.warningText:
|
||||
return (
|
||||
SettingsRegistry.customWarningTextColorLight,
|
||||
SettingsRegistry.customWarningTextColorDark,
|
||||
);
|
||||
case _ThemeSlot.warningCard:
|
||||
return (
|
||||
SettingsRegistry.customWarningCardColorLight,
|
||||
SettingsRegistry.customWarningCardColorDark,
|
||||
);
|
||||
case _ThemeSlot.errorAccent:
|
||||
return (
|
||||
SettingsRegistry.customErrorAccentColorLight,
|
||||
SettingsRegistry.customErrorAccentColorDark,
|
||||
);
|
||||
case _ThemeSlot.errorText:
|
||||
return (
|
||||
SettingsRegistry.customErrorTextColorLight,
|
||||
SettingsRegistry.customErrorTextColorDark,
|
||||
);
|
||||
case _ThemeSlot.errorCard:
|
||||
return (
|
||||
SettingsRegistry.customErrorCardColorLight,
|
||||
SettingsRegistry.customErrorCardColorDark,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _applySlotColor(FirkaColors colors, _ThemeSlot slot, Color color) {
|
||||
switch (slot) {
|
||||
@@ -153,7 +232,9 @@ class _ThemeEditorScreenState extends State<ThemeEditorScreen> {
|
||||
super.initState();
|
||||
_originalIsLight = appStyle.isLight;
|
||||
_preview = ThemePreviewData.build();
|
||||
_hsv = HSVColor.fromColor(_colorForSlotAndMode(_slot!, _mode));
|
||||
_hsv = HSVColor.fromColor(
|
||||
_colorForSlotAndMode(_slot!, _mode),
|
||||
);
|
||||
_syncHexField();
|
||||
_refreshPreviewStyle();
|
||||
}
|
||||
@@ -207,9 +288,8 @@ class _ThemeEditorScreenState extends State<ThemeEditorScreen> {
|
||||
final editingLight = _mode != _BrightnessMode.dark;
|
||||
if (_mode == _BrightnessMode.both || editingLight == isLight) {
|
||||
if (slot == _ThemeSlot.background) {
|
||||
final stops = List<Color>.from(
|
||||
_currentGradient(isLightSource: isLight),
|
||||
);
|
||||
final stops =
|
||||
List<Color>.from(_currentGradient(isLightSource: isLight));
|
||||
if (_bgStopIndex < stops.length) {
|
||||
stops[_bgStopIndex] = _hsv.toColor();
|
||||
} else {
|
||||
@@ -266,7 +346,8 @@ class _ThemeEditorScreenState extends State<ThemeEditorScreen> {
|
||||
final color = _hsv.toColor();
|
||||
final hex = color.toHexSetting();
|
||||
_hexController.text =
|
||||
(color.a >= 1.0 ? hex.substring(4) : hex.substring(2)).toUpperCase();
|
||||
(color.a >= 1.0 ? hex.substring(4) : hex.substring(2))
|
||||
.toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,12 +370,10 @@ class _ThemeEditorScreenState extends State<ThemeEditorScreen> {
|
||||
final setting = isLightSource
|
||||
? SettingsRegistry.customBackgroundGradientLight
|
||||
: SettingsRegistry.customBackgroundGradientDark;
|
||||
final stops = List<Color>.from(
|
||||
_currentGradient(isLightSource: isLightSource),
|
||||
);
|
||||
final idx = _bgStopIndex
|
||||
.clamp(0, math.max(0, stops.length - 1))
|
||||
.toInt();
|
||||
final stops =
|
||||
List<Color>.from(_currentGradient(isLightSource: isLightSource));
|
||||
final idx =
|
||||
_bgStopIndex.clamp(0, math.max(0, stops.length - 1)).toInt();
|
||||
if (stops.isNotEmpty) {
|
||||
stops[idx] = color;
|
||||
} else {
|
||||
@@ -338,7 +417,6 @@ class _ThemeEditorScreenState extends State<ThemeEditorScreen> {
|
||||
name: widget.data.l10n.s_c_themes_own_label,
|
||||
origin: ThemeOrigin.own,
|
||||
swatch: UserTheme.swatchFromAppStyle(),
|
||||
code: captureThemeCode(_settings),
|
||||
);
|
||||
await isarInit.writeTxn(() async {
|
||||
await isarInit.userThemeModels.putByThemeId(theme.toModel());
|
||||
@@ -364,9 +442,8 @@ class _ThemeEditorScreenState extends State<ThemeEditorScreen> {
|
||||
_slot = slot;
|
||||
if (slot == _ThemeSlot.background) {
|
||||
final stops = _gradientForMode(_mode);
|
||||
_bgStopIndex = _bgStopIndex
|
||||
.clamp(0, math.max(0, stops.length - 1))
|
||||
.toInt();
|
||||
_bgStopIndex =
|
||||
_bgStopIndex.clamp(0, math.max(0, stops.length - 1)).toInt();
|
||||
}
|
||||
_hsv = HSVColor.fromColor(_colorForSlotAndMode(slot, _mode));
|
||||
_refreshPreviewStyle();
|
||||
@@ -381,9 +458,8 @@ class _ThemeEditorScreenState extends State<ThemeEditorScreen> {
|
||||
if (slot != null) {
|
||||
if (slot == _ThemeSlot.background) {
|
||||
final stops = _gradientForMode(mode);
|
||||
_bgStopIndex = _bgStopIndex
|
||||
.clamp(0, math.max(0, stops.length - 1))
|
||||
.toInt();
|
||||
_bgStopIndex =
|
||||
_bgStopIndex.clamp(0, math.max(0, stops.length - 1)).toInt();
|
||||
}
|
||||
_hsv = HSVColor.fromColor(_colorForSlotAndMode(slot, mode));
|
||||
}
|
||||
@@ -397,14 +473,13 @@ class _ThemeEditorScreenState extends State<ThemeEditorScreen> {
|
||||
final setting = isLightSource
|
||||
? SettingsRegistry.customBackgroundGradientLight
|
||||
: SettingsRegistry.customBackgroundGradientDark;
|
||||
final stops = List<Color>.from(
|
||||
_currentGradient(isLightSource: isLightSource),
|
||||
);
|
||||
final stops =
|
||||
List<Color>.from(_currentGradient(isLightSource: isLightSource));
|
||||
final lastColor = stops.isNotEmpty
|
||||
? stops.last
|
||||
: (isLightSource
|
||||
? _defaultGradients.light.last
|
||||
: _defaultGradients.dark.last);
|
||||
? _defaultGradients.light.last
|
||||
: _defaultGradients.dark.last);
|
||||
stops.add(lastColor);
|
||||
await _settings.set(setting, stops.toHexSettingJson());
|
||||
}
|
||||
@@ -438,9 +513,8 @@ class _ThemeEditorScreenState extends State<ThemeEditorScreen> {
|
||||
final setting = isLightSource
|
||||
? SettingsRegistry.customBackgroundGradientLight
|
||||
: SettingsRegistry.customBackgroundGradientDark;
|
||||
final stops = List<Color>.from(
|
||||
_currentGradient(isLightSource: isLightSource),
|
||||
);
|
||||
final stops =
|
||||
List<Color>.from(_currentGradient(isLightSource: isLightSource));
|
||||
if (stops.length > 1 && index < stops.length) {
|
||||
stops.removeAt(index);
|
||||
await _settings.set(setting, stops.toHexSettingJson());
|
||||
@@ -555,14 +629,15 @@ class _ThemeEditorScreenState extends State<ThemeEditorScreen> {
|
||||
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_hsv = HSVColor.fromColor(switch (_mode) {
|
||||
_BrightnessMode.light => lightDefault,
|
||||
_BrightnessMode.dark => darkDefault,
|
||||
_BrightnessMode.both =>
|
||||
lightDefault == darkDefault
|
||||
_hsv = HSVColor.fromColor(
|
||||
switch (_mode) {
|
||||
_BrightnessMode.light => lightDefault,
|
||||
_BrightnessMode.dark => darkDefault,
|
||||
_BrightnessMode.both => lightDefault == darkDefault
|
||||
? lightDefault
|
||||
: (_originalIsLight ? lightDefault : darkDefault),
|
||||
});
|
||||
},
|
||||
);
|
||||
_refreshPreviewStyle();
|
||||
});
|
||||
_syncHexField();
|
||||
@@ -763,7 +838,12 @@ class _ThemeEditorScreenState extends State<ThemeEditorScreen> {
|
||||
final solid = _hsv.toColor().withAlpha(255);
|
||||
return ColorSlider(
|
||||
value: _hsv.alpha,
|
||||
trackGradient: LinearGradient(colors: [solid.withAlpha(0), solid]),
|
||||
trackGradient: LinearGradient(
|
||||
colors: [
|
||||
solid.withAlpha(0),
|
||||
solid,
|
||||
],
|
||||
),
|
||||
thumbColor: _hsv.toColor(),
|
||||
onChanged: (t) => _applyHsv(_hsv.withAlpha(t.clamp(0.0, 1.0))),
|
||||
);
|
||||
|
||||
@@ -73,7 +73,10 @@ class ThemePagePreview extends StatelessWidget {
|
||||
children: [
|
||||
_PreviewStatusBar(),
|
||||
Expanded(child: body),
|
||||
_PreviewBottomNav(data: data, activeTab: activeTab),
|
||||
_PreviewBottomNav(
|
||||
data: data,
|
||||
activeTab: activeTab,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -111,7 +114,11 @@ class _PreviewStatusBar extends StatelessWidget {
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Icon(Icons.wifi, size: 12, color: appStyle.colors.textPrimary),
|
||||
Icon(
|
||||
Icons.wifi,
|
||||
size: 12,
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Icon(
|
||||
Icons.battery_full,
|
||||
@@ -129,7 +136,10 @@ class _PreviewBottomNav extends StatelessWidget {
|
||||
final AppInitialization data;
|
||||
final ThemePreviewNavTab activeTab;
|
||||
|
||||
const _PreviewBottomNav({required this.data, required this.activeTab});
|
||||
const _PreviewBottomNav({
|
||||
required this.data,
|
||||
required this.activeTab,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -217,56 +217,11 @@ class ThemePreviewData {
|
||||
);
|
||||
final chartSpanDays = day.difference(sept).inDays.clamp(1, 365);
|
||||
const chartValues = [
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
3,
|
||||
3,
|
||||
3,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
|
||||
3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
|
||||
4, 4, 3, 3, 4, 4, 4, 4, 5, 5,
|
||||
5, 4, 4, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
];
|
||||
final chartGrades = [
|
||||
for (var i = 0; i < chartValues.length; i++)
|
||||
@@ -275,9 +230,7 @@ class ThemePreviewData {
|
||||
matematika,
|
||||
chartValues[i],
|
||||
sept.add(
|
||||
Duration(
|
||||
days: (i * chartSpanDays / (chartValues.length - 1)).round(),
|
||||
),
|
||||
Duration(days: (i * chartSpanDays / (chartValues.length - 1)).round()),
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
@@ -82,7 +82,9 @@ class ThemePreviewHomeMain extends StatelessWidget {
|
||||
for (final test in preview.tests) {
|
||||
noticeBoardWidgets.add((InfoCard.test(test), test.createdAt));
|
||||
}
|
||||
noticeBoardWidgets.sort((a, b) => b.$2.difference(a.$2).inMilliseconds);
|
||||
noticeBoardWidgets.sort(
|
||||
(a, b) => b.$2.difference(a.$2).inMilliseconds,
|
||||
);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
@@ -145,7 +147,11 @@ class ThemePreviewHomeGrades extends StatelessWidget {
|
||||
in preview.subjects.toList()
|
||||
..sort((a, b) => a.name.compareTo(b.name))) {
|
||||
gradeCards.add(
|
||||
GradeSmallCard(allGrades.getAverageBySubject(subject), null, subject),
|
||||
GradeSmallCard(
|
||||
allGrades.getAverageBySubject(subject),
|
||||
null,
|
||||
subject,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -231,7 +237,9 @@ class ThemePreviewHomeGrades extends StatelessWidget {
|
||||
height: 26,
|
||||
decoration: ShapeDecoration(
|
||||
color: filled ? getGradeColor(value).withAlpha(38) : Colors.transparent,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
@@ -255,9 +263,15 @@ class ThemePreviewHomeTimetable extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final day = DateTime(preview.now.year, preview.now.month, preview.now.day);
|
||||
final day = DateTime(
|
||||
preview.now.year,
|
||||
preview.now.month,
|
||||
preview.now.day,
|
||||
);
|
||||
final monday = day.getMonday();
|
||||
final tabDays = [for (var i = 0; i < 5; i++) monday.add(Duration(days: i))];
|
||||
final tabDays = [
|
||||
for (var i = 0; i < 5; i++) monday.add(Duration(days: i)),
|
||||
];
|
||||
|
||||
return Stack(
|
||||
children: [
|
||||
@@ -378,15 +392,17 @@ class ThemePreviewHomeTimetableMonthly extends StatelessWidget {
|
||||
var omissionCountMonth = 0;
|
||||
|
||||
for (var i = 0; i < 49; i++) {
|
||||
final d = DateTime(gridStart.year, gridStart.month, gridStart.day + i);
|
||||
final d = DateTime(
|
||||
gridStart.year,
|
||||
gridStart.month,
|
||||
gridStart.day + i,
|
||||
);
|
||||
final key = DateTime(d.year, d.month, d.day);
|
||||
final meta =
|
||||
preview.monthDayMeta[key] ??
|
||||
final meta = preview.monthDayMeta[key] ??
|
||||
const ThemePreviewMonthDay(lessonCount: 0, hasTest: false);
|
||||
final outOfRange =
|
||||
d.isBefore(currentMonthStart) || d.isAfter(currentMonthEnd);
|
||||
final isToday =
|
||||
!outOfRange &&
|
||||
final isToday = !outOfRange &&
|
||||
now.year == d.year &&
|
||||
now.day == d.day &&
|
||||
now.month == d.month;
|
||||
@@ -406,12 +422,11 @@ class ThemePreviewHomeTimetableMonthly extends StatelessWidget {
|
||||
child: Text(
|
||||
meta.lessonCount.toString(),
|
||||
style: appStyle.fonts.H_16px.apply(
|
||||
color:
|
||||
(todayAccent ??
|
||||
(meta.omission != null
|
||||
? appStyle.colors.errorText
|
||||
: appStyle.colors.secondary))
|
||||
.withAlpha(outOfRange ? 77 : 255),
|
||||
color: (todayAccent ??
|
||||
(meta.omission != null
|
||||
? appStyle.colors.errorText
|
||||
: appStyle.colors.secondary))
|
||||
.withAlpha(outOfRange ? 77 : 255),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -513,7 +528,9 @@ class ThemePreviewHomeTimetableMonthly extends StatelessWidget {
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
Text(
|
||||
now.format(data.l10n, FormatMode.yyyymmmm).toLowerCase(),
|
||||
now
|
||||
.format(data.l10n, FormatMode.yyyymmmm)
|
||||
.toLowerCase(),
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
@@ -531,11 +548,7 @@ class ThemePreviewHomeTimetableMonthly extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 74 + 16 + 12,
|
||||
left: 20,
|
||||
right: 20,
|
||||
),
|
||||
padding: const EdgeInsets.only(top: 74 + 16 + 12, left: 20, right: 20),
|
||||
child: GridView.count(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 7,
|
||||
@@ -607,7 +620,9 @@ class _PreviewStatusToast extends StatelessWidget {
|
||||
color: active
|
||||
? appStyle.colors.buttonSecondaryFill
|
||||
: appStyle.colors.cardTranslucent,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
spacing: 6,
|
||||
|
||||
@@ -68,15 +68,7 @@ Future<void> showThemeShareSheet(
|
||||
BuildContext context, {
|
||||
required UserTheme theme,
|
||||
required AppInitialization data,
|
||||
Future<void> Function()? onPublish,
|
||||
}) async {
|
||||
// publish first so the link carries a share id and the people who scan it
|
||||
// keep seeing this theme as it is edited
|
||||
if (!theme.isBuiltin && theme.shareId.isEmpty) {
|
||||
await onPublish?.call();
|
||||
if (!context.mounted) return;
|
||||
}
|
||||
|
||||
}) {
|
||||
return showModalBottomSheet<void>(
|
||||
context: context,
|
||||
elevation: 100,
|
||||
@@ -111,7 +103,10 @@ Future<void> showThemeImportSheet(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.viewInsetsOf(context).bottom,
|
||||
),
|
||||
child: _ThemeImportSheet(l10n: data.l10n, onImport: onImport),
|
||||
child: _ThemeImportSheet(
|
||||
l10n: data.l10n,
|
||||
onImport: onImport,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -150,8 +145,7 @@ class _ThemeShareSheetState extends State<_ThemeShareSheet> {
|
||||
setState(() => _isSharing = true);
|
||||
|
||||
try {
|
||||
final boundary =
|
||||
_cardKey.currentContext?.findRenderObject() as RenderRepaintBoundary?;
|
||||
final boundary = _cardKey.currentContext?.findRenderObject() as RenderRepaintBoundary?;
|
||||
if (boundary == null) {
|
||||
throw Exception("RenderRepaintBoundary not found");
|
||||
}
|
||||
@@ -164,19 +158,23 @@ class _ThemeShareSheetState extends State<_ThemeShareSheet> {
|
||||
|
||||
final pngBytes = byteData.buffer.asUint8List();
|
||||
final tempDir = await getTemporaryDirectory();
|
||||
final sanitizedName = widget.theme.name
|
||||
.replaceAll(RegExp(r'[^\w\s-]'), '')
|
||||
.trim();
|
||||
final sanitizedName = widget.theme.name.replaceAll(RegExp(r'[^\w\s-]'), '').trim();
|
||||
final safeName = sanitizedName.isEmpty ? 'firka' : sanitizedName;
|
||||
final file = File('${tempDir.path}/firka_theme_$safeName.png');
|
||||
await file.writeAsBytes(pngBytes);
|
||||
|
||||
await SharePlus.instance.share(
|
||||
ShareParams(files: [XFile(file.path)], subject: widget.theme.name),
|
||||
ShareParams(
|
||||
files: [XFile(file.path)],
|
||||
subject: widget.theme.name,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
await SharePlus.instance.share(
|
||||
ShareParams(text: widget.shareUrl, subject: widget.theme.name),
|
||||
ShareParams(
|
||||
text: widget.shareUrl,
|
||||
subject: widget.theme.name,
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
if (mounted) {
|
||||
@@ -193,7 +191,10 @@ class _ThemeShareSheetState extends State<_ThemeShareSheet> {
|
||||
children: [
|
||||
RepaintBoundary(
|
||||
key: _cardKey,
|
||||
child: ThemeQrCard(theme: widget.theme, shareData: widget.shareUrl),
|
||||
child: ThemeQrCard(
|
||||
theme: widget.theme,
|
||||
shareData: widget.shareUrl,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_sheetButton(
|
||||
@@ -220,7 +221,10 @@ class _ThemeImportSheet extends StatefulWidget {
|
||||
final AppLocalizations l10n;
|
||||
final Future<void> Function(UserTheme theme) onImport;
|
||||
|
||||
const _ThemeImportSheet({required this.l10n, required this.onImport});
|
||||
const _ThemeImportSheet({
|
||||
required this.l10n,
|
||||
required this.onImport,
|
||||
});
|
||||
|
||||
@override
|
||||
State<_ThemeImportSheet> createState() => _ThemeImportSheetState();
|
||||
@@ -230,8 +234,6 @@ class _ThemeImportSheetState extends State<_ThemeImportSheet> {
|
||||
_ImportMode _mode = _ImportMode.camera;
|
||||
final _controller = TextEditingController();
|
||||
ThemeBinaryData? _previewData;
|
||||
String? _code;
|
||||
String _shareId = '';
|
||||
String? _extractedName;
|
||||
String? _error;
|
||||
bool _isAnalyzingImage = false;
|
||||
@@ -259,8 +261,6 @@ class _ThemeImportSheetState extends State<_ThemeImportSheet> {
|
||||
setState(() {
|
||||
_controller.text = trimmed;
|
||||
_previewData = decoded;
|
||||
_code = payload.code;
|
||||
_shareId = payload.shareId;
|
||||
_extractedName = payload.name;
|
||||
_error = null;
|
||||
});
|
||||
@@ -280,8 +280,6 @@ class _ThemeImportSheetState extends State<_ThemeImportSheet> {
|
||||
if (raw.isEmpty) {
|
||||
setState(() {
|
||||
_previewData = null;
|
||||
_code = null;
|
||||
_shareId = '';
|
||||
_extractedName = null;
|
||||
_error = null;
|
||||
});
|
||||
@@ -311,9 +309,7 @@ class _ThemeImportSheetState extends State<_ThemeImportSheet> {
|
||||
return;
|
||||
}
|
||||
|
||||
final capture = await MobileScannerPlatform.instance.analyzeImage(
|
||||
picked.path,
|
||||
);
|
||||
final capture = await MobileScannerPlatform.instance.analyzeImage(picked.path);
|
||||
if (capture != null && capture.barcodes.isNotEmpty) {
|
||||
bool found = false;
|
||||
for (final barcode in capture.barcodes) {
|
||||
@@ -349,24 +345,32 @@ class _ThemeImportSheetState extends State<_ThemeImportSheet> {
|
||||
|
||||
Future<void> _import() async {
|
||||
final preview = _previewData;
|
||||
final code = _code;
|
||||
if (preview == null || code == null) return;
|
||||
if (preview == null) return;
|
||||
|
||||
final themeName = _extractedName != null && _extractedName!.isNotEmpty
|
||||
? _extractedName!
|
||||
: widget.l10n.s_c_themes_imported_label;
|
||||
|
||||
final List<Color> swatch;
|
||||
if (preview.isFullTheme) {
|
||||
swatch = [
|
||||
preview.lightSlot(ThemeColorSlot.accent) ?? appStyle.colors.accent,
|
||||
preview.lightSlot(ThemeColorSlot.textPrimary) ?? appStyle.colors.textPrimary,
|
||||
preview.lightSlot(ThemeColorSlot.background) ?? appStyle.colors.background,
|
||||
];
|
||||
} else {
|
||||
swatch = preview.colors.length >= 3
|
||||
? preview.colors.take(3).toList()
|
||||
: (preview.colors.isNotEmpty
|
||||
? preview.colors
|
||||
: [appStyle.colors.accent, appStyle.colors.textPrimary, appStyle.colors.background]);
|
||||
}
|
||||
|
||||
final theme = UserTheme(
|
||||
id: Snowflake.nextId(),
|
||||
name: themeName,
|
||||
origin: ThemeOrigin.downloaded,
|
||||
swatch: [
|
||||
preview.lightSlot(ThemeColorSlot.accent),
|
||||
preview.lightSlot(ThemeColorSlot.textPrimary),
|
||||
preview.lightSlot(ThemeColorSlot.background),
|
||||
],
|
||||
code: code,
|
||||
shareId: _shareId,
|
||||
swatch: swatch,
|
||||
);
|
||||
|
||||
await widget.onImport(theme);
|
||||
@@ -393,7 +397,9 @@ class _ThemeImportSheetState extends State<_ThemeImportSheet> {
|
||||
: appStyle.colors.card,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: selected ? appStyle.colors.accent : Colors.transparent,
|
||||
color: selected
|
||||
? appStyle.colors.accent
|
||||
: Colors.transparent,
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
@@ -473,11 +479,13 @@ class _ThemeImportSheetState extends State<_ThemeImportSheet> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
for (final color in [
|
||||
_previewData!.lightSlot(ThemeColorSlot.accent),
|
||||
_previewData!.lightSlot(ThemeColorSlot.textPrimary),
|
||||
_previewData!.lightSlot(ThemeColorSlot.background),
|
||||
])
|
||||
for (final color in (_previewData!.isFullTheme
|
||||
? [
|
||||
_previewData!.lightSlot(ThemeColorSlot.accent) ?? appStyle.colors.accent,
|
||||
_previewData!.lightSlot(ThemeColorSlot.textPrimary) ?? appStyle.colors.textPrimary,
|
||||
_previewData!.lightSlot(ThemeColorSlot.background) ?? appStyle.colors.background,
|
||||
]
|
||||
: _previewData!.colors.take(4)))
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 4),
|
||||
width: 20,
|
||||
@@ -486,9 +494,7 @@ class _ThemeImportSheetState extends State<_ThemeImportSheet> {
|
||||
color: color,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: appStyle.colors.textPrimary.withValues(
|
||||
alpha: 0.25,
|
||||
),
|
||||
color: appStyle.colors.textPrimary.withValues(alpha: 0.25),
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
@@ -497,7 +503,9 @@ class _ThemeImportSheetState extends State<_ThemeImportSheet> {
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
"Teljes téma (32 szín)",
|
||||
_previewData!.isFullTheme
|
||||
? "Teljes téma (32 szín)"
|
||||
: "${_previewData!.colors.length} szín",
|
||||
style: appStyle.fonts.B_12R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
@@ -622,9 +630,7 @@ class _ThemeImportSheetState extends State<_ThemeImportSheet> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.accent.withValues(
|
||||
alpha: 0.15,
|
||||
),
|
||||
color: appStyle.colors.accent.withValues(alpha: 0.15),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Majesticon(
|
||||
@@ -655,10 +661,7 @@ class _ThemeImportSheetState extends State<_ThemeImportSheet> {
|
||||
] else if (_mode == _ImportMode.text) ...[
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 4,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.card,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
|
||||
@@ -10,8 +10,6 @@ import "package:firka/core/bloc/theme_cubit.dart";
|
||||
import "package:firka/ui/components/firka_icon_button.dart";
|
||||
import "package:firka/ui/phone/screens/themes/preview/theme_preview_data.dart";
|
||||
import "package:firka/ui/phone/screens/themes/preview/theme_preview_pages.dart";
|
||||
import "package:firka/core/theme_palette.dart";
|
||||
import "package:firka/core/theme_sync.dart";
|
||||
import "package:firka/ui/phone/screens/themes/sheets/theme_sheets.dart";
|
||||
import "package:firka/ui/phone/screens/themes/user_theme.dart";
|
||||
import "package:firka/ui/phone/screens/themes/widgets/theme_name_label.dart";
|
||||
@@ -91,175 +89,160 @@ class _ThemeScreenState extends State<ThemeScreen> {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Transform.translate(
|
||||
offset: const Offset(-4, 0),
|
||||
child: GestureDetector(
|
||||
onTap: () => context.pop(),
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.chevronLeftLine,
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Transform.translate(
|
||||
offset: const Offset(-4, 0),
|
||||
child: GestureDetector(
|
||||
onTap: () => context.pop(),
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.chevronLeftLine,
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
Transform.translate(
|
||||
offset: const Offset(-4, 1),
|
||||
child: Text(
|
||||
l10n.s_c_theme_header,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
Transform.translate(
|
||||
offset: const Offset(-4, 1),
|
||||
child: Text(
|
||||
l10n.s_c_theme_header,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ThemeSwatchIcon(swatch: _theme.swatch, size: 48),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ThemeNameLabel(
|
||||
name: _theme.name,
|
||||
editable: _theme.canRename,
|
||||
style: appStyle.fonts.H_H2.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
onChanged: (value) {
|
||||
setState(() => _theme.name = value);
|
||||
widget.args.onChanged();
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
_originLabel,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
spacing: 8,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ThemeSwatchIcon(swatch: _theme.swatch, size: 48),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (_theme.canEdit)
|
||||
FirkaIconButton(
|
||||
onTap: () async {
|
||||
// apply this theme before editing so the
|
||||
// editor sees the right colors
|
||||
await widget.args.onUse(_theme.id);
|
||||
if (!mounted) return;
|
||||
await context.push("/theme-editor");
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_theme.swatch =
|
||||
UserTheme.swatchFromAppStyle();
|
||||
_theme.code = captureThemeCode(
|
||||
widget.data.settings,
|
||||
);
|
||||
appStyle = buildStyleForBrightness(
|
||||
appStyle.isLight,
|
||||
isCustomTheme: true,
|
||||
);
|
||||
});
|
||||
widget.args.onChanged();
|
||||
},
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.editPen4Line,
|
||||
size: 18,
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
ThemeNameLabel(
|
||||
name: _theme.name,
|
||||
editable: _theme.canRename,
|
||||
style: appStyle.fonts.H_H2.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
if (_theme.canShare)
|
||||
FirkaIconButton(
|
||||
onTap: () => showThemeShareSheet(
|
||||
context,
|
||||
theme: _theme,
|
||||
data: widget.data,
|
||||
onPublish: () async {
|
||||
_theme.shareId = await publishTheme(
|
||||
widget.data.settings,
|
||||
_theme,
|
||||
);
|
||||
widget.args.onChanged();
|
||||
if (mounted) setState(() {});
|
||||
},
|
||||
),
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.shareLine,
|
||||
size: 18,
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
if (_theme.canDelete)
|
||||
FirkaIconButton(
|
||||
onTap: _delete,
|
||||
color: appStyle.colors.accent,
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.deleteBinLine,
|
||||
size: 18,
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
onChanged: (value) {
|
||||
setState(() => _theme.name = value);
|
||||
widget.args.onChanged();
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
_originLabel,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 28),
|
||||
Expanded(
|
||||
child: CarouselSlider(
|
||||
options: CarouselOptions(
|
||||
height: double.infinity,
|
||||
viewportFraction: 0.72,
|
||||
enableInfiniteScroll: false,
|
||||
enlargeCenterPage: false,
|
||||
padEnds: false,
|
||||
),
|
||||
items: buildThemePreviewCarouselItems(
|
||||
data: widget.data,
|
||||
preview: _preview,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
await widget.args.onUse(_theme.id);
|
||||
if (!context.mounted) return;
|
||||
context.pop();
|
||||
},
|
||||
child: FirkaCard(
|
||||
color: appStyle.colors.accent,
|
||||
left: const [],
|
||||
center: [
|
||||
Text(
|
||||
l10n.s_c_themes_use,
|
||||
style: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
if (_theme.isOwn) ...[
|
||||
FirkaIconButton(
|
||||
onTap: () async {
|
||||
await context.push("/theme-editor");
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_theme.swatch =
|
||||
UserTheme.swatchFromAppStyle();
|
||||
appStyle = buildStyleForBrightness(
|
||||
appStyle.isLight,
|
||||
isCustomTheme: true,
|
||||
);
|
||||
});
|
||||
widget.args.onChanged();
|
||||
},
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.editPen4Line,
|
||||
size: 18,
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
FirkaIconButton(
|
||||
onTap: () => showThemeShareSheet(
|
||||
context,
|
||||
theme: _theme,
|
||||
data: widget.data,
|
||||
),
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.shareLine,
|
||||
size: 18,
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
if (_theme.canDelete)
|
||||
FirkaIconButton(
|
||||
onTap: _delete,
|
||||
color: appStyle.colors.accent,
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.deleteBinLine,
|
||||
size: 18,
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 28),
|
||||
Expanded(
|
||||
child: CarouselSlider(
|
||||
options: CarouselOptions(
|
||||
height: double.infinity,
|
||||
viewportFraction: 0.72,
|
||||
enableInfiniteScroll: false,
|
||||
enlargeCenterPage: false,
|
||||
padEnds: false,
|
||||
),
|
||||
items: buildThemePreviewCarouselItems(
|
||||
data: widget.data,
|
||||
preview: _preview,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
await widget.args.onUse(_theme.id);
|
||||
if (!context.mounted) return;
|
||||
context.pop();
|
||||
},
|
||||
child: FirkaCard(
|
||||
color: appStyle.colors.accent,
|
||||
left: const [],
|
||||
center: [
|
||||
Text(
|
||||
l10n.s_c_themes_use,
|
||||
style: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
);
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ 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/ui/components/firka_icon_button.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/ui/phone/screens/themes/sheets/theme_sheets.dart";
|
||||
import "package:firka/ui/phone/screens/themes/user_theme.dart";
|
||||
@@ -51,12 +49,6 @@ class _ThemesScreenState extends State<ThemesScreen> {
|
||||
}
|
||||
|
||||
Future<void> _loadThemes() async {
|
||||
// pull this account's own theme, and catch up on any edits the owners of
|
||||
// the imported ones have made since
|
||||
await syncThemeFromServer(widget.data.settings);
|
||||
await refreshSharedThemes(widget.data.settings);
|
||||
if (!mounted) return;
|
||||
|
||||
final stored = await isarInit.userThemeModels.where().findAll();
|
||||
if (!mounted) return;
|
||||
|
||||
@@ -68,7 +60,10 @@ class _ThemesScreenState extends State<ThemesScreen> {
|
||||
setState(() {
|
||||
_storedThemes = stored.map(UserTheme.fromModel).toList();
|
||||
_selectedId = normalized;
|
||||
final knownIds = {_builtin.id, ..._storedThemes.map((t) => t.id)};
|
||||
final knownIds = {
|
||||
_builtin.id,
|
||||
..._storedThemes.map((t) => t.id),
|
||||
};
|
||||
if (isBuiltinThemeId(_selectedId)) {
|
||||
// Always use the composed builtin id for the current core/grade.
|
||||
_selectedId = _builtin.id;
|
||||
@@ -119,13 +114,6 @@ class _ThemesScreenState extends State<ThemesScreen> {
|
||||
final (coreId, gradeId) = parseBuiltinThemeId(next);
|
||||
await Settings.selectedCoreThemeId.set(coreId);
|
||||
await Settings.selectedGradeThemeId.set(gradeId);
|
||||
} else {
|
||||
// select it first, the colors written next are then saved to this theme
|
||||
await Settings.selectedThemeId.setSilently(next);
|
||||
final code = _storedThemes.where((t) => t.id == next).firstOrNull?.code;
|
||||
if (code != null && code.isNotEmpty) {
|
||||
await applyThemeCode(widget.data.settings, code);
|
||||
}
|
||||
}
|
||||
setState(() => _selectedId = next);
|
||||
await Settings.selectedThemeId.set(next);
|
||||
@@ -148,7 +136,6 @@ class _ThemesScreenState extends State<ThemesScreen> {
|
||||
name: name,
|
||||
origin: ThemeOrigin.own,
|
||||
swatch: UserTheme.swatchFromAppStyle(),
|
||||
code: captureThemeCode(widget.data.settings),
|
||||
);
|
||||
await _persistTheme(theme);
|
||||
if (!mounted) return;
|
||||
@@ -208,7 +195,9 @@ class _ThemesScreenState extends State<ThemesScreen> {
|
||||
padding: const EdgeInsets.only(left: 4, bottom: 8, top: 16),
|
||||
child: Text(
|
||||
text,
|
||||
style: appStyle.fonts.B_16R.apply(color: appStyle.colors.textPrimary),
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -232,7 +221,7 @@ class _ThemesScreenState extends State<ThemesScreen> {
|
||||
onTap: () => _openTheme(theme),
|
||||
child: FirkaCard(
|
||||
left: [
|
||||
ThemeSwatchIcon(swatch: theme.swatch, size: 26),
|
||||
ThemeSwatchIcon(swatch: theme.swatch, size: 36),
|
||||
const SizedBox(width: 10),
|
||||
ThemeNameLabel(
|
||||
name: theme.name,
|
||||
@@ -259,8 +248,8 @@ class _ThemesScreenState extends State<ThemesScreen> {
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
icon,
|
||||
size: 24,
|
||||
color: appStyle.colors.accent,
|
||||
size: 20,
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
@@ -359,7 +348,7 @@ class _ThemesScreenState extends State<ThemesScreen> {
|
||||
children: [
|
||||
_sectionLabel(l10n.s_c_themes_current),
|
||||
_themeRow(_selected, selected: true),
|
||||
if (_selected.canShare)
|
||||
if (!_selected.isBuiltin)
|
||||
_actionRow(
|
||||
icon: Majesticon.shareLine,
|
||||
label: l10n.s_c_themes_share_current,
|
||||
@@ -375,7 +364,10 @@ class _ThemesScreenState extends State<ThemesScreen> {
|
||||
selected: isBuiltinThemeId(_selectedId),
|
||||
),
|
||||
for (final theme in _ownThemes)
|
||||
_themeRow(theme, selected: theme.id == _selectedId),
|
||||
_themeRow(
|
||||
theme,
|
||||
selected: theme.id == _selectedId,
|
||||
),
|
||||
_actionRow(
|
||||
icon: Majesticon.plusLine,
|
||||
label: l10n.s_c_themes_create_new,
|
||||
@@ -383,7 +375,10 @@ class _ThemesScreenState extends State<ThemesScreen> {
|
||||
),
|
||||
_sectionLabel(l10n.s_c_themes_downloaded),
|
||||
for (final theme in _downloadedThemes)
|
||||
_themeRow(theme, selected: theme.id == _selectedId),
|
||||
_themeRow(
|
||||
theme,
|
||||
selected: theme.id == _selectedId,
|
||||
),
|
||||
_actionRow(
|
||||
icon: Majesticon.arrowDownCircleLine,
|
||||
label: l10n.s_c_themes_import,
|
||||
|
||||
@@ -16,36 +16,20 @@ class UserTheme {
|
||||
final ThemeOrigin origin;
|
||||
List<Color> swatch;
|
||||
|
||||
/// the whole theme as a share code, see [UserThemeModel.code]
|
||||
String code;
|
||||
|
||||
/// the server handle this theme is tied to, empty until it is shared or
|
||||
/// imported, see [UserThemeModel.shareId]
|
||||
String shareId;
|
||||
|
||||
UserTheme({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.origin,
|
||||
required this.swatch,
|
||||
this.code = '',
|
||||
this.shareId = '',
|
||||
});
|
||||
|
||||
bool get isBuiltin => origin == ThemeOrigin.builtin || isBuiltinThemeId(id);
|
||||
bool get isBuiltin =>
|
||||
origin == ThemeOrigin.builtin || isBuiltinThemeId(id);
|
||||
bool get isOwn => origin == ThemeOrigin.own && !isBuiltinThemeId(id);
|
||||
bool get isDownloaded => origin == ThemeOrigin.downloaded;
|
||||
bool get canRename => isOwn;
|
||||
bool get canEdit => isOwn;
|
||||
bool get canDelete => !isBuiltin;
|
||||
|
||||
/// a copy of someone else's shared theme, so it follows their edits
|
||||
bool get followsShare => isDownloaded && shareId.isNotEmpty;
|
||||
|
||||
/// builtins can always be shared (the code is computed on the fly),
|
||||
/// custom themes can be shared once their code has been captured
|
||||
bool get canShare => isBuiltin || code.isNotEmpty;
|
||||
|
||||
static List<Color> swatchFromCore(CoreTheme core, {bool isLight = true}) {
|
||||
final colors = core.forBrightness(isLight);
|
||||
return [colors.accent, colors.textPrimary, colors.background];
|
||||
@@ -84,8 +68,6 @@ class UserTheme {
|
||||
_ => ThemeOrigin.own,
|
||||
},
|
||||
swatch: model.swatchArgb.map(Color.new).toList(),
|
||||
code: model.code,
|
||||
shareId: model.shareId,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -97,9 +79,7 @@ class UserTheme {
|
||||
ThemeOrigin.downloaded => "downloaded",
|
||||
ThemeOrigin.own || ThemeOrigin.builtin => "own",
|
||||
}
|
||||
..swatchArgb = swatch.map((c) => c.toARGB32()).toList()
|
||||
..code = code
|
||||
..shareId = shareId;
|
||||
..swatchArgb = swatch.map((c) => c.toARGB32()).toList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,39 +98,29 @@ class ThemeScreenArgs {
|
||||
}
|
||||
|
||||
extension UserThemeShareExtension on UserTheme {
|
||||
/// for builtins the code is computed from the core+grade themes,
|
||||
/// for custom themes it comes from the stored code field
|
||||
String get shareCode {
|
||||
if (isBuiltin) {
|
||||
final (coreId, gradeId) = parseBuiltinThemeId(id);
|
||||
final core = resolveCore(coreId);
|
||||
final grade = resolveGrade(gradeId);
|
||||
final bytes = ThemeBinaryFormat.encodeCoreTheme(
|
||||
core,
|
||||
gradeColors: [
|
||||
grade.light.grade1,
|
||||
grade.light.grade2,
|
||||
grade.light.grade3,
|
||||
grade.light.grade4,
|
||||
grade.light.grade5,
|
||||
],
|
||||
final core = resolveCore(id);
|
||||
return ThemeBinaryFormat.encodeToBase64(
|
||||
ThemeBinaryFormat.decode(ThemeBinaryFormat.encodeCoreTheme(core)).colors,
|
||||
);
|
||||
return ThemeBinaryFormat.toBase64(bytes);
|
||||
} else if (swatch.isNotEmpty) {
|
||||
return ThemeBinaryFormat.encodeToBase64(swatch);
|
||||
} else {
|
||||
return ThemeBinaryFormat.encodeToBase64([
|
||||
appStyle.colors.accent,
|
||||
appStyle.colors.textPrimary,
|
||||
appStyle.colors.background,
|
||||
]);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
/// carries the whole theme so it imports with no network at all, plus the
|
||||
/// share id so the copy can follow the owner's later edits
|
||||
String get shareUrl {
|
||||
final url =
|
||||
"https://firka.app/?d=$shareCode&n=${Uri.encodeComponent(name)}";
|
||||
return shareId.isEmpty ? url : "$url&s=$shareId";
|
||||
}
|
||||
String get shareUrl =>
|
||||
"https://firka.app/?d=$shareCode&n=${Uri.encodeComponent(name)}";
|
||||
}
|
||||
|
||||
extension ThemeShareCodeStringExtension on String {
|
||||
({String code, String? name, String shareId}) parseThemeSharePayload() {
|
||||
({String code, String? name}) parseThemeSharePayload() {
|
||||
final trimmed = trim();
|
||||
if (trimmed.startsWith('firka://') || trimmed.startsWith('http')) {
|
||||
final uri = Uri.tryParse(trimmed);
|
||||
@@ -158,11 +128,10 @@ extension ThemeShareCodeStringExtension on String {
|
||||
return (
|
||||
code: uri.queryParameters['d'] ?? trimmed,
|
||||
name: uri.queryParameters['n'],
|
||||
shareId: uri.queryParameters['s'] ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
return (code: trimmed, name: null, shareId: '');
|
||||
return (code: trimmed, name: null);
|
||||
}
|
||||
|
||||
ThemeBinaryData? tryDecodeThemeData() {
|
||||
|
||||
@@ -4,18 +4,27 @@ class ThemeSwatchIcon extends StatelessWidget {
|
||||
final List<Color> swatch;
|
||||
final double size;
|
||||
|
||||
const ThemeSwatchIcon({required this.swatch, this.size = 40, super.key});
|
||||
const ThemeSwatchIcon({
|
||||
required this.swatch,
|
||||
this.size = 40,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = swatch.length >= 3
|
||||
? swatch.take(3).toList()
|
||||
: [...swatch, ...List.filled(3 - swatch.length, Colors.grey)];
|
||||
: [
|
||||
...swatch,
|
||||
...List.filled(3 - swatch.length, Colors.grey),
|
||||
];
|
||||
|
||||
return SizedBox(
|
||||
width: size,
|
||||
height: size,
|
||||
child: CustomPaint(painter: _SwatchPainter(colors: colors)),
|
||||
child: CustomPaint(
|
||||
painter: _SwatchPainter(colors: colors),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
// ignore_for_file: depend_on_referenced_packages
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:firka/api/client/kreta_client.dart';
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/app/initialization.dart';
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
@@ -85,27 +83,6 @@ Future<void> _resetMockServer(HttpClient httpClient) async {
|
||||
await resp.drain();
|
||||
}
|
||||
|
||||
/// The [from, to) ranges of every OrarendElemek (timetable) request the mock
|
||||
/// server has received since the last reset, in `yyyy-MM-dd` form.
|
||||
Future<List<(DateTime, DateTime)>> _timetableRequestRanges(
|
||||
HttpClient httpClient,
|
||||
) async {
|
||||
final req = await httpClient.getUrl(
|
||||
Uri.parse('$_mockServerUrl/admin/api/timetable-requests'),
|
||||
);
|
||||
final resp = await req.close();
|
||||
final body = await resp.transform(utf8.decoder).join();
|
||||
final list = jsonDecode(body) as List;
|
||||
return list
|
||||
.map(
|
||||
(e) => (
|
||||
DateTime.parse((e as Map<String, dynamic>)['from'] as String),
|
||||
DateTime.parse(e['to'] as String),
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
Future<void> _putTimetable(
|
||||
HttpClient httpClient,
|
||||
List<Map<String, dynamic>> lessons,
|
||||
@@ -127,15 +104,8 @@ Map<String, dynamic> _lesson({
|
||||
required String start,
|
||||
required String end,
|
||||
required String name,
|
||||
String room = '101',
|
||||
String stateUid = '1',
|
||||
String stateName = 'Megtartott',
|
||||
String stateDesc = 'Megtartott óra',
|
||||
String teacher = 'Teszt Tanár',
|
||||
String? substituteTeacher,
|
||||
int daysFromToday = 0,
|
||||
}) {
|
||||
final today = DateTime.now().add(Duration(days: daysFromToday));
|
||||
final today = DateTime.now();
|
||||
final datePrefix =
|
||||
'${today.year}-${today.month.toString().padLeft(2, '0')}-${today.day.toString().padLeft(2, '0')}';
|
||||
return {
|
||||
@@ -145,8 +115,7 @@ Map<String, dynamic> _lesson({
|
||||
'VegIdopont': '${datePrefix}T$end:00',
|
||||
'Nev': name,
|
||||
'OsztalyCsoport': {'Uid': '10,11.A', 'Nev': '11.A'},
|
||||
'TanarNeve': teacher,
|
||||
'HelyettesTanarNeve': substituteTeacher,
|
||||
'TanarNeve': 'Teszt Tanár',
|
||||
'Tantargy': {
|
||||
'Uid': '1,MATEK',
|
||||
'Nev': name,
|
||||
@@ -157,10 +126,10 @@ Map<String, dynamic> _lesson({
|
||||
},
|
||||
'SortIndex': 1,
|
||||
},
|
||||
'TeremNeve': room,
|
||||
'TeremNeve': '101',
|
||||
'Tipus': {'Uid': '1', 'Nev': 'Tanóra', 'Leiras': 'Tanóra'},
|
||||
'TanuloJelenlet': {'Uid': '', 'Nev': '', 'Leiras': ''},
|
||||
'Allapot': {'Uid': stateUid, 'Nev': stateName, 'Leiras': stateDesc},
|
||||
'Allapot': {'Uid': '1', 'Nev': 'Megtartott', 'Leiras': 'Megtartott óra'},
|
||||
'IsTanuloHaziFeladatEnabled': false,
|
||||
'IsHaziFeladatMegoldva': false,
|
||||
'Csatolmanyok': [],
|
||||
@@ -305,660 +274,5 @@ void main() {
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
Future<KretaClient> _initAndSync(
|
||||
HttpClient httpClient,
|
||||
List<Map<String, dynamic>> seedLessons,
|
||||
) async {
|
||||
await _resetMockServer(httpClient);
|
||||
await _putTimetable(httpClient, seedLessons);
|
||||
|
||||
final isar = await initDB();
|
||||
await isar.writeTxn(() async {
|
||||
await isar.clear();
|
||||
});
|
||||
Settings = SettingsRepository(isar);
|
||||
await Settings.loadAll();
|
||||
|
||||
await Settings.mockBackendEnabled.set(true);
|
||||
await Settings.mockBackendUrl.set(_mockServerUrl);
|
||||
|
||||
final tokenResp = await _authenticateMockServer(httpClient);
|
||||
final tokenModel = TokenModel.fromResp(tokenResp);
|
||||
|
||||
await isar.writeTxn(() async {
|
||||
await isar.tokenModels.clear();
|
||||
await isar.tokenModels.put(tokenModel);
|
||||
});
|
||||
|
||||
await initializeApp();
|
||||
expect(initDone, isTrue);
|
||||
|
||||
final client = initData.client!;
|
||||
await client.init();
|
||||
await client.renewCache(reInit: false);
|
||||
return client;
|
||||
}
|
||||
|
||||
List<LessonCacheModel> _lessonsToday(CacheManager cache) {
|
||||
final today = DateTime.now();
|
||||
bool isToday(DateTime d) =>
|
||||
d.year == today.year && d.month == today.month && d.day == today.day;
|
||||
return cache
|
||||
.getTimeTable()
|
||||
.findAllSync()
|
||||
.where((l) => isToday(l.start))
|
||||
.toList();
|
||||
}
|
||||
|
||||
testWidgets(
|
||||
'a room-only substitution that mints a new Uid still leaves exactly one row',
|
||||
(tester) async {
|
||||
HttpOverrides.global = _RealHttpOverrides();
|
||||
|
||||
await tester.runAsync(() async {
|
||||
final client = await _initAndSync(httpClient, [
|
||||
_lesson(
|
||||
uid: '9001',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Matematika',
|
||||
room: '101',
|
||||
),
|
||||
]);
|
||||
|
||||
expect(_lessonsToday(client.cache).length, 1);
|
||||
|
||||
// room change, new Uid, old Uid gone from this fetch
|
||||
await _putTimetable(httpClient, [
|
||||
_lesson(
|
||||
uid: '9001-v2',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Matematika',
|
||||
room: '204',
|
||||
),
|
||||
]);
|
||||
await client.renewCache(reInit: false);
|
||||
|
||||
final after = _lessonsToday(client.cache);
|
||||
expect(
|
||||
after.length,
|
||||
1,
|
||||
reason:
|
||||
'a clean Uid cutover must replace the row, not leave both cached',
|
||||
);
|
||||
expect(after.single.roomName, '204');
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'a cancellation that mints a new Uid still leaves exactly one row',
|
||||
(tester) async {
|
||||
HttpOverrides.global = _RealHttpOverrides();
|
||||
|
||||
await tester.runAsync(() async {
|
||||
final client = await _initAndSync(httpClient, [
|
||||
_lesson(
|
||||
uid: '9001',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Matematika',
|
||||
),
|
||||
]);
|
||||
|
||||
expect(_lessonsToday(client.cache).length, 1);
|
||||
|
||||
// cancellation, new Uid, old Uid gone from this fetch
|
||||
await _putTimetable(httpClient, [
|
||||
_lesson(
|
||||
uid: '9001-v2',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Matematika',
|
||||
stateUid: '3',
|
||||
stateName: 'Elmaradt',
|
||||
stateDesc: 'Elmaradt óra',
|
||||
),
|
||||
]);
|
||||
await client.renewCache(reInit: false);
|
||||
|
||||
final after = _lessonsToday(client.cache);
|
||||
expect(
|
||||
after.length,
|
||||
1,
|
||||
reason:
|
||||
'a clean Uid cutover must replace the row, not leave both cached',
|
||||
);
|
||||
expect(after.single.state, 'Elmaradt');
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'a cancellation Uid-swap seen by two overlapping fetches still leaves one row',
|
||||
(tester) async {
|
||||
HttpOverrides.global = _RealHttpOverrides();
|
||||
|
||||
await tester.runAsync(() async {
|
||||
final client = await _initAndSync(httpClient, [
|
||||
_lesson(
|
||||
uid: '9001',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Matematika',
|
||||
),
|
||||
]);
|
||||
|
||||
expect(_lessonsToday(client.cache).length, 1);
|
||||
|
||||
// simulates two overlapping fetch windows seeing a Uid swap
|
||||
final today = DateTime.now();
|
||||
await _putTimetable(httpClient, [
|
||||
_lesson(
|
||||
uid: '9001-cancelled',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Matematika',
|
||||
stateUid: '3',
|
||||
stateName: 'Elmaradt',
|
||||
stateDesc: 'Elmaradt óra',
|
||||
),
|
||||
]);
|
||||
await client.getLessons(
|
||||
today.subtract(const Duration(days: 3)),
|
||||
today.add(const Duration(days: 4)),
|
||||
);
|
||||
|
||||
final after = _lessonsToday(client.cache);
|
||||
expect(
|
||||
after.length,
|
||||
1,
|
||||
reason:
|
||||
'a cancellation for an existing period should replace the row, '
|
||||
'not leave the pre-cancellation copy cached alongside it',
|
||||
);
|
||||
expect(after.single.state, 'Elmaradt');
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'a full-day reschedule swaps every Uid without leaving any stale rows behind',
|
||||
(tester) async {
|
||||
HttpOverrides.global = _RealHttpOverrides();
|
||||
|
||||
await tester.runAsync(() async {
|
||||
final client = await _initAndSync(httpClient, [
|
||||
_lesson(
|
||||
uid: '9001',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Matematika',
|
||||
),
|
||||
_lesson(uid: '9002', start: '08:25', end: '09:10', name: 'Fizika'),
|
||||
_lesson(uid: '9003', start: '09:20', end: '10:05', name: 'Kémia'),
|
||||
]);
|
||||
|
||||
expect(_lessonsToday(client.cache).length, 3);
|
||||
|
||||
// the whole day gets re-issued with brand new Uids (e.g. timetable regenerated)
|
||||
await _putTimetable(httpClient, [
|
||||
_lesson(
|
||||
uid: '9101',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Matematika',
|
||||
),
|
||||
_lesson(uid: '9102', start: '08:25', end: '09:10', name: 'Fizika'),
|
||||
_lesson(uid: '9103', start: '09:20', end: '10:05', name: 'Kémia'),
|
||||
]);
|
||||
await client.renewCache(reInit: false);
|
||||
|
||||
final after = _lessonsToday(client.cache);
|
||||
expect(
|
||||
after.length,
|
||||
3,
|
||||
reason:
|
||||
'none of the old-Uid rows should survive a full-day reschedule',
|
||||
);
|
||||
expect(
|
||||
after.map((l) => l.cacheKey).toSet().length,
|
||||
3,
|
||||
reason: 'all surviving rows must belong to the new Uids',
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'a substitution Uid-swap seen by two overlapping fetches still leaves one row',
|
||||
(tester) async {
|
||||
HttpOverrides.global = _RealHttpOverrides();
|
||||
|
||||
await tester.runAsync(() async {
|
||||
final client = await _initAndSync(httpClient, [
|
||||
_lesson(
|
||||
uid: '9002',
|
||||
start: '08:25',
|
||||
end: '09:10',
|
||||
name: 'Munkav. idegennyelv',
|
||||
teacher: 'Eredeti Tanár',
|
||||
),
|
||||
]);
|
||||
|
||||
expect(_lessonsToday(client.cache).length, 1);
|
||||
|
||||
// reproduces the screenshot bug: two overlapping fetches see a Uid swap
|
||||
final today = DateTime.now();
|
||||
await _putTimetable(httpClient, [
|
||||
_lesson(
|
||||
uid: '9002-subst',
|
||||
start: '08:25',
|
||||
end: '09:10',
|
||||
name: 'Munkav. idegennyelv',
|
||||
teacher: 'Helyettesítő Tanár',
|
||||
substituteTeacher: 'Helyettesítő Tanár',
|
||||
),
|
||||
]);
|
||||
await client.getLessons(
|
||||
today.subtract(const Duration(days: 3)),
|
||||
today.add(const Duration(days: 4)),
|
||||
);
|
||||
|
||||
final after = _lessonsToday(client.cache);
|
||||
expect(
|
||||
after.length,
|
||||
1,
|
||||
reason:
|
||||
'a substitution for an existing period should replace it, not '
|
||||
'leave both the pre- and post-substitution rows cached',
|
||||
);
|
||||
expect(after.single.teacher, 'Helyettesítő Tanár');
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'a failed refetch falls back to the existing cache instead of losing it',
|
||||
(tester) async {
|
||||
HttpOverrides.global = _RealHttpOverrides();
|
||||
|
||||
await tester.runAsync(() async {
|
||||
final client = await _initAndSync(httpClient, [
|
||||
_lesson(
|
||||
uid: '9001',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Matematika',
|
||||
),
|
||||
]);
|
||||
|
||||
expect(_lessonsToday(client.cache).length, 1);
|
||||
|
||||
// backend isn't listening, so the refetch fails
|
||||
await Settings.mockBackendUrl.set('http://127.0.0.1:1');
|
||||
final today = DateTime.now();
|
||||
final result = await client.getLessons(
|
||||
today.subtract(const Duration(days: 1)),
|
||||
today.add(const Duration(days: 1)),
|
||||
);
|
||||
|
||||
expect(
|
||||
result.length,
|
||||
1,
|
||||
reason: 'a failed request should fall back to the cached lessons',
|
||||
);
|
||||
expect(
|
||||
_lessonsToday(client.cache).length,
|
||||
1,
|
||||
reason: 'the existing cache must not be wiped by a failed fetch',
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'renewCache never issues two overlapping timetable range requests',
|
||||
(tester) async {
|
||||
HttpOverrides.global = _RealHttpOverrides();
|
||||
|
||||
await tester.runAsync(() async {
|
||||
// renewTimetable's chunks are anchored to Sept 1st, which rarely
|
||||
// aligns with the current-window's Monday anchor, so chunks used
|
||||
// to redundantly re-request an already-fresh range.
|
||||
await _initAndSync(httpClient, [
|
||||
_lesson(
|
||||
uid: '9001',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Matematika',
|
||||
),
|
||||
]);
|
||||
|
||||
final ranges = await _timetableRequestRanges(httpClient);
|
||||
expect(
|
||||
ranges.length,
|
||||
greaterThan(1),
|
||||
reason:
|
||||
'renewCache should fetch more than just the current window '
|
||||
'(sanity check that renewTimetable actually ran)',
|
||||
);
|
||||
|
||||
for (var i = 0; i < ranges.length; i++) {
|
||||
for (var j = i + 1; j < ranges.length; j++) {
|
||||
final (aFrom, aTo) = ranges[i];
|
||||
final (bFrom, bTo) = ranges[j];
|
||||
final overlaps = aFrom.isBefore(bTo) && bFrom.isBefore(aTo);
|
||||
expect(
|
||||
overlaps,
|
||||
isFalse,
|
||||
reason:
|
||||
'requests $i ($aFrom..$aTo) and $j ($bFrom..$bTo) overlap: '
|
||||
'a redundant fetch can clobber already-fresh data for '
|
||||
'the days in the overlap',
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'a manual full-range refresh overlapping an in-progress chunked sync '
|
||||
'never loses a day that was already fetched',
|
||||
(tester) async {
|
||||
HttpOverrides.global = _RealHttpOverrides();
|
||||
|
||||
await tester.runAsync(() async {
|
||||
// Two overlapping, differently-boundaried getLessonsCovering()
|
||||
// calls (e.g. two refreshes landing close together) shouldn't
|
||||
// wipe an already-cached day via their scoped deletes.
|
||||
await _resetMockServer(httpClient);
|
||||
await _putTimetable(httpClient, [
|
||||
_lesson(
|
||||
uid: 'd0',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Matematika',
|
||||
daysFromToday: 0,
|
||||
),
|
||||
_lesson(
|
||||
uid: 'd10',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Fizika',
|
||||
daysFromToday: 10,
|
||||
),
|
||||
_lesson(
|
||||
uid: 'd20',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Kémia',
|
||||
daysFromToday: 20,
|
||||
),
|
||||
]);
|
||||
|
||||
final isar = await initDB();
|
||||
await isar.writeTxn(() async {
|
||||
await isar.clear();
|
||||
});
|
||||
Settings = SettingsRepository(isar);
|
||||
await Settings.loadAll();
|
||||
|
||||
await Settings.mockBackendEnabled.set(true);
|
||||
await Settings.mockBackendUrl.set(_mockServerUrl);
|
||||
|
||||
final tokenResp = await _authenticateMockServer(httpClient);
|
||||
final tokenModel = TokenModel.fromResp(tokenResp);
|
||||
|
||||
await isar.writeTxn(() async {
|
||||
await isar.tokenModels.clear();
|
||||
await isar.tokenModels.put(tokenModel);
|
||||
});
|
||||
|
||||
await initializeApp();
|
||||
expect(initDone, isTrue);
|
||||
|
||||
final client = initData.client!;
|
||||
await client.init();
|
||||
|
||||
final now = DateTime.now();
|
||||
final today = DateTime(now.year, now.month, now.day);
|
||||
bool isOnDay(DateTime d, int offset) {
|
||||
final target = today.add(Duration(days: offset));
|
||||
return d.year == target.year &&
|
||||
d.month == target.month &&
|
||||
d.day == target.day;
|
||||
}
|
||||
|
||||
int lessonsOn(int offset) => client.cache
|
||||
.getTimeTable()
|
||||
.findAllSync()
|
||||
.where((l) => isOnDay(l.start, offset))
|
||||
.length;
|
||||
|
||||
// Sync everything first so all 3 days are already cached.
|
||||
await client.getLessonsCovering(
|
||||
today,
|
||||
today.add(const Duration(days: 23)),
|
||||
);
|
||||
expect(lessonsOn(0), 1);
|
||||
expect(lessonsOn(10), 1);
|
||||
expect(lessonsOn(20), 1);
|
||||
|
||||
// Poll during the overlapping re-fetches to catch a transient
|
||||
// dip, not just the end state.
|
||||
var polling = true;
|
||||
var day10DroppedToZero = false;
|
||||
var day20DroppedToZero = false;
|
||||
unawaited(() async {
|
||||
while (polling) {
|
||||
if (lessonsOn(10) == 0) day10DroppedToZero = true;
|
||||
if (lessonsOn(20) == 0) day20DroppedToZero = true;
|
||||
await Future.delayed(Duration.zero);
|
||||
}
|
||||
}());
|
||||
|
||||
// Two shifted, overlapping ranges fired concurrently.
|
||||
await Future.wait([
|
||||
client.getLessonsCovering(
|
||||
today,
|
||||
today.add(const Duration(days: 20)),
|
||||
),
|
||||
client.getLessonsCovering(
|
||||
today.add(const Duration(days: 3)),
|
||||
today.add(const Duration(days: 23)),
|
||||
),
|
||||
]);
|
||||
polling = false;
|
||||
|
||||
expect(
|
||||
day10DroppedToZero,
|
||||
isFalse,
|
||||
reason:
|
||||
'day 10 was already cached and should never transiently '
|
||||
'read as empty during the overlapping re-fetch',
|
||||
);
|
||||
expect(
|
||||
day20DroppedToZero,
|
||||
isFalse,
|
||||
reason:
|
||||
'day 20 was already cached and should never transiently '
|
||||
'read as empty during the overlapping re-fetch',
|
||||
);
|
||||
|
||||
expect(
|
||||
lessonsOn(0),
|
||||
1,
|
||||
reason: 'day 0 lesson should survive both overlapping fetches',
|
||||
);
|
||||
expect(
|
||||
lessonsOn(10),
|
||||
1,
|
||||
reason: 'day 10 lesson should survive both overlapping fetches',
|
||||
);
|
||||
expect(
|
||||
lessonsOn(20),
|
||||
1,
|
||||
reason: 'day 20 lesson should survive both overlapping fetches',
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
"a chunk's own boundary day survives being fetched by a narrower, "
|
||||
'earlier-ending request first',
|
||||
(tester) async {
|
||||
HttpOverrides.global = _RealHttpOverrides();
|
||||
|
||||
await tester.runAsync(() async {
|
||||
// `to` is meant as exclusive everywhere in kreta_client.dart, but
|
||||
// the delete scope used to treat it as inclusive, wiping one day
|
||||
// beyond what was actually fetched.
|
||||
await _resetMockServer(httpClient);
|
||||
await _putTimetable(httpClient, [
|
||||
_lesson(
|
||||
uid: 'boundary',
|
||||
start: '07:30',
|
||||
end: '08:15',
|
||||
name: 'Matematika',
|
||||
daysFromToday: 3,
|
||||
),
|
||||
]);
|
||||
|
||||
final isar = await initDB();
|
||||
await isar.writeTxn(() async {
|
||||
await isar.clear();
|
||||
});
|
||||
Settings = SettingsRepository(isar);
|
||||
await Settings.loadAll();
|
||||
await Settings.mockBackendEnabled.set(true);
|
||||
await Settings.mockBackendUrl.set(_mockServerUrl);
|
||||
|
||||
final tokenResp = await _authenticateMockServer(httpClient);
|
||||
final tokenModel = TokenModel.fromResp(tokenResp);
|
||||
await isar.writeTxn(() async {
|
||||
await isar.tokenModels.clear();
|
||||
await isar.tokenModels.put(tokenModel);
|
||||
});
|
||||
|
||||
await initializeApp();
|
||||
expect(initDone, isTrue);
|
||||
|
||||
final client = initData.client!;
|
||||
await client.init();
|
||||
|
||||
final now = DateTime.now();
|
||||
final today = DateTime(now.year, now.month, now.day);
|
||||
final boundary = today.add(const Duration(days: 3));
|
||||
|
||||
int lessonsOnBoundaryDay() => client.cache
|
||||
.getTimeTable()
|
||||
.findAllSync()
|
||||
.where(
|
||||
(l) =>
|
||||
l.start.year == boundary.year &&
|
||||
l.start.month == boundary.month &&
|
||||
l.start.day == boundary.day,
|
||||
)
|
||||
.length;
|
||||
|
||||
await client.getLessons(
|
||||
today,
|
||||
today.add(const Duration(days: 7)),
|
||||
);
|
||||
expect(lessonsOnBoundaryDay(), 1);
|
||||
|
||||
// `to` lands exactly on the boundary day (exclusive) — must not
|
||||
// touch that day's already-cached lesson.
|
||||
await client.getLessons(today, boundary);
|
||||
|
||||
expect(
|
||||
lessonsOnBoundaryDay(),
|
||||
1,
|
||||
reason:
|
||||
"a fetch whose exclusive `to` is the boundary day must not "
|
||||
'delete that day\'s already-cached lessons — it never '
|
||||
'asked the server for that day in the first place',
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'two occurrences of the same recurring weekly slot on different '
|
||||
'dates both survive being cached',
|
||||
(tester) async {
|
||||
HttpOverrides.global = _RealHttpOverrides();
|
||||
|
||||
await tester.runAsync(() async {
|
||||
// Comma-prefixed Uids share a leading "recurring slot" segment
|
||||
// across weeks — cacheKey used to be derived from only that
|
||||
// segment, so different weeks' lessons overwrote each other.
|
||||
await _resetMockServer(httpClient);
|
||||
await _putTimetable(httpClient, [
|
||||
_lesson(
|
||||
uid: '53721555,slotA-week1',
|
||||
start: '11:00',
|
||||
end: '11:45',
|
||||
name: 'Adatbázis-kezelés II',
|
||||
daysFromToday: 0,
|
||||
),
|
||||
_lesson(
|
||||
uid: '53721555,slotA-week2',
|
||||
start: '11:00',
|
||||
end: '11:45',
|
||||
name: 'Adatbázis-kezelés II',
|
||||
daysFromToday: 7,
|
||||
),
|
||||
]);
|
||||
|
||||
final isar = await initDB();
|
||||
await isar.writeTxn(() async {
|
||||
await isar.clear();
|
||||
});
|
||||
Settings = SettingsRepository(isar);
|
||||
await Settings.loadAll();
|
||||
await Settings.mockBackendEnabled.set(true);
|
||||
await Settings.mockBackendUrl.set(_mockServerUrl);
|
||||
|
||||
final tokenResp = await _authenticateMockServer(httpClient);
|
||||
final tokenModel = TokenModel.fromResp(tokenResp);
|
||||
await isar.writeTxn(() async {
|
||||
await isar.tokenModels.clear();
|
||||
await isar.tokenModels.put(tokenModel);
|
||||
});
|
||||
|
||||
await initializeApp();
|
||||
expect(initDone, isTrue);
|
||||
|
||||
final client = initData.client!;
|
||||
await client.init();
|
||||
await client.getLessons(
|
||||
DateTime.now(),
|
||||
DateTime.now().add(const Duration(days: 10)),
|
||||
);
|
||||
|
||||
final cachedStarts = client.cache
|
||||
.getTimeTable()
|
||||
.findAllSync()
|
||||
.map((l) => l.start)
|
||||
.toSet();
|
||||
|
||||
expect(
|
||||
cachedStarts.length,
|
||||
2,
|
||||
reason:
|
||||
'both occurrences of the recurring slot should be cached as '
|
||||
'distinct rows on their own dates — a cacheKey collision '
|
||||
'would leave only one row, dated whichever occurrence was '
|
||||
'written last',
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,280 +0,0 @@
|
||||
// ignore_for_file: depend_on_referenced_packages
|
||||
//
|
||||
// Isolates whether the monthly calendar's lesson-count flicker is a
|
||||
// UI/query bug or comes from upstream data churn during sync.
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/app/initialization.dart';
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:firka/core/bloc/home_refresh_cubit.dart';
|
||||
import 'package:firka/core/bloc/profile_picture_cubit.dart';
|
||||
import 'package:firka/core/bloc/settings_cubit.dart';
|
||||
import 'package:firka/core/bloc/toast_cubit.dart';
|
||||
import 'package:firka/l10n/app_localizations.dart';
|
||||
import 'package:firka/ui/phone/pages/home/home_timetable_mo.dart';
|
||||
import 'package:firka_common/data/database.dart';
|
||||
import 'package:firka_common/data/models/token_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:kreta_api/kreta_api.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:flutter_local_notifications_platform_interface/flutter_local_notifications_platform_interface.dart';
|
||||
|
||||
const _mockServerUrl = 'http://127.0.0.1:8090';
|
||||
|
||||
class _RealHttpOverrides extends HttpOverrides {}
|
||||
|
||||
class _MockNotificationsPlatform extends FlutterLocalNotificationsPlatform
|
||||
with MockPlatformInterfaceMixin {
|
||||
Future<bool?> initialize(
|
||||
InitializationSettings initializationSettings, {
|
||||
void Function(NotificationResponse)? onDidReceiveNotificationResponse,
|
||||
void Function(NotificationResponse)?
|
||||
onDidReceiveBackgroundNotificationResponse,
|
||||
}) async => true;
|
||||
|
||||
@override
|
||||
Future<List<ActiveNotification>> getActiveNotifications() async => [];
|
||||
}
|
||||
|
||||
Future<TokenGrantResponse> _authenticateMockServer(HttpClient httpClient) async {
|
||||
final loginReq = await httpClient.getUrl(
|
||||
Uri.parse('$_mockServerUrl/Account/Login'),
|
||||
);
|
||||
final loginResp = await loginReq.close();
|
||||
final loginBody = await loginResp.transform(utf8.decoder).join();
|
||||
final match = RegExp(r'name="code" value="([^"]+)"').firstMatch(loginBody);
|
||||
final code = match!.group(1)!;
|
||||
|
||||
final tokenReq = await httpClient.postUrl(
|
||||
Uri.parse('$_mockServerUrl/connect/token'),
|
||||
);
|
||||
tokenReq.headers.contentType = ContentType('application', 'x-www-form-urlencoded');
|
||||
tokenReq.write('grant_type=authorization_code&code=${Uri.encodeQueryComponent(code)}');
|
||||
final tokenResp = await tokenReq.close();
|
||||
final tokenBody = await tokenResp.transform(utf8.decoder).join();
|
||||
return TokenGrantResponse.fromJson(jsonDecode(tokenBody) as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
Future<void> _resetMockServer(HttpClient httpClient) async {
|
||||
final req = await httpClient.postUrl(Uri.parse('$_mockServerUrl/admin/api/reset'));
|
||||
final resp = await req.close();
|
||||
await resp.drain();
|
||||
}
|
||||
|
||||
Future<void> _putTimetable(
|
||||
HttpClient httpClient,
|
||||
List<Map<String, dynamic>> lessons,
|
||||
) async {
|
||||
final req = await httpClient.putUrl(Uri.parse('$_mockServerUrl/admin/api/timetable'));
|
||||
req.headers.contentType = ContentType.json;
|
||||
req.write(jsonEncode(lessons));
|
||||
final resp = await req.close();
|
||||
if (resp.statusCode != 204 && resp.statusCode != 200) {
|
||||
final body = await resp.transform(utf8.decoder).join();
|
||||
throw Exception('Failed to PUT timetable (${resp.statusCode}): $body');
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> _lesson({
|
||||
required String uid,
|
||||
required String start,
|
||||
required String end,
|
||||
required String name,
|
||||
int daysFromToday = 0,
|
||||
}) {
|
||||
final today = DateTime.now().add(Duration(days: daysFromToday));
|
||||
final datePrefix =
|
||||
'${today.year}-${today.month.toString().padLeft(2, '0')}-${today.day.toString().padLeft(2, '0')}';
|
||||
return {
|
||||
'Uid': uid,
|
||||
'Datum': '${datePrefix}T00:00:00',
|
||||
'KezdetIdopont': '${datePrefix}T$start:00',
|
||||
'VegIdopont': '${datePrefix}T$end:00',
|
||||
'Nev': name,
|
||||
'OsztalyCsoport': {'Uid': '10,11.A', 'Nev': '11.A'},
|
||||
'TanarNeve': 'Teszt Tanár',
|
||||
'Tantargy': {
|
||||
'Uid': '1,MATEK',
|
||||
'Nev': name,
|
||||
'Kategoria': {'Uid': '1', 'Nev': 'Kötelező', 'Leiras': 'Kötelező tantárgy'},
|
||||
'SortIndex': 1,
|
||||
},
|
||||
'TeremNeve': '101',
|
||||
'Tipus': {'Uid': '1', 'Nev': 'Tanóra', 'Leiras': 'Tanóra'},
|
||||
'TanuloJelenlet': {'Uid': '', 'Nev': '', 'Leiras': ''},
|
||||
'Allapot': {'Uid': '1', 'Nev': 'Megtartott', 'Leiras': 'Megtartott óra'},
|
||||
'IsTanuloHaziFeladatEnabled': false,
|
||||
'IsHaziFeladatMegoldva': false,
|
||||
'Csatolmanyok': [],
|
||||
'IsDigitalisOra': false,
|
||||
'DigitalisTamogatoEszkozTipusList': [],
|
||||
'Letrehozas': '${datePrefix}T00:00:00',
|
||||
'UtolsoModositas': DateTime.now().toUtc().toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
HttpOverrides.global = _RealHttpOverrides();
|
||||
FlutterLocalNotificationsPlatform.instance = _MockNotificationsPlatform();
|
||||
logger = Logger('TimetableMonthWidgetFlickerTest');
|
||||
|
||||
testWidgets(
|
||||
'repeated HomeRefreshCubit triggers never drop an already-rendered '
|
||||
'day\'s lesson count when the underlying data is unchanged',
|
||||
(tester) async {
|
||||
HttpOverrides.global = _RealHttpOverrides();
|
||||
final httpClient = HttpClient()..connectionTimeout = const Duration(seconds: 5);
|
||||
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
const MethodChannel('plugins.flutter.io/path_provider'),
|
||||
(MethodCall methodCall) async => Directory.systemTemp.path,
|
||||
);
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
const MethodChannel('dev.fluttercommunity.plus/package_info'),
|
||||
(MethodCall methodCall) async => {
|
||||
'appName': 'firka',
|
||||
'packageName': 'app.firka.naplo',
|
||||
'version': '1.0.0',
|
||||
'buildNumber': '1',
|
||||
},
|
||||
);
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
const MethodChannel('firka.app/main'),
|
||||
(MethodCall methodCall) async => 'SM-A705FN;11;30',
|
||||
);
|
||||
|
||||
await tester.runAsync(() async {
|
||||
await _resetMockServer(httpClient);
|
||||
// Lessons on 3 different days within the visible 49-day grid.
|
||||
await _putTimetable(httpClient, [
|
||||
_lesson(uid: 'd0', start: '07:30', end: '08:15', name: 'Matematika', daysFromToday: 0),
|
||||
_lesson(uid: 'd5', start: '07:30', end: '08:15', name: 'Fizika', daysFromToday: 5),
|
||||
_lesson(uid: 'd12', start: '07:30', end: '08:15', name: 'Kémia', daysFromToday: 12),
|
||||
]);
|
||||
|
||||
final isar = await initDB();
|
||||
await isar.writeTxn(() async {
|
||||
await isar.clear();
|
||||
});
|
||||
Settings = SettingsRepository(isar);
|
||||
await Settings.loadAll();
|
||||
await Settings.mockBackendEnabled.set(true);
|
||||
await Settings.mockBackendUrl.set(_mockServerUrl);
|
||||
|
||||
final tokenResp = await _authenticateMockServer(httpClient);
|
||||
final tokenModel = TokenModel.fromResp(tokenResp);
|
||||
await isar.writeTxn(() async {
|
||||
await isar.tokenModels.clear();
|
||||
await isar.tokenModels.put(tokenModel);
|
||||
});
|
||||
|
||||
await initializeApp();
|
||||
expect(initDone, isTrue);
|
||||
|
||||
final client = initData.client!;
|
||||
await client.init();
|
||||
await client.renewCache(reInit: false);
|
||||
// Make sure the whole visible grid (7 weeks) is actually synced,
|
||||
// not just renewCache's default 2-week window.
|
||||
await client.getLessonsCovering(
|
||||
DateTime.now().subtract(const Duration(days: 21)),
|
||||
DateTime.now().add(const Duration(days: 28)),
|
||||
);
|
||||
});
|
||||
|
||||
await tester.pumpWidget(
|
||||
MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider<SettingsCubit>.value(value: initData.settingsCubit),
|
||||
BlocProvider<ProfilePictureCubit>.value(
|
||||
value: initData.profilePictureCubit,
|
||||
),
|
||||
BlocProvider<ToastCubit>.value(value: initData.toastCubit),
|
||||
BlocProvider<HomeRefreshCubit>.value(
|
||||
value: initData.homeRefreshCubit,
|
||||
),
|
||||
],
|
||||
child: MaterialApp(
|
||||
localizationsDelegates: const [
|
||||
AppLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: HomeTimetableMonthlyScreen(initData),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Read the badge Text out of each cell directly — scanning all
|
||||
// on-screen Text would also match the day-of-month labels.
|
||||
List<String?> badgeTexts() {
|
||||
final columns = tester
|
||||
.widgetList<Column>(
|
||||
find.descendant(
|
||||
of: find.byType(GridView),
|
||||
matching: find.byType(Column),
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
return columns.map((col) {
|
||||
final container = col.children.first as Container;
|
||||
final body = container.child;
|
||||
if (body is Center && body.child is Text) {
|
||||
return (body.child as Text).data;
|
||||
}
|
||||
return null;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
final baseline = badgeTexts();
|
||||
final baselineNonEmptyCount = baseline.whereType<String>().length;
|
||||
expect(
|
||||
baselineNonEmptyCount,
|
||||
greaterThanOrEqualTo(3),
|
||||
reason:
|
||||
'sanity check: the 3 seeded days should show non-empty lesson '
|
||||
'count badges before any refresh trigger fires',
|
||||
);
|
||||
|
||||
var everLostABadge = false;
|
||||
for (var i = 0; i < 15; i++) {
|
||||
initData.homeRefreshCubit.requestRefresh();
|
||||
await tester.pump();
|
||||
final current = badgeTexts();
|
||||
for (var cell = 0; cell < baseline.length; cell++) {
|
||||
if (baseline[cell] != null && current[cell] == null) {
|
||||
everLostABadge = true;
|
||||
}
|
||||
}
|
||||
if (everLostABadge) break;
|
||||
}
|
||||
|
||||
expect(
|
||||
everLostABadge,
|
||||
isFalse,
|
||||
reason:
|
||||
'a day that had a lesson-count badge lost it after a pure UI '
|
||||
'refresh trigger, with no network activity and unchanged Isar '
|
||||
'data — this would be a genuine widget/query bug, not server '
|
||||
'data variability',
|
||||
);
|
||||
|
||||
httpClient.close(force: true);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1,314 +0,0 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.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/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:firka/l10n/app_localizations_en.dart';
|
||||
import 'package:firka/l10n/app_localizations_hu.dart';
|
||||
import 'package:firka/services/notification_delivery_service.dart';
|
||||
import 'package:firka/services/progress_notification_service.dart';
|
||||
import 'package:isar_community/isar.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
const progressChannel = MethodChannel('app.firka/progress_notification');
|
||||
late Directory tempDir;
|
||||
late List<MethodCall> progressCalls;
|
||||
|
||||
setUp(() async {
|
||||
progressCalls = [];
|
||||
ProgressNotificationService.isAndroidOverride = true;
|
||||
NotificationDeliveryService.isAndroidOverride = true;
|
||||
NotificationDeliveryService.resetForTesting();
|
||||
NotificationDeliveryService.gmsAvailabilityOverride = true;
|
||||
|
||||
tempDir = Directory.systemTemp.createTempSync('progress_test_');
|
||||
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
const MethodChannel('plugins.flutter.io/path_provider'),
|
||||
(MethodCall methodCall) async => tempDir.path,
|
||||
);
|
||||
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
progressChannel,
|
||||
(MethodCall call) async {
|
||||
progressCalls.add(call);
|
||||
return true;
|
||||
},
|
||||
);
|
||||
|
||||
final isar = await initDB();
|
||||
await isar.writeTxn(() async {
|
||||
await isar.clear();
|
||||
});
|
||||
Settings = SettingsRepository(isar);
|
||||
await Settings.loadAll();
|
||||
});
|
||||
|
||||
tearDown(() async {
|
||||
debugFakeTime = null;
|
||||
try {
|
||||
if (tempDir.existsSync()) {
|
||||
tempDir.deleteSync(recursive: true);
|
||||
}
|
||||
} catch (_) {}
|
||||
});
|
||||
|
||||
test('progressNotificationEnabled setting defaults to false and can be toggled', () async {
|
||||
expect(Settings.progressNotificationEnabled.value, isFalse);
|
||||
await Settings.progressNotificationEnabled.set(true);
|
||||
expect(Settings.progressNotificationEnabled.value, isTrue);
|
||||
await Settings.progressNotificationEnabled.set(false);
|
||||
expect(Settings.progressNotificationEnabled.value, isFalse);
|
||||
});
|
||||
|
||||
test('startService and stopService invoke appropriate method channel methods', () async {
|
||||
final startRes = await ProgressNotificationService.startService();
|
||||
expect(startRes, isTrue);
|
||||
expect(progressCalls.any((c) => c.method == 'startProgressService'), isTrue);
|
||||
|
||||
final stopRes = await ProgressNotificationService.stopService();
|
||||
expect(stopRes, isTrue);
|
||||
expect(progressCalls.any((c) => c.method == 'stopProgressService'), isTrue);
|
||||
});
|
||||
|
||||
test('schedule6AmAlarm and cancel6AmAlarm invoke appropriate method channel methods', () async {
|
||||
final schedRes = await ProgressNotificationService.schedule6AmAlarm();
|
||||
expect(schedRes, isTrue);
|
||||
expect(progressCalls.any((c) => c.method == 'schedule6AmAlarm'), isTrue);
|
||||
|
||||
final cancelRes = await ProgressNotificationService.cancel6AmAlarm();
|
||||
expect(cancelRes, isTrue);
|
||||
expect(progressCalls.any((c) => c.method == 'cancel6AmAlarm'), isTrue);
|
||||
});
|
||||
|
||||
test('sync stops service and cancels alarm when disabled', () async {
|
||||
await Settings.notifyAll.set(true);
|
||||
await Settings.progressNotificationEnabled.set(false);
|
||||
progressCalls.clear();
|
||||
|
||||
await ProgressNotificationService.sync();
|
||||
|
||||
expect(progressCalls.any((c) => c.method == 'stopProgressService'), isTrue);
|
||||
expect(progressCalls.any((c) => c.method == 'cancel6AmAlarm'), isTrue);
|
||||
});
|
||||
|
||||
test('sync schedules 6 AM alarm when delivery method is alarm', () async {
|
||||
await Settings.notifyAll.set(true);
|
||||
await Settings.progressNotificationEnabled.set(true);
|
||||
await Settings.notificationDeliveryMethod.set(NotificationDeliveryMethod.alarm);
|
||||
progressCalls.clear();
|
||||
|
||||
await ProgressNotificationService.sync();
|
||||
|
||||
expect(progressCalls.any((c) => c.method == 'schedule6AmAlarm'), isTrue);
|
||||
});
|
||||
|
||||
test('sync cancels 6 AM alarm when delivery method is FCM (triggers via FCM wakeup)', () async {
|
||||
await Settings.notifyAll.set(true);
|
||||
await Settings.progressNotificationEnabled.set(true);
|
||||
await Settings.notificationDeliveryMethod.set(NotificationDeliveryMethod.fcm);
|
||||
progressCalls.clear();
|
||||
|
||||
await ProgressNotificationService.sync();
|
||||
|
||||
expect(progressCalls.any((c) => c.method == 'cancel6AmAlarm'), isTrue);
|
||||
});
|
||||
|
||||
LessonCacheModel makeLesson(String uid, String name, DateTime start, DateTime end) {
|
||||
return LessonCacheModel()
|
||||
..cacheKey = Isar.autoIncrement
|
||||
..createdAt = DateTime.now()
|
||||
..uid = uid
|
||||
..name = name
|
||||
..state = 'normal'
|
||||
..type = 'lesson'
|
||||
..start = start
|
||||
..end = end;
|
||||
}
|
||||
|
||||
test('isRunning queries method channel isProgressServiceRunning', () async {
|
||||
progressCalls.clear();
|
||||
final running = await ProgressNotificationService.isRunning();
|
||||
expect(running, isTrue);
|
||||
expect(progressCalls.any((c) => c.method == 'isProgressServiceRunning'), isTrue);
|
||||
});
|
||||
|
||||
test('checkAndStartOnAppOpen does not start when time is before first lesson start', () async {
|
||||
final isar = isarInit;
|
||||
final today = DateTime.now();
|
||||
final lesson1 = makeLesson('l1', 'Math', DateTime(today.year, today.month, today.day, 8, 0), DateTime(today.year, today.month, today.day, 8, 45));
|
||||
final lesson2 = makeLesson('l2', 'History', DateTime(today.year, today.month, today.day, 9, 0), DateTime(today.year, today.month, today.day, 9, 45));
|
||||
|
||||
await isar.writeTxn(() async {
|
||||
await isar.lessonCacheModels.putAll([lesson1, lesson2]);
|
||||
});
|
||||
|
||||
await Settings.notifyAll.set(true);
|
||||
await Settings.progressNotificationEnabled.set(true);
|
||||
|
||||
// Set time before first lesson (07:30)
|
||||
debugFakeTime = DateTime(today.year, today.month, today.day, 7, 30);
|
||||
progressCalls.clear();
|
||||
|
||||
await ProgressNotificationService.checkAndStartOnAppOpen();
|
||||
|
||||
expect(progressCalls.any((c) => c.method == 'startProgressService'), isFalse);
|
||||
});
|
||||
|
||||
test('checkAndStartOnAppOpen starts service when time is within school day and service is not running', () async {
|
||||
final isar = isarInit;
|
||||
final today = DateTime.now();
|
||||
final lesson1 = makeLesson('l1', 'Math', DateTime(today.year, today.month, today.day, 8, 0), DateTime(today.year, today.month, today.day, 8, 45));
|
||||
final lesson2 = makeLesson('l2', 'History', DateTime(today.year, today.month, today.day, 9, 0), DateTime(today.year, today.month, today.day, 9, 45));
|
||||
|
||||
await isar.writeTxn(() async {
|
||||
await isar.lessonCacheModels.putAll([lesson1, lesson2]);
|
||||
});
|
||||
|
||||
await Settings.notifyAll.set(true);
|
||||
await Settings.progressNotificationEnabled.set(true);
|
||||
|
||||
// Mock isProgressServiceRunning returning false
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
progressChannel,
|
||||
(MethodCall call) async {
|
||||
progressCalls.add(call);
|
||||
if (call.method == 'isProgressServiceRunning') return false;
|
||||
return true;
|
||||
},
|
||||
);
|
||||
|
||||
// Set time inside school day (08:20)
|
||||
debugFakeTime = DateTime(today.year, today.month, today.day, 8, 20);
|
||||
progressCalls.clear();
|
||||
|
||||
await ProgressNotificationService.checkAndStartOnAppOpen();
|
||||
|
||||
expect(progressCalls.any((c) => c.method == 'isProgressServiceRunning'), isTrue);
|
||||
expect(progressCalls.any((c) => c.method == 'startProgressService'), isTrue);
|
||||
});
|
||||
|
||||
test('checkAndStartOnAppOpen does not start service when already running', () async {
|
||||
final isar = isarInit;
|
||||
final today = DateTime.now();
|
||||
final lesson1 = makeLesson('l1', 'Math', DateTime(today.year, today.month, today.day, 8, 0), DateTime(today.year, today.month, today.day, 8, 45));
|
||||
final lesson2 = makeLesson('l2', 'History', DateTime(today.year, today.month, today.day, 9, 0), DateTime(today.year, today.month, today.day, 9, 45));
|
||||
|
||||
await isar.writeTxn(() async {
|
||||
await isar.lessonCacheModels.putAll([lesson1, lesson2]);
|
||||
});
|
||||
|
||||
await Settings.notifyAll.set(true);
|
||||
await Settings.progressNotificationEnabled.set(true);
|
||||
|
||||
// Mock isProgressServiceRunning returning true
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
progressChannel,
|
||||
(MethodCall call) async {
|
||||
progressCalls.add(call);
|
||||
if (call.method == 'isProgressServiceRunning') return true;
|
||||
return true;
|
||||
},
|
||||
);
|
||||
|
||||
// Set time inside school day (08:20)
|
||||
debugFakeTime = DateTime(today.year, today.month, today.day, 8, 20);
|
||||
progressCalls.clear();
|
||||
|
||||
await ProgressNotificationService.checkAndStartOnAppOpen();
|
||||
|
||||
expect(progressCalls.any((c) => c.method == 'isProgressServiceRunning'), isTrue);
|
||||
expect(progressCalls.any((c) => c.method == 'startProgressService'), isFalse);
|
||||
});
|
||||
|
||||
test('checkAndStartOnAppOpen stops service and does not start when time is after last lesson end', () async {
|
||||
final isar = isarInit;
|
||||
final today = DateTime.now();
|
||||
final lesson1 = makeLesson('l1', 'Math', DateTime(today.year, today.month, today.day, 8, 0), DateTime(today.year, today.month, today.day, 8, 45));
|
||||
final lesson2 = makeLesson('l2', 'History', DateTime(today.year, today.month, today.day, 9, 0), DateTime(today.year, today.month, today.day, 9, 45));
|
||||
|
||||
await isar.writeTxn(() async {
|
||||
await isar.lessonCacheModels.putAll([lesson1, lesson2]);
|
||||
});
|
||||
|
||||
await Settings.notifyAll.set(true);
|
||||
await Settings.progressNotificationEnabled.set(true);
|
||||
|
||||
// Mock isProgressServiceRunning returning true
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
progressChannel,
|
||||
(MethodCall call) async {
|
||||
progressCalls.add(call);
|
||||
if (call.method == 'isProgressServiceRunning') return true;
|
||||
return true;
|
||||
},
|
||||
);
|
||||
|
||||
// Set time after last lesson (10:00)
|
||||
debugFakeTime = DateTime(today.year, today.month, today.day, 10, 0);
|
||||
progressCalls.clear();
|
||||
|
||||
await ProgressNotificationService.checkAndStartOnAppOpen();
|
||||
|
||||
expect(progressCalls.any((c) => c.method == 'startProgressService'), isFalse);
|
||||
expect(progressCalls.any((c) => c.method == 'stopProgressService'), isTrue);
|
||||
});
|
||||
|
||||
test('syncStrings sends Hungarian strings map to native platform without Unicode symbols', () async {
|
||||
progressCalls.clear();
|
||||
await ProgressNotificationService.syncStrings(AppLocalizationsHu());
|
||||
final call = progressCalls.firstWhere((c) => c.method == 'updateProgressStrings');
|
||||
final map = call.arguments as Map;
|
||||
expect(map['progress_notif_channel_name'], 'Tanítási nap folyamata');
|
||||
expect(map['progress_notif_channel_desc'], 'Élő értesítés a mai órák és szünetek állapotáról');
|
||||
expect(map['progress_notif_lesson_title'], '{number}. óra: {name}');
|
||||
expect(map['progress_notif_substitution'], ' (Helyettesítés)');
|
||||
expect(map['progress_notif_case1_text'], '{minutes} perc múlva ({timeRange}){room}{substitution}{remaining}');
|
||||
expect(map['progress_notif_case2_lesson_text'], '{minutes} perc van hátra ({timeRange}){room}{substitution}{remaining}');
|
||||
expect(map['progress_notif_case2_break_title'], 'Szünet');
|
||||
expect(map['progress_notif_case2_break_text'], '{minutes} perc van hátra{remaining}');
|
||||
expect(map['progress_notif_critical_text'], '{minutes}p');
|
||||
expect(map['progress_notif_remaining_lessons_one'], ' - Még 1 óra van hátra');
|
||||
expect(map['progress_notif_remaining_lessons_other'], ' - Még {count} óra van hátra');
|
||||
|
||||
// Verify none of the strings contain Unicode bullet
|
||||
for (final val in map.values) {
|
||||
expect((val as String).contains('•'), isFalse);
|
||||
}
|
||||
});
|
||||
|
||||
test('syncStrings sends English strings map to native platform without Unicode symbols', () async {
|
||||
progressCalls.clear();
|
||||
await ProgressNotificationService.syncStrings(AppLocalizationsEn());
|
||||
final call = progressCalls.firstWhere((c) => c.method == 'updateProgressStrings');
|
||||
final map = call.arguments as Map;
|
||||
expect(map['progress_notif_channel_name'], 'School day progress');
|
||||
expect(map['progress_notif_channel_desc'], "Live progress notification for today's lessons and breaks");
|
||||
expect(map['progress_notif_lesson_title'], 'Lesson {number}: {name}');
|
||||
expect(map['progress_notif_substitution'], ' (Substitution)');
|
||||
expect(map['progress_notif_case1_text'], 'In {minutes} min ({timeRange}){room}{substitution}{remaining}');
|
||||
expect(map['progress_notif_case2_lesson_text'], '{minutes} min left ({timeRange}){room}{substitution}{remaining}');
|
||||
expect(map['progress_notif_case2_break_title'], 'Break');
|
||||
expect(map['progress_notif_case2_break_text'], '{minutes} min left{remaining}');
|
||||
expect(map['progress_notif_critical_text'], '{minutes}m');
|
||||
expect(map['progress_notif_remaining_lessons_one'], ' - 1 lesson remaining');
|
||||
expect(map['progress_notif_remaining_lessons_other'], ' - {count} lessons remaining');
|
||||
|
||||
// Verify none of the strings contain Unicode bullet
|
||||
for (final val in map.values) {
|
||||
expect((val as String).contains('•'), isFalse);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,201 +1,48 @@
|
||||
import 'package:firka/ui/phone/screens/themes/builtin_theme_id.dart';
|
||||
import 'package:firka/ui/phone/screens/themes/user_theme.dart';
|
||||
import 'package:firka/ui/phone/screens/themes/widgets/theme_qr_card.dart';
|
||||
import 'package:firka_common/ui/theme/core_theme.dart';
|
||||
import 'package:firka_common/ui/theme/grade_theme.dart';
|
||||
import 'package:firka_common/ui/theme/theme_binary_format.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
final _testGradeColors = [
|
||||
resolveGrade(defaultGradeThemeId).light.grade1,
|
||||
resolveGrade(defaultGradeThemeId).light.grade2,
|
||||
resolveGrade(defaultGradeThemeId).light.grade3,
|
||||
resolveGrade(defaultGradeThemeId).light.grade4,
|
||||
resolveGrade(defaultGradeThemeId).light.grade5,
|
||||
];
|
||||
|
||||
void main() {
|
||||
group('theme sharing binary format in firka', () {
|
||||
test('encode and decode url-safe base64 string for firkacore', () {
|
||||
final bytes = ThemeBinaryFormat.encodeCoreTheme(
|
||||
firkaCore,
|
||||
gradeColors: _testGradeColors,
|
||||
);
|
||||
group('Theme sharing binary format in firka', () {
|
||||
test('encode and decode URL-safe base64 string for firkaCore', () {
|
||||
final bytes = ThemeBinaryFormat.encodeCoreTheme(firkaCore);
|
||||
final b64 = ThemeBinaryFormat.toBase64(bytes);
|
||||
expect(b64.isNotEmpty, isTrue);
|
||||
|
||||
final decodedBytes = ThemeBinaryFormat.fromBase64(b64);
|
||||
final decoded = ThemeBinaryFormat.decode(decodedBytes);
|
||||
final slots = decoded.toThemeSlots();
|
||||
expect(
|
||||
slots.light[ThemeColorSlot.background],
|
||||
firkaCore.light.background,
|
||||
);
|
||||
expect(slots.light[ThemeColorSlot.background], firkaCore.light.background);
|
||||
expect(slots.dark[ThemeColorSlot.background], firkaCore.dark.background);
|
||||
expect(slots.light[ThemeColorSlot.accent], firkaCore.light.accent);
|
||||
expect(slots.dark[ThemeColorSlot.accent], firkaCore.dark.accent);
|
||||
});
|
||||
|
||||
test('builtin theme produces a share code', () {
|
||||
final builtin = UserTheme.builtin(
|
||||
'firka',
|
||||
coreId: defaultCoreThemeId,
|
||||
gradeId: defaultGradeThemeId,
|
||||
);
|
||||
expect(builtin.canShare, isTrue);
|
||||
final code = builtin.shareCode;
|
||||
expect(code.isNotEmpty, isTrue);
|
||||
|
||||
// the code round-trips back to valid binary data
|
||||
final decoded = ThemeBinaryFormat.decodeFromBase64(code);
|
||||
expect(decoded.gradeColors.length, 5);
|
||||
final slots = decoded.toThemeSlots();
|
||||
expect(slots.light[ThemeColorSlot.accent], firkaCore.light.accent);
|
||||
});
|
||||
|
||||
test('custom theme without code cannot share', () {
|
||||
final custom = UserTheme(
|
||||
id: 'custom_1',
|
||||
name: 'empty',
|
||||
origin: ThemeOrigin.own,
|
||||
swatch: const [Colors.red, Colors.white, Colors.black],
|
||||
);
|
||||
expect(custom.canShare, isFalse);
|
||||
});
|
||||
|
||||
test('custom theme with code can share', () {
|
||||
final bytes = ThemeBinaryFormat.encodeCoreTheme(
|
||||
firkaCore,
|
||||
gradeColors: _testGradeColors,
|
||||
);
|
||||
final code = ThemeBinaryFormat.toBase64(bytes);
|
||||
final custom = UserTheme(
|
||||
id: 'custom_2',
|
||||
name: 'with code',
|
||||
origin: ThemeOrigin.own,
|
||||
swatch: const [Colors.red, Colors.white, Colors.black],
|
||||
code: code,
|
||||
);
|
||||
expect(custom.canShare, isTrue);
|
||||
expect(custom.shareCode, code);
|
||||
});
|
||||
|
||||
test('share url includes name and code', () {
|
||||
final bytes = ThemeBinaryFormat.encodeCoreTheme(
|
||||
firkaCore,
|
||||
gradeColors: _testGradeColors,
|
||||
);
|
||||
final code = ThemeBinaryFormat.toBase64(bytes);
|
||||
final theme = UserTheme(
|
||||
id: 'url_test',
|
||||
name: 'Teszt Téma',
|
||||
origin: ThemeOrigin.own,
|
||||
swatch: const [Colors.red, Colors.white, Colors.black],
|
||||
code: code,
|
||||
);
|
||||
final url = theme.shareUrl;
|
||||
expect(url, contains('firka.app'));
|
||||
expect(url, contains('d=$code'));
|
||||
expect(url, contains('n='));
|
||||
});
|
||||
|
||||
test('parse theme share payload from url', () {
|
||||
final code = 'abc123';
|
||||
final url = 'https://firka.app/?d=$code&n=My%20Theme';
|
||||
final payload = url.parseThemeSharePayload();
|
||||
expect(payload.code, code);
|
||||
expect(payload.name, 'My Theme');
|
||||
expect(payload.shareId, isEmpty);
|
||||
});
|
||||
|
||||
test('an unpublished theme shares without a share id', () {
|
||||
final theme = UserTheme(
|
||||
id: 'unpublished',
|
||||
name: 'Teszt',
|
||||
origin: ThemeOrigin.own,
|
||||
swatch: const [Colors.red, Colors.white, Colors.black],
|
||||
code: 'abc123',
|
||||
);
|
||||
expect(theme.shareUrl, isNot(contains('&s=')));
|
||||
});
|
||||
|
||||
test('a published theme carries both the code and the share id', () {
|
||||
final theme = UserTheme(
|
||||
id: 'published',
|
||||
name: 'Teszt',
|
||||
origin: ThemeOrigin.own,
|
||||
swatch: const [Colors.red, Colors.white, Colors.black],
|
||||
code: 'abc123',
|
||||
shareId: 'f' * 32,
|
||||
);
|
||||
|
||||
// the code imports with no network, the share id keeps it up to date
|
||||
final payload = theme.shareUrl.parseThemeSharePayload();
|
||||
expect(payload.code, 'abc123');
|
||||
expect(payload.shareId, 'f' * 32);
|
||||
expect(payload.name, 'Teszt');
|
||||
});
|
||||
|
||||
test('an imported theme follows the share it came from', () {
|
||||
final followed = UserTheme(
|
||||
id: 'imported',
|
||||
name: 'Teszt',
|
||||
origin: ThemeOrigin.downloaded,
|
||||
swatch: const [Colors.red, Colors.white, Colors.black],
|
||||
code: 'abc123',
|
||||
shareId: 'f' * 32,
|
||||
);
|
||||
expect(followed.followsShare, isTrue);
|
||||
|
||||
final pasted = UserTheme(
|
||||
id: 'pasted',
|
||||
name: 'Teszt',
|
||||
origin: ThemeOrigin.downloaded,
|
||||
swatch: const [Colors.red, Colors.white, Colors.black],
|
||||
code: 'abc123',
|
||||
);
|
||||
expect(pasted.followsShare, isFalse);
|
||||
});
|
||||
|
||||
test('sharing no longer freezes a theme', () {
|
||||
final shared = UserTheme(
|
||||
id: 'still_editable',
|
||||
name: 'Teszt',
|
||||
origin: ThemeOrigin.own,
|
||||
swatch: const [Colors.red, Colors.white, Colors.black],
|
||||
code: 'abc123',
|
||||
shareId: 'f' * 32,
|
||||
);
|
||||
expect(shared.canEdit, isTrue);
|
||||
expect(shared.canRename, isTrue);
|
||||
});
|
||||
|
||||
test('parse theme share payload from plain code', () {
|
||||
final code = 'abc123';
|
||||
final payload = code.parseThemeSharePayload();
|
||||
expect(payload.code, code);
|
||||
expect(payload.name, isNull);
|
||||
});
|
||||
|
||||
testWidgets('ThemeQrCard renders theme name and QR code', (tester) async {
|
||||
final bytes = ThemeBinaryFormat.encodeCoreTheme(
|
||||
firkaCore,
|
||||
gradeColors: _testGradeColors,
|
||||
);
|
||||
final bytes = ThemeBinaryFormat.encodeCoreTheme(firkaCore);
|
||||
final b64 = ThemeBinaryFormat.toBase64(bytes);
|
||||
final userTheme = UserTheme(
|
||||
id: 'test_theme',
|
||||
name: 'Firka Green',
|
||||
origin: ThemeOrigin.own,
|
||||
swatch: const [Color(0xFFA7DC22), Colors.white, Color(0xFF1E1E1E)],
|
||||
swatch: const [
|
||||
Color(0xFFA7DC22),
|
||||
Colors.white,
|
||||
Color(0xFF1E1E1E),
|
||||
],
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: ThemeQrCard(theme: userTheme, shareData: b64),
|
||||
child: ThemeQrCard(
|
||||
theme: userTheme,
|
||||
shareData: b64,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -56,9 +56,6 @@ Map<ClassIcon, RegExp> _descriptors = {
|
||||
),
|
||||
ClassIcon.religion: RegExp(r'(hit|erkolcs)tan|vallas|etika|bibliaismeret'),
|
||||
ClassIcon.economics: RegExp(r'penzugy|gazdasag'),
|
||||
ClassIcon.applications: RegExp(
|
||||
r'asztali(?!\s*tenisz)|mob(il)?[\.\s]*(alk|fejl|app|prog)|szoftver\s*(fejl|teszt|alk)|software\s*dev',
|
||||
),
|
||||
ClassIcon.it: RegExp(r'informatika|szoftver|iroda|digitalis'),
|
||||
ClassIcon.code: RegExp(r'prog|alkalmazas'),
|
||||
ClassIcon.networking: RegExp(r'halozat'),
|
||||
@@ -74,10 +71,11 @@ Map<ClassIcon, RegExp> _descriptors = {
|
||||
ClassIcon.diligence: RegExp(r'szorgalom'),
|
||||
ClassIcon.attitude: RegExp(r'magatartas'),
|
||||
ClassIcon.language: RegExp(
|
||||
r'angol|nemet|francia|olasz|orosz|spanyol|latin|kinai|idegen|(ideg(en)?|id)[\.\s-]*ny|munkavallaloi?.*(ideg|id|nyelv)|szakmai.*ny|nyelv',
|
||||
r'angol|nemet|francia|olasz|orosz|spanyol|latin|kinai|nyelv',
|
||||
),
|
||||
ClassIcon.linux: RegExp(r'linux'),
|
||||
ClassIcon.database: RegExp(r'adatbazis.*'),
|
||||
ClassIcon.applications: RegExp(r'asztali alkalmazasok'),
|
||||
ClassIcon.project: RegExp(r'projekt'),
|
||||
};
|
||||
|
||||
@@ -117,23 +115,23 @@ Map<ClassIcon, Uint8List> _iconMap = {
|
||||
ClassIcon.project: Majesticon.presentationSolid,
|
||||
};
|
||||
|
||||
ClassIcon? getIconTypeByName(String subjectName) {
|
||||
ClassIcon? getIconType(SubjectCacheModel subject) {
|
||||
ClassIcon? icon;
|
||||
|
||||
final normalized = subjectName
|
||||
.toLowerCase()
|
||||
.replaceAll("ö", "o")
|
||||
.replaceAll("ü", "u")
|
||||
.replaceAll("ó", "o")
|
||||
.replaceAll("ő", "o")
|
||||
.replaceAll("ú", "u")
|
||||
.replaceAll("é", "e")
|
||||
.replaceAll("á", "a")
|
||||
.replaceAll("ű", "u")
|
||||
.replaceAll("í", "i");
|
||||
|
||||
for (var desc in _descriptors.entries) {
|
||||
if (desc.value.hasMatch(normalized)) {
|
||||
if (desc.value.hasMatch(
|
||||
subject.name
|
||||
.replaceAll("ö", "o")
|
||||
.replaceAll("ü", "u")
|
||||
.replaceAll("ó", "o")
|
||||
.replaceAll("ő", "o")
|
||||
.replaceAll("ú", "u")
|
||||
.replaceAll("é", "e")
|
||||
.replaceAll("á", "a")
|
||||
.replaceAll("ű", "u")
|
||||
.replaceAll("í", "i")
|
||||
.toLowerCase(),
|
||||
)) {
|
||||
icon = desc.key;
|
||||
|
||||
break;
|
||||
@@ -143,10 +141,6 @@ ClassIcon? getIconTypeByName(String subjectName) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
ClassIcon? getIconType(SubjectCacheModel subject) {
|
||||
return getIconTypeByName(subject.name);
|
||||
}
|
||||
|
||||
Uint8List getIconData(ClassIcon? icon) {
|
||||
if (icon == null) return Majesticon.alertCircleSolid;
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@ part 'grade_cache_model.g.dart';
|
||||
|
||||
@collection
|
||||
class GradeCacheModel extends GenericCacheModel<Grade> {
|
||||
GradeCacheModel();
|
||||
|
||||
String? mode;
|
||||
String? topic;
|
||||
late String type;
|
||||
@@ -51,32 +49,4 @@ class GradeCacheModel extends GenericCacheModel<Grade> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Plain-field JSON representation (no Isar links) for cross-process sync, e.g. Wear OS.
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'mode': mode,
|
||||
'topic': topic,
|
||||
'type': type,
|
||||
'valueType': valueType,
|
||||
'writtenAt': writtenAt.toIso8601String(),
|
||||
'numericValue': numericValue,
|
||||
'weightPercentage': weightPercentage,
|
||||
'textValue': textValue,
|
||||
'teacherName': teacherName,
|
||||
};
|
||||
}
|
||||
|
||||
factory GradeCacheModel.fromJson(Map<String, dynamic> json) {
|
||||
return GradeCacheModel()
|
||||
..mode = json['mode'] as String?
|
||||
..topic = json['topic'] as String?
|
||||
..type = json['type'] as String
|
||||
..valueType = json['valueType'] as String
|
||||
..writtenAt = DateTime.parse(json['writtenAt'] as String)
|
||||
..numericValue = json['numericValue'] as int?
|
||||
..weightPercentage = json['weightPercentage'] as int?
|
||||
..textValue = json['textValue'] as String
|
||||
..teacherName = json['teacherName'] as String;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,6 @@ part 'lesson_cache_model.g.dart';
|
||||
|
||||
@collection
|
||||
class LessonCacheModel extends GenericCacheModel<Lesson> {
|
||||
LessonCacheModel();
|
||||
|
||||
String? uid;
|
||||
@Index()
|
||||
late DateTime start;
|
||||
late DateTime end;
|
||||
@@ -42,7 +39,6 @@ class LessonCacheModel extends GenericCacheModel<Lesson> {
|
||||
@override
|
||||
void apply(CacheContext<Lesson> ctx) {
|
||||
this
|
||||
..uid = ctx.data.uid
|
||||
..start = ctx.data.start
|
||||
..end = ctx.data.end
|
||||
..dailyNth = ctx.data.lessonNumber
|
||||
@@ -78,55 +74,17 @@ class LessonCacheModel extends GenericCacheModel<Lesson> {
|
||||
|
||||
if (classGroup.value == null) {
|
||||
classGroup.value = isarInit.classGroupCacheModels
|
||||
.filter()
|
||||
.group(ctx.cacheManager.isCurrentClassGroup)
|
||||
.and()
|
||||
.typeEqualTo("Osztaly")
|
||||
.findFirstSync() ??
|
||||
isarInit.classGroupCacheModels
|
||||
.filter()
|
||||
.group(ctx.cacheManager.isCurrentClassGroup)
|
||||
.findFirstSync();
|
||||
.filter()
|
||||
.group(ctx.cacheManager.isCurrentClassGroup)
|
||||
.and()
|
||||
.typeEqualTo("Osztaly")
|
||||
.findFirstSync()!;
|
||||
}
|
||||
}
|
||||
|
||||
bool isEvent() {
|
||||
return type == TimetableConsts.event;
|
||||
}
|
||||
|
||||
/// Plain-field JSON representation (no Isar links) for cross-process sync, e.g. Wear OS.
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'uid': uid,
|
||||
'start': start.toIso8601String(),
|
||||
'end': end.toIso8601String(),
|
||||
'dailyNth': dailyNth,
|
||||
'yearlyNth': yearlyNth,
|
||||
'name': name,
|
||||
'topic': topic,
|
||||
'roomName': roomName,
|
||||
'state': state,
|
||||
'type': type,
|
||||
'teacher': teacher,
|
||||
'substituteTeacher': substituteTeacher,
|
||||
};
|
||||
}
|
||||
|
||||
factory LessonCacheModel.fromJson(Map<String, dynamic> json) {
|
||||
return LessonCacheModel()
|
||||
..uid = json['uid'] as String?
|
||||
..start = DateTime.parse(json['start'] as String)
|
||||
..end = DateTime.parse(json['end'] as String)
|
||||
..dailyNth = json['dailyNth'] as int?
|
||||
..yearlyNth = json['yearlyNth'] as int?
|
||||
..name = json['name'] as String
|
||||
..topic = json['topic'] as String?
|
||||
..roomName = json['roomName'] as String?
|
||||
..state = json['state'] as String
|
||||
..type = json['type'] as String
|
||||
..teacher = json['teacher'] as String?
|
||||
..substituteTeacher = json['substituteTeacher'] as String?;
|
||||
}
|
||||
}
|
||||
|
||||
typedef AfterQBFilter<OBJ> = QueryBuilder<OBJ, OBJ, QAfterFilterCondition>;
|
||||
|
||||
@@ -8,38 +8,19 @@ part 'message_cache_model.g.dart';
|
||||
|
||||
@collection
|
||||
class MessageCacheModel extends GenericCacheModel<MessageItem> {
|
||||
String? uid;
|
||||
late String author;
|
||||
late String title;
|
||||
late String contentHtml;
|
||||
String? contentText;
|
||||
DateTime? validFrom;
|
||||
DateTime? validTo;
|
||||
DateTime? itemCreatedAt;
|
||||
String? type;
|
||||
|
||||
final student = IsarLink<StudentCacheModel>();
|
||||
|
||||
@override
|
||||
void apply(CacheContext<MessageItem> ctx) {
|
||||
this
|
||||
..uid = ctx.data.uid
|
||||
..author = ctx.data.author
|
||||
..title = ctx.data.title
|
||||
..createdAt = ctx.data.date
|
||||
..contentHtml = ctx.data.contentHTML
|
||||
..contentText = ctx.data.contentText
|
||||
..student.value = ctx.cacheManager.findStudent();
|
||||
|
||||
if (ctx.data is NoticeBoardItem) {
|
||||
final nb = ctx.data as NoticeBoardItem;
|
||||
validFrom = nb.validFrom;
|
||||
validTo = nb.validTo;
|
||||
type = 'NoticeBoard';
|
||||
} else if (ctx.data is InfoBoardItem) {
|
||||
final ib = ctx.data as InfoBoardItem;
|
||||
itemCreatedAt = ib.createdAt;
|
||||
type = ib.type.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,14 +16,5 @@ class UserThemeModel {
|
||||
|
||||
late List<int> swatchArgb;
|
||||
|
||||
/// the whole theme as a share code: the slots, the grade colors and the
|
||||
/// gradients. empty for themes made before codes were stored.
|
||||
String code = "";
|
||||
|
||||
/// the server handle this theme is tied to, empty until it is shared or
|
||||
/// imported. the owner keeps editing a shared theme and everyone holding
|
||||
/// the link follows along, so this is also what a copy refetches by.
|
||||
String shareId = "";
|
||||
|
||||
UserThemeModel();
|
||||
}
|
||||
|
||||
@@ -25,41 +25,46 @@ enum ThemeColorSlot {
|
||||
|
||||
/// Decoded theme binary data.
|
||||
class ThemeBinaryData {
|
||||
/// format version, always [ThemeBinaryFormat.currentVersion].
|
||||
/// Format version (e.g. 0).
|
||||
final int version;
|
||||
|
||||
/// the 32 slot colors: the 16 light slots, then the 16 dark slots.
|
||||
/// Ordered list of colors stored as raw bytes.
|
||||
final List<Color> colors;
|
||||
|
||||
/// the five grade colors, grade 1 first.
|
||||
final List<Color> gradeColors;
|
||||
|
||||
/// background gradient stops, empty when the theme has none.
|
||||
final List<Color> gradientLight;
|
||||
final List<Color> gradientDark;
|
||||
|
||||
const ThemeBinaryData({
|
||||
required this.version,
|
||||
required this.colors,
|
||||
required this.gradeColors,
|
||||
required this.gradientLight,
|
||||
required this.gradientDark,
|
||||
});
|
||||
|
||||
/// retrieves the color for [slot] in light mode.
|
||||
Color lightSlot(ThemeColorSlot slot) => colors[slot.index];
|
||||
/// True if the payload contains both light (0..15) and dark (16..31) slots.
|
||||
bool get isFullTheme => colors.length >= 32;
|
||||
|
||||
/// retrieves the color for [slot] in dark mode.
|
||||
Color darkSlot(ThemeColorSlot slot) =>
|
||||
colors[ThemeColorSlot.values.length + slot.index];
|
||||
/// Retrieves the color for [slot] in light mode, or null if out of range.
|
||||
Color? lightSlot(ThemeColorSlot slot) {
|
||||
final idx = slot.index;
|
||||
return idx < colors.length ? colors[idx] : null;
|
||||
}
|
||||
|
||||
/// Retrieves the color for [slot] in dark mode, or null if out of range.
|
||||
Color? darkSlot(ThemeColorSlot slot) {
|
||||
final idx = 16 + slot.index;
|
||||
return idx < colors.length ? colors[idx] : null;
|
||||
}
|
||||
|
||||
/// Extracts the full theme mapping for light and dark modes.
|
||||
({Map<ThemeColorSlot, Color> light, Map<ThemeColorSlot, Color> dark})
|
||||
toThemeSlots() {
|
||||
return (
|
||||
light: {for (final slot in ThemeColorSlot.values) slot: lightSlot(slot)},
|
||||
dark: {for (final slot in ThemeColorSlot.values) slot: darkSlot(slot)},
|
||||
);
|
||||
({Map<ThemeColorSlot, Color> light, Map<ThemeColorSlot, Color> dark}) toThemeSlots() {
|
||||
final lightMap = <ThemeColorSlot, Color>{};
|
||||
final darkMap = <ThemeColorSlot, Color>{};
|
||||
|
||||
for (final slot in ThemeColorSlot.values) {
|
||||
final lColor = lightSlot(slot);
|
||||
if (lColor != null) lightMap[slot] = lColor;
|
||||
|
||||
final dColor = darkSlot(slot) ?? lColor;
|
||||
if (dColor != null) darkMap[slot] = dColor;
|
||||
}
|
||||
|
||||
return (light: lightMap, dark: darkMap);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -69,22 +74,12 @@ class ThemeBinaryData {
|
||||
|
||||
/// Binary encoder and decoder for Firka themes.
|
||||
///
|
||||
/// format specification, one version only:
|
||||
/// 1. header: varint storing the format version, [currentVersion].
|
||||
/// 2. the 32 slot colors: 16 light, then 16 dark.
|
||||
/// 3. the 5 grade colors, grade 1 first.
|
||||
/// 4. the light background gradient: a varint stop count, then the stops.
|
||||
/// 5. the dark background gradient, the same way.
|
||||
///
|
||||
/// a color is 32-bit argb, 4 bytes: alpha, red, green, blue.
|
||||
/// Format specification:
|
||||
/// 1. Header: Varint storing the format version (e.g. `0x00` for version 0).
|
||||
/// 2. Colors: Raw 32-bit ARGB bytes (4 bytes per color: Alpha, Red, Green, Blue).
|
||||
class ThemeBinaryFormat {
|
||||
/// the only binary format version, anything else is refused.
|
||||
static const int currentVersion = 1;
|
||||
|
||||
static const int gradeColorCount = 5;
|
||||
|
||||
/// more stops than the editor allows is not a theme.
|
||||
static const int maxGradientStops = 16;
|
||||
/// Current binary format version.
|
||||
static const int currentVersion = 0;
|
||||
|
||||
/// Encodes [value] into a standard unsigned LEB128 varint.
|
||||
static void writeVarint(BytesBuilder builder, int value) {
|
||||
@@ -101,10 +96,7 @@ class ThemeBinaryFormat {
|
||||
|
||||
/// Reads a standard unsigned LEB128 varint from [bytes] starting at [offset].
|
||||
/// Returns a record of `(value, bytesRead)`.
|
||||
static (int value, int bytesRead) readVarint(
|
||||
Uint8List bytes, [
|
||||
int offset = 0,
|
||||
]) {
|
||||
static (int value, int bytesRead) readVarint(Uint8List bytes, [int offset = 0]) {
|
||||
var result = 0;
|
||||
var shift = 0;
|
||||
var index = offset;
|
||||
@@ -120,125 +112,94 @@ class ThemeBinaryFormat {
|
||||
throw const FormatException('Varint overflow');
|
||||
}
|
||||
}
|
||||
throw const FormatException(
|
||||
'Unexpected end of buffer while reading varint',
|
||||
);
|
||||
throw const FormatException('Unexpected end of buffer while reading varint');
|
||||
}
|
||||
|
||||
static void _writeColor(BytesBuilder builder, Color color) {
|
||||
final argb = color.toARGB32();
|
||||
builder.addByte((argb >> 24) & 0xFF);
|
||||
builder.addByte((argb >> 16) & 0xFF);
|
||||
builder.addByte((argb >> 8) & 0xFF);
|
||||
builder.addByte(argb & 0xFF);
|
||||
/// Encodes a list of [colors] into the binary theme format.
|
||||
///
|
||||
/// Prepends [version] as a varint (default 0), followed by 4 raw bytes per
|
||||
/// color in 32-bit ARGB order (Alpha, Red, Green, Blue).
|
||||
static Uint8List encode({
|
||||
required List<Color> colors,
|
||||
int version = currentVersion,
|
||||
}) {
|
||||
final builder = BytesBuilder(copy: false);
|
||||
|
||||
// 1. Version as varint
|
||||
writeVarint(builder, version);
|
||||
|
||||
// 2. Colors as raw bytes (4 bytes each: A, R, G, B)
|
||||
for (final color in colors) {
|
||||
final argb = color.toARGB32();
|
||||
builder.addByte((argb >> 24) & 0xFF);
|
||||
builder.addByte((argb >> 16) & 0xFF);
|
||||
builder.addByte((argb >> 8) & 0xFF);
|
||||
builder.addByte(argb & 0xFF);
|
||||
}
|
||||
|
||||
return builder.takeBytes();
|
||||
}
|
||||
|
||||
/// decodes raw binary theme [bytes], throws a [FormatException] for anything
|
||||
/// that is not a complete theme of the current version.
|
||||
/// Decodes raw binary theme [bytes].
|
||||
///
|
||||
/// Reads the leading varint version and parses the subsequent raw bytes as
|
||||
/// 32-bit ARGB colors (4 bytes per color).
|
||||
static ThemeBinaryData decode(Uint8List bytes) {
|
||||
if (bytes.isEmpty) {
|
||||
throw const FormatException('Cannot decode empty theme bytes');
|
||||
}
|
||||
|
||||
// 1. Read version varint
|
||||
final (version, headerLength) = readVarint(bytes, 0);
|
||||
if (version != currentVersion) {
|
||||
throw FormatException('Unsupported theme version $version');
|
||||
|
||||
final colorByteLength = bytes.length - headerLength;
|
||||
if (colorByteLength % 4 != 0) {
|
||||
throw FormatException(
|
||||
'Invalid color byte length ($colorByteLength). '
|
||||
'Color bytes must be a multiple of 4.',
|
||||
);
|
||||
}
|
||||
|
||||
var offset = headerLength;
|
||||
final colorCount = colorByteLength ~/ 4;
|
||||
final colors = <Color>[];
|
||||
|
||||
List<Color> readColors(int count) {
|
||||
if (offset + count * 4 > bytes.length) {
|
||||
throw const FormatException('Theme data ends too early');
|
||||
}
|
||||
final colors = <Color>[];
|
||||
for (var i = 0; i < count; i++) {
|
||||
colors.add(
|
||||
Color.fromARGB(
|
||||
bytes[offset],
|
||||
bytes[offset + 1],
|
||||
bytes[offset + 2],
|
||||
bytes[offset + 3],
|
||||
),
|
||||
);
|
||||
offset += 4;
|
||||
}
|
||||
return colors;
|
||||
for (var i = 0; i < colorCount; i++) {
|
||||
final offset = headerLength + (i * 4);
|
||||
final a = bytes[offset];
|
||||
final r = bytes[offset + 1];
|
||||
final g = bytes[offset + 2];
|
||||
final b = bytes[offset + 3];
|
||||
colors.add(Color.fromARGB(a, r, g, b));
|
||||
}
|
||||
|
||||
List<Color> readGradient() {
|
||||
final (count, read) = readVarint(bytes, offset);
|
||||
offset += read;
|
||||
if (count > maxGradientStops) {
|
||||
throw FormatException('Too many gradient stops ($count)');
|
||||
}
|
||||
return readColors(count);
|
||||
}
|
||||
|
||||
final colors = readColors(ThemeColorSlot.values.length * 2);
|
||||
final gradeColors = readColors(gradeColorCount);
|
||||
final gradientLight = readGradient();
|
||||
final gradientDark = readGradient();
|
||||
if (offset != bytes.length) {
|
||||
throw const FormatException('Unexpected data after the theme');
|
||||
}
|
||||
|
||||
return ThemeBinaryData(
|
||||
version: version,
|
||||
colors: colors,
|
||||
gradeColors: gradeColors,
|
||||
gradientLight: gradientLight,
|
||||
gradientDark: gradientDark,
|
||||
);
|
||||
return ThemeBinaryData(version: version, colors: colors);
|
||||
}
|
||||
|
||||
/// encodes a complete theme: the 16 light and 16 dark slots, the grade
|
||||
/// colors (grade 1 first) and the two background gradients.
|
||||
/// Encodes a complete 32-color Firka theme (16 light slots + 16 dark slots).
|
||||
static Uint8List encodeFullTheme({
|
||||
required Map<ThemeColorSlot, Color> light,
|
||||
required Map<ThemeColorSlot, Color> dark,
|
||||
required List<Color> gradeColors,
|
||||
List<Color> gradientLight = const [],
|
||||
List<Color> gradientDark = const [],
|
||||
int version = currentVersion,
|
||||
}) {
|
||||
if (gradeColors.length != gradeColorCount) {
|
||||
throw ArgumentError.value(
|
||||
gradeColors.length,
|
||||
'gradeColors',
|
||||
'A theme has $gradeColorCount grade colors',
|
||||
);
|
||||
}
|
||||
if (gradientLight.length > maxGradientStops ||
|
||||
gradientDark.length > maxGradientStops) {
|
||||
throw ArgumentError('A gradient has at most $maxGradientStops stops');
|
||||
final colors = <Color>[];
|
||||
|
||||
// Light slots (0..15)
|
||||
for (final slot in ThemeColorSlot.values) {
|
||||
colors.add(light[slot] ?? Colors.transparent);
|
||||
}
|
||||
|
||||
final builder = BytesBuilder(copy: false);
|
||||
writeVarint(builder, currentVersion);
|
||||
// Dark slots (16..31)
|
||||
for (final slot in ThemeColorSlot.values) {
|
||||
_writeColor(builder, light[slot] ?? Colors.transparent);
|
||||
colors.add(dark[slot] ?? light[slot] ?? Colors.transparent);
|
||||
}
|
||||
for (final slot in ThemeColorSlot.values) {
|
||||
_writeColor(builder, dark[slot] ?? light[slot] ?? Colors.transparent);
|
||||
}
|
||||
for (final color in gradeColors) {
|
||||
_writeColor(builder, color);
|
||||
}
|
||||
for (final stops in [gradientLight, gradientDark]) {
|
||||
writeVarint(builder, stops.length);
|
||||
for (final color in stops) {
|
||||
_writeColor(builder, color);
|
||||
}
|
||||
}
|
||||
return builder.takeBytes();
|
||||
|
||||
return encode(colors: colors, version: version);
|
||||
}
|
||||
|
||||
/// Encodes a [CoreTheme] (both light and dark colors) into binary.
|
||||
static Uint8List encodeCoreTheme(
|
||||
CoreTheme theme, {
|
||||
required List<Color> gradeColors,
|
||||
List<Color> gradientLight = const [],
|
||||
List<Color> gradientDark = const [],
|
||||
int version = currentVersion,
|
||||
}) {
|
||||
Color getSlot(CoreThemeColors c, ThemeColorSlot slot) => switch (slot) {
|
||||
ThemeColorSlot.accent => c.accent,
|
||||
@@ -260,20 +221,13 @@ class ThemeBinaryFormat {
|
||||
};
|
||||
|
||||
final lightMap = {
|
||||
for (final slot in ThemeColorSlot.values)
|
||||
slot: getSlot(theme.light, slot),
|
||||
for (final slot in ThemeColorSlot.values) slot: getSlot(theme.light, slot),
|
||||
};
|
||||
final darkMap = {
|
||||
for (final slot in ThemeColorSlot.values) slot: getSlot(theme.dark, slot),
|
||||
};
|
||||
|
||||
return encodeFullTheme(
|
||||
light: lightMap,
|
||||
dark: darkMap,
|
||||
gradeColors: gradeColors,
|
||||
gradientLight: gradientLight,
|
||||
gradientDark: gradientDark,
|
||||
);
|
||||
return encodeFullTheme(light: lightMap, dark: darkMap, version: version);
|
||||
}
|
||||
|
||||
/// Encodes [bytes] to Base64 (URL-safe without padding by default).
|
||||
@@ -292,6 +246,16 @@ class ThemeBinaryFormat {
|
||||
return base64Url.decode(normalized);
|
||||
}
|
||||
|
||||
/// Convenience method: Encodes [colors] directly into a URL-safe Base64 string.
|
||||
static String encodeToBase64(
|
||||
List<Color> colors, {
|
||||
int version = currentVersion,
|
||||
bool urlSafe = true,
|
||||
}) {
|
||||
final bytes = encode(colors: colors, version: version);
|
||||
return toBase64(bytes, urlSafe: urlSafe);
|
||||
}
|
||||
|
||||
/// Convenience method: Decodes a URL-safe Base64 string into [ThemeBinaryData].
|
||||
static ThemeBinaryData decodeFromBase64(String encoded) {
|
||||
final bytes = fromBase64(encoded);
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
import 'package:firka_common/core/icon_helper.dart';
|
||||
import 'package:firka_common/data/models/subject_cache_model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('getIconType - Software development (ClassIcon.applications)', () {
|
||||
void checkSubject(String name, dynamic expected) {
|
||||
final subject = SubjectCacheModel()..name = name;
|
||||
expect(getIconType(subject), expected, reason: 'Failed for "$name"');
|
||||
}
|
||||
|
||||
test('matches variations of Asztali és mobil alk', () {
|
||||
checkSubject('Asztali és mobil alk', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali és mobil alk.', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali és mobil alkalmazások', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali és mobil alkalmazások fejlesztése', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali és mobil alkalmazásfejlesztés', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali és mobil alk. fej.', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali és mobil fej.', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali és mobil', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali és mob alk', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali alk.', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali alk', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali alkalmazások', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali- és mobilalkalmazások', equals(ClassIcon.applications));
|
||||
checkSubject('Asztali-mobil alk.', equals(ClassIcon.applications));
|
||||
});
|
||||
|
||||
test('matches mobile application development variations', () {
|
||||
checkSubject('Mobil alk.', equals(ClassIcon.applications));
|
||||
checkSubject('Mobil alk', equals(ClassIcon.applications));
|
||||
checkSubject('Mobil alkalmazások', equals(ClassIcon.applications));
|
||||
checkSubject('Mobilalkalmazások', equals(ClassIcon.applications));
|
||||
checkSubject('Mobil app', equals(ClassIcon.applications));
|
||||
checkSubject('Mobilfejlesztés', equals(ClassIcon.applications));
|
||||
checkSubject('Mobil programozás', equals(ClassIcon.applications));
|
||||
});
|
||||
|
||||
test('matches software development variations', () {
|
||||
checkSubject('Szoftverfejlesztés', equals(ClassIcon.applications));
|
||||
checkSubject('Szoftverfejlesztés és tesztelés', equals(ClassIcon.applications));
|
||||
checkSubject('Szoftverfejlesztő', equals(ClassIcon.applications));
|
||||
checkSubject('Szoftvertesztelés', equals(ClassIcon.applications));
|
||||
checkSubject('Software development', equals(ClassIcon.applications));
|
||||
checkSubject('Software dev', equals(ClassIcon.applications));
|
||||
});
|
||||
|
||||
test('does not misclassify asztalitenisz as applications', () {
|
||||
checkSubject('Asztalitenisz', isNot(equals(ClassIcon.applications)));
|
||||
checkSubject('Asztali tenisz', isNot(equals(ClassIcon.applications)));
|
||||
});
|
||||
});
|
||||
|
||||
group('getIconType - Language / Szakmai angol / Idegen nyelv (ClassIcon.language)', () {
|
||||
void checkSubject(String name, dynamic expected) {
|
||||
final subject = SubjectCacheModel()..name = name;
|
||||
expect(getIconType(subject), expected, reason: 'Failed for "$name"');
|
||||
}
|
||||
|
||||
test('matches multiple ways of shortening idegen nyelv', () {
|
||||
checkSubject('id.ny.', equals(ClassIcon.language));
|
||||
checkSubject('id. ny.', equals(ClassIcon.language));
|
||||
checkSubject('id.ny', equals(ClassIcon.language));
|
||||
checkSubject('id ny', equals(ClassIcon.language));
|
||||
checkSubject('idny', equals(ClassIcon.language));
|
||||
checkSubject('id-ny', equals(ClassIcon.language));
|
||||
checkSubject('ID.NY.', equals(ClassIcon.language));
|
||||
checkSubject('ID. NY.', equals(ClassIcon.language));
|
||||
checkSubject('ID NY', equals(ClassIcon.language));
|
||||
checkSubject('IDNY', equals(ClassIcon.language));
|
||||
checkSubject('id. nyelv', equals(ClassIcon.language));
|
||||
checkSubject('id.nyelv', equals(ClassIcon.language));
|
||||
checkSubject('id nyelv', equals(ClassIcon.language));
|
||||
checkSubject('idegen ny.', equals(ClassIcon.language));
|
||||
checkSubject('idegen ny', equals(ClassIcon.language));
|
||||
checkSubject('ideg. ny.', equals(ClassIcon.language));
|
||||
checkSubject('ideg.ny.', equals(ClassIcon.language));
|
||||
checkSubject('idegen nyelv', equals(ClassIcon.language));
|
||||
checkSubject('idegennyelv', equals(ClassIcon.language));
|
||||
checkSubject('idegen nyelvi', equals(ClassIcon.language));
|
||||
});
|
||||
|
||||
test('matches Munkavállalói foreign language / szakmai angol variations', () {
|
||||
checkSubject('Munkavállalói id.ny.', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállalói ID.NY.', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállalói id. ny.', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállalói id ny', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállalói idny', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállalói id.', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállalói idegen ny.', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállalói idegen nyelv', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállalói idegennyelv', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállalói angol', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállalói német', equals(ClassIcon.language));
|
||||
checkSubject('Munkavallaloi id.ny.', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállaló id.ny.', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállaló id. ny.', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállaló idegen nyelv', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállaló idegen ny.', equals(ClassIcon.language));
|
||||
checkSubject('Munkavállaló id.', equals(ClassIcon.language));
|
||||
checkSubject('Munkavallalo id.ny.', equals(ClassIcon.language));
|
||||
});
|
||||
|
||||
test('matches Szakmai idegen nyelv variations', () {
|
||||
checkSubject('Szakmai id.ny.', equals(ClassIcon.language));
|
||||
checkSubject('Szakmai id. ny.', equals(ClassIcon.language));
|
||||
checkSubject('Szakmai ID.NY.', equals(ClassIcon.language));
|
||||
checkSubject('Szakmai idegen nyelv', equals(ClassIcon.language));
|
||||
checkSubject('Szakmai idegen ny.', equals(ClassIcon.language));
|
||||
checkSubject('Szakmai angol', equals(ClassIcon.language));
|
||||
checkSubject('Szakmai német', equals(ClassIcon.language));
|
||||
checkSubject('Szakmai nyelv', equals(ClassIcon.language));
|
||||
checkSubject('Szakmai ny.', equals(ClassIcon.language));
|
||||
checkSubject('Szakmai ny', equals(ClassIcon.language));
|
||||
});
|
||||
|
||||
test('does not misclassify non-language subjects', () {
|
||||
checkSubject('Munkavállalói ismeretek', isNull);
|
||||
checkSubject('Magyar nyelv', equals(ClassIcon.grammar));
|
||||
});
|
||||
});
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user