113 Commits

Author SHA1 Message Date
zypherift
d5aed7c74f Bump Android versionCode to 6 2026-04-08 00:21:04 +02:00
zypherift
eadf7e81a5 Remove in-app updater and open_filex integration 2026-04-08 00:04:12 +02:00
zypherift
be3050faed Remove merged media read permissions via manifest tools override 2026-04-07 23:10:38 +02:00
zypherift
4b430eb3fa Bump Android versionCode to 5 2026-04-07 22:28:37 +02:00
zypherift
13a51a8a1f Use photo picker flow and remove broad media permissions 2026-04-07 21:40:38 +02:00
zypherift
46a6f38ad6 Bump Android versionCode to 4 2026-04-07 13:33:18 +02:00
zypherift
9ece125d9f Remove Shake SDK integration entirely 2026-04-07 13:30:28 +02:00
zypherift
87eddff7c0 Set Android versionCode to 2 2026-04-07 13:09:15 +02:00
zypherift
b801e8277b Remove disallowed permissions, target API 35, and hide share/own paints actions 2026-04-07 12:53:14 +02:00
zypherift
2c4c226470 Rename Android package to hu.refilc.naplo 2026-04-07 11:59:12 +02:00
zypherift
6fde731fe8 Build and archive Android AAB in CI 2026-04-05 02:28:03 +02:00
zypherift
4385785bb8 Disable verbose CI logs and set Gradle heap to 28G 2026-04-05 02:23:33 +02:00
zypherift
071ab301bb Increase Jenkins pipeline verbosity 2026-04-05 02:09:08 +02:00
zypherift
e5e0386777 Set Kotlin compiler strategy to in-process for CI 2026-04-05 02:01:14 +02:00
zypherift
f9dfc808c4 Remove local org.gradle.java.home override 2026-04-05 01:56:21 +02:00
zypherift
02340c9e6f Relax material_color_utilities constraint for CI Flutter pin 2026-04-05 01:54:46 +02:00
zypherift
36f3a57a1f Restore default Gradle memory settings 2026-04-05 01:53:20 +02:00
zypherift
48aba53ae7 Fix Android 36 AAR metadata build and low-memory Gradle setup 2026-04-05 01:42:04 +02:00
3f4323731c Update refilc/pubspec.yaml 2026-04-04 23:49:45 +02:00
c3c89362b4 Update refilc/pubspec.yaml 2026-04-04 23:44:32 +02:00
6b8b0d53de again 2026-04-04 23:40:52 +02:00
c618755472 again 2026-04-04 23:35:22 +02:00
5560ff9279 reanem 2026-04-04 23:26:10 +02:00
7889d9bd4f again 2026-04-04 23:22:02 +02:00
66daf83e92 again 2026-04-04 23:15:57 +02:00
d36ba67cb5 again 2026-04-04 23:08:02 +02:00
bc97a1224e i hate breaking changes 2026-04-04 23:06:27 +02:00
a976743c45 again 2026-04-04 22:58:51 +02:00
39bf2f1ec1 again 2026-04-04 22:56:18 +02:00
bcfdaf0953 After Flutter 3.29, registerWith method is deleted. 2026-04-04 22:49:07 +02:00
9c0159d65b Update refilc/pubspec.yaml 2026-04-04 21:49:31 +02:00
5905630c49 Update Jenkinsfile 2026-04-04 21:47:57 +02:00
a9d35c7414 Update Jenkinsfile 2026-04-04 20:53:51 +02:00
bfa69e3cd2 Update Jenkinsfile 2026-04-04 20:08:31 +02:00
8d19ce4a68 Update Jenkinsfile 2026-04-04 19:57:49 +02:00
44ff18e56b Update Jenkinsfile 2026-04-04 19:27:18 +02:00
rnxm
1d32b9e1e7 Merge pull request #35 from B3ni15/master
IOS Fix, Live activity, Apple Stuff fix
2026-03-19 06:35:50 +01:00
e25f62bd8c Remove demo user login functionality from LoginScreenState 2026-03-18 22:16:42 +01:00
f86bce4877 Enhance demo mode to load demo data into providers without API calls 2026-03-18 22:11:42 +01:00
702912d476 Add demo mode auto-launch functionality in KretenLoginWidget 2026-03-18 22:10:07 +01:00
5210106032 Refactor LiveCardProvider to track previous state and lesson ID for updates 2026-03-18 09:48:32 +01:00
02fecf7ac7 Set custom user agent for WebView in KretenLoginWidget 2026-03-18 07:05:22 +01:00
90165f257c Update lesson filtering logic to include substitute teachers in ServerSyncProvider 2026-03-17 12:05:10 +01:00
2ece6bd36f Add demo mode functionality to KretenLoginWidget and integrate with LoginScreen 2026-03-16 13:44:33 +01:00
446988ec0b Increase auto-retry limit to 3 and improve error messaging in KretenLoginWidget 2026-03-15 22:46:50 +01:00
b33a6d2ca0 Guard auto-retry to initial load only in KretenLoginWidget
After the login page first loaded successfully, any subsequent
navigation error (e.g. during credential entry) would silently reload
_loginUrl, discarding user-entered credentials. This was because the
auto-retry block only checked _autoRetryCount, which was reset to 0 by
onPageFinished after every successful load.

Add _hasLoadedOnce that is set true in onPageFinished and only cleared
in _retry() (explicit user action). Gate the silent auto-retry on
!_hasLoadedOnce so it only fires before the login page has been shown
to the user for the first time.

https://claude.ai/code/session_016dhktF2DaoTQeifUaZrxbP
2026-03-15 22:38:00 +01:00
c3b1e783b8 Fix auto-retry cap never being reached in KretenLoginWidget
_autoRetryCount was reset to 0 in onPageStarted, which fires after
every loadRequest call including the one inside _retryLoad. This meant
the retry cap (_maxAutoRetries = 1) was never reached, causing an
infinite retry loop on persistent errors.

Move the _autoRetryCount reset to onPageFinished so it only clears
when the page actually loads successfully (or via the user-initiated
_retry which already resets it explicitly).

https://claude.ai/code/session_016dhktF2DaoTQeifUaZrxbP
2026-03-15 22:38:00 +01:00
84e8346ccc Fix login page error message shown on initial load
Add auto-retry logic in KretenLoginWidget so that the first web
resource error silently retries once before showing the error UI.
This prevents the error message from appearing immediately when the
e-KRÉTA server is briefly unreachable (e.g., transient network
issues), resolving the App Store Guideline 2.1(a) rejection.

https://claude.ai/code/session_016dhktF2DaoTQeifUaZrxbP
2026-03-15 22:38:00 +01:00
cd0026e4c7 Add loading state management and error handling in KretenLoginWidget for improved user experience 2026-03-15 22:38:00 +01:00
0dc6cd915c Add expiration handling in LockScreenLiveActivityView for improved user feedback 2026-03-15 22:38:00 +01:00
c301b62d37 Add user change listener and restore user logic in TimetableProvider for improved state management 2026-03-15 22:38:00 +01:00
d9268505e4 Fix command formatting in Podfile and update Pods_Runner.framework reference in project.pbxproj for improved compatibility 2026-03-15 22:38:00 +01:00
906e2c97cf Fix Hungarian text typos in KretenLoginWidget for improved clarity 2026-03-15 22:38:00 +01:00
b8b996a5d3 Add error handling and timeout logic in KretenLoginWidget for improved user experience 2026-03-15 22:38:00 +01:00
fc261d4005 Enhance countdown timer display in LockScreenLiveActivityView for improved readability and layout 2026-03-15 22:38:00 +01:00
10f24af7e4 Update lesson start time check to 2 hours in LiveCardProvider for improved activity termination logic 2026-03-15 22:38:00 +01:00
5cc3d3d38a Refactor lesson display logic in LockScreenLiveActivityView for improved clarity and efficiency 2026-03-15 22:38:00 +01:00
9bafd2647f Enhance lesson end detection logic in LiveCardProvider to ensure proper activity termination 2026-03-15 22:38:00 +01:00
96ebd10ed1 Implement device unregistration on application termination 2026-03-15 22:38:00 +01:00
225e75e8d2 Add forceUnregister call on activity dismissal to ensure proper cleanup 2026-03-15 22:38:00 +01:00
649381ebbf Remove redundant debug print statements in LiveCardProvider to streamline logging 2026-03-15 22:38:00 +01:00
f524019779 Add break entry fields in lesson filtering and remove unused imports in sync provider 2026-03-15 22:38:00 +01:00
70ada25915 Remove unused activity creation flag and simplify dismissal logic in LiveCardProvider 2026-03-15 22:38:00 +01:00
0a3d0183f2 Add activity creation state management to prevent dismiss notifications during creation 2026-03-15 22:38:00 +01:00
7e254654d1 Update debug message for activity dismissal to clarify user action 2026-03-15 22:38:00 +01:00
439c98dfd9 Refactor lesson data handling in ServerSyncProvider to include breaks between lessons and improve clarity 2026-03-15 22:38:00 +01:00
93d8bef238 Refactor LiveActivityManager and public_vars to improve clarity and remove unused comments 2026-03-15 22:38:00 +01:00
c4945f6ab9 Add cleanup flag to prevent dismiss notifications during activity cleanup 2026-03-15 22:38:00 +01:00
1ce961eaaa Add debug print statement for live activity state and settings 2026-03-15 22:38:00 +01:00
0046d18f3a Update activity start condition message for clarity and add time constraint 2026-03-15 22:38:00 +01:00
36637e889b Refactor activity start condition message for clarity 2026-03-15 22:38:00 +01:00
f2fdd0005d Add live activity consent check to unseen new features migration 2026-03-15 22:38:00 +01:00
86d90adf2b Add live activity consent acceptance handling and update settings model 2026-03-15 22:38:00 +01:00
022d5c81ce Refactor Live Activity consent dialog and add privacy policy screen with localization support 2026-03-15 22:38:00 +01:00
aea12d20fc Add Live Activity feature with consent dialog and settings integration 2026-03-15 22:38:00 +01:00
5d95e1e1d7 Implement developer mode for Live Activity with fake lessons and immediate updates 2026-03-15 22:38:00 +01:00
7720cbd07d Add developer settings for fake lessons and update localization
- Introduced `dev_live_fake_lessons` setting in the database schema.
- Updated `SettingsProvider` to manage the new `devLiveFakeLessons` property.
- Enhanced `LiveCardProvider` to generate fake lessons based on the new setting.
- Added UI toggle for fake lessons in the settings screen with appropriate localization.
2026-03-15 22:38:00 +01:00
30d75d6a60 Update Flutter build name to 5.1.2 and reset build number to 0 in project.pbxproj 2026-03-15 22:38:00 +01:00
68c76afdde Revert version number to 5.1.2+0 in pubspec.yaml 2026-03-15 22:37:47 +01:00
55035b535c Refactor Live Activity creation to return success status and handle push token updates asynchronously 2026-03-15 22:37:47 +01:00
fe33bb2db0 Enhance Live Activity dismissal handling by passing deviceId and updating server unregistration logic 2026-03-15 22:37:47 +01:00
e857f10073 Add user dismissal handling and clean up previous activities in LiveActivityManager 2026-03-15 22:37:47 +01:00
d8ae92e0f7 Update aps-environment to production in entitlements files 2026-03-15 22:37:47 +01:00
b8ae1c7c69 Remove demo login text from LoginScreen widget 2026-03-15 22:37:47 +01:00
70a1c99ea7 Refactor HTTP requests in ServerSyncProvider to use http package 2026-03-15 22:37:47 +01:00
340d9d1d8e Implement Live Activity dismissal handling and server unregistration 2026-03-15 22:37:47 +01:00
280d3561cf Refactor ServerSyncProvider usage in LiveCardProvider and add unregister method 2026-03-15 22:37:47 +01:00
4ec24aa69f Update base URL in ServerSyncProvider to point to legacy server 2026-03-15 22:37:47 +01:00
1adc7b0a15 Refactor width calculation for AnimatedContainer in StatusBar widget 2026-03-15 22:37:47 +01:00
5c9248c3eb Fix progress bar width calculation in StatusBar widget 2026-03-15 22:37:47 +01:00
53623d84df Set Swift version and flags for DKImagePickerController in Podfile post-install 2026-03-15 22:37:47 +01:00
dc5a5723fc Add demo group averages to DemoData and update GradeProvider to store them 2026-03-15 22:37:47 +01:00
6c5279205b Remove MinimumOSVersion key from AppFrameworkInfo.plist 2026-03-15 22:37:47 +01:00
7c329b0ae6 Add demo mode support and demo data for various providers 2026-03-15 22:37:47 +01:00
556a49646d Update base URL in ServerSyncProvider to point to the correct server 2026-03-15 22:37:47 +01:00
a661098855 Implement live activity token rotation and server synchronization for push notifications 2026-03-15 22:37:47 +01:00
Armand
1021cdc6b2 Merge pull request #33 from B3ni15/master
IOS Fixes, cleanup
2026-03-03 10:42:21 +01:00
fb471a3dc8 Update material_color_utilities dependency to version 0.13.0 2026-03-03 06:39:54 +01:00
29157b60a5 Add didChangeDependencies method to LoginScreenState for system UI overlay style 2026-03-03 06:33:40 +01:00
1e2a8f787d Update MethodChannel identifier for live activity integration 2026-02-28 11:49:23 +01:00
8a7b4bcf21 Remove unused input and output paths from Pods build phases in project configuration 2026-02-27 11:58:35 +01:00
432276a966 Refactor project configuration to improve build settings and support for multiple platforms 2026-02-27 11:58:12 +01:00
2052dfd60a Implement demo mode activation via tap gesture in login screen 2026-02-27 11:57:42 +01:00
e4844fef38 Add demo mode functionality to user provider and login screen 2026-02-27 11:52:52 +01:00
5d29e19845 Remove unused input and output paths from Pods build phases in project configuration 2026-02-27 11:18:46 +01:00
dccf97fb91 Update app display name to "Firka Legacy" in project configuration 2026-02-27 11:18:11 +01:00
5cae4b43e9 Update iOS project configuration and entitlements for improved functionality 2026-02-27 11:17:37 +01:00
7a429b3770 Update intl dependency to version 0.20.2 across multiple pubspec.yaml files 2026-02-27 11:08:26 +01:00
5c682b16e6 Órarend fix 2025-11-03 21:09:55 +01:00
5b37056052 verzió fix 2025-11-03 21:09:55 +01:00
rnxm
c49a221e19 Build fix (#29) 2025-11-03 18:36:29 +01:00
Zan
084eb00e5b Update .gitignore 2025-11-02 18:20:34 +01:00
Zan
e3e1983265 Updated to version 35 and key isn't needed 2025-11-02 18:20:18 +01:00
87 changed files with 2883 additions and 1420 deletions

1
.gitignore vendored
View File

@@ -95,3 +95,4 @@ refilc/android/*key.properties
tool_logs/build/*.log
tool_logs/d8dx_fix/*.log
tool_logs/pub_fix/*.log
refilc/android/app/key.jks

36
Jenkinsfile vendored
View File

@@ -1,56 +1,40 @@
pipeline {
agent any
environment {
ANDROID_SDK = '/home/jenkins/flutter_things/android-sdk'
ANDROID_PATH="$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools"
FLUTTER = '/home/jenkins/flutter_things/flutter/bin'
PATH = "$PATH:$ANDROID_PATH:$FLUTTER"
//TODO: need to fix flutter
}
stages {
stage('Copy Key Properties') {
steps {
// Copy the key.properties file
sh 'cp /home/jenkins/key.properties refilc/android/key.properties'
sh 'cp /var/lib/jenkins/key.properties "$WORKSPACE/refilc/android/key.properties"'
}
}
stage('Flutter Doctor') {
steps {
// Ensure Flutter is set up correctly
sh 'flutter doctor'
}
}
stage('Dependencies') {
steps {
// Get Flutter dependencies
sh 'cd refilc && flutter pub get'
}
}
stage('Build') {
steps {
// Build the Flutter project
sh 'cd refilc && flutter build apk --release'
sh '''
cd refilc
flutter build apk --release
flutter build appbundle --release
'''
}
}
stage('Archive') {
steps {
// Archive the APK
archiveArtifacts artifacts: 'build/app/outputs/flutter-apk/app-release.apk', fingerprint: true
archiveArtifacts artifacts: 'refilc/build/app/outputs/flutter-apk/app-release.apk,refilc/build/app/outputs/bundle/release/app-release.aab',
fingerprint: true
}
}
}
post {
always {
// Clean up workspace after build
cleanWs()
deleteDir()
}
}
}
}

View File

@@ -33,11 +33,17 @@ if (flutterVersionName == null) {
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file("key.properties")
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
def debugKeystoreProperties = new Properties()
def debugKeystorePropertiesFile = rootProject.file("debugkey.properties")
debugKeystoreProperties.load(new FileInputStream(debugKeystorePropertiesFile))
if (debugKeystorePropertiesFile.exists()) {
debugKeystoreProperties.load(new FileInputStream(debugKeystorePropertiesFile))
}
def hasReleaseKeystore = keystorePropertiesFile.exists() && keystoreProperties['storeFile']
// magical code that fixes builds
subprojects {
@@ -53,12 +59,12 @@ subprojects {
}
android {
namespace = "app.firka.legacy"
namespace = "hu.refilc.naplo"
ndkVersion "27.2.12479018"
// compileSdkVersion rootProject.ext.compileSdkVersion
compileSdkVersion 34
compileSdkVersion 36
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@@ -72,10 +78,10 @@ android {
}
defaultConfig {
applicationId "app.firka.legacy"
applicationId "hu.refilc.naplo"
minSdkVersion 24
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
targetSdkVersion 35
versionCode 6
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
@@ -100,17 +106,20 @@ android {
signingConfigs {
debug {
// Use the default Android debug keystore to avoid alias mismatches
keyAlias "androiddebugkey"
keyPassword debugKeystoreProperties['keyPassword']
storeFile file(debugKeystoreProperties['storeFile'])
storePassword debugKeystoreProperties['storePassword']
storeFile file(System.properties['user.home'] + "/.android/debug.keystore")
storePassword "android"
keyPassword "android"
}
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
if (hasReleaseKeystore) {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
}
@@ -120,7 +129,11 @@ android {
}
release {
signingConfig signingConfigs.release
if (hasReleaseKeystore) {
signingConfig signingConfigs.release
} else {
signingConfig signingConfigs.debug
}
shrinkResources true
minifyEnabled true
debuggable false

View File

@@ -1,8 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.firka.legacy">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="hu.refilc.naplo">
<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
</manifest>

View File

@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="app.firka.legacy">
xmlns:tools="http://schemas.android.com/tools" package="hu.refilc.naplo">
<application android:name="${applicationName}" android:label="Firka" tools:replace="android:label" android:icon="@mipmap/ic_launcher"
android:requestLegacyExternalStorage="true" android:enableOnBackInvokedCallback="false">
@@ -8,7 +8,7 @@
android:name="flutter.embedding.android.SurfaceView"
android:value="true" />
<activity android:exported="true" android:name="app.firka.legacy.MainActivity"
<activity android:exported="true" android:name="hu.refilc.naplo.MainActivity"
android:launchMode="singleTop" android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"
@@ -56,7 +56,7 @@
</activity>
<meta-data android:name="flutterEmbedding" android:value="2" />
<receiver android:name="app.firka.legacy.widget_timetable.WidgetTimetable"
<receiver android:name="hu.refilc.naplo.widget_timetable.WidgetTimetable"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
@@ -72,7 +72,7 @@
android:resource="@xml/home_widget_test_info" />
</receiver>
<service android:name="app.firka.legacy.widget_timetable.WidgetTimetableService"
<service android:name="hu.refilc.naplo.widget_timetable.WidgetTimetableService"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<receiver android:name="es.antonborri.home_widget.HomeWidgetBackgroundReceiver"
@@ -89,12 +89,21 @@
<meta-data android:name="flutterEmbedding" android:value="2" />
<!-- Permissions -->
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32"
tools:node="remove" />
<uses-permission
android:name="android.permission.READ_MEDIA_IMAGES"
tools:node="remove" />
<uses-permission
android:name="android.permission.READ_MEDIA_VIDEO"
tools:node="remove" />
<uses-permission
android:name="android.permission.READ_MEDIA_AUDIO"
tools:node="remove" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

View File

@@ -1,4 +1,4 @@
package app.firka.legacy
package hu.refilc.naplo
import io.flutter.embedding.android.FlutterActivity

View File

@@ -1,4 +1,4 @@
package app.firka.legacy.database
package hu.refilc.naplo.database
import android.content.ContentValues
import android.content.Context
@@ -7,7 +7,7 @@ import android.database.sqlite.SQLiteDatabase
import java.sql.SQLException
import app.firka.legacy.database.SQLiteHelper
import hu.refilc.naplo.database.SQLiteHelper
import kotlin.arrayOf
class DBManager(private val context: Context) {

View File

@@ -1,4 +1,4 @@
package app.firka.legacy.database
package hu.refilc.naplo.database
import android.content.Context
import android.database.sqlite.SQLiteDatabase

View File

@@ -1,4 +1,4 @@
package app.firka.legacy.utils
package hu.refilc.naplo.utils
import android.content.Context
import android.net.ConnectivityManager

View File

@@ -1,4 +1,4 @@
package app.firka.legacy.utils
package hu.refilc.naplo.utils
import java.time.DayOfWeek
import java.time.Duration

View File

@@ -1,4 +1,4 @@
package app.firka.legacy.widget_timetable
package hu.refilc.naplo.widget_timetable
import android.app.PendingIntent
import android.app.UiModeManager
@@ -30,11 +30,11 @@ import java.text.ParseException
import java.text.SimpleDateFormat
import java.util.Date
import app.firka.legacy.database.DBManager
import app.firka.legacy.MainActivity
import app.firka.legacy.R
import hu.refilc.naplo.database.DBManager
import hu.refilc.naplo.MainActivity
import hu.refilc.naplo.R
import app.firka.legacy.utils.Week
import hu.refilc.naplo.utils.Week
import es.antonborri.home_widget.HomeWidgetBackgroundIntent
import es.antonborri.home_widget.HomeWidgetLaunchIntent

View File

@@ -1,4 +1,4 @@
package app.firka.legacy.widget_timetable
package hu.refilc.naplo.widget_timetable
import android.app.UiModeManager
import android.appwidget.AppWidgetManager
@@ -19,8 +19,8 @@ import org.json.JSONObject
import java.util.Collections
import java.util.Comparator
import app.firka.legacy.database.DBManager
import app.firka.legacy.R
import hu.refilc.naplo.database.DBManager
import hu.refilc.naplo.R
class WidgetTimetableDataProvider(context: Context, intent: Intent) : RemoteViewsService.RemoteViewsFactory {
private val context: Context

View File

@@ -1,4 +1,4 @@
package app.firka.legacy.widget_timetable
package hu.refilc.naplo.widget_timetable
import android.content.Context
import android.content.Intent

View File

@@ -1,8 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.firka.legacy">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="hu.refilc.naplo">
<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
</manifest>

View File

@@ -22,9 +22,12 @@ allprojects {
repositories {
google()
jcenter()
maven {
// [required] background_fetch
url "${project(':background_fetch').projectDir}/libs"
def backgroundFetchProject = findProject(':background_fetch')
if (backgroundFetchProject != null) {
maven {
// [required] background_fetch
url "${backgroundFetchProject.projectDir}/libs"
}
}
}
@@ -47,8 +50,8 @@ subprojects {
afterEvaluate {project ->
if (project.plugins.hasPlugin('android') || project.plugins.hasPlugin('android-library')) {
android {
compileSdkVersion 34
buildToolsVersion '31.0.0'
compileSdkVersion 36
buildToolsVersion '36.0.0'
}
}
}

View File

@@ -1,5 +1,6 @@
org.gradle.jvmargs=-Xmx6G -XX:MaxMetaspaceSize=4G -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC
org.gradle.jvmargs=-Xmx28G -XX:MaxMetaspaceSize=4G -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC
android.useAndroidX=true
android.enableJetifier=true
org.gradle.parallel=true
kotlin.compiler.execution.strategy=in-process
# kotlin.jvm.target.validation.mode=IGNORE

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip

View File

@@ -24,7 +24,7 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.7.3" apply false
id "com.android.application" version "8.9.2" apply false
id "org.jetbrains.kotlin.android" version "2.0.21" apply false
}

View File

@@ -20,7 +20,5 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
</dict>
</plist>

View File

@@ -1,2 +1,3 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"
#include "Generated.xcconfig"

View File

@@ -28,7 +28,7 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_frameworks! :linkage => :static
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
@@ -41,23 +41,11 @@ post_install do |installer|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
if target.name == 'DKImagePickerController'
config.build_settings['SWIFT_VERSION'] = '5.0'
config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -Xfrontend -disable-reflection-metadata'
end
end
end
bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
framework_path = File.join(Dir.pwd, framework_relative_path)
command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
puts "Stripping bitcode: #{command}"
system(command)
end
framework_paths = [
"Pods/Shake/Sources/Shake.xcframework/ios-arm64/Shake.framework/Shake",
"Pods/Shake/Sources/Shake.xcframework/ios-arm64_x86_64-simulator/Shake.framework/Shake"
]
framework_paths.each do |framework_relative_path|
strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
end
end

View File

@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1806187910CAF539F6FC2B28 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CCB997B38F457FB73A5A9B6A /* Pods_Runner.framework */; };
3127F78D28EAEDE200C2EFB3 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3127F75528EAECC800C2EFB3 /* WidgetKit.framework */; };
3127F78E28EAEDE200C2EFB3 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3127F75728EAECC800C2EFB3 /* SwiftUI.framework */; };
3127F79828EAEDE300C2EFB3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3127F79728EAEDE300C2EFB3 /* Assets.xcassets */; };
@@ -15,7 +16,6 @@
3127F7A428EAEE3D00C2EFB3 /* livecard.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 3127F7A328EAEE3D00C2EFB3 /* livecard.intentdefinition */; };
3127F7A628EAEE5900C2EFB3 /* livecard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3127F7A528EAEE5900C2EFB3 /* livecard.swift */; };
3127F7A828EAEE8500C2EFB3 /* lesson_model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3127F7A728EAEE8500C2EFB3 /* lesson_model.swift */; };
373A6ECB5FC71FE9D8AF2EDB /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F0ADD56276103500A3016C8 /* Pods_Runner.framework */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
4F35BF332BE2FFA30098EF72 /* public_vars.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F35BF322BE2FFA30098EF72 /* public_vars.swift */; };
4F35BF352BE2FFD80098EF72 /* LiveActivityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F35BF342BE2FFD80098EF72 /* LiveActivityManager.swift */; };
@@ -66,7 +66,7 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
1F0ADD56276103500A3016C8 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
2F639A73BBD0AA532FD89597 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
3127F73928EAEC3200C2EFB3 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
3127F73F28EAEC8A00C2EFB3 /* IntentsUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IntentsUI.framework; path = System/Library/Frameworks/IntentsUI.framework; sourceTree = SDKROOT; };
3127F75528EAECC800C2EFB3 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
@@ -83,11 +83,10 @@
4F35BF342BE2FFD80098EF72 /* LiveActivityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveActivityManager.swift; sourceTree = "<group>"; };
4F35BF3B2BE303A40098EF72 /* app_group_directory.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = app_group_directory.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4F35BF3D2BE304550098EF72 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
707F8089D970F81C480F73C4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
60F3B7142FA88CEF9B740E3C /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
80777CF254888CE770D5F909 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -95,7 +94,8 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
98578F0EBCC6D3FF8391AAEB /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
CCB997B38F457FB73A5A9B6A /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DCFCD496781E9C672922FB23 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -112,7 +112,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
373A6ECB5FC71FE9D8AF2EDB /* Pods_Runner.framework in Frameworks */,
1806187910CAF539F6FC2B28 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -137,10 +137,10 @@
isa = PBXGroup;
children = (
4F35BF3B2BE303A40098EF72 /* app_group_directory.framework */,
1F0ADD56276103500A3016C8 /* Pods_Runner.framework */,
3127F73F28EAEC8A00C2EFB3 /* IntentsUI.framework */,
3127F75528EAECC800C2EFB3 /* WidgetKit.framework */,
3127F75728EAECC800C2EFB3 /* SwiftUI.framework */,
CCB997B38F457FB73A5A9B6A /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -148,9 +148,9 @@
91FEB6212755D596FFFFEC73 /* Pods */ = {
isa = PBXGroup;
children = (
80777CF254888CE770D5F909 /* Pods-Runner.debug.xcconfig */,
98578F0EBCC6D3FF8391AAEB /* Pods-Runner.release.xcconfig */,
707F8089D970F81C480F73C4 /* Pods-Runner.profile.xcconfig */,
60F3B7142FA88CEF9B740E3C /* Pods-Runner.debug.xcconfig */,
2F639A73BBD0AA532FD89597 /* Pods-Runner.release.xcconfig */,
DCFCD496781E9C672922FB23 /* Pods-Runner.profile.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
@@ -229,7 +229,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
779338C8D92BCBC36F75F791 /* [CP] Check Pods Manifest.lock */,
FF86224C7703027F130483F3 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
@@ -237,8 +237,8 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3127F74F28EAEC8A00C2EFB3 /* Embed Foundation Extensions */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
71459C0EB905E05018E3D78F /* [CP] Embed Pods Frameworks */,
262089761B766E074256257A /* [CP] Copy Pods Resources */,
F87C348DE3B0D2671B7E9A6F /* [CP] Embed Pods Frameworks */,
B0FC589DBDE68DA21F80B4BB /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@@ -312,23 +312,6 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
262089761B766E074256257A /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
@@ -347,11 +330,43 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n";
};
71459C0EB905E05018E3D78F /* [CP] Embed Pods Frameworks */ = {
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 12;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
};
B0FC589DBDE68DA21F80B4BB /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
F87C348DE3B0D2671B7E9A6F /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
@@ -364,7 +379,7 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
779338C8D92BCBC36F75F791 /* [CP] Check Pods Manifest.lock */ = {
FF86224C7703027F130483F3 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -386,21 +401,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 12;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -500,7 +500,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -513,27 +513,31 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 283;
DEVELOPMENT_TEAM = 4J97JVC2FG;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_NAME = 5.1.1;
FLUTTER_BUILD_NUMBER = 283;
FLUTTER_BUILD_NAME = 5.1.2;
FLUTTER_BUILD_NUMBER = 0;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Firka;
INFOPLIST_KEY_CFBundleDisplayName = "Firka Legacy";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 5.1.1;
PRODUCT_BUNDLE_IDENTIFIER = app.firka.legacy;
PRODUCT_BUNDLE_IDENTIFIER = app.firkaa.legacy;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
@@ -552,7 +556,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 283;
DEVELOPMENT_TEAM = 4J97JVC2FG;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = livecard/Info.plist;
@@ -568,15 +572,18 @@
MARKETING_VERSION = 5.1.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = app.firka.legacy.livecard;
PRODUCT_BUNDLE_IDENTIFIER = app.firkaa.legacy.livecard;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
@@ -594,7 +601,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 283;
DEVELOPMENT_TEAM = 4J97JVC2FG;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = livecard/Info.plist;
@@ -609,14 +616,17 @@
);
MARKETING_VERSION = 5.1.1;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = app.firka.legacy.livecard;
PRODUCT_BUNDLE_IDENTIFIER = app.firkaa.legacy.livecard;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
};
@@ -634,7 +644,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 283;
DEVELOPMENT_TEAM = 4J97JVC2FG;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = livecard/Info.plist;
@@ -649,14 +659,17 @@
);
MARKETING_VERSION = 5.1.1;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = app.firka.legacy.livecard;
PRODUCT_BUNDLE_IDENTIFIER = app.firkaa.legacy.livecard;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Profile;
};
@@ -708,7 +721,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -758,7 +771,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -773,28 +786,32 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 283;
DEVELOPMENT_TEAM = 4J97JVC2FG;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_NAME = 5.1.1;
FLUTTER_BUILD_NUMBER = 283;
FLUTTER_BUILD_NAME = 5.1.2;
FLUTTER_BUILD_NUMBER = 0;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Firka;
INFOPLIST_KEY_CFBundleDisplayName = "Firka Legacy";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 5.1.1;
PRODUCT_BUNDLE_IDENTIFIER = app.firka.legacy;
PRODUCT_BUNDLE_IDENTIFIER = app.firkaa.legacy;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
@@ -803,27 +820,31 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 283;
DEVELOPMENT_TEAM = 4J97JVC2FG;
DEVELOPMENT_TEAM = R9PZGUCNJ3;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_NAME = 5.1.1;
FLUTTER_BUILD_NUMBER = 283;
FLUTTER_BUILD_NAME = 5.1.2;
FLUTTER_BUILD_NUMBER = 0;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Firka;
INFOPLIST_KEY_CFBundleDisplayName = "Firka Legacy";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 5.1.1;
PRODUCT_BUNDLE_IDENTIFIER = app.firka.legacy;
PRODUCT_BUNDLE_IDENTIFIER = app.firkaa.legacy;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;

View File

@@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
@@ -43,11 +44,13 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">

View File

@@ -2,112 +2,168 @@ import UIKit
import background_fetch
import ActivityKit
import Flutter
import Security
@main
@objc class AppDelegate: FlutterAppDelegate {
private var methodChannel: FlutterMethodChannel?
private var methodChannel: FlutterMethodChannel?
private var tokenRotationObserver: NSObjectProtocol?
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
guard let controller = window?.rootViewController as? FlutterViewController else {
fatalError("rootViewController is not type FlutterViewController")
}
methodChannel = FlutterMethodChannel(name: "app.firka/liveactivity",
binaryMessenger: controller as! FlutterBinaryMessenger)
methodChannel?.setMethodCallHandler({
[weak self] (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
guard call.method == "createLiveActivity" || call.method == "endLiveActivity" || call.method == "updateLiveActivity" else {
result(FlutterMethodNotImplemented)
return
}
self?.handleMethodCall(call, result: result)
})
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func applicationWillTerminate(_ application: UIApplication) {
if #available(iOS 16.2, *) {
LiveActivityManager.stop()
}
}
private func handleMethodCall(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
if call.method == "createLiveActivity" {
if let args = call.arguments as? [String: Any] {
lessonDataDictionary = args
globalLessonData = LessonData(from: lessonDataDictionary)
print("swift: megkapott flutter adatok:",lessonDataDictionary)
print("Live Activity bekapcsolva az eszközön: ",checkLiveActivityFeatureAvailable())
if(checkLiveActivityFeatureAvailable()) {
createLiveActivity(with: lessonDataDictionary)
result(checkLiveActivityFeatureAvailable())
} else {
result(nil)
}
} else {
result(FlutterError(code: "INVALID_ARGUMENTS", message: "Invalid iOS arguments received", details: nil))
}
} else if call.method == "updateLiveActivity" {
if let args = call.arguments as? [String: Any] {
lessonDataDictionary = args
globalLessonData = LessonData(from: lessonDataDictionary)
updateLiveActivity(with: lessonDataDictionary)
result(nil)
} else {
result(FlutterError(code: "INVALID_ARGUMENTS", message: "Invalid iOS arguments received", details: nil))
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
guard let controller = window?.rootViewController as? FlutterViewController else {
fatalError("rootViewController is not type FlutterViewController")
}
} else if call.method == "endLiveActivity" {
endLiveActivity()
result(nil)
methodChannel = FlutterMethodChannel(
name: "app.firka/liveactivity",
binaryMessenger: controller as! FlutterBinaryMessenger
)
methodChannel?.setMethodCallHandler({ [weak self] (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
guard call.method == "createLiveActivity"
|| call.method == "endLiveActivity"
|| call.method == "updateLiveActivity"
else {
result(FlutterMethodNotImplemented)
return
}
self?.handleMethodCall(call, result: result)
})
NotificationCenter.default.addObserver(
forName: NSNotification.Name("LiveActivityDismissed"),
object: nil,
queue: .main
) { [weak self] _ in
let deviceId = self?.getOrCreateDeviceId() ?? ""
self?.methodChannel?.invokeMethod("liveActivityDismissed", arguments: [
"deviceId": deviceId,
])
}
tokenRotationObserver = NotificationCenter.default.addObserver(
forName: NSNotification.Name("LiveActivityTokenUpdated"),
object: nil,
queue: .main
) { [weak self] notification in
if let newToken = notification.object as? String {
let deviceId = self?.getOrCreateDeviceId() ?? ""
let bundleId = Bundle.main.bundleIdentifier ?? ""
self?.methodChannel?.invokeMethod("liveActivityTokenUpdated", arguments: [
"pushToken": newToken,
"deviceId": deviceId,
"bundleId": bundleId,
])
}
}
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
private func createLiveActivity(with activityData: [String: Any]) -> String? {
var lessonData = LessonData(from: activityData)
print("Live Activity létrehozása...")
if #available(iOS 16.2, *) {
LiveActivityManager.create()
}
return nil
}
private func updateLiveActivity(with activityData: [String: Any]) {
let lessonData = LessonData(from: activityData)
print("swift: megkapott flutter adatok:",lessonDataDictionary)
print("Live Activity frissítés...")
if #available(iOS 16.2, *) {
LiveActivityManager.update()
}
}
override func applicationWillTerminate(_ application: UIApplication) {
let deviceId = getOrCreateDeviceId()
unregisterFromServer(deviceId: deviceId)
if #available(iOS 16.2, *) {
LiveActivityManager.stop()
}
if let observer = tokenRotationObserver {
NotificationCenter.default.removeObserver(observer)
}
}
private func endLiveActivity() {
print("Live Activity befejezése...")
if #available(iOS 16.2, *) {
LiveActivityManager.stop()
}
}
private func checkIfLiveActivityExists() -> Bool {
if let activityID = activityID {
if #available(iOS 16.2, *) {
return LiveActivityManager.isRunning(activityID)
}
}
return false
}
private func checkLiveActivityFeatureAvailable() -> Bool {
if #available(iOS 16.2, *) {
guard ActivityAuthorizationInfo().areActivitiesEnabled else {
return false
}
return true
}
return false
}
private func unregisterFromServer(deviceId: String) {
guard let url = URL(string: "https://legacy-la.devbeni.lol/unregister") else { return }
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: ["device_id": deviceId])
let semaphore = DispatchSemaphore(value: 0)
URLSession.shared.dataTask(with: request) { _, _, _ in
semaphore.signal()
}.resume()
_ = semaphore.wait(timeout: .now() + 3)
}
private func handleMethodCall(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
if call.method == "createLiveActivity" {
guard let args = call.arguments as? [String: Any] else {
result(FlutterError(code: "INVALID_ARGUMENTS", message: "Invalid iOS arguments received", details: nil))
return
}
lessonDataDictionary = args
globalLessonData = LessonData(from: lessonDataDictionary)
print("swift: megkapott flutter adatok:", lessonDataDictionary)
print("Live Activity bekapcsolva az eszközön:", checkLiveActivityFeatureAvailable())
guard checkLiveActivityFeatureAvailable() else {
result(nil)
return
}
if #available(iOS 16.2, *) {
LiveActivityManager.create { success in
let deviceId = self.getOrCreateDeviceId()
let bundleId = Bundle.main.bundleIdentifier ?? ""
result([
"success": success,
"deviceId": deviceId,
"bundleId": bundleId,
])
}
} else {
result(nil)
}
} else if call.method == "updateLiveActivity" {
guard let args = call.arguments as? [String: Any] else {
result(FlutterError(code: "INVALID_ARGUMENTS", message: "Invalid iOS arguments received", details: nil))
return
}
lessonDataDictionary = args
globalLessonData = LessonData(from: lessonDataDictionary)
if #available(iOS 16.2, *) {
LiveActivityManager.update()
}
result(nil)
} else if call.method == "endLiveActivity" {
if #available(iOS 16.2, *) {
LiveActivityManager.stop()
}
result(nil)
}
}
private func getOrCreateDeviceId() -> String {
let keychainKey = "refilc.live.device_id"
let query: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrAccount as String: keychainKey,
kSecReturnData as String: true,
kSecMatchLimit as String: kSecMatchLimitOne,
]
var item: CFTypeRef?
if SecItemCopyMatching(query as CFDictionary, &item) == errSecSuccess,
let data = item as? Data,
let existingId = String(data: data, encoding: .utf8) {
return existingId
}
let newId = UUID().uuidString
let addQuery: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrAccount as String: keychainKey,
kSecValueData as String: newId.data(using: .utf8)!,
]
SecItemAdd(addQuery as CFDictionary, nil)
return newId
}
private func checkLiveActivityFeatureAvailable() -> Bool {
if #available(iOS 16.2, *) {
return ActivityAuthorizationInfo().areActivitiesEnabled
}
return false
}
}

View File

@@ -1,138 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.transistorsoft.firkanotification</string>
<string>com.transistorsoft.firkaliveactivity</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleAlternateIcons</key>
<dict>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.transistorsoft.firkanotification</string>
<string>com.transistorsoft.firkaliveactivity</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleAlternateIcons</key>
<key>firka_concept</key>
<dict>
<key>firka_concept</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>firka_concept</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>firka_default</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>firka_default</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>firka_overcomplicated</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>firka_overcomplicated</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>firka_pride</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>firka_pride</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>CFBundleIconFiles</key>
<array>
<string>firka_concept</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIcons</key>
<key>firka_default</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string></string>
</array>
<key>CFBundleIconName</key>
<string></string>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>CFBundleIconFiles</key>
<array>
<string>firka_default</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>firka_overcomplicated</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>firka_overcomplicated</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>firka_pride</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>firka_pride</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Firka</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>firkaapp</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
<string>http</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>The app requires the camera access to set a custom profile picture.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>The app requires the photo library to set a custom profile picture.</string>
<key>NSSupportsLiveActivities</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>processing</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string></string>
</array>
<key>CFBundleIconName</key>
<string></string>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Firka Legacy</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>firkaapp</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
<string>http</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>The app requires the camera access to set a custom profile picture.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>The app requires the photo library to set a custom profile picture.</string>
<key>NSSupportsLiveActivities</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>processing</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

View File

@@ -3,8 +3,10 @@
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<string>production</string>
<key>com.apple.security.application-groups</key>
<array/>
<array>
<string>group.firkaa.legacy</string>
</array>
</dict>
</plist>

View File

@@ -1,12 +1,7 @@
//
// public_vars.swift
// Runner
//
// Created by Geryy on 02/05/2024.
//
import Foundation
var lessonDataDictionary: [String: Any] = [:]
var globalLessonData = LessonData(from: lessonDataDictionary)
var activityID: String? = ""
var activityPushToken: String? = nil
var isCleaningUpOldActivities = false

View File

@@ -17,7 +17,7 @@ public struct LiveActivitiesAppAttributes: ActivityAttributes, Identifiable {
var nextSubject: String
var nextRoom: String
}
public var id = UUID()
}
@@ -26,67 +26,153 @@ final class LiveActivityManager {
static let shared = LiveActivityManager()
var currentActivity: Activity<LiveActivitiesAppAttributes>?
class func create() {
Task {
do {
let contentState = LiveActivitiesAppAttributes.ContentState(color: globalLessonData.color, icon: globalLessonData.icon, index: globalLessonData.index, title: globalLessonData.title, subtitle: globalLessonData.subtitle, description: globalLessonData.description, startDate: globalLessonData.startDate, endDate: globalLessonData.endDate, date: globalLessonData.date, nextSubject: globalLessonData.nextSubject, nextRoom: globalLessonData.nextRoom)
let activityContent = ActivityContent(state: contentState, staleDate: globalLessonData.endDate, relevanceScore: 0)
let activity = try Activity<LiveActivitiesAppAttributes>.request(
attributes: LiveActivitiesAppAttributes(),
content: activityContent,
pushType: nil
)
activityID = activity.id
print("Live Activity létrehozva. Azonosító: \(activity.id)")
} catch {
print("Hiba történt a Live Activity létrehozásakor: \(error)")
}
class func create(completion: @escaping (Bool) -> Void) {
Task {
isCleaningUpOldActivities = true
for activity in Activity<LiveActivitiesAppAttributes>.activities {
await activity.end(nil, dismissalPolicy: .immediate)
}
}
class func update() {
Task {
for activity in Activity<LiveActivitiesAppAttributes>.activities {
do {
let contentState = LiveActivitiesAppAttributes.ContentState(color: globalLessonData.color, icon: globalLessonData.icon, index: globalLessonData.index, title: globalLessonData.title, subtitle: globalLessonData.subtitle, description: globalLessonData.description, startDate: globalLessonData.startDate, endDate: globalLessonData.endDate, date: globalLessonData.date, nextSubject: globalLessonData.nextSubject, nextRoom: globalLessonData.nextRoom)
let activityContent = ActivityContent(state: contentState, staleDate: globalLessonData.endDate, relevanceScore: 0)
try? await Task.sleep(nanoseconds: 200_000_000)
isCleaningUpOldActivities = false
await activity.update(activityContent)
activityID = activity.id
print("Live Activity frissítve. Azonosító: \(activity.id)")
} catch {
print("Hiba történt a Live Activity frissítésekor: \(error)")
}
do {
let contentState = LiveActivitiesAppAttributes.ContentState(
color: globalLessonData.color,
icon: globalLessonData.icon,
index: globalLessonData.index,
title: globalLessonData.title,
subtitle: globalLessonData.subtitle,
description: globalLessonData.description,
startDate: globalLessonData.startDate,
endDate: globalLessonData.endDate,
date: globalLessonData.date,
nextSubject: globalLessonData.nextSubject,
nextRoom: globalLessonData.nextRoom
)
let activityContent = ActivityContent(
state: contentState,
staleDate: globalLessonData.endDate,
relevanceScore: 0
)
let activity = try Activity<LiveActivitiesAppAttributes>.request(
attributes: LiveActivitiesAppAttributes(),
content: activityContent,
pushType: .token
)
activityID = activity.id
print("Live Activity létrehozva. Azonosító: \(activity.id)")
completion(true)
Task { await monitorActivityState(activity: activity) }
Task {
for await tokenData in activity.pushTokenUpdates {
let tokenHex = tokenData.map { String(format: "%02x", $0) }.joined()
activityPushToken = tokenHex
print("Live Activity push token: \(tokenHex)")
NotificationCenter.default.post(
name: NSNotification.Name("LiveActivityTokenUpdated"),
object: tokenHex
)
}
}
} catch {
print("Hiba történt a Live Activity létrehozásakor: \(error)")
completion(false)
}
}
}
private class func monitorActivityState(activity: Activity<LiveActivitiesAppAttributes>) async {
for await state in activity.activityStateUpdates {
if state == .dismissed || state == .ended {
if isCleaningUpOldActivities {
print("Live Activity ended during cleanup - ignoring dismiss")
break
}
print("Live Activity dismissed/ended by user or system")
activityID = nil
activityPushToken = nil
NotificationCenter.default.post(
name: NSNotification.Name("LiveActivityDismissed"),
object: nil
)
await activity.end(nil, dismissalPolicy: .immediate)
break
}
}
}
class func update() {
Task {
for activity in Activity<LiveActivitiesAppAttributes>.activities {
let contentState = LiveActivitiesAppAttributes.ContentState(
color: globalLessonData.color,
icon: globalLessonData.icon,
index: globalLessonData.index,
title: globalLessonData.title,
subtitle: globalLessonData.subtitle,
description: globalLessonData.description,
startDate: globalLessonData.startDate,
endDate: globalLessonData.endDate,
date: globalLessonData.date,
nextSubject: globalLessonData.nextSubject,
nextRoom: globalLessonData.nextRoom
)
let activityContent = ActivityContent(
state: contentState,
staleDate: globalLessonData.endDate,
relevanceScore: 0
)
await activity.update(activityContent)
activityID = activity.id
print("Live Activity frissítve. Azonosító: \(activity.id)")
}
}
}
class func stop() {
if (activityID != "") {
if activityID != "" {
Task {
for activity in Activity<LiveActivitiesAppAttributes>.activities{
let contentState = LiveActivitiesAppAttributes.ContentState(color: globalLessonData.color, icon: globalLessonData.icon, index: globalLessonData.index, title: globalLessonData.title, subtitle: globalLessonData.subtitle, description: globalLessonData.description, startDate: globalLessonData.startDate, endDate: globalLessonData.endDate, date: globalLessonData.date, nextSubject: globalLessonData.nextSubject, nextRoom: globalLessonData.nextRoom)
await activity.end(ActivityContent(state: contentState, staleDate: Date.distantFuture),dismissalPolicy: .immediate)
for activity in Activity<LiveActivitiesAppAttributes>.activities {
let contentState = LiveActivitiesAppAttributes.ContentState(
color: globalLessonData.color,
icon: globalLessonData.icon,
index: globalLessonData.index,
title: globalLessonData.title,
subtitle: globalLessonData.subtitle,
description: globalLessonData.description,
startDate: globalLessonData.startDate,
endDate: globalLessonData.endDate,
date: globalLessonData.date,
nextSubject: globalLessonData.nextSubject,
nextRoom: globalLessonData.nextRoom
)
await activity.end(
ActivityContent(state: contentState, staleDate: Date.distantFuture),
dismissalPolicy: .immediate
)
}
activityID = nil
activityPushToken = nil
print("Live Activity sikeresen leállítva")
}
}
}
class func isRunning(_ activityID: String) -> Bool {
for activity in Activity<LiveActivitiesAppAttributes>.activities {
if activity.id == activityID {
return true
}
for activity in Activity<LiveActivitiesAppAttributes>.activities {
if activity.id == activityID {
return true
}
return false
}
return false
}
}

View File

@@ -3,8 +3,10 @@
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<string>production</string>
<key>com.apple.security.application-groups</key>
<array/>
<array>
<string>group.firkaa.legacy</string>
</array>
</dict>
</plist>

View File

@@ -51,72 +51,103 @@ extension Color {
struct LockScreenLiveActivityView: View {
let context: ActivityViewContext<LiveActivitiesAppAttributes>
private var isExpired: Bool {
context.state.endDate <= Date()
}
private var hasNextLesson: Bool {
!context.state.nextSubject.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
}
private var nextLessonLine: String {
if context.state.nextRoom.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
return context.state.nextSubject
}
return "\(context.state.nextSubject) - \(context.state.nextRoom)"
}
private var countdownFont: Font {
// h:mm:ss needs more space than mm:ss
let remaining = max(0, context.state.endDate.timeIntervalSinceNow)
return remaining >= 3600 ? .title3 : .title2
}
var body: some View {
HStack(alignment: .center) {
HStack(alignment: .center, spacing: 0) {
// Ikon
Image(systemName: context.state.icon)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: CGFloat(30), height: CGFloat(30))
.padding(.leading, CGFloat(24))
.frame(width: 28, height: 28)
.padding(.leading, 16)
VStack(alignment: .center) {
VStack(alignment: .leading, spacing: 3) {
// Jelenlegi óra
VStack {
if(context.state.title.contains("Az első órádig")) {
if context.state.title.contains("Az első órádig") {
Text(context.state.title)
.font(.system(size: 15))
.bold()
.multilineTextAlignment(.center)
} else if(context.state.title == "Szünet") {
.font(.system(size: 14, weight: .semibold))
.lineLimit(2)
} else if context.state.title == "Szünet" {
Text(context.state.title)
.font(.body)
.bold()
.padding(.trailing, 90)
} else {
MultilineTextView(text: "\(context.state.index) \(context.state.title) - \(context.state.subtitle)", limit: 25)
.font(.body)
.bold()
.multilineTextAlignment(.center)
}
.font(.system(size: 15, weight: .bold))
} else {
Text("\(context.state.index) \(context.state.title) - \(context.state.subtitle)")
.font(.system(size: 15, weight: .bold))
.lineLimit(2)
}
// Leírás
if (context.state.description != "") {
Text(context.state.description)
.font(.subheadline)
if !context.state.description.isEmpty {
Text(context.state.description)
.font(.system(size: 13))
.lineLimit(2)
.foregroundStyle(.secondary)
}
// Következő óra
if(context.state.nextSubject != "" && context.state.nextRoom != "") {
HStack {
Image(systemName: "arrow.right")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: CGFloat(8), height: CGFloat(8))
if hasNextLesson {
HStack(spacing: 4) {
Image(systemName: "arrow.right")
.font(.system(size: 8, weight: .semibold))
.foregroundStyle(.secondary)
Text(nextLessonLine)
.font(.system(size: 12))
.foregroundStyle(.secondary)
}
} else {
Text("Ez az utolsó óra! Kitartást!")
.font(.system(size: 13))
.foregroundStyle(.secondary)
Text("\(context.state.nextSubject) - \(context.state.nextRoom)")
.font(.caption)
}
.multilineTextAlignment(.center)
} else {
Spacer(minLength: 5)
Text("Ez az utolsó óra! Kitartást!")
.font(.system(size: 15))
}
}
.padding(15)
.padding(.horizontal, 12)
.padding(.vertical, 14)
.layoutPriority(0)
Spacer()
Spacer(minLength: 4)
// Visszaszámláló
Text(timerInterval: context.state.date, countsDown: true)
.multilineTextAlignment(.center)
.frame(width: 85)
.font(.title2)
.monospacedDigit()
.padding(.trailing)
if isExpired {
Text("Vége")
.multilineTextAlignment(.trailing)
.frame(minWidth: 86, maxWidth: 100, alignment: .trailing)
.font(.headline)
.lineLimit(1)
.minimumScaleFactor(0.75)
.layoutPriority(1)
.padding(.trailing, 16)
} else {
Text(timerInterval: context.state.date, countsDown: true)
.multilineTextAlignment(.trailing)
.frame(minWidth: 86, maxWidth: 100, alignment: .trailing)
.font(countdownFont)
.monospacedDigit()
.lineLimit(1)
.minimumScaleFactor(0.75)
.layoutPriority(1)
.padding(.trailing, 16)
}
}
// .activityBackgroundTint(
// context.state.color != "#676767"
@@ -210,14 +241,18 @@ struct LiveCardWidget: Widget {
Spacer(minLength: 2)
if(context.state.nextRoom != "" && context.state.nextSubject != "") {
if(!context.state.nextSubject.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty) {
Text("Következő óra és terem:")
.font(.system(size: 14))
.padding(.trailing, -45)
Spacer(minLength: 2)
Text("\(context.state.nextSubject) - \(context.state.nextRoom)")
.modifier(DynamicFontSizeModifier(text: "\(context.state.nextSubject) - \(context.state.nextRoom)"))
let nextLessonLine = context.state.nextRoom.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
? context.state.nextSubject
: "\(context.state.nextSubject) - \(context.state.nextRoom)"
Text(nextLessonLine)
.modifier(DynamicFontSizeModifier(text: nextLessonLine))
.padding(.trailing, 35)
} else {
Text("Ez az utolsó óra! Kitartást!")
@@ -232,14 +267,26 @@ struct LiveCardWidget: Widget {
}
/// Compact
} compactLeading: {
} compactLeading: {
Image(systemName: context.state.icon)
}
compactTrailing: {
Text(timerInterval: context.state.date, countsDown: true)
.multilineTextAlignment(.center)
.frame(width: 40)
.font(.caption2)
if context.state.endDate <= Date() {
Text("Vége")
.multilineTextAlignment(.center)
.frame(width: 52)
.font(.caption2)
.lineLimit(1)
.minimumScaleFactor(0.7)
} else {
Text(timerInterval: context.state.date, countsDown: true)
.multilineTextAlignment(.center)
.frame(width: 52)
.font(.caption2)
.monospacedDigit()
.lineLimit(1)
.minimumScaleFactor(0.7)
}
/// Collapsed
} minimal: {

View File

@@ -3,10 +3,14 @@
import 'dart:async';
import 'package:refilc/api/providers/liveactivity/platform_channel.dart';
import 'package:refilc/api/providers/liveactivity/server_sync_provider.dart';
import 'package:refilc/helpers/subject.dart';
import 'package:refilc/models/settings.dart';
import 'package:refilc/ui/flutter_colorpicker/utils.dart';
import 'package:refilc_kreta_api/models/lesson.dart';
import 'package:refilc_kreta_api/models/subject.dart';
import 'package:refilc_kreta_api/models/category.dart' as kreta;
import 'package:refilc_kreta_api/models/teacher.dart';
import 'package:refilc_kreta_api/models/week.dart';
import 'package:refilc/utils/format.dart';
import 'package:refilc_kreta_api/providers/timetable_provider.dart';
@@ -30,21 +34,24 @@ class LiveCardProvider extends ChangeNotifier {
Lesson? prevLesson;
List<Lesson>? nextLessons;
// new variables
static bool hasActivityStarted = false;
static bool hasDayEnd = false;
static bool hasUserDismissed = false;
static DateTime? storeFirstRunDate;
static DateTime? _lastProcessedDay;
static bool hasActivitySettingsChanged = false;
// ignore: non_constant_identifier_names
static Map<String, String> LAData = {};
static DateTime? now;
//
LiveCardState currentState = LiveCardState.empty;
static LiveCardState _previousState = LiveCardState.empty;
static String? _previousLessonId;
// ignore: unused_field
late Timer _timer;
late final TimetableProvider _timetable;
late final SettingsProvider _settings;
static final ServerSyncProvider serverSync = ServerSyncProvider();
late Duration _delay;
@@ -59,12 +66,31 @@ class LiveCardProvider extends ChangeNotifier {
_delay = settings.bellDelayEnabled
? Duration(seconds: settings.bellDelay)
: Duration.zero;
PlatformChannel.onTokenUpdated = (pushToken, deviceId, bundleId) {
if (!_settings.liveActivityEnabled) return;
debugPrint("Push token érkezett: $pushToken");
serverSync.registerAndSync(
deviceId: deviceId,
pushToken: pushToken,
bundleId: bundleId,
liveActivityColor:
'#${settings.liveActivityColor.toHexString().substring(2)}',
todayLessons: _today(_timetable),
);
};
PlatformChannel.onActivityDismissed = (deviceId) {
debugPrint("Live Activity dismissed by user");
serverSync.forceUnregister(deviceId);
hasActivityStarted = false;
hasUserDismissed = true;
};
update();
}
// Debugging
static DateTime _now() {
// return DateTime(2023, 9, 27, 9, 30);
return DateTime.now();
}
@@ -85,8 +111,6 @@ class LiveCardProvider extends ChangeNotifier {
}
Map<String, String> toMap() {
// print("LIVE ACTIVITY COLOR BELOW:");
// print(_settings.liveActivityColor.toHexString().substring(2));
String color = '#${_settings.liveActivityColor.toHexString().substring(2)}';
switch (currentState) {
@@ -242,6 +266,12 @@ class LiveCardProvider extends ChangeNotifier {
: Duration.zero;
DateTime now = _now().add(_delay);
_resetDayScopedState(now);
currentLesson = null;
nextLesson = null;
prevLesson = null;
nextLessons = null;
if ((currentState == LiveCardState.morning ||
currentState == LiveCardState.afternoon ||
@@ -250,17 +280,14 @@ class LiveCardProvider extends ChangeNotifier {
storeFirstRunDate = now;
}
// Filter cancelled lessons #20
// Filter label lessons #128
today = today
.where((lesson) =>
lesson.status?.name != "Elmaradt" &&
(lesson.status?.name != "Elmaradt" || lesson.substituteTeacher != null) &&
lesson.subject.id != '' &&
!lesson.isEmpty)
.toList();
if (today.isNotEmpty) {
// sort
today.sort((a, b) => a.start.compareTo(b.start));
final _lesson = today.firstWhere(
@@ -294,7 +321,8 @@ class LiveCardProvider extends ChangeNotifier {
}
if (now.isBefore(DateTime(now.year, DateTime.august, 31)) &&
now.isAfter(DateTime(now.year, DateTime.june, 14))) {
now.isAfter(DateTime(now.year, DateTime.june, 14)) &&
!(_settings.developerMode && _settings.devLiveFakeLessons)) {
currentState = LiveCardState.summary;
} else if (currentLesson != null) {
currentState = LiveCardState.duringLesson;
@@ -305,7 +333,9 @@ class LiveCardProvider extends ChangeNotifier {
} else if (now.hour >= 20) {
currentState = LiveCardState.night;
} else if (now.hour >= 5 && now.hour <= 10) {
if (nextLesson == null || now.weekday == 6 || now.weekday == 7) {
if (nextLesson == null ||
((now.weekday == 6 || now.weekday == 7) &&
!(_settings.developerMode && _settings.devLiveFakeLessons))) {
currentState = LiveCardState.empty;
} else {
currentState = LiveCardState.morning;
@@ -314,84 +344,195 @@ class LiveCardProvider extends ChangeNotifier {
currentState = LiveCardState.empty;
}
//LIVE ACTIVITIES
if (!_settings.liveActivityEnabled) {
if (hasActivityStarted) {
debugPrint("Live Activity nincs engedélyezve, de fut – leállítás...");
PlatformChannel.endLiveActivity();
serverSync.unregister();
hasActivityStarted = false;
}
} else {
if (!hasActivityStarted &&
!hasUserDismissed &&
nextLesson != null &&
nextLesson!.start.difference(now).inMinutes <= 120 &&
(currentState == LiveCardState.morning ||
currentState == LiveCardState.afternoon ||
currentState == LiveCardState.night)) {
debugPrint(
"Az első óra előtt állunk, kevesebb mint két órával. Létrehozás...");
hasActivityStarted = true;
_createAndSync();
} else if (!hasActivityStarted &&
!hasUserDismissed &&
((currentState == LiveCardState.duringLesson &&
currentLesson != null) ||
currentState == LiveCardState.duringBreak)) {
debugPrint(
"Óra van, vagy szünet, de nincs LiveActivity. létrehozás...");
hasActivityStarted = true;
_createAndSync();
} else if (!hasActivityStarted &&
_settings.developerMode &&
_settings.devLiveFakeLessons &&
today.isNotEmpty) {
debugPrint("Fake mód: Live Activity létrehozás...");
hasActivityStarted = true;
hasUserDismissed = false;
_createAndSync();
} else if (hasActivityStarted) {
final currentLessonId = currentLesson?.id ?? nextLesson?.id;
final stateChanged = currentState != _previousState;
final lessonChanged = currentLessonId != _previousLessonId;
//CREATE
if (!hasActivityStarted &&
nextLesson != null &&
nextLesson!.start.difference(now).inMinutes <= 60 &&
(currentState == LiveCardState.morning ||
currentState == LiveCardState.afternoon ||
currentState == LiveCardState.night)) {
debugPrint(
"Az első óra előtt állunk, kevesebb mint egy órával. Létrehozás...");
PlatformChannel.createLiveActivity(toMap());
hasActivityStarted = true;
} else if (!hasActivityStarted &&
((currentState == LiveCardState.duringLesson &&
currentLesson != null) ||
currentState == LiveCardState.duringBreak)) {
debugPrint("Óra van, vagy szünet, de nincs LiveActivity. létrehozás...");
PlatformChannel.createLiveActivity(toMap());
hasActivityStarted = true;
}
//UPDATE
else if (hasActivityStarted) {
if (hasActivitySettingsChanged) {
debugPrint("Valamelyik beállítás megváltozott. Frissítés...");
PlatformChannel.updateLiveActivity(toMap());
hasActivitySettingsChanged = false;
} else if (nextLesson != null || currentLesson != null) {
bool afterPrevLessonEnd = prevLesson != null &&
now
.subtract(const Duration(seconds: 1))
.isBefore(prevLesson!.end) &&
now.isAfter(prevLesson!.end);
bool afterCurrentLessonStart = currentLesson != null &&
now
.subtract(const Duration(seconds: 1))
.isBefore(currentLesson!.start) &&
now.isAfter(currentLesson!.start);
if (afterPrevLessonEnd || afterCurrentLessonStart) {
if (hasActivitySettingsChanged) {
debugPrint("Valamelyik beállítás megváltozott. Frissítés...");
PlatformChannel.updateLiveActivity(toMap());
hasActivitySettingsChanged = false;
} else if (stateChanged || lessonChanged) {
debugPrint(
"Óra kezdete/vége után 1 másodperccel vagyunk. Frissítés...");
"Állapot vagy óra váltás: $currentState, lesson: $currentLessonId. Frissítés...");
PlatformChannel.updateLiveActivity(toMap());
}
}
}
//END
if ((currentState == LiveCardState.afternoon ||
currentState == LiveCardState.morning ||
currentState == LiveCardState.night) &&
hasActivityStarted &&
nextLesson != null &&
nextLesson!.start.difference(now).inMinutes > 60) {
debugPrint("Több, mint 1 óra van az első óráig. Befejezés...");
PlatformChannel.endLiveActivity();
hasActivityStarted = false;
} else if (hasActivityStarted &&
!hasDayEnd &&
nextLesson == null &&
now.isAfter(prevLesson!.end)) {
debugPrint("Az utolsó óra véget ért. Befejezés...");
PlatformChannel.endLiveActivity();
hasDayEnd = true;
hasActivityStarted = false;
}
_previousState = currentState;
_previousLessonId = currentLessonId;
}
if (_settings.developerMode && _settings.devLiveFakeLessons) {
} else if ((currentState == LiveCardState.afternoon ||
currentState == LiveCardState.morning ||
currentState == LiveCardState.night) &&
hasActivityStarted &&
nextLesson != null &&
nextLesson!.start.difference(now).inMinutes > 120) {
debugPrint("Több, mint 2 óra van az első óráig. Befejezés...");
PlatformChannel.endLiveActivity();
serverSync.unregister();
hasActivityStarted = false;
} else if (hasActivityStarted &&
!hasDayEnd &&
nextLesson == null &&
prevLesson != null &&
now.isAfter(prevLesson!.end) &&
today.every((l) => l.end.isBefore(now))) {
debugPrint("Az utolsó óra véget ért. Befejezés...");
PlatformChannel.endLiveActivity();
serverSync.unregister();
hasDayEnd = true;
hasActivityStarted = false;
hasUserDismissed = false;
} else if (hasActivityStarted && currentState == LiveCardState.empty) {
debugPrint("Nincs több megjeleníthető mai állapot. Befejezés...");
PlatformChannel.endLiveActivity();
serverSync.unregister();
hasActivityStarted = false;
}
} // end of liveActivityEnabled else block
LAData = toMap();
notifyListeners();
}
Future<void> _createAndSync() async {
final result = await PlatformChannel.createLiveActivity(toMap());
if (result != null && result['success'] == 'true') {
debugPrint("Live Activity létrehozva, várunk a push tokenre...");
} else {
debugPrint("Live Activity létrehozás sikertelen");
hasActivityStarted = false;
}
}
bool get show => currentState != LiveCardState.empty;
Duration get delay => _delay;
bool _sameDate(DateTime a, DateTime b) =>
(a.year == b.year && a.month == b.month && a.day == b.day);
List<Lesson> _today(TimetableProvider p) => (p.getWeek(Week.current()) ?? [])
.where((l) => _sameDate(l.date, _now()))
.toList();
void _resetDayScopedState(DateTime now) {
if (_lastProcessedDay != null && _sameDate(_lastProcessedDay!, now)) {
return;
}
if (hasActivityStarted) {
PlatformChannel.endLiveActivity();
serverSync.unregister();
}
_lastProcessedDay = DateTime(now.year, now.month, now.day);
hasActivityStarted = false;
hasDayEnd = false;
hasUserDismissed = false;
storeFirstRunDate = null;
_previousState = LiveCardState.empty;
_previousLessonId = null;
}
List<Lesson> _today(TimetableProvider p) {
final real = (p.getWeek(Week.current()) ?? [])
.where((l) => _sameDate(l.date, _now()))
.toList();
if (!_settings.developerMode || !_settings.devLiveFakeLessons) {
return real;
}
if (real.isNotEmpty) {
final sorted = List<Lesson>.from(real)
..sort((a, b) => a.end.compareTo(b.end));
final lastEnd = sorted.last.end;
final now = _now();
final nextIndex = sorted.length;
if (lastEnd.isBefore(now)) {
return [...real, ..._generateFakeLessons(startIndex: nextIndex)];
}
final fakeStart = lastEnd.add(const Duration(minutes: 10));
return [
...real,
..._generateFakeLessons(baseStart: fakeStart, startIndex: nextIndex)
];
}
return _generateFakeLessons();
}
static List<Lesson> _generateFakeLessons(
{DateTime? baseStart, int startIndex = 0}) {
final now = _now();
final start0 = baseStart ?? now.subtract(const Duration(minutes: 10));
const subjects = [
('Matematika', 'fake_math', 'Egyenletek'),
('Magyar', 'fake_hun', 'Nyelvtan'),
('Angol', 'fake_eng', 'Writing'),
('Fizika', 'fake_phys', 'Mechanika'),
('Történelem', 'fake_hist', 'XX. század'),
('Informatika', 'fake_info', 'Programozás'),
];
final lessons = <Lesson>[];
for (int i = 0; i < 6; i++) {
final start = start0.add(Duration(minutes: i * 55));
final end = start.add(const Duration(minutes: 45));
final (name, id, desc) = subjects[i];
lessons.add(Lesson(
id: 'fake_lesson_${startIndex + i}',
date: DateTime(now.year, now.month, now.day),
subject: GradeSubject(
id: id,
category: kreta.Category(id: '', name: ''),
name: name,
),
lessonIndex: '${startIndex + i + 1}',
teacher: Teacher(id: 'fake_teacher', name: 'Teszt Tanár'),
start: start,
end: end,
homeworkId: '',
description: desc,
room: '${(i + 1) * 100 + 1}',
groupName: '',
name: name,
));
}
return lessons;
}
}

View File

@@ -4,25 +4,62 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
class PlatformChannel {
static const MethodChannel _channel = MethodChannel('hu.refilc/liveactivity');
static const MethodChannel _channel = MethodChannel('app.firka/liveactivity');
static Future<void> createLiveActivity(
/// Callback token rotation esetén (iOS APNs új tokent ad ki).
static void Function(String pushToken, String deviceId, String bundleId)? onTokenUpdated;
/// Callback ha a user dismiss-eli a Live Activity-t (swipe left).
static void Function(String deviceId)? onActivityDismissed;
static void _setupMethodCallListener() {
_channel.setMethodCallHandler((call) async {
if (call.method == 'liveActivityTokenUpdated') {
final args = call.arguments as Map?;
if (args != null && onTokenUpdated != null) {
onTokenUpdated!(
args['pushToken'] as String? ?? '',
args['deviceId'] as String? ?? '',
args['bundleId'] as String? ?? '',
);
}
} else if (call.method == 'liveActivityDismissed') {
final args = call.arguments as Map?;
final deviceId = args?['deviceId'] as String? ?? '';
debugPrint("Live Activity dismissed by user (device: $deviceId)");
onActivityDismissed?.call(deviceId);
}
});
}
/// Létrehozza a Live Activity-t. Azonnal visszatér deviceId/bundleId-vel.
/// A push token később érkezik az onTokenUpdated callback-en.
static Future<Map<String, String>?> createLiveActivity(
Map<String, dynamic> activityData) async {
if (Platform.isIOS) {
_setupMethodCallListener();
try {
debugPrint("creating...");
await _channel.invokeMethod('createLiveActivity', activityData);
debugPrint("creating live activity...");
final result = await _channel.invokeMethod<Map>(
'createLiveActivity', activityData);
if (result == null) return null;
return {
'success': (result['success'] as bool? ?? false).toString(),
'deviceId': result['deviceId'] as String? ?? '',
'bundleId': result['bundleId'] as String? ?? '',
};
} on PlatformException catch (e) {
debugPrint("Hiba történt a Live Activity létrehozásakor: ${e.message}");
}
}
return null;
}
static Future<void> updateLiveActivity(
Map<String, dynamic> activityData) async {
if (Platform.isIOS) {
try {
debugPrint("updating...");
debugPrint("updating live activity...");
await _channel.invokeMethod('updateLiveActivity', activityData);
} on PlatformException catch (e) {
debugPrint("Hiba történt a Live Activity frissítésekor: ${e.message}");
@@ -33,11 +70,11 @@ class PlatformChannel {
static Future<void> endLiveActivity() async {
if (Platform.isIOS) {
try {
debugPrint("finishing...");
debugPrint("ending live activity...");
await _channel.invokeMethod('endLiveActivity');
} on PlatformException catch (e) {
debugPrint("Hiba történt a Live Activity befejezésekor: ${e.message}");
}
}
}
}
}

View File

@@ -0,0 +1,176 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
import 'package:refilc/helpers/subject.dart';
import 'package:refilc/utils/format.dart';
import 'package:refilc_kreta_api/models/lesson.dart';
class ServerSyncProvider {
static const String _baseUrl = 'https://legacy-la.devbeni.lol';
String? _deviceId;
Future<void> registerAndSync({
required String deviceId,
required String pushToken,
required String bundleId,
required String liveActivityColor,
required List<Lesson> todayLessons,
}) async {
_deviceId = deviceId;
await _register(
deviceId: deviceId,
pushToken: pushToken,
bundleId: bundleId,
liveActivityColor: liveActivityColor,
);
final validLessons = _filterLessons(todayLessons);
if (validLessons.isNotEmpty) {
await _uploadSchedule(deviceId: deviceId, lessons: validLessons);
}
}
Future<void> refreshToken({
required String pushToken,
required String bundleId,
required String liveActivityColor,
}) async {
if (_deviceId == null) return;
await _register(
deviceId: _deviceId!,
pushToken: pushToken,
bundleId: bundleId,
liveActivityColor: liveActivityColor,
);
}
Future<void> _register({
required String deviceId,
required String pushToken,
required String bundleId,
required String liveActivityColor,
}) async {
try {
final response = await http.post(
Uri.parse('$_baseUrl/register'),
headers: {'Content-Type': 'application/json'},
body: jsonEncode({
'device_id': deviceId,
'apns_token': pushToken,
'bundle_id': bundleId,
'settings': {
'live_activity_color': liveActivityColor,
},
}),
).timeout(const Duration(seconds: 10));
if (response.statusCode != 200 && response.statusCode != 201) {
debugPrint('ServerSync register hiba: ${response.statusCode} ${response.body}');
} else {
debugPrint('ServerSync: device regisztrálva');
}
} catch (e) {
debugPrint('ServerSync register kivétel: $e');
}
}
Future<void> _uploadSchedule({
required String deviceId,
required List<Lesson> lessons,
}) async {
try {
final now = DateTime.now();
final dateStr =
'${now.year}-${now.month.toString().padLeft(2, '0')}-${now.day.toString().padLeft(2, '0')}';
final entries = <Map<String, dynamic>>[];
for (int i = 0; i < lessons.length; i++) {
final l = lessons[i];
entries.add({
'type': 'lesson',
'index': l.lessonIndex.toString(),
'subject': l.subject.renamedTo ??
ShortSubject.resolve(subject: l.subject).capital(),
'icon': SubjectIcon.resolveName(subject: l.subject),
'room': l.room.replaceAll('_', ' '),
'description': l.description,
'start': l.start.millisecondsSinceEpoch,
'end': l.end.millisecondsSinceEpoch,
});
if (i < lessons.length - 1) {
final next = lessons[i + 1];
if (l.end.isBefore(next.start)) {
entries.add({
'type': 'break',
'index': '',
'subject': 'Szünet',
'icon': 'cup.and.saucer',
'room': '',
'description': '',
'start': l.end.millisecondsSinceEpoch,
'end': next.start.millisecondsSinceEpoch,
'nextSubject': next.subject.renamedTo ??
ShortSubject.resolve(subject: next.subject).capital(),
'nextIcon': SubjectIcon.resolveName(subject: next.subject),
'nextRoom': next.room.replaceAll('_', ' '),
'nextIndex': next.lessonIndex.toString(),
});
}
}
}
final response = await http.post(
Uri.parse('$_baseUrl/schedule'),
headers: {'Content-Type': 'application/json'},
body: jsonEncode({
'device_id': deviceId,
'date': dateStr,
'lessons': entries,
}),
).timeout(const Duration(seconds: 10));
if (response.statusCode != 200 && response.statusCode != 201) {
debugPrint('ServerSync schedule hiba: ${response.statusCode} ${response.body}');
} else {
debugPrint('ServerSync: ${entries.length} elem feltöltve ($dateStr)');
}
} catch (e) {
debugPrint('ServerSync schedule kivétel: $e');
}
}
Future<void> unregister() async {
if (_deviceId == null) return;
await forceUnregister(_deviceId!);
}
Future<void> forceUnregister(String deviceId) async {
try {
final response = await http.post(
Uri.parse('$_baseUrl/unregister'),
headers: {'Content-Type': 'application/json'},
body: jsonEncode({'device_id': deviceId}),
).timeout(const Duration(seconds: 10));
if (response.statusCode == 200) {
debugPrint('ServerSync: device + schedule törölve (unregister)');
} else {
debugPrint('ServerSync unregister hiba: ${response.statusCode}');
}
} catch (e) {
debugPrint('ServerSync unregister kivétel: $e');
}
_deviceId = null;
}
List<Lesson> _filterLessons(List<Lesson> lessons) {
return lessons
.where((l) =>
(l.status?.name != 'Elmaradt' || l.substituteTeacher != null) &&
l.subject.id != '' &&
!l.isEmpty)
.toList()
..sort((a, b) => a.start.compareTo(b.start));
}
}

View File

@@ -23,8 +23,6 @@ import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import 'package:home_widget/home_widget.dart';
import 'live_card_provider.dart';
import 'liveactivity/platform_channel.dart';
// Mutex
bool lock = false;
@@ -38,6 +36,22 @@ Future<void> syncAll(BuildContext context) async {
print("INFO Syncing all");
UserProvider user = Provider.of<UserProvider>(context, listen: false);
// Demo mode: load demo data into providers without API calls
if (user.isDemo) {
await Provider.of<GradeProvider>(context, listen: false).fetch();
await Provider.of<TimetableProvider>(context, listen: false)
.fetch(week: Week.current());
await Provider.of<ExamProvider>(context, listen: false).fetch();
await Provider.of<HomeworkProvider>(context, listen: false)
.fetch(from: DateTime.now().subtract(const Duration(days: 30)));
await Provider.of<MessageProvider>(context, listen: false).fetchAll();
await Provider.of<NoteProvider>(context, listen: false).fetch();
await Provider.of<EventProvider>(context, listen: false).fetch();
await Provider.of<AbsenceProvider>(context, listen: false).fetch();
lock = false;
return Future.value();
}
StatusProvider statusProvider =
Provider.of<StatusProvider>(context, listen: false);
@@ -142,15 +156,8 @@ Future<void> syncAll(BuildContext context) async {
}
return Future.wait(tasks).then((value) {
// Unlock
lock = false;
if (Platform.isIOS && LiveCardProvider.hasActivityStarted == true) {
PlatformChannel.endLiveActivity();
LiveCardProvider.hasActivityStarted = false;
}
// Update Widget
if (Platform.isAndroid) updateWidget();
});
}

View File

@@ -1,65 +0,0 @@
import 'dart:io';
import 'package:refilc/api/client.dart';
import 'package:refilc/models/release.dart';
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
class UpdateProvider extends ChangeNotifier {
// Private
late List<Release> _releases;
bool _available = false;
bool get available => _available && _releases.isNotEmpty;
// Public
List<Release> get releases => _releases;
UpdateProvider({
List<Release> initialReleases = const [],
required BuildContext context,
}) {
_releases = List.castFrom(initialReleases);
}
Future<void> fetch() async {
late String currentVersion;
PackageInfo packageInfo = await PackageInfo.fromPlatform();
currentVersion = packageInfo.version;
if (!Platform.isAndroid) return;
_releases = await FilcAPI.getReleases() ?? [];
_releases.sort((a, b) => -a.version.compareTo(b.version));
// Check for new releases
if (_releases.isNotEmpty) {
if (!_releases.first.prerelease) {
_available = _releases.first.version
.compareTo(Version.fromString(currentVersion)) ==
1;
}
// ignore: avoid_print
if (_available) print("INFO: New update: ${releases.first.version}");
notifyListeners();
}
}
Future<Map> installedVersion() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
String appName = packageInfo.appName;
String packageName = packageInfo.packageName;
String version = packageInfo.version;
String buildNumber = packageInfo.buildNumber;
Map<String, String> release = {
"app_name": appName,
"package_name": packageName,
"version": version,
"build_number": buildNumber,
};
return release;
}
}

View File

@@ -24,6 +24,7 @@ class UserProvider with ChangeNotifier {
String get picture => user?.picture ?? "";
String? get displayName => user?.displayName;
int? get gradeStreak => user?.gradeStreak;
bool get isDemo => user?.isDemo ?? false;
final SettingsProvider _settings;

View File

@@ -73,7 +73,6 @@ import 'package:refilc_kreta_api/providers/message_provider.dart';
import 'package:refilc_kreta_api/providers/note_provider.dart';
import 'package:refilc_kreta_api/providers/timetable_provider.dart';
import 'package:refilc/api/providers/user_provider.dart';
import 'package:refilc/api/providers/update_provider.dart';
import 'package:refilc_mobile_ui/pages/grades/calculator/grade_calculator_provider.dart';
import 'package:flutter_displaymode/flutter_displaymode.dart';
import 'package:refilc_plus/providers/plus_provider.dart';
@@ -129,9 +128,6 @@ class App extends StatelessWidget {
ChangeNotifierProvider<NewsProvider>(
create: (context) => NewsProvider(context: context),
),
ChangeNotifierProvider<UpdateProvider>(
create: (context) => UpdateProvider(context: context),
),
ChangeNotifierProvider<AdProvider>(
create: (context) => AdProvider(context: context),
),

View File

@@ -1,5 +1,6 @@
// ignore_for_file: avoid_print
import 'dart:convert';
import 'dart:io';
import 'package:refilc/api/providers/database_provider.dart';
@@ -14,6 +15,7 @@ const settingsDB = DatabaseStruct("settings", {
"language": String, "start_page": int, "rounding": int, "theme": int,
"accent_color": int, "news": int, "seen_news": String,
"developer_mode": int,
"dev_live_fake_lessons": int,
"update_channel": int, "config": String, "custom_accent_color": int,
"custom_background_color": int, "custom_highlight_color": int,
"custom_text_color": int, // new txt color
@@ -56,6 +58,8 @@ const settingsDB = DatabaseStruct("settings", {
"uwu_mode": int,
"new_popups": int,
"unseen_new_features": String,
"live_activity_enabled": int,
"live_activity_consent_accepted": int,
"cloud_sync_enabled": int,
"cloud_sync_token": String,
"local_updated_at": String,
@@ -184,6 +188,25 @@ Future<Database> initDB(DatabaseProvider database) async {
print("ERROR: migrateDB: $error");
}
// One-time migration: add 'live_activity_consent' to unseen_new_features for existing users
// Only if they haven't already accepted or dismissed it
try {
final rows = await db.query('settings', columns: ['unseen_new_features', 'live_activity_consent_accepted']);
if (rows.isNotEmpty) {
final consentAccepted = rows.first['live_activity_consent_accepted'] as int? ?? 0;
if (consentAccepted == 0) {
final raw = rows.first['unseen_new_features'] as String? ?? '[]';
final list = (jsonDecode(raw) as List).cast<String>();
if (!list.contains('live_activity_consent')) {
list.add('live_activity_consent');
await db.update('settings', {'unseen_new_features': jsonEncode(list)});
}
}
}
} catch (e) {
print("ERROR: live_activity_consent migration: $e");
}
return db;
}

View File

@@ -9,8 +9,8 @@ import 'package:refilc_kreta_api/client/client.dart';
import 'package:refilc_kreta_api/models/attachment.dart';
import 'package:refilc_kreta_api/models/homework.dart';
import 'package:flutter/widgets.dart';
import 'package:open_filex/open_filex.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
extension AttachmentHelper on Attachment {
Future<String> download(BuildContext context,
@@ -32,8 +32,10 @@ extension AttachmentHelper on Attachment {
String downloads = await StorageHelper.downloadsPath();
if (!await File("$downloads/$name").exists()) await download(context);
var result = await OpenFilex.open("$downloads/$name");
return result.type == ResultType.done;
return launchUrl(
Uri.file("$downloads/$name"),
mode: LaunchMode.externalApplication,
);
}
}
@@ -59,7 +61,9 @@ extension HomeworkAttachmentHelper on HomeworkAttachment {
String downloads = await StorageHelper.downloadsPath();
if (!await File("$downloads/$name").exists()) await download(context);
var result = await OpenFilex.open("$downloads/$name");
return result.type == ResultType.done;
return launchUrl(
Uri.file("$downloads/$name"),
mode: LaunchMode.externalApplication,
);
}
}

View File

@@ -10,6 +10,7 @@ class LiveActivityHelper {
await PlatformChannel.updateLiveActivity(LiveCardProvider.LAData);
} else {
await PlatformChannel.endLiveActivity();
LiveCardProvider.serverSync.unregister();
}
}
}

View File

@@ -1,80 +0,0 @@
import 'dart:async';
import 'dart:io';
import 'dart:typed_data';
import 'package:refilc/api/client.dart';
import 'package:refilc/helpers/storage_helper.dart';
import 'package:refilc/models/release.dart';
import 'package:open_filex/open_filex.dart';
import 'package:permission_handler/permission_handler.dart';
enum UpdateState { none, preparing, downloading, installing }
typedef UpdateCallback = Function(double progress, UpdateState state);
// ignore: todo
// TODO: cleanup old apk files
extension UpdateHelper on Release {
Future<void> install({UpdateCallback? updateCallback}) async {
updateCallback!(-1, UpdateState.preparing);
String downloads = await StorageHelper.downloadsPath();
File apk = File("$downloads/refilc-v$version.apk");
if (!await apk.exists()) {
updateCallback(-1, UpdateState.downloading);
var bytes = await download(updateCallback: updateCallback);
if (!await StorageHelper.write(apk.path, bytes)) {
throw "failed to write apk: permission denied";
}
}
updateCallback(-1, UpdateState.installing);
var installPerms =
(await Permission.manageExternalStorage.request().isGranted &&
await Permission.requestInstallPackages.request().isGranted);
if (installPerms) {
var result = await OpenFilex.open(apk.path);
if (result.type != ResultType.done) {
// ignore: avoid_print
print("ERROR: installUpdate.openFile: ${result.message}");
throw result.message;
}
}
updateCallback(-1, UpdateState.none);
}
Future<Uint8List> download({UpdateCallback? updateCallback}) async {
var response = await FilcAPI.downloadRelease(downloads.first);
List<List<int>> chunks = [];
int downloaded = 0;
var completer = Completer<Uint8List>();
response?.stream.listen((List<int> chunk) {
updateCallback!(
downloaded / (response.contentLength ?? 0), UpdateState.downloading);
chunks.add(chunk);
downloaded += chunk.length;
}, onDone: () {
// Save the file
final Uint8List bytes = Uint8List(response.contentLength ?? 0);
int offset = 0;
for (List<int> chunk in chunks) {
bytes.setRange(offset, offset + chunk.length, chunk);
offset += chunk.length;
}
completer.complete(bytes);
});
return completer.future;
}
}

View File

@@ -33,8 +33,6 @@ import 'package:refilc/utils/service_locator.dart';
import 'package:refilc_mobile_ui/screens/error_screen.dart';
import 'package:refilc_mobile_ui/screens/error_report_screen.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:shake_flutter/models/shake_report_configuration.dart';
import 'package:shake_flutter/shake_flutter.dart';
import 'helpers/live_activity_helper.dart';
@@ -58,28 +56,6 @@ void main() async {
BackgroundFetch.registerHeadlessTask(backgroundHeadlessTask);
// setting up things for shakebugs
// List<ShakePickerItem> pickerItems = [
// ShakePickerItem('Bug', 'Hiba', tag: 'bug'),
// ShakePickerItem('Suggestion', 'Fejlesztési javaslat', tag: 'suggestion'),
// ShakePickerItem('Question', 'Kérdés', tag: 'question')
// ];
// ShakePicker picker =
// ShakePicker('Feedback type', 'Visszajelzés típusa', pickerItems);
// ShakeTitle title = ShakeTitle('Title', 'Leírás', required: true);
// ShakeInspectButton inspect = ShakeInspectButton();
// ShakeAttachments attachments = ShakeAttachments();
// List<ShakeFormComponent> components = [picker, title, inspect, attachments];
// ShakeForm form = ShakeForm(components);
// Shake.setShakeForm(form);
// shakebugs initialization
// Shake.setInvokeShakeOnScreenshot(true);
Shake.start('Y44AwzfY6091xO2Nr0w59RHSpNxJhhiSFGs4enmoJwelN82ZRzTLE5X');
// pre-cache required icons
const todaySvg = SvgAssetLoader('assets/svg/menu_icons/today_selected.svg');
const gradesSvg = SvgAssetLoader('assets/svg/menu_icons/grades_selected.svg');
@@ -206,18 +182,6 @@ Widget errorBuilder(FlutterErrorDetails details) {
Navigator.of(context, rootNavigator: true)
.push(MaterialPageRoute(builder: (context) {
if (kReleaseMode) {
// silent report to shakebugs
ShakeReportConfiguration configuration = ShakeReportConfiguration();
configuration.blackBoxData = true;
configuration.activityHistoryData = true;
configuration.screenshot = true;
configuration.video = false;
Shake.silentReport(
configuration: configuration,
description:
'Silent Report #${DateTime.now().year}${DateTime.now().month}${DateTime.now().day}',
);
// show error report screen
return ErrorReportScreen(details);
} else {
return ErrorScreen(details);

View File

@@ -54,6 +54,7 @@ class SettingsProvider extends ChangeNotifier {
// minutes: times 15
int _notificationPollInterval;
bool _developerMode;
bool _devLiveFakeLessons;
VibrationStrength _vibrate;
bool _abWeeks;
bool _swapABweeks;
@@ -109,6 +110,8 @@ class SettingsProvider extends ChangeNotifier {
bool _uwuMode;
bool _newPopups;
List<String> _unseenNewFeatures;
bool _liveActivityEnabled;
bool _liveActivityConsentAccepted;
bool _cloudSyncEnabled;
String _cloudSyncToken;
DateTime _updatedAt;
@@ -134,6 +137,7 @@ class SettingsProvider extends ChangeNotifier {
required bool notificationsLessonsEnabled,
required int notificationsBitfield,
required bool developerMode,
required bool devLiveFakeLessons,
required int notificationPollInterval,
required VibrationStrength vibrate,
required bool abWeeks,
@@ -187,6 +191,8 @@ class SettingsProvider extends ChangeNotifier {
required bool uwuMode,
required bool newPopups,
required List<String> unseenNewFeatures,
required bool liveActivityEnabled,
required bool liveActivityConsentAccepted,
required bool cloudSyncEnabled,
required String cloudSyncToken,
required DateTime updatedAt,
@@ -209,6 +215,7 @@ class SettingsProvider extends ChangeNotifier {
_notificationsLessonsEnabled = notificationsLessonsEnabled,
_notificationsBitfield = notificationsBitfield,
_developerMode = developerMode,
_devLiveFakeLessons = devLiveFakeLessons,
_notificationPollInterval = notificationPollInterval,
_vibrate = vibrate,
_abWeeks = abWeeks,
@@ -262,6 +269,8 @@ class SettingsProvider extends ChangeNotifier {
_uwuMode = uwuMode,
_newPopups = newPopups,
_unseenNewFeatures = unseenNewFeatures,
_liveActivityEnabled = liveActivityEnabled,
_liveActivityConsentAccepted = liveActivityConsentAccepted,
_cloudSyncEnabled = cloudSyncEnabled,
_cloudSyncToken = cloudSyncToken,
_updatedAt = updatedAt,
@@ -303,6 +312,7 @@ class SettingsProvider extends ChangeNotifier {
notificationsBitfield: map["notifications_bitfield"],
notificationPollInterval: map["notification_poll_interval"],
developerMode: map["developer_mode"] == 1,
devLiveFakeLessons: map["dev_live_fake_lessons"] == 1,
vibrate: VibrationStrength.values[map["vibration_strength"]],
abWeeks: map["ab_weeks"] == 1,
swapABweeks: map["swap_ab_weeks"] == 1,
@@ -356,6 +366,8 @@ class SettingsProvider extends ChangeNotifier {
uwuMode: map['uwu_mode'] == 1,
newPopups: map['new_popups'] == 1,
unseenNewFeatures: jsonDecode(map["unseen_new_features"]).cast<String>(),
liveActivityEnabled: map['live_activity_enabled'] == 1,
liveActivityConsentAccepted: map['live_activity_consent_accepted'] == 1,
cloudSyncEnabled: map['cloud_sync_enabled'] == 1,
cloudSyncToken: map['cloud_sync_token'],
updatedAt: DateTime.tryParse(map['local_updated_at']) ?? DateTime.now(),
@@ -381,6 +393,7 @@ class SettingsProvider extends ChangeNotifier {
"notifications_lessons": _notificationsLessonsEnabled ? 1 : 0,
"notifications_bitfield": _notificationsBitfield,
"developer_mode": _developerMode ? 1 : 0,
"dev_live_fake_lessons": _devLiveFakeLessons ? 1 : 0,
"grade_color1": _gradeColors[0].value,
"grade_color2": _gradeColors[1].value,
"grade_color3": _gradeColors[2].value,
@@ -438,6 +451,8 @@ class SettingsProvider extends ChangeNotifier {
"uwu_mode": _uwuMode ? 1 : 0,
"new_popups": _newPopups ? 1 : 0,
"unseen_new_features": jsonEncode(_unseenNewFeatures),
"live_activity_enabled": _liveActivityEnabled ? 1 : 0,
"live_activity_consent_accepted": _liveActivityConsentAccepted ? 1 : 0,
"cloud_sync_enabled": _cloudSyncEnabled ? 1 : 0,
"cloud_sync_token": _cloudSyncToken,
"local_updated_at": _updatedAt.toIso8601String(),
@@ -471,6 +486,7 @@ class SettingsProvider extends ChangeNotifier {
notificationsLessonsEnabled: true,
notificationsBitfield: 255,
developerMode: true,
devLiveFakeLessons: false,
notificationPollInterval: 1,
vibrate: VibrationStrength.medium,
abWeeks: false,
@@ -523,7 +539,9 @@ class SettingsProvider extends ChangeNotifier {
newColors: true,
uwuMode: false,
newPopups: false,
unseenNewFeatures: [],
unseenNewFeatures: ['live_activity_consent'],
liveActivityEnabled: false,
liveActivityConsentAccepted: false,
cloudSyncEnabled: false,
cloudSyncToken: '',
updatedAt: DateTime.now(),
@@ -549,6 +567,7 @@ class SettingsProvider extends ChangeNotifier {
bool get notificationsLessonsEnabled => _notificationsLessonsEnabled;
int get notificationsBitfield => _notificationsBitfield;
bool get developerMode => _developerMode;
bool get devLiveFakeLessons => _devLiveFakeLessons;
int get notificationPollInterval => _notificationPollInterval;
VibrationStrength get vibrate => _vibrate;
bool get abWeeks => _abWeeks;
@@ -601,6 +620,8 @@ class SettingsProvider extends ChangeNotifier {
bool get uwuMode => _uwuMode;
bool get newPopups => _newPopups;
List<String> get unseenNewFeatures => _unseenNewFeatures;
bool get liveActivityEnabled => _liveActivityEnabled;
bool get liveActivityConsentAccepted => _liveActivityConsentAccepted;
bool get cloudSyncEnabled => _cloudSyncEnabled;
String get cloudSyncToken => _cloudSyncToken;
DateTime get updatedAt => _updatedAt;
@@ -626,6 +647,7 @@ class SettingsProvider extends ChangeNotifier {
bool? notificationsLessonsEnabled,
int? notificationsBitfield,
bool? developerMode,
bool? devLiveFakeLessons,
int? notificationPollInterval,
VibrationStrength? vibrate,
bool? abWeeks,
@@ -675,6 +697,8 @@ class SettingsProvider extends ChangeNotifier {
bool? uwuMode,
bool? newPopups,
List<String>? unseenNewFeatures,
bool? liveActivityEnabled,
bool? liveActivityConsentAccepted,
bool? cloudSyncEnabled,
String? cloudSyncToken,
bool? qTimetableLessonNum,
@@ -727,6 +751,9 @@ class SettingsProvider extends ChangeNotifier {
if (developerMode != null && developerMode != _developerMode) {
_developerMode = developerMode;
}
if (devLiveFakeLessons != null && devLiveFakeLessons != _devLiveFakeLessons) {
_devLiveFakeLessons = devLiveFakeLessons;
}
if (notificationPollInterval != null &&
notificationPollInterval != _notificationPollInterval) {
_notificationPollInterval = notificationPollInterval;
@@ -875,6 +902,15 @@ class SettingsProvider extends ChangeNotifier {
if (unseenNewFeatures != null && unseenNewFeatures != _unseenNewFeatures) {
_unseenNewFeatures = unseenNewFeatures;
}
if (liveActivityEnabled != null && liveActivityEnabled != _liveActivityEnabled) {
_liveActivityEnabled = liveActivityEnabled;
if (!liveActivityEnabled && Platform.isIOS) {
LiveCardProvider.hasActivitySettingsChanged = true;
}
}
if (liveActivityConsentAccepted != null && liveActivityConsentAccepted != _liveActivityConsentAccepted) {
_liveActivityConsentAccepted = liveActivityConsentAccepted;
}
if (cloudSyncEnabled != null && cloudSyncEnabled != _cloudSyncEnabled) {
_cloudSyncEnabled = cloudSyncEnabled;
}
@@ -930,6 +966,7 @@ class SettingsProvider extends ChangeNotifier {
notificationsBitfield: map["notifications_bitfield"],
notificationPollInterval: map["notification_poll_interval"],
developerMode: map["developer_mode"] == 1,
devLiveFakeLessons: map["dev_live_fake_lessons"] == 1,
vibrate:
VibrationStrength.values[map["vibration_strength"] ?? _vibrate.index],
abWeeks: map["ab_weeks"] == 1,
@@ -993,6 +1030,8 @@ class SettingsProvider extends ChangeNotifier {
newPopups: map['new_popups'] == 1,
unseenNewFeatures:
jsonDecode(map["unseen_new_features"] ?? "[]").cast<String>(),
liveActivityEnabled: map['live_activity_enabled'] == 1,
liveActivityConsentAccepted: map['live_activity_consent_accepted'] == 1,
cloudSyncEnabled: map['cloud_sync_enabled'] == 1,
cloudSyncToken: map['cloud_sync_token'],
qTimetableLessonNum: map['q_timetable_lesson_num'] == 1,

View File

@@ -4,6 +4,8 @@ import 'package:refilc_kreta_api/models/school.dart';
import 'package:refilc_kreta_api/models/student.dart';
import 'package:uuid/uuid.dart';
const String demoUserId = 'demo-user-00000000-0000-0000-0000-000000000000';
enum Role { student, parent }
class User {
@@ -115,6 +117,36 @@ class User {
@override
String toString() => jsonEncode(toMap());
static User demo() {
return User(
id: demoUserId,
name: 'Demo Diák',
username: 'demo',
password: '',
instituteCode: 'demo',
student: Student(
id: demoUserId,
name: 'Demo Diák',
school: School(
instituteCode: 'demo',
name: 'Demo Iskola',
city: 'Budapest',
),
birth: DateTime(2005, 9, 1),
yearId: '1',
parents: [],
gradeDelay: 0,
),
role: Role.student,
nickname: 'Demo',
accessToken: 'demo',
accessTokenExpire: DateTime.now().add(const Duration(days: 365)),
refreshToken: 'demo',
);
}
bool get isDemo => id == demoUserId;
static Map<String, Object?> loginBody({
required String username,
required String password,

View File

@@ -4,8 +4,6 @@ import 'package:flutter/material.dart';
import 'package:home_widget/home_widget.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:shake_flutter/models/shake_theme.dart';
import 'package:shake_flutter/shake_flutter.dart';
Future<bool?> updateWidget() async {
try {
@@ -35,12 +33,5 @@ class ThemeModeObserver extends ChangeNotifier {
_updateNavbarColor = updateNavbarColor;
if (Platform.isAndroid) updateWidget();
notifyListeners();
// change shake theme as well
ShakeTheme darkTheme = ShakeTheme();
darkTheme.accentColor = "#FFFFFF";
ShakeTheme lightTheme = ShakeTheme();
lightTheme.accentColor = "#000000";
Shake.setShakeTheme(mode == ThemeMode.dark ? darkTheme : lightTheme);
}
}

View File

@@ -1,5 +1,4 @@
import 'package:refilc/api/providers/ad_provider.dart';
import 'package:refilc/api/providers/update_provider.dart';
import 'package:refilc/models/settings.dart';
import 'package:refilc/ui/date_widget.dart';
import 'package:refilc/ui/filter/widgets/grades.dart' as grade_filter;
@@ -12,7 +11,6 @@ import 'package:refilc/ui/filter/widgets/exams.dart' as exam_filter;
import 'package:refilc/ui/filter/widgets/notes.dart' as note_filter;
import 'package:refilc/ui/filter/widgets/events.dart' as event_filter;
import 'package:refilc/ui/filter/widgets/lessons.dart' as lesson_filter;
import 'package:refilc/ui/filter/widgets/update.dart' as update_filter;
import 'package:refilc/ui/filter/widgets/missed_exams.dart'
as missed_exam_filter;
import 'package:refilc/ui/filter/widgets/ads.dart' as ad_filter;
@@ -54,7 +52,6 @@ enum FilterType {
notes,
events,
lessons,
updates,
certifications,
missedExams,
ads,
@@ -70,7 +67,6 @@ Future<List<DateWidget>> getFilterWidgets(FilterType activeData,
final examProvider = Provider.of<ExamProvider>(context);
final noteProvider = Provider.of<NoteProvider>(context);
final eventProvider = Provider.of<EventProvider>(context);
final updateProvider = Provider.of<UpdateProvider>(context);
final settingsProvider = Provider.of<SettingsProvider>(context);
final adProvider = Provider.of<AdProvider>(context);
@@ -87,7 +83,6 @@ Future<List<DateWidget>> getFilterWidgets(FilterType activeData,
context: context, absencesNoExcused: true),
getFilterWidgets(FilterType.homework, context: context),
getFilterWidgets(FilterType.exams, context: context),
getFilterWidgets(FilterType.updates, context: context),
getFilterWidgets(FilterType.certifications, context: context),
getFilterWidgets(FilterType.missedExams, context: context),
getFilterWidgets(FilterType.ads, context: context),
@@ -162,13 +157,6 @@ Future<List<DateWidget>> getFilterWidgets(FilterType activeData,
.getWidgets(timetableProvider.getWeek(Week.current()) ?? []);
break;
// Updates
case FilterType.updates:
if (updateProvider.available) {
items = [update_filter.getWidget(updateProvider.releases.first)];
}
break;
// Missed Exams
case FilterType.missedExams:
items = missed_exam_filter

View File

@@ -1,11 +0,0 @@
import 'package:refilc/models/release.dart';
import 'package:refilc/ui/date_widget.dart';
import 'package:refilc_mobile_ui/common/widgets/update/update_viewable.dart'
as mobile;
DateWidget getWidget(Release providerRelease) {
return DateWidget(
date: DateTime.now(),
widget: mobile.UpdateViewable(providerRelease),
);
}

View File

@@ -3,7 +3,7 @@ description: "Egy nem hivatalos e-KRÉTA kliens, diákoktól diákoknak."
homepage: https://refilc.hu
publish_to: "none"
version: 5.1.5+290
version: 5.1.2+0
environment:
sdk: ^3.6.0
@@ -26,13 +26,13 @@ dependencies:
flutter_localizations:
sdk: flutter
i18n_extension: ^12.0.1
sqflite: ^2.4.1
intl: ^0.19.0
sqflite: 2.3.3+1
intl: ^0.20.2
provider: ^6.1.2
http: ^1.3.0
uuid: ^4.5.1
html: ^0.15.5
open_filex: ^4.6.0
path_provider: ^2.1.5
permission_handler: ^12.0.0
share_plus: ^10.1.4
@@ -40,8 +40,8 @@ dependencies:
flutter_displaymode: ^0.6.0
quick_actions: ^1.1.0
animated_list_plus: ^0.5.2
dynamic_color: ^1.7.0
material_color_utilities: ^0.11.1
dynamic_color: 1.7.0
material_color_utilities: ">=0.11.1 <0.14.0"
crypto: ^3.0.6
elegant_notification: ^2.4.1
flutter_feather_icons: ^2.0.0+1
@@ -59,17 +59,18 @@ dependencies:
package_info_plus: ^8.2.1
screenshot: ^3.0.0
flutter_staggered_grid_view: ^0.7.0
image_crop_plus: ^1.0.0
image_crop_plus:
git:
url: https://github.com/wrbl606/image_crop
maps_launcher: ^3.0.0+1
google_fonts: ^6.2.1
get_it: ^7.7.0
xml: ^6.5.0
carousel_slider: ^5.0.0
flutter_portal: ^1.1.4
shake_flutter: ^17.1.0
dependency_overrides:
webview_flutter_wkwebview: 3.17.0
intl: 0.20.2
dev_dependencies:
flutter_launcher_icons: ^0.14.3
@@ -127,4 +128,4 @@ flutter_native_splash:
ios: true
ios_content_mode: center
web: false
compress: true
compress: true

View File

@@ -42,14 +42,17 @@ class TimetableController extends ChangeNotifier {
static DateTime _getYearStart(int year) {
var s1 = DateTime(year, DateTime.september, 1);
if (s1.weekday == 6) {
s1.add(const Duration(days: 2));
} else if (s1.weekday == 7) {
s1.add(const Duration(days: 1));
if (s1.weekday == DateTime.saturday) {
s1 = s1.add(const Duration(days: 2, hours: 2));
} else if (s1.weekday == DateTime.sunday) {
s1 = s1.add(const Duration(days: 1, hours: 2));
} else {
s1 = s1.add(const Duration(hours: 2));
}
return s1;
}
// Jump shortcuts
Future<void> next(BuildContext context) =>
jump(Week.fromId(currentWeekId + 1), context: context);

View File

@@ -0,0 +1,394 @@
import 'package:refilc/models/user.dart';
import 'package:refilc_kreta_api/models/absence.dart';
import 'package:refilc_kreta_api/models/category.dart';
import 'package:refilc_kreta_api/models/exam.dart';
import 'package:refilc_kreta_api/models/grade.dart';
import 'package:refilc_kreta_api/models/group_average.dart';
import 'package:refilc_kreta_api/models/homework.dart';
import 'package:refilc_kreta_api/models/lesson.dart';
import 'package:refilc_kreta_api/models/message.dart';
import 'package:refilc_kreta_api/models/recipient.dart';
import 'package:refilc_kreta_api/models/subject.dart';
import 'package:refilc_kreta_api/models/teacher.dart';
import 'package:refilc_kreta_api/models/week.dart';
class DemoData {
static final _subjectMath = GradeSubject(
id: 'demo-subject-math',
category: Category(id: 'matematika', name: 'matematika'),
name: 'Matematika',
);
static final _subjectHun = GradeSubject(
id: 'demo-subject-hun',
category: Category(id: 'magyar_nyelv_es_irodalom', name: 'magyar_nyelv_es_irodalom'),
name: 'Magyar nyelv és irodalom',
);
static final _subjectHist = GradeSubject(
id: 'demo-subject-hist',
category: Category(id: 'tortenelem_es_allampolgari_ismeretek', name: 'tortenelem_es_allampolgari_ismeretek'),
name: 'Történelem',
);
static final _subjectEng = GradeSubject(
id: 'demo-subject-eng',
category: Category(id: 'angol_nyelv', name: 'angol_nyelv'),
name: 'Angol nyelv',
);
static final _subjectPhy = GradeSubject(
id: 'demo-subject-phy',
category: Category(id: 'fizika', name: 'fizika'),
name: 'Fizika',
);
static final _subjectBio = GradeSubject(
id: 'demo-subject-bio',
category: Category(id: 'biologia_egeszsegtan', name: 'biologia_egeszsegtan'),
name: 'Biológia',
);
static final _subjectChem = GradeSubject(
id: 'demo-subject-chem',
category: Category(id: 'kemia', name: 'kemia'),
name: 'Kémia',
);
static final _subjectPE = GradeSubject(
id: 'demo-subject-pe',
category: Category(id: 'testnevelés_és_sport', name: 'testnevelés_és_sport'),
name: 'Testnevelés',
);
static final _subjectIT = GradeSubject(
id: 'demo-subject-it',
category: Category(id: 'informatika', name: 'informatika'),
name: 'Informatika',
);
static final _teacherNagy = Teacher.fromString('Nagy Katalin');
static final _teacherSzabo = Teacher.fromString('Szabó Péter');
static final _teacherKovacs = Teacher.fromString('Kovács Mária');
static final _teacherToth = Teacher.fromString('Tóth László');
static final _teacherVarga = Teacher.fromString('Varga Erzsébet');
static final _teacherFekete = Teacher.fromString('Fekete Gábor');
static final _modeOral = Category(id: '1,SzobaliVizsga', name: 'Szóbeli vizsga', description: 'Szóbeli vizsga');
static final _modeWritten = Category(id: '2,IrasbaliVizsga', name: 'Írásbeli vizsga', description: 'Írásbeli vizsga');
static final _modePractical = Category(id: '3,Gyakorlati', name: 'Gyakorlati', description: 'Gyakorlati');
static List<Grade> get grades {
final now = DateTime.now();
return [
_makeGrade('demo-g-1', 5, 'Jeles', 'Ötös', 100, _subjectMath, _teacherNagy, 'Függvények', now.subtract(const Duration(days: 3)), _modeWritten, GradeType.midYear),
_makeGrade('demo-g-2', 4, 'Jó', 'Négyes', 100, _subjectMath, _teacherNagy, 'Egyenletek', now.subtract(const Duration(days: 14)), _modeWritten, GradeType.midYear),
_makeGrade('demo-g-3', 5, 'Jeles', 'Ötös', 100, _subjectHun, _teacherKovacs, 'Arany János költészete', now.subtract(const Duration(days: 5)), _modeOral, GradeType.midYear),
_makeGrade('demo-g-4', 4, 'Jó', 'Négyes', 100, _subjectHun, _teacherKovacs, 'Fogalmazás', now.subtract(const Duration(days: 20)), _modeWritten, GradeType.midYear),
_makeGrade('demo-g-5', 5, 'Jeles', 'Ötös', 100, _subjectEng, _teacherSzabo, 'Grammar test', now.subtract(const Duration(days: 7)), _modeWritten, GradeType.midYear),
_makeGrade('demo-g-6', 5, 'Jeles', 'Ötös', 100, _subjectEng, _teacherSzabo, 'Speaking', now.subtract(const Duration(days: 18)), _modeOral, GradeType.midYear),
_makeGrade('demo-g-7', 4, 'Jó', 'Négyes', 100, _subjectHist, _teacherToth, 'Az első világháború', now.subtract(const Duration(days: 10)), _modeOral, GradeType.midYear),
_makeGrade('demo-g-8', 3, 'Közepes', 'Hármas', 100, _subjectHist, _teacherToth, 'Témazáró', now.subtract(const Duration(days: 25)), _modeWritten, GradeType.midYear),
_makeGrade('demo-g-9', 5, 'Jeles', 'Ötös', 100, _subjectPhy, _teacherVarga, 'Mechanika', now.subtract(const Duration(days: 8)), _modeWritten, GradeType.midYear),
_makeGrade('demo-g-10', 4, 'Jó', 'Négyes', 100, _subjectBio, _teacherFekete, 'Sejtbiológia', now.subtract(const Duration(days: 12)), _modeOral, GradeType.midYear),
_makeGrade('demo-g-11', 5, 'Jeles', 'Ötös', 100, _subjectChem, _teacherVarga, 'Kémiai kötések', now.subtract(const Duration(days: 6)), _modeWritten, GradeType.midYear),
_makeGrade('demo-g-12', 5, 'Jeles', 'Ötös', 100, _subjectIT, _teacherSzabo, 'Programozás alapjai', now.subtract(const Duration(days: 4)), _modePractical, GradeType.midYear),
_makeGrade('demo-g-13', 4, 'Jó', 'Négyes', 100, _subjectMath, _teacherNagy, 'Statisztika', now.subtract(const Duration(days: 30)), _modeWritten, GradeType.halfYear),
_makeGrade('demo-g-14', 5, 'Jeles', 'Ötös', 100, _subjectHun, _teacherKovacs, 'Félévzáró', now.subtract(const Duration(days: 60)), _modeWritten, GradeType.halfYear),
_makeGrade('demo-g-15', 4, 'Jó', 'Négyes', 100, _subjectEng, _teacherSzabo, 'Mid-year exam', now.subtract(const Duration(days: 60)), _modeWritten, GradeType.halfYear),
];
}
static Grade _makeGrade(
String id,
int value,
String valueName,
String shortName,
int weight,
GradeSubject subject,
Teacher teacher,
String description,
DateTime date,
Category mode,
GradeType type,
) {
return Grade(
id: id,
date: date,
value: GradeValue(value, valueName, shortName, weight),
teacher: teacher,
description: description,
type: type,
groupId: 'demo-group',
subject: subject,
mode: mode,
writeDate: date,
seenDate: date,
form: '',
json: {
'SzamErtek': value,
'SzovegesErtek': valueName,
'SzovegesErtekelesRovidNev': shortName,
'SulySzazalekErteke': weight,
'ErtekFajta': null,
},
);
}
static Map<Week, List<Lesson>> get timetable {
final week = Week.current();
return {week: _lessonsForWeek(week)};
}
static List<Lesson> _lessonsForWeek(Week week) {
final monday = week.start;
List<Lesson> lessons = [];
// Monday
lessons.addAll(_dayLessons(monday, [
_LessonDef('Matematika', _subjectMath, _teacherNagy, '101', '9A'),
_LessonDef('Magyar nyelv és irodalom', _subjectHun, _teacherKovacs, '203', '9A'),
_LessonDef('Történelem', _subjectHist, _teacherToth, '105', '9A'),
_LessonDef('Angol nyelv', _subjectEng, _teacherSzabo, '102', '9A'),
_LessonDef('Testnevelés', _subjectPE, _teacherFekete, 'Tornaterem', '9A'),
]));
// Tuesday
lessons.addAll(_dayLessons(monday.add(const Duration(days: 1)), [
_LessonDef('Fizika', _subjectPhy, _teacherVarga, '204', '9A'),
_LessonDef('Biológia', _subjectBio, _teacherFekete, '205', '9A'),
_LessonDef('Matematika', _subjectMath, _teacherNagy, '101', '9A'),
_LessonDef('Informatika', _subjectIT, _teacherSzabo, 'Számítóterem', '9A'),
]));
// Wednesday
lessons.addAll(_dayLessons(monday.add(const Duration(days: 2)), [
_LessonDef('Magyar nyelv és irodalom', _subjectHun, _teacherKovacs, '203', '9A'),
_LessonDef('Kémia', _subjectChem, _teacherVarga, '206', '9A'),
_LessonDef('Angol nyelv', _subjectEng, _teacherSzabo, '102', '9A'),
_LessonDef('Történelem', _subjectHist, _teacherToth, '105', '9A'),
_LessonDef('Testnevelés', _subjectPE, _teacherFekete, 'Tornaterem', '9A'),
]));
// Thursday
lessons.addAll(_dayLessons(monday.add(const Duration(days: 3)), [
_LessonDef('Matematika', _subjectMath, _teacherNagy, '101', '9A'),
_LessonDef('Biológia', _subjectBio, _teacherFekete, '205', '9A'),
_LessonDef('Fizika', _subjectPhy, _teacherVarga, '204', '9A'),
_LessonDef('Informatika', _subjectIT, _teacherSzabo, 'Számítóterem', '9A'),
]));
// Friday
lessons.addAll(_dayLessons(monday.add(const Duration(days: 4)), [
_LessonDef('Magyar nyelv és irodalom', _subjectHun, _teacherKovacs, '203', '9A'),
_LessonDef('Kémia', _subjectChem, _teacherVarga, '206', '9A'),
_LessonDef('Matematika', _subjectMath, _teacherNagy, '101', '9A'),
_LessonDef('Angol nyelv', _subjectEng, _teacherSzabo, '102', '9A'),
]));
return lessons;
}
static List<Lesson> _dayLessons(DateTime day, List<_LessonDef> defs) {
final List<Lesson> result = [];
// School starts at 8:00, each lesson is 45 min, 15 min break
DateTime time = DateTime(day.year, day.month, day.day, 8, 0);
for (int i = 0; i < defs.length; i++) {
final def = defs[i];
final start = time;
final end = time.add(const Duration(minutes: 45));
result.add(Lesson(
id: 'demo-lesson-${day.weekday}-$i',
date: day,
subject: def.subject,
lessonIndex: '${i + 1}',
teacher: def.teacher,
start: start,
end: end,
homeworkId: '',
description: '',
room: def.room,
groupName: def.group,
name: def.name,
));
time = end.add(const Duration(minutes: 15));
}
return result;
}
static List<Absence> get absences {
final now = DateTime.now();
return [
_makeAbsence('demo-abs-1', _subjectMath, _teacherNagy, now.subtract(const Duration(days: 15)), Justification.excused),
_makeAbsence('demo-abs-2', _subjectMath, _teacherNagy, now.subtract(const Duration(days: 15)), Justification.excused),
_makeAbsence('demo-abs-3', _subjectHun, _teacherKovacs, now.subtract(const Duration(days: 15)), Justification.excused),
_makeAbsence('demo-abs-4', _subjectEng, _teacherSzabo, now.subtract(const Duration(days: 8)), Justification.pending),
_makeAbsence('demo-abs-5', _subjectHist, _teacherToth, now.subtract(const Duration(days: 8)), Justification.pending),
_makeAbsence('demo-abs-6', _subjectPhy, _teacherVarga, now.subtract(const Duration(days: 2)), Justification.unexcused),
];
}
static Absence _makeAbsence(
String id,
GradeSubject subject,
Teacher teacher,
DateTime date,
Justification state,
) {
final start = DateTime(date.year, date.month, date.day, 8, 0);
final end = start.add(const Duration(minutes: 45));
return Absence(
id: id,
date: date,
delay: 0,
submitDate: date,
teacher: teacher,
state: state,
subject: subject,
lessonStart: start,
lessonEnd: end,
group: 'demo-group',
);
}
static List<Exam> get exams {
final now = DateTime.now();
return [
Exam(
id: 'demo-exam-1',
date: now.subtract(const Duration(days: 3)),
writeDate: now.add(const Duration(days: 7)),
subject: _subjectMath,
teacher: _teacherNagy,
description: 'Trigonometria témazáró',
group: 'demo-group',
),
Exam(
id: 'demo-exam-2',
date: now.subtract(const Duration(days: 5)),
writeDate: now.add(const Duration(days: 12)),
subject: _subjectHun,
teacher: _teacherKovacs,
description: 'Petőfi Sándor életmű dolgozat',
group: 'demo-group',
),
Exam(
id: 'demo-exam-3',
date: now.subtract(const Duration(days: 1)),
writeDate: now.add(const Duration(days: 5)),
subject: _subjectPhy,
teacher: _teacherVarga,
description: 'Elektromosságtan',
group: 'demo-group',
),
];
}
static List<Homework> get homework {
final now = DateTime.now();
return [
Homework(
id: 'demo-hw-1',
date: now.subtract(const Duration(days: 2)),
lessonDate: now.subtract(const Duration(days: 2)),
deadline: now.add(const Duration(days: 5)),
byTeacher: true,
homeworkEnabled: true,
teacher: _teacherNagy,
content: 'Oldjátok meg a tankönyv 84-85. oldalán lévő feladatokat (1-15).',
subject: _subjectMath,
group: 'demo-group',
attachments: [],
),
Homework(
id: 'demo-hw-2',
date: now.subtract(const Duration(days: 4)),
lessonDate: now.subtract(const Duration(days: 4)),
deadline: now.add(const Duration(days: 3)),
byTeacher: true,
homeworkEnabled: true,
teacher: _teacherKovacs,
content: 'Írjatok egy 1-2 oldalas elemzést Petőfi Sándor "Szeptember végén" c. verséről.',
subject: _subjectHun,
group: 'demo-group',
attachments: [],
),
Homework(
id: 'demo-hw-3',
date: now.subtract(const Duration(days: 1)),
lessonDate: now.subtract(const Duration(days: 1)),
deadline: now.add(const Duration(days: 6)),
byTeacher: true,
homeworkEnabled: true,
teacher: _teacherSzabo,
content: 'Complete exercises 3-7 on page 42 of the workbook.',
subject: _subjectEng,
group: 'demo-group',
attachments: [],
),
];
}
static List<Message> get messages {
final now = DateTime.now();
return [
Message(
id: 10001,
messageId: 10001,
seen: true,
deleted: false,
date: now.subtract(const Duration(days: 1)),
author: 'Nagy Katalin',
content: 'Kedves Szülők!\n\nTájékoztatjuk Önöket, hogy jövő héten pótdolgozatot írunk matematikából. Kérem, segítsenek gyermeküknek a felkészülésben.\n\nÜdvözlettel,\nNagy Katalin',
subject: 'Pótdolgozat - Matematika',
type: MessageType.inbox,
recipients: [Recipient(id: 1, name: 'Demo Diák', kretaId: 1)],
attachments: [],
isSeen: true,
),
Message(
id: 10002,
messageId: 10002,
seen: false,
deleted: false,
date: now.subtract(const Duration(days: 3)),
author: 'Kovács Mária',
content: 'Kedves Diákok!\n\nEmlékeztetem Önöket, hogy a fogalmazást péntekig be kell adni. Kérem, ne felejtsék el!\n\nÜdvözlettel,\nKovács Mária',
subject: 'Fogalmazás határideje',
type: MessageType.inbox,
recipients: [Recipient(id: 1, name: 'Demo Diák', kretaId: 1)],
attachments: [],
isSeen: false,
),
Message(
id: 10003,
messageId: 10003,
seen: true,
deleted: false,
date: now.subtract(const Duration(days: 7)),
author: 'Tóth László',
content: 'Kedves Szülők!\n\nAz osztálykirándulás időpontja: március 20. Kérem, hogy a beleegyező nyilatkozatot hozzák vissza aláírva.\n\nÜdvözlettel,\nTóth László\nosztályfőnök',
subject: 'Osztálykirándulás',
type: MessageType.inbox,
recipients: [Recipient(id: 1, name: 'Demo Diák', kretaId: 1)],
attachments: [],
isSeen: true,
),
];
}
static List<GroupAverage> get groupAverages => [
GroupAverage(uid: 'demo-avg-math', average: 4.2, subject: _subjectMath),
GroupAverage(uid: 'demo-avg-hun', average: 3.8, subject: _subjectHun),
GroupAverage(uid: 'demo-avg-hist', average: 3.9, subject: _subjectHist),
GroupAverage(uid: 'demo-avg-eng', average: 4.5, subject: _subjectEng),
GroupAverage(uid: 'demo-avg-phy', average: 3.6, subject: _subjectPhy),
GroupAverage(uid: 'demo-avg-bio', average: 4.1, subject: _subjectBio),
GroupAverage(uid: 'demo-avg-chem', average: 3.7, subject: _subjectChem),
GroupAverage(uid: 'demo-avg-pe', average: 4.8, subject: _subjectPE),
GroupAverage(uid: 'demo-avg-it', average: 4.3, subject: _subjectIT),
];
static bool isDemo(String? userId) => userId == demoUserId;
}
class _LessonDef {
final String name;
final GradeSubject subject;
final Teacher teacher;
final String room;
final String group;
const _LessonDef(this.name, this.subject, this.teacher, this.room, this.group);
}

View File

@@ -5,6 +5,7 @@ import 'package:refilc/api/providers/database_provider.dart';
import 'package:refilc/models/user.dart';
import 'package:refilc_kreta_api/client/api.dart';
import 'package:refilc_kreta_api/client/client.dart';
import 'package:refilc_kreta_api/demo/demo_data.dart';
import 'package:refilc_kreta_api/models/absence.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -81,6 +82,12 @@ class AbsenceProvider with ChangeNotifier {
Future<void> fetch() async {
User? user = Provider.of<UserProvider>(_context, listen: false).user;
if (user == null) throw "Cannot fetch Absences for User null";
if (DemoData.isDemo(user.id)) {
await store(DemoData.absences);
return;
}
String iss = user.instituteCode;
List? absencesJson = await Provider.of<KretaClient>(_context, listen: false)

View File

@@ -3,6 +3,7 @@ import 'package:refilc/api/providers/database_provider.dart';
import 'package:refilc/models/user.dart';
import 'package:refilc_kreta_api/client/api.dart';
import 'package:refilc_kreta_api/client/client.dart';
import 'package:refilc_kreta_api/demo/demo_data.dart';
import 'package:refilc_kreta_api/models/event.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -40,6 +41,7 @@ class EventProvider with ChangeNotifier {
Future<void> fetch() async {
User? user = Provider.of<UserProvider>(_context, listen: false).user;
if (user == null) throw "Cannot fetch Events for User null";
if (DemoData.isDemo(user.id)) return;
String iss = user.instituteCode;
List? eventsJson = await Provider.of<KretaClient>(_context, listen: false)

View File

@@ -3,6 +3,7 @@ import 'package:refilc/api/providers/database_provider.dart';
import 'package:refilc/models/user.dart';
import 'package:refilc_kreta_api/client/api.dart';
import 'package:refilc_kreta_api/client/client.dart';
import 'package:refilc_kreta_api/demo/demo_data.dart';
import 'package:refilc_kreta_api/models/exam.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -68,6 +69,12 @@ class ExamProvider with ChangeNotifier {
Future<void> fetch() async {
User? user = Provider.of<UserProvider>(_context, listen: false).user;
if (user == null) throw "Cannot fetch Exams for User null";
if (DemoData.isDemo(user.id)) {
await store(DemoData.exams);
return;
}
String iss = user.instituteCode;
List? examsJson = await Provider.of<KretaClient>(_context, listen: false)

View File

@@ -5,6 +5,7 @@ import 'package:refilc/models/settings.dart';
import 'package:refilc/models/user.dart';
import 'package:refilc_kreta_api/client/api.dart';
import 'package:refilc_kreta_api/client/client.dart';
import 'package:refilc_kreta_api/demo/demo_data.dart';
import 'package:refilc_kreta_api/models/grade.dart';
import 'package:refilc_kreta_api/models/group_average.dart';
import 'package:refilc_kreta_api/providers/grade_provider.i18n.dart';
@@ -164,11 +165,15 @@ Future<void> unseenAll() async {
// Fetches Grades from the Kreta API then stores them in the database
Future<void> fetch() async {
// test cucc
// unseenAll();
User? user = _user.user;
if (user == null) throw "Cannot fetch Grades for User null";
if (DemoData.isDemo(user.id)) {
await store(DemoData.grades);
await storeGroupAvg(DemoData.groupAverages);
return;
}
String iss = user.instituteCode;
List? gradesJson = await _kreta.getAPI(KretaAPI.grades(iss));

View File

@@ -4,6 +4,7 @@ import 'package:refilc/api/providers/database_provider.dart';
import 'package:refilc/models/user.dart';
import 'package:refilc_kreta_api/client/api.dart';
import 'package:refilc_kreta_api/client/client.dart';
import 'package:refilc_kreta_api/demo/demo_data.dart';
import 'package:refilc_kreta_api/models/homework.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@@ -75,6 +76,12 @@ class HomeworkProvider with ChangeNotifier {
User? user = Provider.of<UserProvider>(_context, listen: false).user;
if (user == null) throw "Cannot fetch Homework for User null";
if (DemoData.isDemo(user.id)) {
_homework = DemoData.homework;
notifyListeners();
return;
}
String iss = user.instituteCode;
List? homeworkJson = [];

View File

@@ -7,6 +7,7 @@ import 'package:refilc/api/providers/database_provider.dart';
import 'package:refilc/models/user.dart';
import 'package:refilc_kreta_api/client/api.dart';
import 'package:refilc_kreta_api/client/client.dart';
import 'package:refilc_kreta_api/demo/demo_data.dart';
import 'package:refilc_kreta_api/models/message.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -53,13 +54,21 @@ class MessageProvider with ChangeNotifier {
Future<void> fetch({MessageType type = MessageType.inbox}) async {
// Check Message Type
if (type == MessageType.draft) return;
String messageType =
["beerkezett", "elkuldott", "torolt"].elementAt(type.index);
// Check User
User? user = Provider.of<UserProvider>(_context, listen: false).user;
if (user == null) throw "Cannot fetch Messages for User null";
if (DemoData.isDemo(user.id)) {
if (type == MessageType.inbox) {
await store(DemoData.messages, type);
}
return;
}
String messageType =
["beerkezett", "elkuldott", "torolt"].elementAt(type.index);
// Get messages
List? messagesJson = await Provider.of<KretaClient>(_context, listen: false)
.getAPI(KretaAPI.messages(messageType));
@@ -127,6 +136,8 @@ class MessageProvider with ChangeNotifier {
User? user = Provider.of<UserProvider>(_context, listen: false).user;
if (user == null) throw "Cannot fetch Messages for User null";
if (DemoData.isDemo(user.id)) return;
// get categories
List? availableCategoriesJson =
await Provider.of<KretaClient>(_context, listen: false)

View File

@@ -3,6 +3,7 @@ import 'package:refilc/api/providers/database_provider.dart';
import 'package:refilc/models/user.dart';
import 'package:refilc_kreta_api/client/api.dart';
import 'package:refilc_kreta_api/client/client.dart';
import 'package:refilc_kreta_api/demo/demo_data.dart';
import 'package:refilc_kreta_api/models/note.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -39,6 +40,7 @@ class NoteProvider with ChangeNotifier {
Future<void> fetch() async {
User? user = Provider.of<UserProvider>(_context, listen: false).user;
if (user == null) throw "Cannot fetch Notes for User null";
if (DemoData.isDemo(user.id)) return;
String iss = user.instituteCode;
List? notesJson = await Provider.of<KretaClient>(_context, listen: false)

View File

@@ -3,12 +3,14 @@ import 'package:refilc/api/providers/database_provider.dart';
import 'package:refilc/models/user.dart';
import 'package:refilc_kreta_api/client/api.dart';
import 'package:refilc_kreta_api/client/client.dart';
import 'package:refilc_kreta_api/demo/demo_data.dart';
import 'package:refilc_kreta_api/models/lesson.dart';
import 'package:refilc_kreta_api/models/week.dart';
import 'package:flutter/foundation.dart';
class TimetableProvider with ChangeNotifier {
Map<Week, List<Lesson>> lessons = {};
String? _activeUserId;
late final UserProvider _user;
late final DatabaseProvider _database;
late final KretaClient _kreta;
@@ -20,17 +22,38 @@ class TimetableProvider with ChangeNotifier {
}) : _user = user,
_database = database,
_kreta = kreta {
_user.addListener(_onUserChanged);
restoreUser();
}
@override
void dispose() {
_user.removeListener(_onUserChanged);
super.dispose();
}
void _onUserChanged() {
final userId = _user.id;
if (userId == _activeUserId) return;
_activeUserId = userId;
lessons = {};
notifyListeners();
restoreUser();
}
Future<void> restoreUser() async {
String? userId = _user.id;
_activeUserId = userId;
// Load lessons from the database
if (userId != null) {
var dbLessons = await _database.userQuery.getLessons(userId: userId);
lessons = dbLessons;
await convertBySettings();
} else {
lessons = {};
notifyListeners();
}
}
@@ -71,8 +94,21 @@ class TimetableProvider with ChangeNotifier {
// Fetches Lessons from the Kreta API then stores them in the database
Future<void> fetch({Week? week}) async {
if (week == null) return;
if (_activeUserId != _user.id) {
_activeUserId = _user.id;
await restoreUser();
}
User? user = _user.user;
if (user == null) throw "Cannot fetch Lessons for User null";
if (DemoData.isDemo(user.id)) {
lessons = DemoData.timetable;
notifyListeners();
return;
}
String iss = user.instituteCode;
List? lessonsJson;

View File

@@ -12,12 +12,13 @@ dependencies:
http: ^1.3.0
provider: ^6.1.2
file_picker: ^8.3.7
intl: ^0.19.0
intl: ^0.20.2
i18n_extension: ^12.0.1
uuid: ^4.5.1
dependency_overrides:
webview_flutter_wkwebview: 3.17.0
intl: 0.20.2
dev_dependencies:
flutter_lints: ^5.0.0

View File

@@ -1,32 +0,0 @@
import 'package:refilc/models/release.dart';
import 'package:flutter/material.dart';
import 'package:refilc_mobile_ui/common/panel/panel_button.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'update_tile.i18n.dart';
class UpdateTile extends StatelessWidget {
const UpdateTile(this.release, {super.key, this.onTap, this.padding});
final Release release;
final Function()? onTap;
final EdgeInsetsGeometry? padding;
@override
Widget build(BuildContext context) {
return Padding(
padding: padding ?? const EdgeInsets.symmetric(horizontal: 8.0),
child: PanelButton(
onPressed: onTap,
title: Text("update_available".i18n),
leading: const Icon(FeatherIcons.download),
trailing: Text(
release.tag,
style: TextStyle(
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.secondary,
),
),
),
);
}
}

View File

@@ -1,21 +0,0 @@
import 'package:i18n_extension/i18n_extension.dart';
extension Localization on String {
static final _t = Translations.byLocale("hu_hu") +
{
"en_en": {
"update_available": "Update Available",
},
"hu_hu": {
"update_available": "Frissítés elérhető",
},
"de_de": {
"update_available": "Update verfügbar",
},
};
String get i18n => localize(this, _t);
String fill(List<Object> params) => localizeFill(this, params);
String plural(int value) => localizePlural(value, this, _t);
String version(Object modifier) => localizeVersion(modifier, this, _t);
}

View File

@@ -1,18 +0,0 @@
import 'package:refilc/models/release.dart';
import 'package:refilc_mobile_ui/common/widgets/update/update_tile.dart';
import 'package:refilc_mobile_ui/common/widgets/update/updates_view.dart';
import 'package:flutter/material.dart';
class UpdateViewable extends StatelessWidget {
const UpdateViewable(this.release, {super.key});
final Release release;
@override
Widget build(BuildContext context) {
return UpdateTile(
release,
onTap: () => UpdateView.show(release, context: context),
);
}
}

View File

@@ -1,185 +0,0 @@
import 'package:refilc/api/providers/status_provider.dart';
import 'package:refilc/models/release.dart';
import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc/utils/color.dart';
import 'package:refilc_mobile_ui/common/bottom_card.dart';
import 'package:refilc_mobile_ui/common/custom_snack_bar.dart';
import 'package:refilc_mobile_ui/common/material_action_button.dart';
import 'package:refilc/helpers/update_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_custom_tabs/flutter_custom_tabs.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:provider/provider.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'updates_view.i18n.dart';
class UpdateView extends StatefulWidget {
const UpdateView(this.release, {super.key});
final Release release;
static void show(Release release, {required BuildContext context}) =>
showBottomCard(context: context, child: UpdateView(release));
@override
UpdateViewState createState() => UpdateViewState();
}
class UpdateViewState extends State<UpdateView> {
double progress = 0.0;
UpdateState state = UpdateState.none;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"new_update".i18n,
style: const TextStyle(
fontWeight: FontWeight.w700, fontSize: 18.0),
),
Text(
"${widget.release.version}",
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.0,
color:
AppColors.of(context).text.withValues(alpha: 0.6),
),
),
],
),
ClipRRect(
borderRadius: BorderRadius.circular(18.0),
child: Image.asset(
"assets/images/pixel.png",
width: 64.0,
),
)
],
),
),
// Description
Container(
margin: const EdgeInsets.only(top: 8.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0),
),
child: SizedBox(
height: 200.0,
child: Markdown(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
physics: const BouncingScrollPhysics(),
data: widget.release.body,
onTapLink: (text, href, title) =>
launchUrl(Uri.parse(href ?? "")),
),
),
),
// Download button
Center(
child: MaterialActionButton(
backgroundColor: AppColors.of(context).filc,
onPressed:
state == UpdateState.none ? () => downloadPrecheck() : null,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (state == UpdateState.downloading ||
state == UpdateState.preparing)
Container(
height: 18.0,
width: 18.0,
margin: const EdgeInsets.only(right: 8.0),
child: CircularProgressIndicator(
value: progress > 0.05 ? progress : null,
color: ColorUtils.foregroundColor(
AppColors.of(context).filc),
),
),
Text([
"download".i18n,
"downloading".i18n,
"downloading".i18n,
"installing".i18n
][state.index]
.toUpperCase()),
],
),
),
),
],
),
);
}
String fmtSize() =>
"${(widget.release.downloads.first.size / 1024 / 1024).toStringAsFixed(1)} MB";
void downloadPrecheck() {
final status = Provider.of<StatusProvider>(context, listen: false);
if (status.networkType == ConnectivityResult.mobile) {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text("mobileAlertTitle".i18n),
content: Text("mobileAlertDesc".i18n.fill([fmtSize()])),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop(false);
},
child: Text("no".i18n),
),
TextButton(
onPressed: () {
Navigator.of(context).pop(true);
},
child: Text("yes".i18n),
),
],
),
).then((value) => value ? download() : null);
} else {
download();
}
}
void download() {
widget.release
.install(updateCallback: (p, s) {
if (mounted) {
setState(() {
progress = p;
state = s;
});
}
})
.then((_) => Navigator.of(context).maybePop())
.catchError((error, stackTrace) {
if (mounted) {
Navigator.of(context).maybePop();
ScaffoldMessenger.of(context).showSnackBar(CustomSnackBar(
context: context,
content: Text("error".i18n),
backgroundColor: AppColors.of(context).red,
));
setState(() => state = UpdateState.none);
}
return true;
});
}
}

View File

@@ -1,46 +0,0 @@
import 'package:i18n_extension/i18n_extension.dart';
extension Localization on String {
static final _t = Translations.byLocale("hu_hu") +
{
"en_en": {
"new_update": "New Update",
"download": "download",
"downloading": "downloading",
"installing": "installing",
"error": "Failed to install update!",
"no": "No",
"yes": "Yes",
"mobileAlertTitle": "Hold up!",
"mobileAlertDesc": "You're on mobile network trying to download a %s update. Are you sure you want to continue?"
},
"hu_hu": {
"new_update": "Új frissítés",
"download": "Letöltés",
"downloading": "Letöltés",
"installing": "Telepítés",
"error": "Nem sikerült telepíteni a frissítést!",
"no": "Nem",
"yes": "Igen",
"mobileAlertTitle": "Figyelem!",
"mobileAlertDesc": "Jelenleg mobil interneten vagy, és egy %s méretű frissítést próbálsz letölteni. Biztosan folytatod?"
},
"de_de": {
"new_update": "Neues Update",
"download": "herunterladen",
"downloading": "Herunterladen",
"installing": "Installation",
"error": "Update konnte nicht installiert werden!",
"no": "Nein",
"yes": "Ja",
"mobileAlertTitle": "Achtung!",
"mobileAlertDesc":
"Sie befinden sich gerade im mobilen Internet und versuchen, ein %s Update herunterzuladen. Sind Sie sicher, dass Sie weitermachen wollen?"
},
};
String get i18n => localize(this, _t);
String fill(List<Object> params) => localizeFill(this, params);
String plural(int value) => localizePlural(value, this, _t);
String version(Object modifier) => localizeVersion(modifier, this, _t);
}

View File

@@ -5,7 +5,6 @@ import 'dart:math';
import 'package:animations/animations.dart';
import 'package:collection/collection.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:refilc/api/providers/update_provider.dart';
import 'package:refilc/models/settings.dart';
import 'package:refilc/theme/colors/utils.dart';
import 'package:refilc/ui/date_widget.dart';
@@ -59,7 +58,6 @@ class AbsencesPageState extends State<AbsencesPage>
late AbsenceProvider absenceProvider;
late TimetableProvider timetableProvider;
late NoteProvider noteProvider;
late UpdateProvider updateProvider;
late String firstName;
late TabController _tabController;
late List<SubjectAbsence> absences = [];
@@ -136,7 +134,6 @@ class AbsencesPageState extends State<AbsencesPage>
user = Provider.of<UserProvider>(context);
absenceProvider = Provider.of<AbsenceProvider>(context);
noteProvider = Provider.of<NoteProvider>(context);
updateProvider = Provider.of<UpdateProvider>(context);
timetableProvider = Provider.of<TimetableProvider>(context);
List<String> nameParts = user.displayName?.split(" ") ?? ["?"];
@@ -168,7 +165,7 @@ class AbsencesPageState extends State<AbsencesPage>
backgroundColor: Theme.of(context)
.colorScheme
.tertiary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available,
badge: false,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,

View File

@@ -305,6 +305,8 @@ class _GradeSubjectViewState extends State<GradeSubjectView>
if (DateTime.now().day > 5) {
_timetableController.next(context);
}
fetchGoalPlans();
}
void fetchGoalPlans() async {
@@ -370,8 +372,6 @@ class _GradeSubjectViewState extends State<GradeSubjectView>
buildTiles(ghostGrades);
}
fetchGoalPlans();
return Scaffold(
key: _scaffoldKey,
floatingActionButtonLocation: ExpandableFab.location,

View File

@@ -9,7 +9,6 @@ import 'package:collection/collection.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/foundation.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:refilc/api/providers/update_provider.dart';
import 'package:refilc/models/settings.dart';
import 'package:refilc/ui/widgets/grade/grade_tile.dart';
import 'package:refilc_kreta_api/models/exam.dart';
@@ -79,7 +78,6 @@ class GradesPageState extends State<GradesPage> {
late UserProvider user;
late GradeProvider gradeProvider;
late UpdateProvider updateProvider;
late GradeCalculatorProvider calculatorProvider;
late HomeworkProvider homeworkProvider;
late ExamProvider examProvider;
@@ -450,7 +448,6 @@ class GradesPageState extends State<GradesPage> {
Widget build(BuildContext context) {
user = Provider.of<UserProvider>(context);
gradeProvider = Provider.of<GradeProvider>(context);
updateProvider = Provider.of<UpdateProvider>(context);
calculatorProvider = Provider.of<GradeCalculatorProvider>(context);
homeworkProvider = Provider.of<HomeworkProvider>(context);
examProvider = Provider.of<ExamProvider>(context);
@@ -587,7 +584,7 @@ class GradesPageState extends State<GradesPage> {
backgroundColor: Theme.of(context)
.colorScheme
.tertiary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available,
badge: false,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,

View File

@@ -13,7 +13,6 @@ import 'package:intl/intl.dart';
import 'package:refilc_mobile_ui/pages/messages/messages_page.dart';
import 'package:refilc_plus/providers/plus_provider.dart';
import 'package:animated_list_plus/animated_list_plus.dart';
import 'package:refilc/api/providers/update_provider.dart';
import 'package:refilc/api/providers/sync.dart';
import 'package:confetti/confetti.dart';
import 'package:refilc/models/settings.dart';
@@ -51,7 +50,6 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
late TabController _tabController;
late UserProvider user;
late SettingsProvider settings;
late UpdateProvider updateProvider;
late StatusProvider statusProvider;
late GradeProvider gradeProvider;
late TimetableProvider timetableProvider;
@@ -174,7 +172,6 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
user = Provider.of<UserProvider>(context);
settings = Provider.of<SettingsProvider>(context);
statusProvider = Provider.of<StatusProvider>(context, listen: false);
updateProvider = Provider.of<UpdateProvider>(context);
_liveCard = Provider.of<LiveCardProvider>(context);
gradeProvider = Provider.of<GradeProvider>(context);
context.watch<PlusProvider>();
@@ -335,7 +332,7 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
.tertiary, //!settings.presentationMode
//? ColorUtils.stringToColor(user.displayName ?? "?")
//: Theme.of(context).colorScheme.secondary,
badge: updateProvider.available,
badge: false,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,

View File

@@ -1,7 +1,6 @@
import 'dart:math';
import 'package:google_fonts/google_fonts.dart';
import 'package:refilc/api/providers/update_provider.dart';
import 'package:refilc/models/settings.dart';
import 'package:refilc/ui/date_widget.dart';
import 'package:refilc_kreta_api/providers/message_provider.dart';
@@ -35,7 +34,6 @@ class MessagesPageState extends State<MessagesPage>
late UserProvider user;
late MessageProvider messageProvider;
late UpdateProvider updateProvider;
late String firstName;
late TabController tabController;
@@ -50,7 +48,6 @@ class MessagesPageState extends State<MessagesPage>
Widget build(BuildContext context) {
user = Provider.of<UserProvider>(context);
messageProvider = Provider.of<MessageProvider>(context);
updateProvider = Provider.of<UpdateProvider>(context);
List<String> nameParts = user.displayName?.split(" ") ?? ["?"];
firstName = nameParts.length > 1 ? nameParts[1] : nameParts[0];
@@ -108,7 +105,7 @@ class MessagesPageState extends State<MessagesPage>
backgroundColor: Theme.of(context)
.colorScheme
.tertiary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available,
badge: false,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,

View File

@@ -26,7 +26,6 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:refilc/api/providers/database_provider.dart';
import 'package:refilc/api/providers/self_note_provider.dart';
import 'package:refilc/api/providers/update_provider.dart';
import 'package:refilc/models/self_note.dart';
import 'package:refilc/models/settings.dart';
import 'package:refilc/utils/format.dart';
@@ -76,7 +75,6 @@ class NotesPage extends StatefulWidget {
class NotesPageState extends State<NotesPage> with TickerProviderStateMixin {
late UserProvider user;
late UpdateProvider updateProvider;
late DatabaseProvider databaseProvider;
late SelfNoteProvider selfNoteProvider;
@@ -112,7 +110,6 @@ Future<void> deleteTodoItem(TodoItem item) async {
user = Provider.of<UserProvider>(context, listen: false);
databaseProvider = Provider.of<DatabaseProvider>(context, listen: false);
updateProvider = Provider.of<UpdateProvider>(context, listen: false);
selfNoteProvider = Provider.of<SelfNoteProvider>(context, listen: false);
doneItems = await databaseProvider.userQuery.toDoItems(userId: user.id!);
@@ -287,7 +284,6 @@ if (selfNoteProvider.todos.isNotEmpty) {
Widget build(BuildContext context) {
user = Provider.of<UserProvider>(context);
databaseProvider = Provider.of<DatabaseProvider>(context);
updateProvider = Provider.of<UpdateProvider>(context);
selfNoteProvider = Provider.of<SelfNoteProvider>(context);
List<String> nameParts = user.displayName?.split(" ") ?? ["?"];
@@ -357,7 +353,7 @@ if (selfNoteProvider.todos.isNotEmpty) {
name: firstName,
backgroundColor: Theme.of(context).colorScheme.tertiary,
//ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available,
badge: false,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,

View File

@@ -38,7 +38,10 @@ class _ImageNoteEditorState extends State<ImageNoteEditor> {
File? image;
Future pickImage() async {
try {
final image = await ImagePicker().pickImage(source: ImageSource.gallery);
final image = await ImagePicker().pickImage(
source: ImageSource.gallery,
requestFullMetadata: false,
);
if (image == null) return;
File imageFile = File(image.path);

View File

@@ -3,7 +3,6 @@ import 'package:animations/animations.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:i18n_extension/i18n_extension.dart';
import 'package:refilc/api/providers/database_provider.dart';
import 'package:refilc/api/providers/update_provider.dart';
import 'package:refilc/models/settings.dart';
import 'package:refilc/utils/format.dart';
import 'package:refilc_kreta_api/client/client.dart';
@@ -77,7 +76,6 @@ class TimetablePageState extends State<TimetablePage>
late UserProvider user;
late TimetableProvider timetableProvider;
late UpdateProvider updateProvider;
late SettingsProvider settingsProvider;
late DatabaseProvider db;
@@ -105,6 +103,7 @@ class TimetablePageState extends State<TimetablePage>
// Update timetable on user change
Future<void> _userListener() async {
await Provider.of<TimetableProvider>(context, listen: false).restoreUser();
await Provider.of<KretaClient>(context, listen: false).refreshLogin();
if (mounted) _controller.jump(_controller.currentWeek, context: context);
}
@@ -208,7 +207,6 @@ class TimetablePageState extends State<TimetablePage>
Widget build(BuildContext context) {
user = Provider.of<UserProvider>(context);
timetableProvider = Provider.of<TimetableProvider>(context);
updateProvider = Provider.of<UpdateProvider>(context);
settingsProvider = Provider.of<SettingsProvider>(context);
getCustom();
@@ -314,7 +312,7 @@ class TimetablePageState extends State<TimetablePage>
backgroundColor: Theme.of(context)
.colorScheme
.tertiary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available,
badge: false,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,

View File

@@ -18,14 +18,17 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
class KretenLoginWidget extends StatefulWidget {
const KretenLoginWidget({super.key, required this.onLogin});
const KretenLoginWidget({super.key, required this.onLogin, this.onDemoMode});
// final String selectedSchool;
final void Function(String code) onLogin;
final VoidCallback? onDemoMode;
@override
State<KretenLoginWidget> createState() => _KretenLoginWidgetState();
@@ -37,7 +40,39 @@ class _KretenLoginWidgetState extends State<KretenLoginWidget>
late AnimationController _animationController;
var loadingPercentage = 0;
var currentUrl = '';
bool _initialPageLoaded = false;
bool _hasFadedIn = false;
bool _hasError = false;
bool _hasTimedOut = false;
Timer? _timeoutTimer;
int _autoRetryCount = 0;
static const int _maxAutoRetries = 3;
bool _hasLoadedOnce = false;
static const _loginUrl =
'https://idp.e-kreta.hu/connect/authorize?prompt=login&nonce=wylCrqT4oN6PPgQn2yQB0euKei9nJeZ6_ffJ-VpSKZU&response_type=code&code_challenge_method=S256&scope=openid%20email%20offline_access%20kreta-ellenorzo-webapi.public%20kreta-eugyintezes-webapi.public%20kreta-fileservice-webapi.public%20kreta-mobile-global-webapi.public%20kreta-dkt-webapi.public%20kreta-ier-webapi.public&code_challenge=HByZRRnPGb-Ko_wTI7ibIba1HQ6lor0ws4bcgReuYSQ&redirect_uri=https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect&client_id=kreta-ellenorzo-student-mobile-ios&state=refilc_student_mobile';
static final Uri _redirectUri = Uri.parse(
'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect',
);
bool _isRedirectUri(Uri uri) {
return uri.scheme == _redirectUri.scheme &&
uri.host == _redirectUri.host &&
uri.path == _redirectUri.path;
}
bool _shouldIgnoreError(WebResourceError error) {
if (error.isForMainFrame == false) {
return true;
}
final String description = error.description.toLowerCase();
return error.errorCode == -999 ||
description.contains('cancelled') ||
description.contains('canceled') ||
description.contains('frame load interrupted');
}
@override
void initState() {
@@ -50,88 +85,134 @@ class _KretenLoginWidgetState extends State<KretenLoginWidget>
controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1')
..setNavigationDelegate(NavigationDelegate(
onNavigationRequest: (n) async {
if (n.url.startsWith('https://mobil.e-kreta.hu')) {
setState(() {
loadingPercentage = 0;
currentUrl = n.url;
});
// final String instituteCode = widget.selectedSchool;
// if (!n.url.startsWith(
// 'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=')) {
// return;
// }
List<String> requiredThings = n.url
.replaceAll(
'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=',
'')
.replaceAll(
'&scope=openid%20email%20offline_access%20kreta-ellenorzo-webapi.public%20kreta-eugyintezes-webapi.public%20kreta-fileservice-webapi.public%20kreta-mobile-global-webapi.public%20kreta-dkt-webapi.public%20kreta-ier-webapi.public&state=refilc_student_mobile&session_state=',
':')
.split(':');
String code = requiredThings[0];
// String sessionState = requiredThings[1];
widget.onLogin(code);
// Future.delayed(const Duration(milliseconds: 500), () {
// Navigator.of(context).pop();
// });
// Navigator.of(context).pop();
return NavigationDecision.prevent;
} else {
return NavigationDecision.navigate;
final Uri? uri = Uri.tryParse(n.url);
if (uri != null && _isRedirectUri(uri)) {
final String? code = uri.queryParameters['code'];
if (code != null && code.isNotEmpty) {
_timeoutTimer?.cancel();
widget.onLogin(code);
return NavigationDecision.prevent;
}
}
return NavigationDecision.navigate;
},
onPageStarted: (url) async {
// setState(() {
// loadingPercentage = 0;
// currentUrl = url;
// });
if (!mounted) return;
// // final String instituteCode = widget.selectedSchool;
// if (!url.startsWith(
// 'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=')) {
// return;
// }
setState(() {
currentUrl = url;
_hasError = false;
// List<String> requiredThings = url
// .replaceAll(
// 'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=',
// '')
// .replaceAll(
// '&scope=openid%20email%20offline_access%20kreta-ellenorzo-webapi.public%20kreta-eugyintezes-webapi.public%20kreta-fileservice-webapi.public%20kreta-mobile-global-webapi.public%20kreta-dkt-webapi.public%20kreta-ier-webapi.public&state=refilc_student_mobile&session_state=',
// ':')
// .split(':');
_hasTimedOut = false;
// String code = requiredThings[0];
// // String sessionState = requiredThings[1];
// widget.onLogin(code);
// // Future.delayed(const Duration(milliseconds: 500), () {
// // Navigator.of(context).pop();
// // });
// // Navigator.of(context).pop();
if (!_initialPageLoaded) {
loadingPercentage = 0;
}
});
},
onProgress: (progress) {
if (!mounted) return;
setState(() {
loadingPercentage = progress;
});
},
onPageFinished: (url) {
_timeoutTimer?.cancel();
if (!mounted) return;
_autoRetryCount = 0;
_hasLoadedOnce = true;
setState(() {
currentUrl = url;
_initialPageLoaded = true;
_hasError = false;
_hasTimedOut = false;
loadingPercentage = 100;
});
},
onWebResourceError: (error) {
if (_shouldIgnoreError(error)) {
return;
}
_timeoutTimer?.cancel();
if (!mounted) return;
// Auto-retry on first errors before showing the error UI,
// to handle transient network issues on initial load.
if (!_hasLoadedOnce && _autoRetryCount < _maxAutoRetries) {
_autoRetryCount++;
Future.delayed(Duration(seconds: _autoRetryCount), () {
if (mounted) _retryLoad();
});
return;
}
// If demo mode is available, auto-launch it instead of
// showing an error UI (e.g. when outside Hungary).
if (widget.onDemoMode != null) {
widget.onDemoMode!();
return;
}
setState(() {
_hasError = true;
});
},
))
..loadRequest(
Uri.parse(
'https://idp.e-kreta.hu/connect/authorize?prompt=login&nonce=wylCrqT4oN6PPgQn2yQB0euKei9nJeZ6_ffJ-VpSKZU&response_type=code&code_challenge_method=S256&scope=openid%20email%20offline_access%20kreta-ellenorzo-webapi.public%20kreta-eugyintezes-webapi.public%20kreta-fileservice-webapi.public%20kreta-mobile-global-webapi.public%20kreta-dkt-webapi.public%20kreta-ier-webapi.public&code_challenge=HByZRRnPGb-Ko_wTI7ibIba1HQ6lor0ws4bcgReuYSQ&redirect_uri=https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect&client_id=kreta-ellenorzo-student-mobile-ios&state=refilc_student_mobile'), // &institute_code=${widget.selectedSchool}
Uri.parse(_loginUrl), // &institute_code=${widget.selectedSchool}
);
_startTimeoutTimer();
}
void _startTimeoutTimer() {
_timeoutTimer?.cancel();
_timeoutTimer = Timer(const Duration(seconds: 15), () {
if (mounted && !_initialPageLoaded && !_hasError) {
if (widget.onDemoMode != null) {
widget.onDemoMode!();
return;
}
setState(() {
_hasTimedOut = true;
});
}
});
}
void _retryLoad() {
setState(() {
_hasError = false;
_hasTimedOut = false;
_initialPageLoaded = false;
loadingPercentage = 0;
});
controller.loadRequest(Uri.parse(_loginUrl));
_startTimeoutTimer();
}
void _retry() {
setState(() {
_hasError = false;
_hasTimedOut = false;
_initialPageLoaded = false;
loadingPercentage = 0;
_hasFadedIn = false;
});
_autoRetryCount = 0;
_hasLoadedOnce = false;
_animationController.reset();
controller.loadRequest(Uri.parse(_loginUrl));
_startTimeoutTimer();
}
// Future<void> loadLoginUrl() async {
@@ -143,6 +224,7 @@ class _KretenLoginWidgetState extends State<KretenLoginWidget>
@override
void dispose() {
_timeoutTimer?.cancel();
// Step 3: Dispose of the animation controller
_animationController.dispose();
super.dispose();
@@ -150,8 +232,64 @@ class _KretenLoginWidgetState extends State<KretenLoginWidget>
@override
Widget build(BuildContext context) {
// Show error UI if there was a web resource error or a timeout
if (_hasError || _hasTimedOut) {
return Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.wifi_off_rounded,
size: 48,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
const SizedBox(height: 16),
Text(
'A bejelentkezési oldal nem érhető el',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Theme.of(context).colorScheme.onSurface,
),
),
const SizedBox(height: 8),
Text(
'Az e-KRÉTA bejelentkezés csak magyarországi hálózatról érhető el. Kérjük, ellenőrizd az internetkapcsolatod.',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 13,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: 24),
FilledButton.icon(
onPressed: _retry,
icon: const Icon(Icons.refresh),
label: const Text('Próbáld újra'),
),
if (widget.onDemoMode != null) ...[
const SizedBox(height: 12),
OutlinedButton(
onPressed: widget.onDemoMode,
child: const Text('Kipróbálom fiók nélkül'),
),
],
const SizedBox(height: 12),
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('Vissza'),
),
],
),
),
);
}
// Trigger the fade-in animation only once when loading reaches 100%
if (loadingPercentage == 100 && !_hasFadedIn) {
if (_initialPageLoaded && !_hasFadedIn) {
_animationController.forward(); // Play the animation
_hasFadedIn =
true; // Set the flag to true, so the animation is not replayed
@@ -159,9 +297,8 @@ class _KretenLoginWidgetState extends State<KretenLoginWidget>
return Stack(
children: [
// Webview that will be displayed only when the loading is 100%
if (loadingPercentage == 100)
FadeTransition(
Positioned.fill(
child: FadeTransition(
opacity: Tween<double>(begin: 0, end: 1).animate(
CurvedAnimation(
parent: _animationController,
@@ -172,23 +309,28 @@ class _KretenLoginWidgetState extends State<KretenLoginWidget>
controller: controller,
),
),
// Show the CircularProgressIndicator while loading is not 100%
if (loadingPercentage < 100)
Center(
child: TweenAnimationBuilder(
tween: Tween<double>(begin: 0, end: loadingPercentage / 100.0),
duration: const Duration(milliseconds: 300),
builder: (context, double value, child) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(
value: value, // Smoothly animates the progress
),
],
);
},
),
if (!_initialPageLoaded)
Positioned.fill(
child: ColoredBox(
color: Theme.of(context).colorScheme.surface,
child: Center(
child: TweenAnimationBuilder(
tween:
Tween<double>(begin: 0, end: loadingPercentage / 100.0),
duration: const Duration(milliseconds: 300),
builder: (context, double value, child) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(
value: value == 0 ? null : value,
),
],
);
},
),
),
),
),
],

View File

@@ -20,6 +20,8 @@
import 'dart:io' show Platform;
import 'package:refilc/api/login.dart';
import 'package:refilc/api/providers/user_provider.dart';
import 'package:refilc/models/user.dart';
import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc_mobile_ui/common/custom_snack_bar.dart';
import 'package:refilc_mobile_ui/common/system_chrome.dart';
@@ -30,6 +32,7 @@ import 'package:flutter/services.dart';
import 'login_screen.i18n.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:refilc_mobile_ui/screens/login/kreten_login.dart'; //new library for new web login
import 'package:provider/provider.dart';
class LoginScreen extends StatefulWidget {
const LoginScreen({super.key, this.back = false});
@@ -49,6 +52,7 @@ class LoginScreenState extends State<LoginScreen> {
LoginState _loginState = LoginState.normal;
bool showBack = false;
int _demoTapCount = 0;
// Scaffold Gradient background
// final LinearGradient _backgroundGradient = const LinearGradient(
@@ -68,6 +72,11 @@ class LoginScreenState extends State<LoginScreen> {
void initState() {
super.initState();
showBack = widget.back;
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
@@ -124,9 +133,23 @@ class LoginScreenState extends State<LoginScreen> {
padding: EdgeInsets.only(left: 24, top: paddingTop),
child: Row(
children: [
Image.asset(
'assets/icons/ic_rounded.png',
width: 30.0,
GestureDetector(
onTap: () {
setState(() => _demoTapCount++);
if (_demoTapCount >= 10) {
_demoTapCount = 0;
final userProvider = Provider.of<UserProvider>(context, listen: false);
final demoUser = User.demo();
userProvider.addUser(demoUser);
userProvider.setUser(demoUser.id);
setSystemChrome(context);
Navigator.of(context).pushReplacementNamed('login_to_navigation');
}
},
child: Image.asset(
'assets/icons/ic_rounded.png',
width: 30.0,
),
),
const SizedBox(width: 8),
Text(
@@ -256,7 +279,7 @@ class LoginScreenState extends State<LoginScreen> {
context: context,
isScrollControlled:
true, // This ensures the modal accommodates input fields properly
builder: (BuildContext context) {
builder: (BuildContext sheetContext) {
return Container(
height: MediaQuery.of(context)
.size
@@ -332,6 +355,15 @@ class LoginScreenState extends State<LoginScreen> {
context)
.pop();
},
onDemoMode: () {
Navigator.of(context).pop();
final userProvider = Provider.of<UserProvider>(context, listen: false);
final demoUser = User.demo();
userProvider.addUser(demoUser);
userProvider.setUser(demoUser.id);
setSystemChrome(context);
Navigator.of(context).pushReplacementNamed('login_to_navigation');
},
),
),
),
@@ -359,7 +391,7 @@ class LoginScreenState extends State<LoginScreen> {
)),
),
),
const SizedBox(height: 19),
const SizedBox(height: 12),
// privacy policy
GestureDetector(
onTap: () => PrivacyView.show(context),

View File

@@ -34,6 +34,7 @@ extension Localization on String {
"welcome_text_4":
"You can also organise your notes by lesson in the built-in notebook, so you can find everything in one app.",
"login_w_kreta_acc": "Log in with your e-KRÉTA account",
"demo_login": "Try demo mode",
},
"hu_hu": {
"username": "Felhasználónév",
@@ -66,6 +67,7 @@ extension Localization on String {
"welcome_text_4":
"A beépített jegyzetfüzetbe órák szerint is rendezheted a jegyzeteidet, így mindent megtalálsz egy appban.",
"login_w_kreta_acc": "Bejelentkezés e-KRÉTA fiókkal",
"demo_login": "Demo mód kipróbálása",
},
"de_de": {
"username": "Benutzername",
@@ -98,6 +100,7 @@ extension Localization on String {
"welcome_text_4":
"You can also organise your notes by lesson in the built-in notebook, so you can find everything in one app.",
"login_w_kreta_acc": "Mit e-KRÉTA-Konto anmelden",
"demo_login": "Demo-Modus ausprobieren",
},
};

View File

@@ -1,7 +1,6 @@
// ignore_for_file: deprecated_member_use
import 'package:flutter_svg/svg.dart';
import 'package:refilc/api/providers/update_provider.dart';
import 'package:refilc/helpers/quick_actions.dart';
import 'package:refilc/models/settings.dart';
import 'package:refilc/theme/observer.dart';
@@ -18,6 +17,7 @@ import 'package:refilc_mobile_ui/screens/navigation/navigation_route_handler.dar
import 'package:refilc_mobile_ui/screens/navigation/status_bar.dart';
import 'package:refilc_mobile_ui/screens/news/news_view.dart';
import 'package:refilc_mobile_ui/screens/settings/settings_screen.dart';
import 'package:refilc_mobile_ui/screens/settings/live_activity_consent_dialog.dart';
import 'package:refilc_plus/ui/mobile/goal_planner/goal_complete_modal.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@@ -32,6 +32,7 @@ import 'package:wtf_sliding_sheet/wtf_sliding_sheet.dart';
import 'package:background_fetch/background_fetch.dart';
import 'package:refilc_plus/providers/goal_provider.dart';
import 'package:refilc/api/providers/ad_provider.dart';
import 'dart:io' show Platform;
class NavigationScreen extends StatefulWidget {
const NavigationScreen({super.key});
@@ -52,7 +53,6 @@ class NavigationScreenState extends State<NavigationScreen>
late SettingsProvider settings;
late NewsProvider newsProvider;
late GoalProvider goalProvider;
late UpdateProvider updateProvider;
late GradeProvider gradeProvicer;
late AdProvider adProvider;
@@ -179,10 +179,6 @@ class NavigationScreenState extends State<NavigationScreen>
goalProvider = Provider.of<GoalProvider>(context, listen: false);
goalProvider.fetchDone(gradeProvider: gradeProvicer);
// get releases
updateProvider = Provider.of<UpdateProvider>(context, listen: false);
updateProvider.fetch();
// get advertisements
adProvider = Provider.of<AdProvider>(context, listen: false);
adProvider.fetch();
@@ -190,6 +186,14 @@ class NavigationScreenState extends State<NavigationScreen>
// initial sync
syncAll(context);
setupQuickActions();
// Show live activity consent dialog on iOS
if (Platform.isIOS &&
settings.unseenNewFeatures.contains('live_activity_consent')) {
WidgetsBinding.instance.addPostFrameCallback((_) {
LiveActivityConsentDialog.show(context);
});
}
}
@override

View File

@@ -55,9 +55,8 @@ class StatusBarState extends State<StatusBar> {
height: currentStatus != null ? 4.0 : 0,
duration: const Duration(milliseconds: 250),
curve: Curves.easeInOut,
width: MediaQuery.of(context).size.width *
statusProvider.progress -
36.0,
width: (MediaQuery.of(context).size.width - 36.0) *
statusProvider.progress,
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
@@ -87,9 +86,8 @@ class StatusBarState extends State<StatusBar> {
child: AnimatedContainer(
duration: const Duration(milliseconds: 250),
curve: Curves.easeInOut,
width: MediaQuery.of(context).size.width *
statusProvider.progress -
36.0,
width: (MediaQuery.of(context).size.width - 36.0) *
statusProvider.progress,
alignment: Alignment.centerRight,
child: Container(
decoration: BoxDecoration(

View File

@@ -0,0 +1,334 @@
import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:provider/provider.dart';
import 'package:refilc/models/settings.dart';
import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc_mobile_ui/screens/settings/live_activity_privacy_policy_screen.dart';
import 'package:refilc_mobile_ui/screens/settings/settings_screen.i18n.dart';
class LiveActivityConsentDialog extends StatelessWidget {
const LiveActivityConsentDialog({super.key});
static Future<void> show(BuildContext context) {
return Navigator.of(context, rootNavigator: true).push(
MaterialPageRoute(
builder: (context) => const LiveActivityConsentDialog(),
),
);
}
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final colors = AppColors.of(context);
return Scaffold(
backgroundColor: theme.scaffoldBackgroundColor,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 24.0),
// Header: bell icon + title
Row(
children: [
Icon(
Icons.notifications_active,
color: theme.colorScheme.secondary,
size: 36.0,
),
const SizedBox(width: 12.0),
Text(
"Live Activity",
style: TextStyle(
fontSize: 28.0,
fontWeight: FontWeight.bold,
color: colors.text,
),
),
],
),
const SizedBox(height: 8.0),
Text(
"la_consent_subtitle".i18n,
style: TextStyle(
fontSize: 15.0,
color: colors.text.withValues(alpha: 0.7),
),
),
const SizedBox(height: 20.0),
// Privacy warning card
Container(
width: double.infinity,
padding: const EdgeInsets.all(16.0),
decoration: BoxDecoration(
color: colors.orange.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(12.0),
border: Border.all(
color: colors.orange.withValues(alpha: 0.3),
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
Icons.shield_outlined,
color: colors.orange,
size: 22.0,
),
const SizedBox(width: 12.0),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"la_privacy_policy".i18n,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w600,
color: colors.orange,
),
),
const SizedBox(height: 4.0),
Text(
"la_privacy_warning".i18n,
style: TextStyle(
fontSize: 13.0,
color: colors.orange.withValues(alpha: 0.85),
),
),
],
),
),
],
),
),
const SizedBox(height: 24.0),
// Intro text
Text(
"la_consent_intro".i18n,
style: TextStyle(
fontSize: 14.0,
color: colors.text.withValues(alpha: 0.8),
),
),
const SizedBox(height: 24.0),
// Info sections
Expanded(
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Column(
children: [
_InfoSection(
icon: Icons.build_outlined,
iconColor: theme.colorScheme.secondary,
title: "la_what_data".i18n,
description: "la_what_data_desc".i18n,
),
const SizedBox(height: 20.0),
_InfoSection(
icon: Icons.lock_outline,
iconColor: theme.colorScheme.secondary,
title: "la_how_protect".i18n,
description: "la_how_protect_desc".i18n,
),
const SizedBox(height: 20.0),
_InfoSection(
icon: Icons.access_time,
iconColor: theme.colorScheme.secondary,
title: "la_how_long".i18n,
description: "la_how_long_desc".i18n,
),
const SizedBox(height: 16.0),
],
),
),
),
// Buttons
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: Column(
children: [
// Learn more
SizedBox(
width: double.infinity,
child: OutlinedButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) =>
const LiveActivityPrivacyPolicyScreen(),
),
);
},
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 14.0),
side: BorderSide(
color: colors.text.withValues(alpha: 0.2),
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"la_learn_more".i18n,
style: TextStyle(
color: colors.text.withValues(alpha: 0.8),
fontSize: 15.0,
),
),
const SizedBox(width: 4.0),
Icon(
FeatherIcons.chevronRight,
size: 18.0,
color: colors.text.withValues(alpha: 0.8),
),
],
),
),
),
const SizedBox(height: 10.0),
// Accept
SizedBox(
width: double.infinity,
child: FilledButton(
onPressed: () => _respond(context, true),
style: FilledButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 14.0),
backgroundColor: theme.colorScheme.secondary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
),
),
child: Text(
"live_activity_accept".i18n,
style: TextStyle(
color: theme.colorScheme.onSecondary,
fontSize: 16.0,
fontWeight: FontWeight.w600,
),
),
),
),
const SizedBox(height: 8.0),
// Decline
SizedBox(
width: double.infinity,
child: OutlinedButton(
onPressed: () => _respond(context, false),
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 14.0),
side: BorderSide(
color: colors.text.withValues(alpha: 0.15),
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
),
),
child: Text(
"live_activity_decline".i18n,
style: TextStyle(
color: colors.text.withValues(alpha: 0.6),
fontSize: 15.0,
),
),
),
),
],
),
),
],
),
),
),
);
}
void _respond(BuildContext context, bool accepted) {
final settings = Provider.of<SettingsProvider>(context, listen: false);
final unseen = List<String>.from(settings.unseenNewFeatures);
unseen.remove('live_activity_consent');
if (accepted) {
settings.update(
liveActivityEnabled: true,
liveActivityConsentAccepted: true,
unseenNewFeatures: unseen,
);
} else {
settings.update(
unseenNewFeatures: unseen,
);
}
Navigator.of(context).pop();
}
}
class _InfoSection extends StatelessWidget {
final IconData icon;
final Color iconColor;
final String title;
final String description;
const _InfoSection({
required this.icon,
required this.iconColor,
required this.title,
required this.description,
});
@override
Widget build(BuildContext context) {
final colors = AppColors.of(context);
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 40.0,
height: 40.0,
decoration: BoxDecoration(
color: iconColor.withValues(alpha: 0.15),
shape: BoxShape.circle,
),
child: Icon(icon, color: iconColor, size: 20.0),
),
const SizedBox(width: 14.0),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.w600,
color: colors.text,
),
),
const SizedBox(height: 4.0),
Text(
description,
style: TextStyle(
fontSize: 13.5,
color: colors.text.withValues(alpha: 0.6),
),
),
],
),
),
],
);
}
}

View File

@@ -0,0 +1,175 @@
import 'package:flutter/material.dart';
import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc_mobile_ui/screens/settings/settings_screen.i18n.dart';
class LiveActivityPrivacyPolicyScreen extends StatelessWidget {
const LiveActivityPrivacyPolicyScreen({super.key});
@override
Widget build(BuildContext context) {
final colors = AppColors.of(context);
return Scaffold(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: AppBar(
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
leading: BackButton(color: colors.text),
title: Text(
"la_pp_title".i18n,
style: TextStyle(
color: colors.text,
fontWeight: FontWeight.bold,
),
),
),
body: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_bodyText("la_pp_intro".i18n, colors),
const SizedBox(height: 24.0),
_sectionTitle("la_pp_what_title".i18n, colors),
const SizedBox(height: 8.0),
_bodyText("la_pp_what_intro".i18n, colors),
const SizedBox(height: 12.0),
_bulletList([
"la_pp_d1".i18n,
"la_pp_d2".i18n,
"la_pp_d3".i18n,
"la_pp_d4".i18n,
"la_pp_d5".i18n,
"la_pp_d6".i18n,
"la_pp_d7".i18n,
], colors),
const SizedBox(height: 16.0),
_bodyText("la_pp_timetable_intro".i18n, colors),
const SizedBox(height: 12.0),
_bulletList([
"la_pp_t1".i18n,
"la_pp_t2".i18n,
"la_pp_t3".i18n,
"la_pp_t4".i18n,
"la_pp_t5".i18n,
"la_pp_t6".i18n,
"la_pp_t7".i18n,
], colors),
const SizedBox(height: 16.0),
_bodyText("la_pp_notifications_intro".i18n, colors),
const SizedBox(height: 12.0),
_bulletList([
"la_pp_n1".i18n,
"la_pp_n2".i18n,
"la_pp_n3".i18n,
"la_pp_n4".i18n,
"la_pp_n5".i18n,
], colors),
const SizedBox(height: 24.0),
_sectionTitle("la_pp_purpose_title".i18n, colors),
const SizedBox(height: 8.0),
_bodyText("la_pp_purpose_intro".i18n, colors),
const SizedBox(height: 12.0),
_bulletList([
"la_pp_p1".i18n,
"la_pp_p2".i18n,
"la_pp_p3".i18n,
"la_pp_p4".i18n,
], colors),
const SizedBox(height: 12.0),
_bodyText("la_pp_no_third_party".i18n, colors),
const SizedBox(height: 24.0),
_sectionTitle("la_pp_rights_title".i18n, colors),
const SizedBox(height: 8.0),
_bodyText("la_pp_rights_intro".i18n, colors),
const SizedBox(height: 12.0),
_bulletList([
"la_pp_r1".i18n,
"la_pp_r2".i18n,
"la_pp_r3".i18n,
"la_pp_r4".i18n,
], colors),
const SizedBox(height: 32.0),
Text(
"la_pp_updated".i18n,
style: TextStyle(
fontSize: 12.0,
color: colors.text.withValues(alpha: 0.4),
),
),
const SizedBox(height: 4.0),
Text(
"la_pp_contact".i18n,
style: TextStyle(
fontSize: 12.0,
color: colors.text.withValues(alpha: 0.4),
),
),
const SizedBox(height: 32.0),
],
),
),
);
}
Widget _sectionTitle(String text, ThemeAppColors colors) {
return Text(
text,
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
color: colors.text,
),
);
}
Widget _bodyText(String text, ThemeAppColors colors) {
return Text(
text,
style: TextStyle(
fontSize: 14.0,
color: colors.text.withValues(alpha: 0.7),
height: 1.5,
),
);
}
Widget _bulletList(List<String> items, ThemeAppColors colors) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: items
.map((item) => Padding(
padding: const EdgeInsets.only(bottom: 6.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"• ",
style: TextStyle(
fontSize: 14.0,
color: colors.text.withValues(alpha: 0.7),
),
),
Expanded(
child: Text(
item,
style: TextStyle(
fontSize: 14.0,
color: colors.text.withValues(alpha: 0.7),
height: 1.4,
),
),
),
],
),
))
.toList(),
);
}
}

View File

@@ -19,8 +19,9 @@
// ignore_for_file: no_leading_underscores_for_local_identifiers, use_build_context_synchronously, deprecated_member_use
import 'dart:convert';
import 'dart:io';
import 'package:refilc/api/providers/update_provider.dart';
import 'package:refilc/api/providers/live_card_provider.dart';
import 'package:refilc_kreta_api/providers/absence_provider.dart';
import 'package:refilc_kreta_api/providers/event_provider.dart';
import 'package:refilc_kreta_api/providers/exam_provider.dart';
@@ -50,7 +51,6 @@ import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart';
import 'package:refilc_mobile_ui/common/system_chrome.dart';
// import 'package:refilc_mobile_ui/common/system_chrome.dart';
import 'package:refilc_mobile_ui/common/widgets/update/updates_view.dart';
import 'package:refilc_mobile_ui/screens/news/news_screen.dart';
// import 'package:refilc_mobile_ui/screens/notes/notes_screen.dart';
@@ -77,8 +77,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_custom_tabs/flutter_custom_tabs.dart' as tabs;
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:provider/provider.dart';
import 'package:shake_flutter/enums/shake_screen.dart';
import 'package:shake_flutter/shake_flutter.dart';
import 'package:url_launcher/url_launcher.dart';
import 'settings_screen.i18n.dart';
import 'package:flutter/services.dart';
@@ -105,7 +103,6 @@ class SettingsScreenState extends State<SettingsScreen>
Future<Map>? futureRelease;
late UserProvider user;
late UpdateProvider updateProvider;
late SettingsProvider settings;
late DatabaseProvider databaseProvider;
late KretaClient kretaClient;
@@ -270,10 +267,6 @@ class SettingsScreenState extends State<SettingsScreen>
@override
void initState() {
super.initState();
Future.delayed(Duration.zero, () {
futureRelease = Provider.of<UpdateProvider>(context, listen: false)
.installedVersion();
});
_hideContainersController = AnimationController(
vsync: this, duration: const Duration(milliseconds: 200));
}
@@ -293,7 +286,6 @@ class SettingsScreenState extends State<SettingsScreen>
Widget build(BuildContext context) {
user = Provider.of<UserProvider>(context);
settings = Provider.of<SettingsProvider>(context);
updateProvider = Provider.of<UpdateProvider>(context);
databaseProvider = Provider.of<DatabaseProvider>(context);
kretaClient = Provider.of<KretaClient>(context);
@@ -393,7 +385,7 @@ class SettingsScreenState extends State<SettingsScreen>
radius: 48.42069,
onTap: () => _showBottomSheet(user.getUser(user.id ?? "")),
name: firstName,
badge: updateProvider.available,
badge: false,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,
@@ -610,27 +602,6 @@ class SettingsScreenState extends State<SettingsScreen>
// ),
// ),
// updates
if (updateProvider.available)
Padding(
padding: const EdgeInsets.symmetric(
vertical: 12.0, horizontal: 24.0),
child: Panel(
child: PanelButton(
onPressed: () => _openUpdates(context),
title: Text("update_available".i18n),
leading: const Icon(FeatherIcons.download),
trailing: Text(
updateProvider.releases.first.tag,
style: TextStyle(
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.secondary,
),
),
),
),
),
// const Padding(
// padding: EdgeInsets.symmetric(vertical: 12.0, horizontal: 24.0),
// child: PremiumBannerButton(),
@@ -960,7 +931,7 @@ class SettingsScreenState extends State<SettingsScreen>
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(4.0),
bottom: Radius.circular(4.0),
bottom: Radius.circular(12.0),
),
),
secondary: Icon(
@@ -1003,23 +974,6 @@ class SettingsScreenState extends State<SettingsScreen>
),
),
),
PanelButton(
leading: Icon(
Icons.feedback_outlined,
size: 22.0,
color: AppColors.of(context).text.withOpacity(0.95),
),
title: Text("feedback".i18n),
onPressed: () => {
Shake.setScreenshotIncluded(false),
Shake.show(ShakeScreen.newTicket),
Shake.setScreenshotIncluded(true),
},
borderRadius: const BorderRadius.vertical(
top: Radius.circular(4.0),
bottom: Radius.circular(12.0),
),
),
],
),
@@ -1044,7 +998,7 @@ class SettingsScreenState extends State<SettingsScreen>
],
),
// developer options
if (true)
if (settings.developerMode)
SplittedPanel(
title: Text("devsettings".i18n),
cardPadding: const EdgeInsets.all(4.0),
@@ -1083,8 +1037,9 @@ class SettingsScreenState extends State<SettingsScreen>
PanelButton(
borderRadius: BorderRadius.vertical(
top: const Radius.circular(4.0),
bottom: Provider.of<PlusProvider>(context, listen: false)
.hasPremium
bottom: (Platform.isIOS ||
Provider.of<PlusProvider>(context, listen: false)
.hasPremium)
? const Radius.circular(4.0)
: const Radius.circular(12.0),
),
@@ -1097,7 +1052,39 @@ class SettingsScreenState extends State<SettingsScreen>
onPressed: () => Clipboard.setData(ClipboardData(
text: Provider.of<KretaClient>(context, listen: false)
.accessToken!)),
)
),
if (Platform.isIOS)
Material(
type: MaterialType.transparency,
child: SwitchListTile(
contentPadding:
const EdgeInsets.only(left: 12.0, right: 4.0),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(4.0),
bottom: Radius.circular(12.0))),
title: Text("dev_fake_lessons".i18n,
style: const TextStyle(fontWeight: FontWeight.w500)),
subtitle: Text("dev_fake_lessons_desc".i18n,
style: TextStyle(
fontSize: 12.0,
color: AppColors.of(context).text.withOpacity(0.65),
)),
onChanged: (v) {
settings.update(devLiveFakeLessons: v);
if (v) {
// Reset Live Activity state to force recreation
LiveCardProvider.hasActivityStarted = false;
LiveCardProvider.hasDayEnd = false;
LiveCardProvider.hasUserDismissed = false;
}
// Trigger LiveCardProvider update immediately
Provider.of<LiveCardProvider>(context, listen: false).update();
},
value: settings.devLiveFakeLessons,
activeColor: Theme.of(context).colorScheme.secondary,
),
),
],
),
@@ -1158,9 +1145,6 @@ class SettingsScreenState extends State<SettingsScreen>
Navigator.of(context, rootNavigator: true)
.push(CupertinoPageRoute(builder: (context) => const NewsScreen()));
void _openUpdates(BuildContext context) =>
UpdateView.show(updateProvider.releases.first, context: context);
void _openPrivacy(BuildContext context) => PrivacyView.show(context);
// void _openNotes(BuildContext context, Map<String, bool> doneItems) async =>

View File

@@ -71,6 +71,8 @@ extension SettingsLocalization on String {
"devactivated": "Developer Mode successfully activated.",
"devsettings": "Developer Settings",
"devmode": "Developer Mode",
"dev_fake_lessons": "Fake Live Activity Lessons",
"dev_fake_lessons_desc": "Generate test lessons around current time for Live Activity testing",
"copy_jwt": "Copy JWT",
"welcome_msg": "Welcome Message",
"default": "Dynamic",
@@ -96,6 +98,64 @@ extension SettingsLocalization on String {
"rename_subjects": "Rename Subjects",
"rename_teachers": "Rename Teachers",
"show_breaks": "Show Breaks",
"live_activity_enabled": "Live Activity",
"live_activity_consent_title": "Live Activity – Data Privacy",
"live_activity_consent_body": "The Live Activity feature sends data to our server for real-time push notification updates.\n\nData sent:\n• Device identifier\n• APNs push token\n• Your timetable\n\nPurpose:\n• Real-time Live Activity updates via push notifications\n\nData is stored on an encrypted server. You can disable this at any time in Settings > General.",
"live_activity_accept": "Accept",
"live_activity_decline": "Decline",
// Live Activity consent screen
"la_consent_subtitle": "Display your timetable live on your device's lock screen",
"la_privacy_policy": "Privacy Policy",
"la_privacy_warning": "To use Live Activity, you must accept the privacy policy",
"la_consent_intro": "To use the Live Activity feature, we need to store and process certain data. Please read the following information carefully.",
"la_what_data": "What data do we store?",
"la_what_data_desc": "Device tokens, Live Activity tokens, timetable data",
"la_how_protect": "How do we protect your data?",
"la_how_protect_desc": "Encrypted storage, secure servers",
"la_how_long": "How long do we store the data?",
"la_how_long_desc": "Data deleted automatically when not needed",
"la_learn_more": "Learn more",
// Live Activity privacy policy detail
"la_pp_title": "Live Activity Privacy Policy",
"la_pp_intro": "To use the Live Activity feature, we need to store and process certain data. Please read the following information carefully.",
"la_pp_what_title": "What data do we store?",
"la_pp_what_intro": "To enable Live Activity, we store the following data along with your device identifier:",
"la_pp_d1": "Device identifier (UUID)",
"la_pp_d2": "Device token",
"la_pp_d3": "Live Activity push token",
"la_pp_d4": "APNs push token",
"la_pp_d5": "Device hash",
"la_pp_d6": "Language preference",
"la_pp_d7": "Bell delay offset",
"la_pp_timetable_intro": "Your timetable data (lessons table) includes:",
"la_pp_t1": "Lesson subject and time",
"la_pp_t2": "Teacher's name",
"la_pp_t3": "Room name",
"la_pp_t4": "Lesson number",
"la_pp_t5": "Lesson theme",
"la_pp_t6": "Substitution info",
"la_pp_t7": "Cancelled lesson status",
"la_pp_notifications_intro": "Scheduled notifications data (scheduled_notifications table) includes:",
"la_pp_n1": "Identifier",
"la_pp_n2": "Device identifier",
"la_pp_n3": "Scheduled time",
"la_pp_n4": "Sent status and time",
"la_pp_n5": "Creation and update times",
"la_pp_purpose_title": "Why do we use this data?",
"la_pp_purpose_intro": "We use the data exclusively for operating the Live Activity feature:",
"la_pp_p1": "Displaying live timetable on the lock screen",
"la_pp_p2": "Sending push notifications when lessons change",
"la_pp_p3": "Syncing your timetable on your device",
"la_pp_p4": "Ensuring Monday morning notifications are delivered even after the weekly database clearance",
"la_pp_no_third_party": "We do not share your data with third parties and do not use it for marketing purposes.",
"la_pp_rights_title": "Your Rights",
"la_pp_rights_intro": "Under GDPR, you have the following rights:",
"la_pp_r1": "Right to access: You can review the types of data stored in this privacy policy.",
"la_pp_r2": "Right to erasure: By disabling the Live Activity feature, all data related to the feature (device identifiers, timetable) is immediately and permanently deleted from our servers.",
"la_pp_r3": "Right to rectification: Timetable data is modified in the Kréta system by authorized persons (e.g., teachers).",
"la_pp_r4": "Right to object: You can object to data processing at any time by disabling the Live Activity feature.",
"la_pp_updated": "Privacy policy last updated: November 2025",
"la_pp_contact": "Have questions? Contact us at support@firka.app.",
"fonts": "Fonts",
"font_family": "Font Family",
"calendar_sync": "Calendar Sync",
@@ -199,6 +259,8 @@ extension SettingsLocalization on String {
"devactivated": "Fejlesztői mód sikeresen aktiválva.",
"devsettings": "Fejlesztői Beállítások",
"devmode": "Fejlesztői mód",
"dev_fake_lessons": "Fake Live Activity órák",
"dev_fake_lessons_desc": "Teszt órákat generál a jelenlegi idő köré a Live Activity teszteléshez",
"copy_jwt": "JWT másolása",
"welcome_msg": "Üdvözlő üzenet",
"default": "Dinamikus",
@@ -224,6 +286,64 @@ extension SettingsLocalization on String {
"rename_subjects": "Tantárgyak átnevezése",
"rename_teachers": "Tanárok átnevezése",
"show_breaks": "Szünetek megjelenítése",
"live_activity_enabled": "Live Activity",
"live_activity_consent_title": "Live Activity – Adatvédelem",
"live_activity_consent_body": "A Live Activity funkció adatokat küld a szerverünkre a valós idejű push értesítés frissítésekhez.\n\nKüldött adatok:\n• Eszközazonosító\n• APNs push token\n• Órarendjeid\n\nCél:\n• Valós idejű Live Activity frissítések push értesítéssel\n\nAz adatokat titkosított szerveren tároljuk. Bármikor kikapcsolhatod a Beállítások > Általános menüben.",
"live_activity_accept": "Elfogadom",
"live_activity_decline": "Elutasítom",
// Live Activity consent screen
"la_consent_subtitle": "Jelenítsd meg az órarendedet élőben a zárolási képernyődön",
"la_privacy_policy": "Adatvédelmi szabályzat",
"la_privacy_warning": "A Live Activity használatához el kell fogadnod az adatvédelmi szabályzatot",
"la_consent_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ást.",
"la_what_data": "Milyen adatokat tárolunk?",
"la_what_data_desc": "Eszköz tokenek, Live Activity tokenek, órarend adatok",
"la_how_protect": "Hogyan védjük az adataidat?",
"la_how_protect_desc": "Titkosított tárolás, biztonságos szerverek",
"la_how_long": "Meddig tároljuk az adatokat?",
"la_how_long_desc": "Az adatok automatikusan törlődnek, ha már nincs rájuk szükség",
"la_learn_more": "Részletek",
// Live Activity privacy policy detail
"la_pp_title": "Live Activity Adatvédelmi Szabályzat",
"la_pp_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ást.",
"la_pp_what_title": "Milyen adatokat tárolunk?",
"la_pp_what_intro": "A Live Activity működéséhez az alábbi adatokat tároljuk az eszközazonosítóddal együtt:",
"la_pp_d1": "Eszközazonosító (UUID)",
"la_pp_d2": "Eszköz token",
"la_pp_d3": "Live Activity push token",
"la_pp_d4": "APNs push token",
"la_pp_d5": "Eszköz hash",
"la_pp_d6": "Nyelvi beállítás",
"la_pp_d7": "Csengő eltolódás értéke",
"la_pp_timetable_intro": "Az órarend adataid (lessons tábla) tartalmazzák:",
"la_pp_t1": "Óra tantárgya és időpontja",
"la_pp_t2": "Tanár neve",
"la_pp_t3": "Terem neve",
"la_pp_t4": "Óraszám",
"la_pp_t5": "Óra témája",
"la_pp_t6": "Helyettesítési információ",
"la_pp_t7": "Elmaradt óra státusz",
"la_pp_notifications_intro": "Ütemezett értesítések adatai (scheduled_notifications tábla) tartalmazzák:",
"la_pp_n1": "Azonosító",
"la_pp_n2": "Eszközazonosító",
"la_pp_n3": "Ütemezett időpont",
"la_pp_n4": "Küldési státusz és időpont",
"la_pp_n5": "Létrehozási és frissítési időpontok",
"la_pp_purpose_title": "Miért használjuk ezeket az adatokat?",
"la_pp_purpose_intro": "Az adatokat kizárólag a Live Activity funkció működtetéséhez használjuk:",
"la_pp_p1": "Élő órarend megjelenítése a zárolási képernyőn",
"la_pp_p2": "Push értesítések küldése óraváltozáskor",
"la_pp_p3": "Órarend szinkronizálása az eszközödön",
"la_pp_p4": "Hétfő reggeli értesítések kézbesítésének biztosítása a heti adatbázis törlés után is",
"la_pp_no_third_party": "Adataidat nem adjuk át harmadik félnek és nem használjuk marketing célokra.",
"la_pp_rights_title": "Jogaid",
"la_pp_rights_intro": "A GDPR alapján az alábbi jogok illetnek meg:",
"la_pp_r1": "Hozzáférés joga: Áttekintheted a tárolt adatok típusait ebben az adatvédelmi szabályzatban.",
"la_pp_r2": "Törlés joga: A Live Activity funkció kikapcsolásával a funkcióhoz kapcsolódó összes adat (eszközazonosítók, órarend) azonnal és véglegesen törlődik a szervereinkről.",
"la_pp_r3": "Helyesbítés joga: Az órarend adatokat a Kréta rendszerben az arra jogosult személyek (pl. tanárok) módosítják.",
"la_pp_r4": "Tiltakozás joga: Bármikor tiltakozhatsz az adatfeldolgozás ellen a Live Activity funkció kikapcsolásával.",
"la_pp_updated": "Adatvédelmi szabályzat utolsó frissítése: 2025. november",
"la_pp_contact": "Kérdésed van? Írj nekünk: support@firka.app.",
"fonts": "Betűk",
"font_family": "Betűtípus",
"calendar_sync": "Naptár szinkronizálás",
@@ -327,6 +447,8 @@ extension SettingsLocalization on String {
"devactivated": "Entwicklermodus erfolgreich aktiviert.",
"devsettings": "Entwickleroptionen",
"devmode": "Entwicklermodus",
"dev_fake_lessons": "Fake Live Activity Stunden",
"dev_fake_lessons_desc": "Generiert Teststunden um die aktuelle Zeit für Live Activity Tests",
"copy_jwt": "JWT kopieren",
"welcome_msg": "Willkommensnachricht",
"default": "Dynamisch",
@@ -352,6 +474,64 @@ extension SettingsLocalization on String {
"rename_subjects": "Fächer umbenennen",
"rename_teachers": "Lehrer umbenennen",
"show_breaks": "Pausen anzeigen",
"live_activity_enabled": "Live Activity",
"live_activity_consent_title": "Live Activity – Datenschutz",
"live_activity_consent_body": "Die Live Activity-Funktion sendet Daten an unseren Server für Echtzeit-Push-Benachrichtigungen.\n\nGesendete Daten:\n• Gerätekennung\n• APNs Push-Token\n• Ihr Stundenplan\n\nZweck:\n• Echtzeit Live Activity-Updates über Push-Benachrichtigungen\n\nDaten werden auf einem verschlüsselten Server gespeichert. Sie können dies jederzeit unter Einstellungen > Allgemein deaktivieren.",
"live_activity_accept": "Akzeptieren",
"live_activity_decline": "Ablehnen",
// Live Activity consent screen
"la_consent_subtitle": "Zeigen Sie Ihren Stundenplan live auf Ihrem Sperrbildschirm an",
"la_privacy_policy": "Datenschutzrichtlinie",
"la_privacy_warning": "Um Live Activity zu nutzen, müssen Sie die Datenschutzrichtlinie akzeptieren",
"la_consent_intro": "Um die Live Activity-Funktion zu nutzen, müssen wir bestimmte Daten speichern und verarbeiten. Bitte lesen Sie die folgenden Informationen sorgfältig durch.",
"la_what_data": "Welche Daten speichern wir?",
"la_what_data_desc": "Geräte-Tokens, Live Activity-Tokens, Stundenplan-Daten",
"la_how_protect": "Wie schützen wir Ihre Daten?",
"la_how_protect_desc": "Verschlüsselte Speicherung, sichere Server",
"la_how_long": "Wie lange speichern wir die Daten?",
"la_how_long_desc": "Daten werden automatisch gelöscht, wenn sie nicht mehr benötigt werden",
"la_learn_more": "Mehr erfahren",
// Live Activity privacy policy detail
"la_pp_title": "Live Activity Datenschutzrichtlinie",
"la_pp_intro": "Um die Live Activity-Funktion zu nutzen, müssen wir bestimmte Daten speichern und verarbeiten. Bitte lesen Sie die folgenden Informationen sorgfältig durch.",
"la_pp_what_title": "Welche Daten speichern wir?",
"la_pp_what_intro": "Um Live Activity zu aktivieren, speichern wir die folgenden Daten zusammen mit Ihrer Gerätekennung:",
"la_pp_d1": "Gerätekennung (UUID)",
"la_pp_d2": "Geräte-Token",
"la_pp_d3": "Live Activity Push-Token",
"la_pp_d4": "APNs Push-Token",
"la_pp_d5": "Geräte-Hash",
"la_pp_d6": "Spracheinstellung",
"la_pp_d7": "Klingelverzögerungswert",
"la_pp_timetable_intro": "Ihre Stundenplan-Daten (Unterrichtstabelle) umfassen:",
"la_pp_t1": "Unterrichtsfach und -zeit",
"la_pp_t2": "Name des Lehrers",
"la_pp_t3": "Raumname",
"la_pp_t4": "Stundennummer",
"la_pp_t5": "Unterrichtsthema",
"la_pp_t6": "Vertretungsinformationen",
"la_pp_t7": "Status ausgefallener Stunden",
"la_pp_notifications_intro": "Geplante Benachrichtigungsdaten (scheduled_notifications Tabelle) umfassen:",
"la_pp_n1": "Kennung",
"la_pp_n2": "Gerätekennung",
"la_pp_n3": "Geplante Zeit",
"la_pp_n4": "Sendestatus und -zeit",
"la_pp_n5": "Erstellungs- und Aktualisierungszeiten",
"la_pp_purpose_title": "Warum verwenden wir diese Daten?",
"la_pp_purpose_intro": "Wir verwenden die Daten ausschließlich für den Betrieb der Live Activity-Funktion:",
"la_pp_p1": "Anzeige des Live-Stundenplans auf dem Sperrbildschirm",
"la_pp_p2": "Senden von Push-Benachrichtigungen bei Stundenänderungen",
"la_pp_p3": "Synchronisation Ihres Stundenplans auf Ihrem Gerät",
"la_pp_p4": "Sicherstellung der Montagmorgen-Benachrichtigungen auch nach der wöchentlichen Datenbankbereinigung",
"la_pp_no_third_party": "Wir geben Ihre Daten nicht an Dritte weiter und verwenden sie nicht für Marketingzwecke.",
"la_pp_rights_title": "Ihre Rechte",
"la_pp_rights_intro": "Gemäß DSGVO haben Sie folgende Rechte:",
"la_pp_r1": "Recht auf Auskunft: Sie können die in dieser Datenschutzrichtlinie gespeicherten Datentypen einsehen.",
"la_pp_r2": "Recht auf Löschung: Durch Deaktivierung der Live Activity-Funktion werden alle funktionsbezogenen Daten (Gerätekennungen, Stundenplan) sofort und dauerhaft von unseren Servern gelöscht.",
"la_pp_r3": "Recht auf Berichtigung: Stundenplan-Daten werden im Kréta-System von autorisierten Personen (z.B. Lehrern) geändert.",
"la_pp_r4": "Widerspruchsrecht: Sie können der Datenverarbeitung jederzeit widersprechen, indem Sie die Live Activity-Funktion deaktivieren.",
"la_pp_updated": "Datenschutzrichtlinie zuletzt aktualisiert: November 2025",
"la_pp_contact": "Fragen? Kontaktieren Sie uns unter support@firka.app.",
"fonts": "Schriftarten",
"font_family": "Schriftfamilie",
"calendar_sync": "Kalender-Synchronisation",

View File

@@ -1,3 +1,6 @@
import 'dart:io' show Platform;
import 'package:refilc/api/providers/liveactivity/platform_channel.dart';
import 'package:refilc/api/providers/live_card_provider.dart';
import 'package:refilc/models/settings.dart';
import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc/utils/format.dart';
@@ -10,6 +13,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:provider/provider.dart';
import 'package:refilc_mobile_ui/screens/settings/settings_screen.i18n.dart';
import 'package:refilc_mobile_ui/screens/settings/live_activity_consent_dialog.dart';
class MenuGeneralSettings extends StatelessWidget {
const MenuGeneralSettings({
@@ -123,6 +127,69 @@ class GeneralSettingsScreenState extends State<GeneralSettingsScreen> {
),
],
),
if (Platform.isIOS)
SplittedPanel(
padding: const EdgeInsets.only(top: 9.0),
cardPadding: const EdgeInsets.all(4.0),
isSeparated: true,
children: [
PanelButton(
padding: const EdgeInsets.only(left: 14.0, right: 6.0),
onPressed: () {
if (!settingsProvider.liveActivityEnabled && !settingsProvider.liveActivityConsentAccepted) {
LiveActivityConsentDialog.show(context).then((_) => setState(() {}));
return;
}
final newVal = !settingsProvider.liveActivityEnabled;
settingsProvider.update(liveActivityEnabled: newVal);
if (!newVal) {
PlatformChannel.endLiveActivity();
LiveCardProvider.serverSync.unregister();
LiveCardProvider.hasActivityStarted = false;
}
setState(() {});
},
title: Text(
"live_activity_enabled".i18n,
style: TextStyle(
color: AppColors.of(context).text.withValues(
alpha: settingsProvider.liveActivityEnabled
? .95
: .25),
),
),
leading: Icon(
FeatherIcons.activity,
size: 22.0,
color: AppColors.of(context).text.withValues(
alpha: settingsProvider.liveActivityEnabled
? .95
: .25),
),
trailing: Switch(
onChanged: (v) {
if (v && !settingsProvider.liveActivityConsentAccepted) {
LiveActivityConsentDialog.show(context).then((_) => setState(() {}));
return;
}
settingsProvider.update(liveActivityEnabled: v);
if (!v) {
PlatformChannel.endLiveActivity();
LiveCardProvider.serverSync.unregister();
LiveCardProvider.hasActivityStarted = false;
}
setState(() {});
},
value: settingsProvider.liveActivityEnabled,
activeColor: Theme.of(context).colorScheme.secondary,
),
borderRadius: const BorderRadius.vertical(
top: Radius.circular(12.0),
bottom: Radius.circular(12.0),
),
),
],
),
SplittedPanel(
padding: const EdgeInsets.only(top: 9.0),
cardPadding: const EdgeInsets.all(4.0),

View File

@@ -19,7 +19,6 @@ import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart';
import 'package:refilc_mobile_ui/common/widgets/custom_segmented_control.dart';
import 'package:refilc_mobile_ui/screens/settings/settings_helper.dart';
import 'package:refilc_mobile_ui/screens/settings/submenu/edit_subject.dart';
import 'package:refilc_mobile_ui/screens/settings/submenu/paint_list.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
@@ -418,12 +417,6 @@ class PersonalizeSettingsScreenState extends State<PersonalizeSettingsScreen>
bottom: Radius.circular(4.0),
),
),
const MenuPaintList(
borderRadius: BorderRadius.vertical(
top: Radius.circular(4.0),
bottom: Radius.circular(12.0),
),
),
],
),
// shadow toggle

View File

@@ -35,16 +35,13 @@ import 'package:refilc_mobile_ui/common/widgets/grade/new_grades.dart';
import 'package:refilc_mobile_ui/common/widgets/homework/homework_tile.dart';
// import 'package:refilc_plus/models/premium_scopes.dart';
// import 'package:refilc_plus/providers/plus_provider.dart';
import 'package:refilc_kreta_api/providers/share_provider.dart';
import 'package:refilc/ui/flutter_colorpicker/colorpicker.dart';
// import 'package:refilc_plus/ui/mobile/plus/upsell.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:provider/provider.dart';
import 'package:refilc_mobile_ui/screens/settings/submenu/share_theme_popup.dart';
import 'theme_screen.i18n.dart';
import 'package:share_plus/share_plus.dart';
class PremiumCustomAccentColorSetting extends StatefulWidget {
const PremiumCustomAccentColorSetting({super.key});
@@ -70,7 +67,6 @@ class _PremiumCustomAccentColorSettingState
extends State<PremiumCustomAccentColorSetting>
with TickerProviderStateMixin {
late final SettingsProvider settings;
late final ShareProvider shareProvider;
bool colorSelection = false;
bool customColorMenu = false;
CustomColorMode colorMode = CustomColorMode.theme;
@@ -135,7 +131,6 @@ class _PremiumCustomAccentColorSettingState
_colorsTabController = TabController(length: 4, vsync: this);
_testTabController = TabController(length: 4, vsync: this);
settings = Provider.of<SettingsProvider>(context, listen: false);
shareProvider = Provider.of<ShareProvider>(context, listen: false);
_openAnimController = AnimationController(
vsync: this, duration: const Duration(milliseconds: 750));
@@ -310,72 +305,6 @@ class _PremiumCustomAccentColorSettingState
appBar: AppBar(
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
leading: BackButton(color: AppColors.of(context).text),
actions: [
Padding(
padding: const EdgeInsets.only(right: 10.0),
child: IconButton(
focusColor: Colors.transparent,
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
onPressed: () async {
// ScaffoldMessenger.of(context).showSnackBar(
// const SnackBar(
// duration: Duration(milliseconds: 1000),
// content: Text(
// "Hamarosan...",
// ),
// ),
// );
// showDialog(
// context: context,
// builder: (context) => WillPopScope(
// onWillPop: () async => false,
// child: AlertDialog(
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(12.0)),
// title: Text("attention".i18n),
// content: Text("share_disclaimer".i18n),
// actions: [
// ActionButton(
// label: "understand".i18n,
// onTap: () async {
// Navigator.of(context).pop();
// SharedGradeColors gradeColors =
// await shareProvider
// .shareCurrentGradeColors(context);
// SharedTheme theme =
// await shareProvider.shareCurrentTheme(
// context,
// gradeColors: gradeColors,
// );
// Share.share(
// theme.id,
// subject: 'share_subj_theme'.i18n,
// );
// },
// ),
// ],
// ),
// ),
// );
if (settings.currentThemeId != '') {
Share.share(
settings.currentThemeId,
subject: 'share_subj_theme'.i18n,
);
} else {
ShareThemeDialog.show(context);
}
},
icon: const Icon(
FeatherIcons.share2,
size: 22.0,
),
),
),
],
title: Text(
"theme_prev".i18n,
style: TextStyle(color: AppColors.of(context).text),

View File

@@ -63,7 +63,10 @@ class _UserProfilePicEditorState extends State<UserProfilePicEditor> {
File? image;
Future pickImage() async {
try {
final image = await ImagePicker().pickImage(source: ImageSource.gallery);
final image = await ImagePicker().pickImage(
source: ImageSource.gallery,
requestFullMetadata: false,
);
if (image == null) return;
File imageFile = File(image.path);

View File

@@ -45,7 +45,7 @@ dependencies:
image_gallery_saver_plus: ^4.0.0
rounded_expansion_tile: ^0.0.13
flutter_expandable_fab: ^2.3.0
intl: ^0.19.0
intl: ^0.20.2
i18n_extension: ^12.0.1
auto_size_text: ^3.0.0
connectivity_plus: ^6.1.3
@@ -53,7 +53,9 @@ dependencies:
share_plus: ^10.1.4
image_picker: ^1.1.2
path_provider: ^2.1.5
image_crop_plus: ^1.0.0
image_crop_plus:
git:
url: https://github.com/wrbl606/image_crop
uuid: ^4.5.1
maps_launcher: ^3.0.0+1
google_fonts: ^6.2.1
@@ -65,11 +67,11 @@ dependencies:
flutter_portal: ^1.1.4
webview_flutter: ^4.10.0
file_picker: ^8.3.7
shake_flutter: ^17.1.0
wakelock_plus: ^1.2.10
dependency_overrides:
webview_flutter_wkwebview: 3.17.0
intl: 0.20.2
dev_dependencies:
flutter_lints: ^5.0.0

View File

@@ -21,14 +21,21 @@ dependencies:
provider: ^6.1.1
flutter_feather_icons: ^2.0.0+1
uni_links: ^0.5.1
uni_links:
git:
url: https://github.com/avioli/uni_links.git
path: "uni_links"
ref: f9de4a02ff096090c96e71baac3fe1a73209e6c3
url_launcher: ^6.2.5
dropdown_button2: ^2.3.9
home_widget: ^0.7.0+1
image_picker: ^1.0.7
animations: ^2.0.11
flutter_svg: ^2.0.10+1
flutter_dynamic_icon: ^2.1.0
flutter_dynamic_icon: # https://medium.com/@bmerdogan/flutter-3-29-deprecates-pluginregistry-registrar-migration-guide-0f206232b768
git:
url: https://github.com/yu1ro/flutter_dynamic_icon
ref: bugfix/delete_deprecation
# android_dynamic_icon: ^2.0.0
i18n_extension: ^12.0.1
http: ^1.2.0
@@ -40,6 +47,7 @@ dependencies:
dependency_overrides:
webview_flutter_wkwebview: 3.17.0
intl: 0.20.2
dev_dependencies:
flutter_lints: ^5.0.0