Compare commits

..

No commits in common. "master" and "5.0.1" have entirely different histories.

329 changed files with 10114 additions and 12635 deletions

9
.gitignore vendored
View File

@ -12,10 +12,10 @@ refilc/build/
refilc/android/key.properties refilc/android/key.properties
refilc/android/debug.keystore refilc/android/debug.keystore
# refilc_desktop_ui/.flutter-plugins refilc_desktop_ui/.flutter-plugins
# refilc_desktop_ui/.flutter-plugins-dependencies refilc_desktop_ui/.flutter-plugins-dependencies
# refilc_desktop_ui/pubspec.lock refilc_desktop_ui/pubspec.lock
# refilc_desktop_ui/.dart_tool/ refilc_desktop_ui/.dart_tool/
refilc_kreta_api/.flutter-plugins refilc_kreta_api/.flutter-plugins
refilc_kreta_api/.flutter-plugins-dependencies refilc_kreta_api/.flutter-plugins-dependencies
@ -37,7 +37,6 @@ refilc_mobile_ui/.dart_tool/
.idea .idea
.gitmodules .gitmodules
.gradle .gradle
.kotlin
refilc/.DS_Store refilc/.DS_Store
.DS_Store .DS_Store

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "naplo-plus"]
path = refilc_plus
url = git@github.com:refilc/naplo-plus.git

1286
.idea/libraries/Dart_Packages.xml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,25 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="Dart SDK"> <library name="Dart SDK">
<CLASSES> <CLASSES>
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/async" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/async" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/cli" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/cli" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/collection" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/collection" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/concurrent" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/convert" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/convert" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/core" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/core" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/developer" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/developer" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/ffi" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/ffi" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/html" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/html" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/indexed_db" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/indexed_db" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/io" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/io" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/isolate" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/isolate" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/js" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/js" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/js_util" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/js_interop" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/math" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/js_interop_unsafe" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/mirrors" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/js_util" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/svg" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/math" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/typed_data" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/mirrors" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/web_audio" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/svg" /> <root url="file:///opt/flutter/bin/cache/dart-sdk/lib/web_gl" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/typed_data" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/web_audio" />
<root url="file://P:/flutter/bin/cache/dart-sdk/lib/web_gl" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES />

1
.idea/misc.xml generated
View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Android API 33, extension level 3 Platform" project-jdk-type="Android SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Android API 33, extension level 3 Platform" project-jdk-type="Android SDK" />
</project> </project>

13
.idea/naplo.iml generated
View File

@ -60,21 +60,8 @@
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/flutter_acrylic/build" /> <excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/flutter_acrylic/build" />
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/flutter_acrylic/.pub" /> <excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/flutter_acrylic/.pub" />
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/flutter_acrylic/.dart_tool" /> <excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/flutter_acrylic/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/refilc/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/refilc/.pub" />
<excludeFolder url="file://$MODULE_DIR$/refilc/build" />
<excludeFolder url="file://$MODULE_DIR$/refilc_kreta_api/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/refilc_kreta_api/.pub" />
<excludeFolder url="file://$MODULE_DIR$/refilc_kreta_api/build" />
<excludeFolder url="file://$MODULE_DIR$/refilc_mobile_ui/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/refilc_mobile_ui/.pub" />
<excludeFolder url="file://$MODULE_DIR$/refilc_mobile_ui/build" />
<excludeFolder url="file://$MODULE_DIR$/refilc_plus/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/refilc_plus/.pub" />
<excludeFolder url="file://$MODULE_DIR$/refilc_plus/build" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
</component> </component>
</module> </module>

5
.idea/vcs.xml generated
View File

@ -2,6 +2,9 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" /> <mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/refilc_plus" vcs="Git" /> <mapping directory="$PROJECT_DIR$/filcnaplo_desktop_ui" vcs="Git" />
<mapping directory="$PROJECT_DIR$/filcnaplo_kreta_api" vcs="Git" />
<mapping directory="$PROJECT_DIR$/filcnaplo_mobile_ui" vcs="Git" />
<mapping directory="$PROJECT_DIR$/filcnaplo_premium" vcs="Git" />
</component> </component>
</project> </project>

56
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,56 @@
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'
}
}
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'
}
}
stage('Archive') {
steps {
// Archive the APK
archiveArtifacts artifacts: 'build/app/outputs/flutter-apk/app-release.apk', fingerprint: true
}
}
}
post {
always {
// Clean up workspace after build
cleanWs()
}
}
}

119
README.md
View File

@ -1,67 +1,52 @@
<p align=center> <p align=center>
<img src="https://raw.githubusercontent.com/Laky2k8/Refilc-2-Episode-1/refs/heads/master/refilc-2-real.png" width=150> <img src="https://refilc.hu/image/brand/logo.png" width=150>
<h1 align=center><b>reFilc</b></h1> <h1 align=center><b>reFilc</b></h1>
</p> </p>
#### Nem hivatalos e-napló alkalmazás az e-KRÉTA rendszerhez - tanulóktól, tanulóknak. #### Nem hivatalos e-napló alkalmazás az e-KRÉTA rendszerhez - tanulóktól, tanulóknak.
[![Downloads](https://img.shields.io/github/downloads-pre/refilc/naplo/total?&logo=github&label=Downloads)](https://github.com/refilc/naplo/releases) &nbsp; [![Discord](https://img.shields.io/discord/1111649116020285532?logo=discord&label=Discord)](https://discord.gg/refilc-1111649116020285532) [![Downloads](https://img.shields.io/github/downloads-pre/refilc/naplo/total?&logo=github&label=Downloads)](https://github.com/refilc/naplo/releases) &nbsp; [![Discord](https://img.shields.io/discord/1111649116020285532?logo=discord&label=Discord)](https://dc.refilc.hu)
## Környezet felállítása ## Setup
### Source code letöltése ### Clone the project
*Az építhéshez szükséged lesz a refilc_plus repora is, amit itt találsz: [student-plus](https://git.qwit.cloud/refilc/student-plus)* <em>A teljes source eléréséhez szükséged lesz a naplo-plus repo-ra is, mely biztonsági okokból privát. Írj Discord szerverünkön, hogy kaphass hozzáférést.</em>
```sh ```sh
git clone https://git.qwit.cloud/refilc/student-legacy.git --recursive git clone --branch dev https://github.com/refilc/naplo --recursive
cd naplo cd naplo
# ha ez nem töltött le refilc plus repoba értelmes dolgokat futtasd a többi parancsot is ```
rm -rf refilc_plus
git clone https://git.qwit.cloud/refilc/student-plus.git refilc_plus ### Install packages
```
Run `fix-pub.sh`
### Csomagok telepítése
### Run the app
Menj be minden mappába és futtasd a következő parancsokat:
```sh ```sh
flutter clean cd refilc
flutter pub get flutter run (--release)
``` ```
### Alkalmazás építése ### Contribution
```sh **Nézd meg a [Contribution guide](CONTRIBUTING.md)-ot!**
cd refilc
flutter build apk --release Az összes (ugyan azon verzióhoz tartozó) contribution meg fog jelenni a release-nél. Kérjük, írd le a Discord nevedet a Description-be, hogy adhassunk rangot.
```
-------
*Ez egy apk fájlt fog építeni*
# Team
### Contribution
**kima:** head developer / project manager
**Nézd meg a [Contribution guide](CONTRIBUTING.md)-ot!**
**Reiner, pdf, Pearoo, Zizi:** community- and project manager / developer
Az összes (ugyan azon verzióhoz tartozó) contribution meg fog jelenni a release-nél. Kérjük, írd le a Discord nevedet a Description-be, hogy adhassunk rangot.
**vrolandd, TMarccci:** head developer
-------
**dwe., xou:** designer
# Csapatunk
**Péter:** video editor
**Management**
- Zypherift <em>**annon:** a régi Filc Napló fejlesztője (ez az app, ha bár sokban változott, alapjaiban a Filc-re épül)</em>
- hayn
- Pearoo
- Zizi
- mnus
- xou
**Designerek**
- dwe
- xou
**vrolandd, TMarccci:** head developer
**Péter:** video editor
***annon:** a régi Filc Napló fejlesztője (ez az app, ha bár sokban változott, alapjaiban a Filc-re épül)*

View File

@ -1,7 +0,0 @@
cd refilc && flutter pub outdated && cd ..
cd refilc_kreta_api && flutter pub outdated && cd ..
cd refilc_mobile_ui && flutter pub outdated && cd ..
# cd refilc_desktop_ui && flutter pub upgrade && cd ..
cd refilc_plus && flutter pub outdated && cd ..
echo Outdated version list above.

View File

@ -1,7 +0,0 @@
cd refilc && flutter pub upgrade --major-versions && cd ..
cd refilc_kreta_api && flutter pub upgrade --major-versions && cd ..
cd refilc_mobile_ui && flutter pub upgrade --major-versions && cd ..
# cd refilc_desktop_ui && flutter pub upgrade && cd ..
cd refilc_plus && flutter pub upgrade --major-versions && cd ..
echo "Upgraded pub (major)."

2
refilc/.gitignore vendored
View File

@ -5,11 +5,9 @@
*.swp *.swp
.DS_Store .DS_Store
.atom/ .atom/
.build/
.buildlog/ .buildlog/
.history .history
.svn/ .svn/
.swiftpm/
migrate_working_dir/ migrate_working_dir/
# IntelliJ related # IntelliJ related

View File

@ -1 +0,0 @@
*.jks

View File

@ -39,23 +39,8 @@ def debugKeystoreProperties = new Properties()
def debugKeystorePropertiesFile = rootProject.file("debugkey.properties") def debugKeystorePropertiesFile = rootProject.file("debugkey.properties")
debugKeystoreProperties.load(new FileInputStream(debugKeystorePropertiesFile)) debugKeystoreProperties.load(new FileInputStream(debugKeystorePropertiesFile))
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (!hasProperty('namespace') || namespace == null || namespace.isEmpty()) {
// Assign a default namespace based on the project name or group
namespace = project.group.toString() ?: "com.example.${project.name}"
}
}
}
}
}
android { android {
namespace = "hu.refilc.naplo" ndkVersion "25.1.8937393"
ndkVersion "27.2.12479018"
// compileSdkVersion rootProject.ext.compileSdkVersion // compileSdkVersion rootProject.ext.compileSdkVersion
compileSdkVersion 34 compileSdkVersion 34
@ -73,7 +58,7 @@ android {
defaultConfig { defaultConfig {
applicationId "hu.refilc.naplo" applicationId "hu.refilc.naplo"
minSdkVersion 24 minSdkVersion 21
targetSdkVersion 34 targetSdkVersion 34
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
@ -82,19 +67,11 @@ android {
} }
compileOptions { compileOptions {
// Flag to enable support for the new language APIs // Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8 // Sets Java compatibility to Java 8
// sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
// targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
// sourceCompatibility JavaVersion.VERSION_21
// targetCompatibility JavaVersion.VERSION_21
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
} }
signingConfigs { signingConfigs {
@ -120,13 +97,7 @@ android {
release { release {
signingConfig signingConfigs.release signingConfig signingConfigs.release
shrinkResources true shrinkResources false
minifyEnabled true
debuggable false
jniDebuggable false
renderscriptDebuggable false
pseudoLocalesEnabled false
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
} }
@ -146,7 +117,7 @@ dependencies {
implementation 'joda-time:joda-time:2.9.4' implementation 'joda-time:joda-time:2.9.4'
androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation 'androidx.window:window:1.0.0' implementation 'androidx.window:window:1.0.0'
implementation 'androidx.window:window-java:1.0.0' implementation 'androidx.window:window-java:1.0.0'
} }

View File

@ -8,9 +8,4 @@
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args -dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error -dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter -dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider -dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider
-dontwarn org.joda.convert.FromString
-dontwarn org.joda.convert.ToString
#-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

View File

@ -2,6 +2,9 @@
xmlns:tools="http://schemas.android.com/tools" package="hu.refilc.naplo"> xmlns:tools="http://schemas.android.com/tools" package="hu.refilc.naplo">
<application android:name="${applicationName}" android:label="reFilc" tools:replace="android:label" android:icon="@mipmap/ic_launcher" <application android:name="${applicationName}" android:label="reFilc" tools:replace="android:label" android:icon="@mipmap/ic_launcher"
android:requestLegacyExternalStorage="true" android:enableOnBackInvokedCallback="false"> android:requestLegacyExternalStorage="true" android:enableOnBackInvokedCallback="false">
<service
android:name="com.solusibejo.flutter_dynamic_icon_plus.FlutterDynamicIconPlusService"
android:stopWithTask="false"/>
<activity android:exported="true" android:name="hu.refilc.naplo.MainActivity" <activity android:exported="true" android:name="hu.refilc.naplo.MainActivity"
android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:launchMode="singleTop" android:theme="@style/LaunchTheme"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 B

After

Width:  |  Height:  |  Size: 69 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 B

After

Width:  |  Height:  |  Size: 69 B

View File

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/> <background android:drawable="@color/ic_launcher_background"/>
<foreground> <foreground android:drawable="@drawable/ic_launcher_foreground"/>
<inset
android:drawable="@drawable/ic_launcher_foreground"
android:inset="16%" />
</foreground>
</adaptive-icon> </adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -6,7 +6,7 @@
<item name="android:windowFullscreen">false</item> <item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item> <item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item> <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowSplashScreenBackground">#7CA021</item> <item name="android:windowSplashScreenBackground">#03112D</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item> <item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
</style> </style>
<!-- Theme applied to the Android Window as soon as the process has started. <!-- Theme applied to the Android Window as soon as the process has started.

View File

@ -6,7 +6,7 @@
<item name="android:windowFullscreen">false</item> <item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item> <item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item> <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowSplashScreenBackground">#7CA021</item> <item name="android:windowSplashScreenBackground">#03112D</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item> <item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
</style> </style>
<!-- Theme applied to the Android Window as soon as the process has started. <!-- Theme applied to the Android Window as soon as the process has started.

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="ic_launcher_background">#7CA021</color> <color name="ic_launcher_background">#03112D</color>
<color name="purple_200">#FFBB86FC</color> <color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color> <color name="purple_500">#FF6200EE</color>
@ -66,4 +66,4 @@
<color name="pink_shade300">#FFF06292</color> <color name="pink_shade300">#FFF06292</color>
<color name="purple_shade300">#FFBA68C8</color> <color name="purple_shade300">#FFBA68C8</color>
<color name="teal_shade300">#FF22AC9B</color> <color name="teal_shade300">#FF22AC9B</color>
</resources> </resources>

View File

@ -1,4 +1,8 @@
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError org.gradle.jvmargs=-Xmx1536M \
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens=java.base/java.lang=ALL-UNNAMED \
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens=java.base/java.io=ALL-UNNAMED \
--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
# kotlin.jvm.target.validation.mode=IGNORE

View File

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

View File

@ -24,8 +24,8 @@ pluginManagement {
plugins { plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0" 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 "7.1.1" apply false
id "org.jetbrains.kotlin.android" version "2.0.21" apply false id "org.jetbrains.kotlin.android" version "1.8.21" apply false
} }
include ":app" include ":app"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 696 KiB

After

Width:  |  Height:  |  Size: 364 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 KiB

After

Width:  |  Height:  |  Size: 581 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1009 KiB

After

Width:  |  Height:  |  Size: 982 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 549 KiB

After

Width:  |  Height:  |  Size: 330 KiB

2
refilc/build.sh Executable file → Normal file
View File

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
flutter build apk --release --tree-shake-icons --split-debug-info=debug-info --split-per-abi --target-platform android-arm,android-arm64 --obfuscate flutter build apk --release --dart-define=APPVER=$(cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1) --no-tree-shake-icons

View File

@ -43,21 +43,4 @@ post_install do |installer|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end 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 end

View File

@ -517,11 +517,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 283; CURRENT_PROJECT_VERSION = 257;
DEVELOPMENT_TEAM = 4J97JVC2FG; DEVELOPMENT_TEAM = 4DKAF249F3;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FLUTTER_BUILD_NAME = 5.1.1;
FLUTTER_BUILD_NUMBER = 283;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = reFilc; INFOPLIST_KEY_CFBundleDisplayName = reFilc;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education";
@ -529,8 +527,8 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 5.1.1; MARKETING_VERSION = 5.0.0;
PRODUCT_BUNDLE_IDENTIFIER = hu.qwit.refilc; PRODUCT_BUNDLE_IDENTIFIER = com.refilc2.naplo;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
@ -551,8 +549,8 @@
CODE_SIGN_ENTITLEMENTS = livecard/livecard.entitlements; CODE_SIGN_ENTITLEMENTS = livecard/livecard.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 283; CURRENT_PROJECT_VERSION = 257;
DEVELOPMENT_TEAM = 4J97JVC2FG; DEVELOPMENT_TEAM = 4DKAF249F3;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = livecard/Info.plist; INFOPLIST_FILE = livecard/Info.plist;
@ -565,10 +563,10 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 5.1.1; MARKETING_VERSION = 5.0.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = hu.qwit.refilc.livecard; PRODUCT_BUNDLE_IDENTIFIER = com.refilc2.naplo.livecardpro;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
@ -593,8 +591,8 @@
CODE_SIGN_ENTITLEMENTS = livecard/livecard.entitlements; CODE_SIGN_ENTITLEMENTS = livecard/livecard.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 283; CURRENT_PROJECT_VERSION = 257;
DEVELOPMENT_TEAM = 4J97JVC2FG; DEVELOPMENT_TEAM = 4DKAF249F3;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = livecard/Info.plist; INFOPLIST_FILE = livecard/Info.plist;
@ -607,9 +605,9 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 5.1.1; MARKETING_VERSION = 5.0.0;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = hu.qwit.refilc.livecard; PRODUCT_BUNDLE_IDENTIFIER = com.refilc2.naplo.livecardpro;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
@ -633,8 +631,8 @@
CODE_SIGN_ENTITLEMENTS = livecard/livecard.entitlements; CODE_SIGN_ENTITLEMENTS = livecard/livecard.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 283; CURRENT_PROJECT_VERSION = 257;
DEVELOPMENT_TEAM = 4J97JVC2FG; DEVELOPMENT_TEAM = 4DKAF249F3;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = livecard/Info.plist; INFOPLIST_FILE = livecard/Info.plist;
@ -647,9 +645,9 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 5.1.1; MARKETING_VERSION = 5.0.0;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = hu.qwit.refilc.livecard; PRODUCT_BUNDLE_IDENTIFIER = com.refilc2.naplo.livecardpro;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
@ -777,11 +775,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 283; CURRENT_PROJECT_VERSION = 257;
DEVELOPMENT_TEAM = 4J97JVC2FG; DEVELOPMENT_TEAM = 4DKAF249F3;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FLUTTER_BUILD_NAME = 5.1.1;
FLUTTER_BUILD_NUMBER = 283;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = reFilc; INFOPLIST_KEY_CFBundleDisplayName = reFilc;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education";
@ -789,8 +785,8 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 5.1.1; MARKETING_VERSION = 5.0.0;
PRODUCT_BUNDLE_IDENTIFIER = hu.qwit.refilc; PRODUCT_BUNDLE_IDENTIFIER = com.refilc2.naplo;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@ -807,11 +803,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 283; CURRENT_PROJECT_VERSION = 257;
DEVELOPMENT_TEAM = 4J97JVC2FG; DEVELOPMENT_TEAM = 4DKAF249F3;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FLUTTER_BUILD_NAME = 5.1.1;
FLUTTER_BUILD_NUMBER = 283;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = reFilc; INFOPLIST_KEY_CFBundleDisplayName = reFilc;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education";
@ -819,8 +813,8 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 5.1.1; MARKETING_VERSION = 5.0.0;
PRODUCT_BUNDLE_IDENTIFIER = hu.qwit.refilc; PRODUCT_BUNDLE_IDENTIFIER = com.refilc2.naplo;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;

View File

@ -12,7 +12,7 @@
<key>livecard.xcscheme_^#shared#^_</key> <key>livecard.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>86</integer> <integer>83</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>

View File

@ -3,7 +3,7 @@ import background_fetch
import ActivityKit import ActivityKit
import Flutter import Flutter
@main @UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate { @objc class AppDelegate: FlutterAppDelegate {
private var methodChannel: FlutterMethodChannel? private var methodChannel: FlutterMethodChannel?

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 B

After

Width:  |  Height:  |  Size: 69 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View File

@ -38,7 +38,7 @@
</scene> </scene>
</scenes> </scenes>
<resources> <resources>
<image name="LaunchImage" width="2700" height="2700"/> <image name="LaunchImage" width="1700" height="1700"/>
<image name="LaunchBackground" width="1" height="1"/> <image name="LaunchBackground" width="1" height="1"/>
</resources> </resources>
</document> </document>

View File

@ -1,138 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.transistorsoft.refilcnotification</string>
<string>com.transistorsoft.refilcliveactivity</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleAlternateIcons</key>
<dict> <dict>
<key>BGTaskSchedulerPermittedIdentifiers</key> <key>refilc_concept</key>
<array>
<string>com.transistorsoft.refilcnotification</string>
<string>com.transistorsoft.refilcliveactivity</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleAlternateIcons</key>
<dict> <dict>
<key>refilc_concept</key> <key>CFBundleIconFiles</key>
<dict> <array>
<key>CFBundleIconFiles</key> <string>refilc_concept</string>
<array> </array>
<string>refilc_concept</string> <key>UIPrerenderedIcon</key>
</array> <false/>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>refilc_default</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>refilc_default</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>refilc_overcomplicated</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>refilc_overcomplicated</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>refilc_pride</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>refilc_pride</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict> </dict>
<key>CFBundleDevelopmentRegion</key> <key>refilc_default</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIcons</key>
<dict> <dict>
<key>CFBundlePrimaryIcon</key> <key>CFBundleIconFiles</key>
<dict> <array>
<key>CFBundleIconFiles</key> <string>refilc_default</string>
<array> </array>
<string></string> <key>UIPrerenderedIcon</key>
</array> <false/>
<key>CFBundleIconName</key> </dict>
<string></string> <key>refilc_overcomplicated</key>
<key>UIPrerenderedIcon</key> <dict>
<false/> <key>CFBundleIconFiles</key>
</dict> <array>
<string>refilc_overcomplicated</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>refilc_pride</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>refilc_pride</string>
</array>
<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>reFilc</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>refilcapp</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> </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>reFilc</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>refilcapp</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> </plist>

View File

@ -1,44 +1,40 @@
import Foundation import Foundation
import ActivityKit
public struct LessonData { public struct LessonData {
var color: String var color: String
var icon: String var icon: String
var index: String var index: String
var title: String var title: String
var subtitle: String var subtitle: String
var description: String var description: String
var startDate: Date var startDate: Date
var endDate: Date var endDate: Date
var date: ClosedRange<Date> var date: ClosedRange<Date>
var nextSubject: String var nextSubject: String
var nextRoom: String var nextRoom: String
init(from dictionary: [String: Any]) {
self.color = dictionary["color"] as? String ?? ""
self.icon = dictionary["icon"] as? String ?? ""
self.index = dictionary["index"] as? String ?? ""
self.title = dictionary["title"] as? String ?? ""
self.subtitle = dictionary["subtitle"] as? String ?? ""
self.description = dictionary["description"] as? String ?? ""
self.nextSubject = dictionary["nextSubject"] as? String ?? ""
self.nextRoom = dictionary["nextRoom"] as? String ?? ""
if let startDateStr = dictionary["startDate"] as? String, let startDateInt = Int(startDateStr) { init(from dictionary: [String: Any]) {
self.startDate = Date(timeIntervalSince1970: TimeInterval(startDateInt) / 1000) self.color = dictionary["color"] as? String ?? ""
} else { self.icon = dictionary["icon"] as? String ?? ""
self.startDate = Date() self.index = dictionary["index"] as? String ?? ""
} self.title = dictionary["title"] as? String ?? ""
self.subtitle = dictionary["subtitle"] as? String ?? ""
self.description = dictionary["description"] as? String ?? ""
self.nextSubject = dictionary["nextSubject"] as? String ?? ""
self.nextRoom = dictionary["nextRoom"] as? String ?? ""
if let endDateStr = dictionary["endDate"] as? String, let endDateInt = Int(endDateStr) { if let startDateStr = dictionary["startDate"] as? String, let startDateInt = Int(startDateStr) {
self.endDate = Date(timeIntervalSince1970: TimeInterval(endDateInt) / 1000) self.startDate = Date(timeIntervalSince1970: TimeInterval(startDateInt) / 1000)
} else { } else {
self.endDate = self.startDate self.startDate = Date()
}
if let endDateStr = dictionary["endDate"] as? String, let endDateInt = Int(endDateStr) {
self.endDate = Date(timeIntervalSince1970: TimeInterval(endDateInt) / 1000)
} else {
self.endDate = Date()
}
date = self.startDate...self.endDate
} }
if self.startDate <= self.endDate {
self.date = self.startDate...self.endDate
} else {
self.date = self.endDate...self.endDate
}
}
} }

View File

@ -11,17 +11,6 @@ struct Widgets: WidgetBundle {
} }
} }
// text contrast background
extension Text {
func getContrastText(backgroundColor: Color) -> some View {
var r, g, b, a: CGFloat
(r, g, b, a) = (0, 0, 0, 0)
UIColor(backgroundColor).getRed(&r, green: &g, blue: &b, alpha: &a)
let luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b
return luminance < 0.6 ? self.foregroundColor(.white) : self.foregroundColor(.black)
}
}
// Color Converter // Color Converter
extension Color { extension Color {
init(hex: String, alpha: Double = 1.0) { init(hex: String, alpha: Double = 1.0) {
@ -73,12 +62,21 @@ struct LockScreenLiveActivityView: View {
.font(.body) .font(.body)
.bold() .bold()
.padding(.trailing, 90) .padding(.trailing, 90)
} else { } else {
MultilineTextView(text: "\(context.state.index) \(context.state.title) - \(context.state.subtitle)", limit: 25) MultilineTextView(text: "\(context.state.index) \(context.state.title)", limit: 25)
.font(.body) .font(.body)
.bold() .bold()
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
} }
//Terem
if (!context.state.subtitle.isEmpty) {
Text(context.state.subtitle)
.italic()
.bold()
.font(.system(size: 13))
}
} }
// Leírás // Leírás
@ -94,9 +92,10 @@ struct LockScreenLiveActivityView: View {
.resizable() .resizable()
.aspectRatio(contentMode: .fit) .aspectRatio(contentMode: .fit)
.frame(width: CGFloat(8), height: CGFloat(8)) .frame(width: CGFloat(8), height: CGFloat(8))
.foregroundStyle(.secondary) Text(context.state.nextSubject)
Text("\(context.state.nextSubject) - \(context.state.nextRoom)")
.font(.caption) .font(.caption)
Text(context.state.nextRoom)
.font(.caption2)
} }
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
} else { } else {
@ -118,15 +117,11 @@ struct LockScreenLiveActivityView: View {
.monospacedDigit() .monospacedDigit()
.padding(.trailing) .padding(.trailing)
} }
// .activityBackgroundTint(
// context.state.color != "#676767"
// ? Color(hex: context.state.color)
// : Color.clear
// )
.activityBackgroundTint( .activityBackgroundTint(
Color.clear context.state.color != "#676767"
? Color(hex: context.state.color)
: Color.clear
) )
.foregroundStyle(Color(hex: context.state.color))
} }
} }
@ -202,23 +197,33 @@ struct LiveCardWidget: Widget {
} else { } else {
// Amikor óra van, expanded DynamicIsland // Amikor óra van, expanded DynamicIsland
MultilineTextView(text: "\(context.state.index) \(context.state.title) - \(context.state.subtitle)", limit: 25) MultilineTextView(text: "\(context.state.index) \(context.state.title)", limit: 25)
.lineLimit(1) .lineLimit(1)
.font(.body) .font(.body)
.bold() .bold()
.padding(.trailing, -35) .padding(.trailing, -35)
Spacer(minLength: 2) Text(context.state.subtitle)
.lineLimit(1)
.italic()
.bold()
.font(.system(size: 13))
.padding(.trailing, -50)
Spacer(minLength: 5)
if(context.state.nextRoom != "" && context.state.nextSubject != "") { if(context.state.nextRoom != "" && context.state.nextSubject != "") {
Text("Következő óra és terem:") Text("Következő óra és terem:")
.font(.system(size: 14)) .font(.system(size: 14))
.padding(.trailing, -45) .padding(.trailing, -35)
Spacer(minLength: 2) Spacer(minLength: 2)
Text(context.state.nextSubject)
Text("\(context.state.nextSubject) - \(context.state.nextRoom)") .modifier(DynamicFontSizeModifier(text: context.state.nextSubject))
.modifier(DynamicFontSizeModifier(text: "\(context.state.nextSubject) - \(context.state.nextRoom)")) .padding(.trailing, -35)
.padding(.trailing, 35) Text(context.state.nextRoom)
// ignore: based on nextSubject characters, I check that the font size of the room is the same as the next subject.
.modifier(DynamicFontSizeModifier(text: context.state.nextSubject))
.padding(.trailing, -35)
} else { } else {
Text("Ez az utolsó óra! Kitartást!") Text("Ez az utolsó óra! Kitartást!")
.font(.system(size: 14)) .font(.system(size: 14))
@ -322,66 +327,3 @@ struct DynamicFontSizeModifier: ViewModifier {
} }
} }
} }
struct LiveCardWidget_Previews: PreviewProvider {
static let attributes = LiveActivitiesAppAttributes()
static let duringLessonExmaple = LiveActivitiesAppAttributes.ContentState(
color: "#FF5733",
icon: "bell",
index: "1.",
title: "Math Class",
subtitle: "101",
description: "Algebra lesson",
startDate: Date(),
endDate: Date().addingTimeInterval(3000),
date: Date()...Date().addingTimeInterval(3000), // 50 minutes later
nextSubject: "Physics",
nextRoom: "102"
)
static let inBreak = LiveActivitiesAppAttributes.ContentState(
color: "#FF5733",
icon: "house",
index: "",
title: "Szünet",
subtitle: "Menj a(z) 122 terembe.",
description: "",
startDate: Date(),
endDate: Date().addingTimeInterval(3000),
date: Date()...Date().addingTimeInterval(3000), // 50 minutes later
nextSubject: "Physics",
nextRoom: "122"
)
static let lastLesson = LiveActivitiesAppAttributes.ContentState(
color: "#00ff00",
icon: "bell",
index: "6.",
title: "Math Class",
subtitle: "",
description: "Lorem Ipsum",
startDate: Date(),
endDate: Date().addingTimeInterval(3000),
date: Date()...Date().addingTimeInterval(3000), // 50 minutes later
nextSubject: "",
nextRoom: ""
)
static var previews: some View {
// Dynamic Island Compact
Group {
attributes
.previewContext(duringLessonExmaple, viewKind: .dynamicIsland(.compact))
.previewDisplayName("During Lesson")
attributes
.previewContext(inBreak, viewKind: .dynamicIsland(.compact))
.previewDisplayName("In Break")
attributes
.previewContext(lastLesson, viewKind: .dynamicIsland(.compact))
.previewDisplayName("During Last Lesson")
}
}
}

View File

@ -18,51 +18,45 @@ import 'package:connectivity_plus/connectivity_plus.dart';
class FilcAPI { class FilcAPI {
// API base // API base
static const baseUrl = "https://api.refilcapp.hu"; static const baseUrl = "https://api.refilc.hu";
// Public API // Public API
static const schoolList = "https://api.refilcapp.hu/v3/public/school-list"; static const schoolList = "$baseUrl/v3/public/school-list";
static const news = "https://staticrf-api.pages.dev/news/index.json"; static const news = "$baseUrl/v3/public/news";
static const supporters = "0.0.0.0"; static const supporters = "$baseUrl/v3/public/supporters";
// Private API // Private API
static const ads = "0.0.0.0"; static const ads = "$baseUrl/v3/private/ads";
static const config = "$baseUrl/v3/private/config"; static const config = "$baseUrl/v3/private/config";
static const reportApi = "$baseUrl/v3/private/crash-report"; static const reportApi = "$baseUrl/v3/private/crash-report";
static const rfPlus = "0.0.0.0"; static const rfPlus = "$baseUrl/v3/rf-plus";
static const plusAuthLogin = "0.0.0.0"; static const plusAuthLogin = "$rfPlus/auth/login";
static const plusAuthCallback = "0.0.0.0"; static const plusAuthCallback = "$rfPlus/auth/callback";
static const plusActivation = "0.0.0.0"; static const plusActivation = "$rfPlus/activate";
static const plusScopes = "0.0.0.0/"; static const plusScopes = "$rfPlus/scopes";
// Updates // Updates
static const repo = "refilc/naplo"; static const repo = "refilc/naplo";
static const releases = "https://api.github.com/repos/$repo/releases"; static const releases = "https://api.github.com/repos/$repo/releases";
// Share API // Share API
static const themeShare = "https://api.refilcapp.hu/v3/shared/theme/add"; static const themeShare = "$baseUrl/v3/shared/theme/add";
static const themeGet = "https://api.refilcapp.hu/v3/shared/theme/get"; static const themeGet = "$baseUrl/v3/shared/theme/get";
static const allThemes = "$themeGet/all"; static const allThemes = "$themeGet/all";
static const themeByID = "$themeGet/"; static const themeByID = "$themeGet/";
static const gradeColorsShare = "https://api.refilcapp.hu/v3/shared/grade-colors/add"; static const gradeColorsShare = "$baseUrl/v3/shared/grade-colors/add";
static const gradeColorsGet = "https://api.refilcapp.hu/v3/shared/grade-colors/get"; static const gradeColorsGet = "$baseUrl/v3/shared/grade-colors/get";
static const allGradeColors = "$gradeColorsGet/all"; static const allGradeColors = "$gradeColorsGet/all";
static const gradeColorsByID = "$gradeColorsGet/"; static const gradeColorsByID = "$gradeColorsGet/";
// Payment API // Payment API
static const payment = "0.0.0.0"; static const payment = "$baseUrl/v3/payment";
static const stripeSheet = "0.0.0.0"; static const stripeSheet = "$payment/stripe-sheet";
// Cloud Sync
// cloud sync? for what reason
static const cloudSyncApi = "0.0.0.0";
static Future<bool> checkConnectivity() async => static Future<bool> checkConnectivity() async =>
(await Connectivity().checkConnectivity())[0] != ConnectivityResult.none; (await Connectivity().checkConnectivity()) != ConnectivityResult.none;
// nem tudom nem vazar-e senkit se, de mar ertelmetlen ez
static Future<List<School>?> getSchools() async { static Future<List<School>?> getSchools() async {
try { try {
http.Response res = await http.get(Uri.parse(schoolList)); http.Response res = await http.get(Uri.parse(schoolList));
@ -72,6 +66,16 @@ class FilcAPI {
.cast<Map>() .cast<Map>()
.map((json) => School.fromJson(json)) .map((json) => School.fromJson(json))
.toList(); .toList();
schools.add(School(
city: "Stockholm",
instituteCode: "refilc-test-sweden",
name: "reFilc Test SE - Leo Ekström High School",
));
schools.add(School(
city: "Madrid",
instituteCode: "refilc-test-spain",
name: "reFilc Test ES - Emilio Obrero University",
));
return schools; return schools;
} else { } else {
throw "HTTP ${res.statusCode}: ${res.body}"; throw "HTTP ${res.statusCode}: ${res.body}";
@ -89,12 +93,10 @@ class FilcAPI {
"x-filc-id": settings.xFilcId, "x-filc-id": settings.xFilcId,
"user-agent": userAgent, "user-agent": userAgent,
// platform things // platform things
"rf-platform": "rf-platform": Platform.operatingSystem,
settings.analyticsEnabled ? Platform.operatingSystem : "unknown", "rf-platform-version": Platform.operatingSystemVersion,
"rf-platform-version": settings.analyticsEnabled "rf-app-version":
? Platform.operatingSystemVersion const String.fromEnvironment("APPVER", defaultValue: "?"),
: "unknown",
"rf-app-version": const String.fromEnvironment("APPVER", defaultValue: "?"),
"rf-uinid": settings.xFilcId, "rf-uinid": settings.xFilcId,
}; };
@ -125,8 +127,7 @@ class FilcAPI {
http.Response res = await http.get(Uri.parse(news)); http.Response res = await http.get(Uri.parse(news));
if (res.statusCode == 200) { if (res.statusCode == 200) {
String utf8Body = utf8.decode(res.bodyBytes); return (jsonDecode(res.body) as List)
return (jsonDecode(utf8Body) as List)
.cast<Map>() .cast<Map>()
.map((e) => News.fromJson(e)) .map((e) => News.fromJson(e))
.toList(); .toList();
@ -230,7 +231,7 @@ class FilcAPI {
} }
// sharing // sharing
static Future<int> addSharedTheme(SharedTheme theme) async { static Future<void> addSharedTheme(SharedTheme theme) async {
try { try {
theme.json.remove('json'); theme.json.remove('json');
theme.json['is_public'] = theme.isPublic.toString(); theme.json['is_public'] = theme.isPublic.toString();
@ -262,19 +263,13 @@ class FilcAPI {
headers: {'Content-Type': 'application/x-www-form-urlencoded'}, headers: {'Content-Type': 'application/x-www-form-urlencoded'},
); );
// if (res.statusCode != 201) { if (res.statusCode != 201) {
// throw "HTTP ${res.statusCode}: ${res.body}"; throw "HTTP ${res.statusCode}: ${res.body}";
// }
if (res.statusCode == 201) {
log('Shared theme successfully with ID: ${theme.id}');
} }
return res.statusCode; log('Shared theme successfully with ID: ${theme.id}');
} on Exception catch (error, stacktrace) { } on Exception catch (error, stacktrace) {
log("ERROR: FilcAPI.addSharedTheme: $error $stacktrace"); log("ERROR: FilcAPI.addSharedTheme: $error $stacktrace");
return 696;
} }
} }
@ -308,7 +303,8 @@ class FilcAPI {
return null; return null;
} }
static Future<int> addSharedGradeColors(SharedGradeColors gradeColors) async { static Future<void> addSharedGradeColors(
SharedGradeColors gradeColors) async {
try { try {
gradeColors.json.remove('json'); gradeColors.json.remove('json');
gradeColors.json['is_public'] = gradeColors.isPublic.toString(); gradeColors.json['is_public'] = gradeColors.isPublic.toString();
@ -324,19 +320,13 @@ class FilcAPI {
headers: {'Content-Type': 'application/x-www-form-urlencoded'}, headers: {'Content-Type': 'application/x-www-form-urlencoded'},
); );
// if (res.statusCode != 201) { if (res.statusCode != 201) {
// throw "HTTP ${res.statusCode}: ${res.body}"; throw "HTTP ${res.statusCode}: ${res.body}";
// }
if (res.statusCode == 201) {
log('Shared grade colors successfully with ID: ${gradeColors.id}');
} }
return res.statusCode; log('Shared grade colors successfully with ID: ${gradeColors.id}');
} on Exception catch (error, stacktrace) { } on Exception catch (error, stacktrace) {
log("ERROR: FilcAPI.addSharedGradeColors: $error $stacktrace"); log("ERROR: FilcAPI.addSharedGradeColors: $error $stacktrace");
return 696;
} }
} }
@ -385,11 +375,6 @@ class FilcAPI {
return null; return null;
} }
// cloud sync
static Future<Map?> cloudSync(Map<String, String> data, String token) async {
return null;
}
} }
class ErrorReport { class ErrorReport {

View File

@ -1,6 +1,5 @@
// ignore_for_file: avoid_print, use_build_context_synchronously // ignore_for_file: avoid_print, use_build_context_synchronously
import 'package:flutter/foundation.dart';
import 'package:refilc/utils/jwt.dart'; import 'package:refilc/utils/jwt.dart';
import 'package:refilc_kreta_api/models/school.dart'; import 'package:refilc_kreta_api/models/school.dart';
import 'package:refilc_kreta_api/providers/absence_provider.dart'; import 'package:refilc_kreta_api/providers/absence_provider.dart';
@ -65,12 +64,8 @@ Future loginAPI({
parents: ['Teszt András', 'Teszt Linda'], parents: ['Teszt András', 'Teszt Linda'],
json: {"a": "b"}, json: {"a": "b"},
address: '1117 Budapest, Gábor Dénes utca 4.', address: '1117 Budapest, Gábor Dénes utca 4.',
gradeDelay: 0,
), ),
role: Role.parent, role: Role.parent,
accessToken: '',
accessTokenExpire: DateTime.now(),
refreshToken: '',
); );
if (onLogin != null) onLogin(user); if (onLogin != null) onLogin(user);
@ -112,9 +107,7 @@ Future loginAPI({
default: default:
// normal login from here // normal login from here
Provider.of<KretaClient>(context, listen: false).userAgent = Provider.of<KretaClient>(context, listen: false).userAgent =
Provider.of<SettingsProvider>(context, listen: false) Provider.of<SettingsProvider>(context, listen: false).config.userAgent;
.config
.userAgent;
Map<String, String> headers = { Map<String, String> headers = {
"content-type": "application/x-www-form-urlencoded", "content-type": "application/x-www-form-urlencoded",
@ -134,7 +127,6 @@ Future loginAPI({
password: password, password: password,
instituteCode: instituteCode, instituteCode: instituteCode,
)); ));
if (res != null) { if (res != null) {
if (res.containsKey("error")) { if (res.containsKey("error")) {
if (res["error"] == "invalid_grant") { if (res["error"] == "invalid_grant") {
@ -156,9 +148,6 @@ Future loginAPI({
name: student.name, name: student.name,
student: student, student: student,
role: JwtUtils.getRoleFromJWT(res["access_token"])!, role: JwtUtils.getRoleFromJWT(res["access_token"])!,
accessToken: res["access_token"],
accessTokenExpire: DateTime.now(),
refreshToken: '',
); );
if (onLogin != null) onLogin(user); if (onLogin != null) onLogin(user);
@ -168,8 +157,7 @@ Future loginAPI({
.store .store
.storeUser(user); .storeUser(user);
Provider.of<UserProvider>(context, listen: false).addUser(user); Provider.of<UserProvider>(context, listen: false).addUser(user);
Provider.of<UserProvider>(context, listen: false) Provider.of<UserProvider>(context, listen: false).setUser(user.id);
.setUser(user.id);
// Get user data // Get user data
try { try {
@ -179,8 +167,7 @@ Future loginAPI({
.fetch(week: Week.current()), .fetch(week: Week.current()),
Provider.of<ExamProvider>(context, listen: false).fetch(), Provider.of<ExamProvider>(context, listen: false).fetch(),
Provider.of<HomeworkProvider>(context, listen: false).fetch(), Provider.of<HomeworkProvider>(context, listen: false).fetch(),
Provider.of<MessageProvider>(context, listen: false) Provider.of<MessageProvider>(context, listen: false).fetchAll(),
.fetchAll(),
Provider.of<MessageProvider>(context, listen: false) Provider.of<MessageProvider>(context, listen: false)
.fetchAllRecipients(), .fetchAllRecipients(),
Provider.of<NoteProvider>(context, listen: false).fetch(), Provider.of<NoteProvider>(context, listen: false).fetch(),
@ -208,124 +195,3 @@ Future loginAPI({
return LoginState.failed; return LoginState.failed;
} }
// new login api
Future newLoginAPI({
required String code,
required BuildContext context,
void Function(User)? onLogin,
void Function()? onSuccess,
}) async {
// actual login (token grant) logic
Provider.of<KretaClient>(context, listen: false).userAgent =
Provider.of<SettingsProvider>(context, listen: false).config.userAgent;
Map<String, String> headers = {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"accept": "*/*",
"user-agent": "eKretaStudent/264745 CFNetwork/1494.0.7 Darwin/23.4.0",
};
Map? res = await Provider.of<KretaClient>(context, listen: false)
.postAPI(KretaAPI.login, headers: headers, body: {
"code": code,
"code_verifier": "DSpuqj_HhDX4wzQIbtn8lr8NLE5wEi1iVLMtMK0jY6c",
"redirect_uri":
"https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect",
"client_id": KretaAPI.clientId,
"grant_type": "authorization_code",
});
if (res != null) {
if (kDebugMode) {
print(res);
// const splitSize = 1000;
// RegExp exp = RegExp(r"\w{" "$splitSize" "}");
// // String str = "0102031522";
// Iterable<Match> matches = exp.allMatches(res.toString());
// var list = matches.map((m) => m.group(0));
// list.forEach((e) {
// print(e);
// });
}
if (res.containsKey("error")) {
if (res["error"] == "invalid_grant") {
print("ERROR: invalid_grant");
return;
}
} else {
if (res.containsKey("access_token")) {
try {
Provider.of<KretaClient>(context, listen: false).accessToken =
res["access_token"];
Provider.of<KretaClient>(context, listen: false).refreshToken =
res["refresh_token"];
String instituteCode =
JwtUtils.getInstituteFromJWT(res["access_token"])!;
String username = JwtUtils.getUsernameFromJWT(res["access_token"])!;
Role role = JwtUtils.getRoleFromJWT(res["access_token"])!;
Map? studentJson =
await Provider.of<KretaClient>(context, listen: false)
.getAPI(KretaAPI.student(instituteCode));
Student student = Student.fromJson(studentJson!);
var user = User(
username: username,
password: '',
instituteCode: instituteCode,
name: student.name,
student: student,
role: role,
accessToken: res["access_token"],
accessTokenExpire:
DateTime.now().add(Duration(seconds: (res["expires_in"] - 30))),
refreshToken: res["refresh_token"],
);
if (onLogin != null) onLogin(user);
// Store User in the database
await Provider.of<DatabaseProvider>(context, listen: false)
.store
.storeUser(user);
Provider.of<UserProvider>(context, listen: false).addUser(user);
Provider.of<UserProvider>(context, listen: false).setUser(user.id);
// Get user data
try {
await Future.wait([
Provider.of<GradeProvider>(context, listen: false).fetch(),
Provider.of<TimetableProvider>(context, listen: false)
.fetch(week: Week.current()),
Provider.of<ExamProvider>(context, listen: false).fetch(),
Provider.of<HomeworkProvider>(context, listen: false).fetch(),
Provider.of<MessageProvider>(context, listen: false).fetchAll(),
Provider.of<MessageProvider>(context, listen: false)
.fetchAllRecipients(),
Provider.of<NoteProvider>(context, listen: false).fetch(),
Provider.of<EventProvider>(context, listen: false).fetch(),
Provider.of<AbsenceProvider>(context, listen: false).fetch(),
]);
} catch (error) {
print("WARNING: failed to fetch user data: $error");
}
if (onSuccess != null) onSuccess();
return LoginState.success;
} catch (error) {
print("ERROR: loginAPI: $error");
// maybe check debug mode
// ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("ERROR: $error")));
return LoginState.failed;
}
}
}
}
return LoginState.failed;
}

View File

@ -18,7 +18,7 @@ class AdProvider extends ChangeNotifier {
} }
Future<void> fetch() async { Future<void> fetch() async {
_ads = []; _ads = await FilcAPI.getAds() ?? [];
_ads.sort((a, b) => -a.date.compareTo(b.date)); _ads.sort((a, b) => -a.date.compareTo(b.date));
// check for new ads // check for new ads

View File

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:refilc/database/query.dart'; import 'package:refilc/database/query.dart';
import 'package:refilc/database/store.dart'; import 'package:refilc/database/store.dart';
// ignore: depend_on_referenced_packages // ignore: depend_on_referenced_packages
@ -13,7 +15,11 @@ class DatabaseProvider {
Future<void> init() async { Future<void> init() async {
Database db; Database db;
db = await openDatabase("app.db"); if (Platform.isLinux || Platform.isWindows) {
db = await databaseFactoryFfi.openDatabase("app.db");
} else {
db = await openDatabase("app.db");
}
query = DatabaseQuery(db: db); query = DatabaseQuery(db: db);
store = DatabaseStore(db: db); store = DatabaseStore(db: db);

View File

@ -5,7 +5,6 @@ import 'dart:async';
import 'package:refilc/api/providers/liveactivity/platform_channel.dart'; import 'package:refilc/api/providers/liveactivity/platform_channel.dart';
import 'package:refilc/helpers/subject.dart'; import 'package:refilc/helpers/subject.dart';
import 'package:refilc/models/settings.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/lesson.dart';
import 'package:refilc_kreta_api/models/week.dart'; import 'package:refilc_kreta_api/models/week.dart';
import 'package:refilc/utils/format.dart'; import 'package:refilc/utils/format.dart';
@ -85,14 +84,11 @@ class LiveCardProvider extends ChangeNotifier {
} }
Map<String, String> toMap() { Map<String, String> toMap() {
// print("LIVE ACTIVITY COLOR BELOW:");
// print(_settings.liveActivityColor.toHexString().substring(2));
String color = '#${_settings.liveActivityColor.toHexString().substring(2)}';
switch (currentState) { switch (currentState) {
case LiveCardState.morning: case LiveCardState.morning:
return { return {
"color": color, "color":
'#${_settings.liveActivityColor.toString().substring(10, 16)}',
"icon": nextLesson != null "icon": nextLesson != null
? SubjectIcon.resolveName(subject: nextLesson?.subject) ? SubjectIcon.resolveName(subject: nextLesson?.subject)
: "book", : "book",
@ -101,22 +97,23 @@ class LiveCardProvider extends ChangeNotifier {
"description": "", "description": "",
"startDate": storeFirstRunDate != null "startDate": storeFirstRunDate != null
? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) -
(_delay.inMilliseconds)) (_delay.inMilliseconds))
.toString() .toString()
: "", : "",
"endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) -
_delay.inMilliseconds) _delay.inMilliseconds)
.toString(), .toString(),
"nextSubject": nextLesson != null "nextSubject": nextLesson != null
? nextLesson?.subject.renamedTo ?? ? nextLesson?.subject.renamedTo ??
ShortSubject.resolve(subject: nextLesson?.subject).capital() ShortSubject.resolve(subject: nextLesson?.subject).capital()
: "", : "",
"nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
}; };
case LiveCardState.afternoon: case LiveCardState.afternoon:
return { return {
"color": color, "color":
'#${_settings.liveActivityColor.toString().substring(10, 16)}',
"icon": nextLesson != null "icon": nextLesson != null
? SubjectIcon.resolveName(subject: nextLesson?.subject) ? SubjectIcon.resolveName(subject: nextLesson?.subject)
: "book", : "book",
@ -125,22 +122,23 @@ class LiveCardProvider extends ChangeNotifier {
"description": "", "description": "",
"startDate": storeFirstRunDate != null "startDate": storeFirstRunDate != null
? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) -
(_delay.inMilliseconds)) (_delay.inMilliseconds))
.toString() .toString()
: "", : "",
"endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) -
_delay.inMilliseconds) _delay.inMilliseconds)
.toString(), .toString(),
"nextSubject": nextLesson != null "nextSubject": nextLesson != null
? nextLesson?.subject.renamedTo ?? ? nextLesson?.subject.renamedTo ??
ShortSubject.resolve(subject: nextLesson?.subject).capital() ShortSubject.resolve(subject: nextLesson?.subject).capital()
: "", : "",
"nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
}; };
case LiveCardState.night: case LiveCardState.night:
return { return {
"color": color, "color":
'#${_settings.liveActivityColor.toString().substring(10, 16)}',
"icon": nextLesson != null "icon": nextLesson != null
? SubjectIcon.resolveName(subject: nextLesson?.subject) ? SubjectIcon.resolveName(subject: nextLesson?.subject)
: "book", : "book",
@ -149,44 +147,44 @@ class LiveCardProvider extends ChangeNotifier {
"description": "", "description": "",
"startDate": storeFirstRunDate != null "startDate": storeFirstRunDate != null
? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) -
(_delay.inMilliseconds)) (_delay.inMilliseconds))
.toString() .toString()
: "", : "",
"endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) -
_delay.inMilliseconds) _delay.inMilliseconds)
.toString(), .toString(),
"nextSubject": nextLesson != null "nextSubject": nextLesson != null
? nextLesson?.subject.renamedTo ?? ? nextLesson?.subject.renamedTo ??
ShortSubject.resolve(subject: nextLesson?.subject).capital() ShortSubject.resolve(subject: nextLesson?.subject).capital()
: "", : "",
"nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
}; };
case LiveCardState.duringLesson: case LiveCardState.duringLesson:
return { return {
"color": color, "color":
'#${_settings.liveActivityColor.toString().substring(10, 16)}',
"icon": currentLesson != null "icon": currentLesson != null
? SubjectIcon.resolveName(subject: currentLesson?.subject) ? SubjectIcon.resolveName(subject: currentLesson?.subject)
: "book", : "book",
"index": "index":
currentLesson != null ? '${currentLesson!.lessonIndex}. ' : "", currentLesson != null ? '${currentLesson!.lessonIndex}. ' : "",
"title": currentLesson != null "title": currentLesson != null
? currentLesson?.subject.renamedTo ?? ? currentLesson?.subject.renamedTo ??
ShortSubject.resolve(subject: currentLesson?.subject) ShortSubject.resolve(subject: currentLesson?.subject)
.capital() .capital()
: "", : "",
"subtitle": "subtitle": "Terem: ${currentLesson?.room.replaceAll("_", " ") ?? ""}",
"Terem: ${currentLesson?.room.replaceAll("_", " ") ?? ""}",
"description": currentLesson?.description ?? "", "description": currentLesson?.description ?? "",
"startDate": ((currentLesson?.start.millisecondsSinceEpoch ?? 0) - "startDate": ((currentLesson?.start.millisecondsSinceEpoch ?? 0) -
_delay.inMilliseconds) _delay.inMilliseconds)
.toString(), .toString(),
"endDate": ((currentLesson?.end.millisecondsSinceEpoch ?? 0) - "endDate": ((currentLesson?.end.millisecondsSinceEpoch ?? 0) -
_delay.inMilliseconds) _delay.inMilliseconds)
.toString(), .toString(),
"nextSubject": nextLesson != null "nextSubject": nextLesson != null
? nextLesson?.subject.renamedTo ?? ? nextLesson?.subject.renamedTo ??
ShortSubject.resolve(subject: nextLesson?.subject).capital() ShortSubject.resolve(subject: nextLesson?.subject).capital()
: "", : "",
"nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
}; };
@ -201,23 +199,24 @@ class LiveCardProvider extends ChangeNotifier {
final diff = getFloorDifference(); final diff = getFloorDifference();
return { return {
"color": color, "color":
'#${_settings.liveActivityColor.toString().substring(10, 16)}',
"icon": iconFloorMap[diff] ?? "cup.and.saucer", "icon": iconFloorMap[diff] ?? "cup.and.saucer",
"title": "Szünet", "title": "Szünet",
"description": "go $diff".i18n.fill([ "description": "go $diff".i18n.fill([
diff != "to room" ? (nextLesson!.getFloor() ?? 0) : nextLesson!.room diff != "to room" ? (nextLesson!.getFloor() ?? 0) : nextLesson!.room
]), ]),
"startDate": ((prevLesson?.end.millisecondsSinceEpoch ?? 0) - "startDate": ((prevLesson?.end.millisecondsSinceEpoch ?? 0) -
_delay.inMilliseconds) _delay.inMilliseconds)
.toString(), .toString(),
"endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) -
_delay.inMilliseconds) _delay.inMilliseconds)
.toString(), .toString(),
"nextSubject": (nextLesson != null "nextSubject": (nextLesson != null
? nextLesson?.subject.renamedTo ?? ? nextLesson?.subject.renamedTo ??
ShortSubject.resolve(subject: nextLesson?.subject) ShortSubject.resolve(subject: nextLesson?.subject)
.capital() .capital()
: "") : "")
.capital(), .capital(),
"nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
"index": "", "index": "",
@ -244,8 +243,8 @@ class LiveCardProvider extends ChangeNotifier {
DateTime now = _now().add(_delay); DateTime now = _now().add(_delay);
if ((currentState == LiveCardState.morning || if ((currentState == LiveCardState.morning ||
currentState == LiveCardState.afternoon || currentState == LiveCardState.afternoon ||
currentState == LiveCardState.night) && currentState == LiveCardState.night) &&
storeFirstRunDate == null) { storeFirstRunDate == null) {
storeFirstRunDate = now; storeFirstRunDate = now;
} }
@ -254,9 +253,9 @@ class LiveCardProvider extends ChangeNotifier {
// Filter label lessons #128 // Filter label lessons #128
today = today today = today
.where((lesson) => .where((lesson) =>
lesson.status?.name != "Elmaradt" && lesson.status?.name != "Elmaradt" &&
lesson.subject.id != '' && lesson.subject.id != '' &&
!lesson.isEmpty) !lesson.isEmpty)
.toList(); .toList();
if (today.isNotEmpty) { if (today.isNotEmpty) {
@ -264,7 +263,7 @@ class LiveCardProvider extends ChangeNotifier {
today.sort((a, b) => a.start.compareTo(b.start)); today.sort((a, b) => a.start.compareTo(b.start));
final _lesson = today.firstWhere( final _lesson = today.firstWhere(
(l) => l.start.isBefore(now) && l.end.isAfter(now), (l) => l.start.isBefore(now) && l.end.isAfter(now),
orElse: () => Lesson.fromJson({})); orElse: () => Lesson.fromJson({}));
if (_lesson.start.year != 0) { if (_lesson.start.year != 0) {
@ -329,7 +328,7 @@ class LiveCardProvider extends ChangeNotifier {
hasActivityStarted = true; hasActivityStarted = true;
} else if (!hasActivityStarted && } else if (!hasActivityStarted &&
((currentState == LiveCardState.duringLesson && ((currentState == LiveCardState.duringLesson &&
currentLesson != null) || currentLesson != null) ||
currentState == LiveCardState.duringBreak)) { currentState == LiveCardState.duringBreak)) {
debugPrint("Óra van, vagy szünet, de nincs LiveActivity. létrehozás..."); debugPrint("Óra van, vagy szünet, de nincs LiveActivity. létrehozás...");
PlatformChannel.createLiveActivity(toMap()); PlatformChannel.createLiveActivity(toMap());
@ -363,11 +362,7 @@ class LiveCardProvider extends ChangeNotifier {
} }
//END //END
if ((currentState == LiveCardState.afternoon || if ((currentState == LiveCardState.afternoon || currentState == LiveCardState.morning || currentState == LiveCardState.night) && hasActivityStarted && nextLesson != null &&
currentState == LiveCardState.morning ||
currentState == LiveCardState.night) &&
hasActivityStarted &&
nextLesson != null &&
nextLesson!.start.difference(now).inMinutes > 60) { nextLesson!.start.difference(now).inMinutes > 60) {
debugPrint("Több, mint 1 óra van az első óráig. Befejezés..."); debugPrint("Több, mint 1 óra van az első óráig. Befejezés...");
PlatformChannel.endLiveActivity(); PlatformChannel.endLiveActivity();
@ -394,4 +389,4 @@ class LiveCardProvider extends ChangeNotifier {
List<Lesson> _today(TimetableProvider p) => (p.getWeek(Week.current()) ?? []) List<Lesson> _today(TimetableProvider p) => (p.getWeek(Week.current()) ?? [])
.where((l) => _sameDate(l.date, _now())) .where((l) => _sameDate(l.date, _now()))
.toList(); .toList();
} }

View File

@ -15,7 +15,7 @@ class StatusProvider extends ChangeNotifier {
StatusProvider() { StatusProvider() {
_handleNetworkChanges(); _handleNetworkChanges();
_handleDNSFailure(); _handleDNSFailure();
Connectivity().checkConnectivity().then((value) => _networkType = value[0]); Connectivity().checkConnectivity().then((value) => _networkType = value);
} }
Status? getStatus() => _stack.isNotEmpty ? _stack[0] : null; Status? getStatus() => _stack.isNotEmpty ? _stack[0] : null;
@ -24,8 +24,8 @@ class StatusProvider extends ChangeNotifier {
void _handleNetworkChanges() { void _handleNetworkChanges() {
Connectivity().onConnectivityChanged.listen((event) { Connectivity().onConnectivityChanged.listen((event) {
_networkType = event[0]; _networkType = event;
if (event[0] == ConnectivityResult.none) { if (event == ConnectivityResult.none) {
if (!_stack.contains(Status.network)) { if (!_stack.contains(Status.network)) {
_stack.remove(Status.apiError); _stack.remove(Status.apiError);
_stack.insert(0, Status.network); _stack.insert(0, Status.network);

View File

@ -2,7 +2,6 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:refilc/api/providers/database_provider.dart'; import 'package:refilc/api/providers/database_provider.dart';
import 'package:refilc/api/providers/status_provider.dart'; import 'package:refilc/api/providers/status_provider.dart';
import 'package:refilc/api/providers/user_provider.dart'; import 'package:refilc/api/providers/user_provider.dart';
@ -29,7 +28,7 @@ import 'liveactivity/platform_channel.dart';
// Mutex // Mutex
bool lock = false; bool lock = false;
Future<void> syncAll(BuildContext context) async { Future<void> syncAll(BuildContext context) {
if (lock) return Future.value(); if (lock) return Future.value();
// Lock // Lock
lock = true; lock = true;
@ -41,12 +40,6 @@ Future<void> syncAll(BuildContext context) async {
StatusProvider statusProvider = StatusProvider statusProvider =
Provider.of<StatusProvider>(context, listen: false); Provider.of<StatusProvider>(context, listen: false);
// check if access token isn't expired
// if (user.user?.accessToken == null) {
// lock = false;
// return Future.value();
// }
List<Future<void>> tasks = []; List<Future<void>> tasks = [];
int taski = 0; int taski = 0;
@ -57,49 +50,6 @@ Future<void> syncAll(BuildContext context) async {
} }
tasks = [ tasks = [
// refresh login
syncStatus(() async {
// print(user.user?.accessTokenExpire);
// print('${user.user?.accessToken ?? "no token"} - ACCESS TOKEN');
// user.user!.accessToken = "";
if (user.user == null) {
Navigator.of(context).pushNamedAndRemoveUntil("login", (_) => false);
lock = false;
return Future.value();
}
if (user.user!.accessToken.replaceAll(" ", "") == "") {
String uid = user.user!.id;
user.removeUser(uid);
await Provider.of<DatabaseProvider>(context, listen: false)
.store
.removeUser(uid);
Navigator.of(context).pushNamedAndRemoveUntil("login", (_) => false);
lock = false;
return;
}
if (user.user!.accessTokenExpire.isBefore(DateTime.now())) {
String authRes = await Provider.of<KretaClient>(context, listen: false)
.refreshLogin() ??
'';
if (authRes != 'success') {
if (kDebugMode) print('ERROR: failed to refresh login');
lock = false;
return Future.value();
} else {
if (kDebugMode) print('INFO: access token refreshed');
}
} else {
if (kDebugMode) print('INFO: access token is not expired');
}
}()),
syncStatus(Provider.of<GradeProvider>(context, listen: false).fetch()), syncStatus(Provider.of<GradeProvider>(context, listen: false).fetch()),
syncStatus(Provider.of<TimetableProvider>(context, listen: false) syncStatus(Provider.of<TimetableProvider>(context, listen: false)
.fetch(week: Week.current())), .fetch(week: Week.current())),
@ -121,8 +71,6 @@ Future<void> syncAll(BuildContext context) async {
if (studentJson == null) return; if (studentJson == null) return;
Student student = Student.fromJson(studentJson); Student student = Student.fromJson(studentJson);
// print(studentJson);
user.user?.name = student.name; user.user?.name = student.name;
// Store user // Store user
@ -141,11 +89,13 @@ Future<void> syncAll(BuildContext context) async {
return false; return false;
} }
return Future.wait(tasks).then((value) { return Future.wait(tasks).then((value) {
// Unlock // Unlock
lock = false; lock = false;
if (Platform.isIOS && LiveCardProvider.hasActivityStarted == true) { if(Platform.isIOS && LiveCardProvider.hasActivityStarted == true){
PlatformChannel.endLiveActivity(); PlatformChannel.endLiveActivity();
LiveCardProvider.hasActivityStarted = false; LiveCardProvider.hasActivityStarted = false;
} }

View File

@ -31,7 +31,6 @@ import 'package:provider/provider.dart';
import 'package:refilc_mobile_ui/common/system_chrome.dart' as mobile; import 'package:refilc_mobile_ui/common/system_chrome.dart' as mobile;
import 'package:refilc_mobile_ui/screens/login/login_route.dart' as mobile; import 'package:refilc_mobile_ui/screens/login/login_route.dart' as mobile;
import 'package:refilc_mobile_ui/screens/login/login_screen.dart' as mobile; import 'package:refilc_mobile_ui/screens/login/login_screen.dart' as mobile;
// import 'package:refilc_mobile_ui/screens/login/kreten_login.dart' as mobileTest;
import 'package:refilc_mobile_ui/screens/navigation/navigation_screen.dart' import 'package:refilc_mobile_ui/screens/navigation/navigation_screen.dart'
as mobile; as mobile;
import 'package:refilc_mobile_ui/screens/settings/settings_route.dart' import 'package:refilc_mobile_ui/screens/settings/settings_route.dart'
@ -39,11 +38,11 @@ import 'package:refilc_mobile_ui/screens/settings/settings_route.dart'
import 'package:refilc_mobile_ui/screens/settings/settings_screen.dart' import 'package:refilc_mobile_ui/screens/settings/settings_screen.dart'
as mobile; as mobile;
// Desktop UI (no more desktop ui) // Desktop UI
// import 'package:refilc_desktop_ui/screens/navigation/navigation_screen.dart' import 'package:refilc_desktop_ui/screens/navigation/navigation_screen.dart'
// as desktop; as desktop;
// import 'package:refilc_desktop_ui/screens/login/login_screen.dart' as desktop; import 'package:refilc_desktop_ui/screens/login/login_screen.dart' as desktop;
// import 'package:refilc_desktop_ui/screens/login/login_route.dart' as desktop; import 'package:refilc_desktop_ui/screens/login/login_route.dart' as desktop;
// Providers // Providers
import 'package:refilc/models/settings.dart'; import 'package:refilc/models/settings.dart';
@ -81,8 +80,7 @@ class App extends StatelessWidget {
CorePalette? corePalette; CorePalette? corePalette;
final status = StatusProvider(); final status = StatusProvider();
final kreta = KretaClient( final kreta = KretaClient(user: user, settings: settings, status: status);
user: user, settings: settings, database: database, status: status);
final timetable = final timetable =
TimetableProvider(user: user, database: database, kreta: kreta); TimetableProvider(user: user, database: database, kreta: kreta);
final premium = PlusProvider(settings: settings); final premium = PlusProvider(settings: settings);
@ -237,7 +235,7 @@ class App extends StatelessWidget {
}, },
onGenerateRoute: (settings) => rootNavigator(settings), onGenerateRoute: (settings) => rootNavigator(settings),
initialRoute: initialRoute:
(user.getUsers().isNotEmpty) ? "navigation" : "login", user.getUsers().isNotEmpty ? "navigation" : "login",
); );
}, },
); );
@ -248,18 +246,17 @@ class App extends StatelessWidget {
Route? rootNavigator(RouteSettings route) { Route? rootNavigator(RouteSettings route) {
if (kIsWeb) { if (kIsWeb) {
return null; switch (route.name) {
// switch (route.name) { case "login_back":
// case "login_back": return CupertinoPageRoute(
// return CupertinoPageRoute( builder: (context) => const desktop.LoginScreen(back: true));
// builder: (context) => const desktop.LoginScreen(back: true)); case "login":
// case "login": return _rootRoute(const desktop.LoginScreen());
// return _rootRoute(const desktop.LoginScreen()); case "navigation":
// case "navigation": return _rootRoute(const desktop.NavigationScreen());
// return _rootRoute(const desktop.NavigationScreen()); case "login_to_navigation":
// case "login_to_navigation": return desktop.loginRoute(const desktop.NavigationScreen());
// return desktop.loginRoute(const desktop.NavigationScreen()); }
// }
} else if (Platform.isAndroid || Platform.isIOS) { } else if (Platform.isAndroid || Platform.isIOS) {
switch (route.name) { switch (route.name) {
case "login_back": case "login_back":
@ -275,18 +272,17 @@ class App extends StatelessWidget {
return mobile.settingsRoute(const mobile.SettingsScreen()); return mobile.settingsRoute(const mobile.SettingsScreen());
} }
} else if (Platform.isWindows || Platform.isMacOS || Platform.isLinux) { } else if (Platform.isWindows || Platform.isMacOS || Platform.isLinux) {
return null; switch (route.name) {
// switch (route.name) { case "login_back":
// case "login_back": return CupertinoPageRoute(
// return CupertinoPageRoute( builder: (context) => const desktop.LoginScreen(back: true));
// builder: (context) => const desktop.LoginScreen(back: true)); case "login":
// case "login": return _rootRoute(const desktop.LoginScreen());
// return _rootRoute(const desktop.LoginScreen()); case "navigation":
// case "navigation": return _rootRoute(const desktop.NavigationScreen());
// return _rootRoute(const desktop.NavigationScreen()); case "login_to_navigation":
// case "login_to_navigation": return desktop.loginRoute(const desktop.NavigationScreen());
// return desktop.loginRoute(const desktop.NavigationScreen()); }
// }
} }
return null; return null;
} }

View File

@ -8,7 +8,7 @@ import 'package:refilc/models/settings.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
// ignore: depend_on_referenced_packages // ignore: depend_on_referenced_packages
import 'package:sqflite_common_ffi/sqflite_ffi.dart'; import 'package:sqflite_common_ffi/sqflite_ffi.dart';
// import 'package:sqflite_common_ffi_web/sqflite_ffi_web.dart'; import 'package:sqflite_common_ffi_web/sqflite_ffi_web.dart';
const settingsDB = DatabaseStruct("settings", { const settingsDB = DatabaseStruct("settings", {
"language": String, "start_page": int, "rounding": int, "theme": int, "language": String, "start_page": int, "rounding": int, "theme": int,
@ -27,8 +27,7 @@ const settingsDB = DatabaseStruct("settings", {
"notifications_absences": int, "notifications_absences": int,
"notifications_messages": int, "notifications_messages": int,
"notifications_lessons": int, // notifications "notifications_lessons": int, // notifications
"x_filc_id": String, "graph_class_avg": int, "x_filc_id": String, "graph_class_avg": int, "presentation_mode": int,
"analytics_enabled": int, "presentation_mode": int,
"bell_delay": int, "bell_delay_enabled": int, "bell_delay": int, "bell_delay_enabled": int,
"grade_opening_fun": int, "icon_pack": String, "premium_scopes": String, "grade_opening_fun": int, "icon_pack": String, "premium_scopes": String,
"premium_token": String, "premium_login": String, "premium_token": String, "premium_login": String,
@ -55,10 +54,6 @@ const settingsDB = DatabaseStruct("settings", {
"new_colors": int, "new_colors": int,
"uwu_mode": int, "uwu_mode": int,
"new_popups": int, "new_popups": int,
"unseen_new_features": String,
"cloud_sync_enabled": int,
"cloud_sync_token": String,
"local_updated_at": String,
// quick settings // quick settings
"q_timetable_lesson_num": int, "q_timetable_sub_tiles": int, "q_timetable_lesson_num": int, "q_timetable_sub_tiles": int,
"q_subjects_sub_tiles": int, "q_subjects_sub_tiles": int,
@ -70,8 +65,6 @@ const usersDB = DatabaseStruct("users", {
"institute_code": String, "student": String, "role": int, "institute_code": String, "student": String, "role": int,
"nickname": String, "picture": String, // premium only (it's now plus btw) "nickname": String, "picture": String, // premium only (it's now plus btw)
"grade_streak": int, "grade_streak": int,
"access_token": String, "access_token_expire": String,
"refresh_token": String,
}); });
const userDataDB = DatabaseStruct("user_data", { const userDataDB = DatabaseStruct("user_data", {
"id": String, "grades": String, "timetable": String, "exams": String, "id": String, "grades": String, "timetable": String, "exams": String,
@ -110,8 +103,7 @@ Future<Database> initDB(DatabaseProvider database) async {
Database db; Database db;
if (kIsWeb) { if (kIsWeb) {
// db = await databaseFactoryFfiWeb.openDatabase("app.db"); db = await databaseFactoryFfiWeb.openDatabase("app.db");
throw "web is not supported";
} else if (Platform.isLinux || Platform.isWindows) { } else if (Platform.isLinux || Platform.isWindows) {
sqfliteFfiInit(); sqfliteFfiInit();
db = await databaseFactoryFfi.openDatabase("app.db"); db = await databaseFactoryFfi.openDatabase("app.db");
@ -145,10 +137,7 @@ Future<Database> initDB(DatabaseProvider database) async {
"role": 0, "role": 0,
"nickname": "", "nickname": "",
"picture": "", "picture": "",
"grade_streak": 0, "grade_streak": 0
"access_token": "",
"access_token_expire": "",
"refresh_token": "",
}, },
); );
await migrateDB(db, struct: userDataDB, defaultValues: { await migrateDB(db, struct: userDataDB, defaultValues: {

View File

@ -8,10 +8,10 @@ class DatabaseStruct {
String typeName = ""; String typeName = "";
switch (type.runtimeType) { switch (type.runtimeType) {
case const (int): case int:
typeName = "integer"; typeName = "integer";
break; break;
case const (String): case String:
typeName = "text"; typeName = "text";
break; break;
} }

File diff suppressed because it is too large Load Diff

View File

@ -6,9 +6,10 @@ import 'package:share_plus/share_plus.dart';
class ShareHelper { class ShareHelper {
static Future<void> shareText(String text, {String? subject}) => static Future<void> shareText(String text, {String? subject}) =>
Share.share(text, subject: subject); Share.share(text, subject: subject);
// ignore: deprecated_member_use
static Future<void> shareFile(String path, {String? text, String? subject}) => static Future<void> shareFile(String path, {String? text, String? subject}) =>
Share.shareXFiles([XFile(path)], text: text, subject: subject); // ignore: deprecated_member_use
Share.shareFiles([path], text: text, subject: subject);
static Future<void> shareAttachment(Attachment attachment, static Future<void> shareAttachment(Attachment attachment,
{required BuildContext context}) async { {required BuildContext context}) async {

View File

@ -1,130 +0,0 @@
import 'dart:math';
class Uwuifier {
final Map<String, double> _spacesModifier;
final double _wordsModifier;
final List<String> faces = [
"OwO",
"UwU",
">w<",
"^w^",
"^-^",
":3",
];
final List<List<String>> uwuMap = [
['(?:r|l)', 'w'],
['(?:R|L)', 'W'],
['na', 'nya'],
['ne', 'nye'],
['NA', 'NYA'],
['NE', 'NYE'],
['Na', 'Nya'],
['Ne', 'Nye'],
['no', 'nyo'],
['NO', 'NYO'],
['No', 'Nyo'],
['nO', 'NYo'],
['ove', 'uv'],
['no', 'nwo'],
];
final Map<String, String> _uwuCache = {};
Uwuifier({
Map<String, double>? spaces,
double? words,
}) : _spacesModifier = spaces ?? {
'faces': 0.05,
'actions': 0.0,
'stutters': 0.1,
},
_wordsModifier = words ?? 1.0;
String uwuifyWords(String sentence) {
final words = sentence.split(' ');
final uwuifiedSentence = words.map((word) {
if (isAt(word) || isUri(word)) return word;
var seed = Random().nextDouble();
for (final uwuMapEntry in uwuMap) {
final oldWord = RegExp(uwuMapEntry[0], caseSensitive: false);
final newWord = uwuMapEntry[1];
if (seed > _wordsModifier) continue;
word = word.replaceAll(oldWord, newWord);
}
return word;
}).join(' ');
return uwuifiedSentence;
}
String uwuifySpaces(String sentence) {
final words = sentence.split(' ');
final faceThreshold = _spacesModifier['faces']!;
final actionThreshold = _spacesModifier['actions']! + faceThreshold;
final stutterThreshold = _spacesModifier['stutters']! + actionThreshold;
final uwuifiedSentence = words.map((word) {
final seed = Random().nextDouble();
final firstCharacter = word[0];
if (seed <= faceThreshold && faces.isNotEmpty) {
word += ' ${faces[Random().nextInt(faces.length)]}';
} else if (seed <= actionThreshold) {
// Skip actions
} else if (seed <= stutterThreshold && !isUri(word)) {
if (Random().nextInt(10) == 0) {
final stutter = Random().nextInt(3);
return '${firstCharacter * (stutter + 1)}-$word';
}
}
return word;
}).join(' ');
return uwuifiedSentence;
}
String uwuifySentence(String sentence) {
if (_uwuCache.containsKey(sentence)) {
return _uwuCache[sentence]!;
}
var uwuifiedSentence = uwuifyWords(sentence);
uwuifiedSentence = uwuifySpaces(uwuifiedSentence);
_uwuCache[sentence] = uwuifiedSentence;
return uwuifiedSentence;
}
bool isAt(String value) {
return value.startsWith('@');
}
bool isUri(String? value) {
if (value == null) return false;
final split = RegExp(
r'''(?:([^:/?#]+):)?(?:\/\/([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?''')
.firstMatch(value);
if (split == null) return false;
final scheme = split.group(1);
final authority = split.group(2);
final path = split.group(3);
if (!(scheme?.isNotEmpty == true && path?.isNotEmpty == true)) return false;
if (authority != null && authority.isNotEmpty) {
if (!(path?.isEmpty == true || path!.startsWith('/'))) return false;
} else if (path?.startsWith('//') == true) {
return false;
}
if (!RegExp(r'''^[a-z][a-z0-9+\-\.]*$''', caseSensitive: false)
.hasMatch(scheme!.toLowerCase())) {
return false;
}
return true;
}
}

View File

@ -5,7 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:refilc/api/providers/user_provider.dart'; import 'package:refilc/api/providers/user_provider.dart';
import 'package:refilc/api/providers/database_provider.dart'; import 'package:refilc/api/providers/database_provider.dart';
import 'package:refilc/database/init.dart'; import 'package:refilc/database/init.dart';
// import 'package:refilc/helpers/notification_helper.dart'; import 'package:refilc/helpers/notification_helper.dart';
import 'package:refilc/models/settings.dart'; import 'package:refilc/models/settings.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -15,8 +15,6 @@ import 'package:refilc/utils/service_locator.dart';
import 'package:refilc_mobile_ui/screens/error_screen.dart'; import 'package:refilc_mobile_ui/screens/error_screen.dart';
import 'package:refilc_mobile_ui/screens/error_report_screen.dart'; import 'package:refilc_mobile_ui/screens/error_report_screen.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.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'; import 'helpers/live_activity_helper.dart';
@ -40,28 +38,6 @@ void main() async {
BackgroundFetch.registerHeadlessTask(backgroundHeadlessTask); 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 // pre-cache required icons
const todaySvg = SvgAssetLoader('assets/svg/menu_icons/today_selected.svg'); const todaySvg = SvgAssetLoader('assets/svg/menu_icons/today_selected.svg');
const gradesSvg = SvgAssetLoader('assets/svg/menu_icons/grades_selected.svg'); const gradesSvg = SvgAssetLoader('assets/svg/menu_icons/grades_selected.svg');
@ -104,7 +80,7 @@ class Startup {
user = await database.query.getUsers(settings); user = await database.query.getUsers(settings);
// Set all notification categories to seen to avoid having notifications that the user has already seen in the app // Set all notification categories to seen to avoid having notifications that the user has already seen in the app
// NotificationsHelper().setAllCategoriesSeen(user); NotificationsHelper().setAllCategoriesSeen(user);
late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin; late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
// Notifications setup // Notifications setup
@ -146,30 +122,30 @@ class Startup {
// Platform specific settings // Platform specific settings
if (!kIsWeb) { if (!kIsWeb) {
// const DarwinInitializationSettings initializationSettingsDarwin = const DarwinInitializationSettings initializationSettingsDarwin =
// DarwinInitializationSettings( DarwinInitializationSettings(
// requestSoundPermission: true, requestSoundPermission: true,
// requestBadgePermission: true, requestBadgePermission: true,
// requestAlertPermission: false, requestAlertPermission: false,
// ); );
// const AndroidInitializationSettings initializationSettingsAndroid = const AndroidInitializationSettings initializationSettingsAndroid =
// AndroidInitializationSettings('ic_notification'); AndroidInitializationSettings('ic_notification');
// const LinuxInitializationSettings initializationSettingsLinux = const LinuxInitializationSettings initializationSettingsLinux =
// LinuxInitializationSettings(defaultActionName: 'Open notification'); LinuxInitializationSettings(defaultActionName: 'Open notification');
// const InitializationSettings initializationSettings = const InitializationSettings initializationSettings =
// InitializationSettings( InitializationSettings(
// android: initializationSettingsAndroid, android: initializationSettingsAndroid,
// iOS: initializationSettingsDarwin, iOS: initializationSettingsDarwin,
// macOS: initializationSettingsDarwin, macOS: initializationSettingsDarwin,
// linux: initializationSettingsLinux, linux: initializationSettingsLinux,
// ); );
// Initialize notifications // Initialize notifications
// await flutterLocalNotificationsPlugin.initialize( await flutterLocalNotificationsPlugin.initialize(
// initializationSettings, initializationSettings,
// onDidReceiveNotificationResponse: onDidReceiveNotificationResponse:
// NotificationsHelper().onDidReceiveNotificationResponse, NotificationsHelper().onDidReceiveNotificationResponse,
// ); );
} }
// if (Platform.isAndroid || Platform.isIOS) { // if (Platform.isAndroid || Platform.isIOS) {
@ -194,18 +170,6 @@ Widget errorBuilder(FlutterErrorDetails details) {
Navigator.of(context, rootNavigator: true) Navigator.of(context, rootNavigator: true)
.push(MaterialPageRoute(builder: (context) { .push(MaterialPageRoute(builder: (context) {
if (kReleaseMode) { 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); return ErrorReportScreen(details);
} else { } else {
return ErrorScreen(details); return ErrorScreen(details);
@ -214,7 +178,7 @@ Widget errorBuilder(FlutterErrorDetails details) {
} }
}); });
return Container(); return Container();
}); });
} }
@ -239,7 +203,7 @@ Future<void> initPlatformState() async {
if (!Platform.isIOS) return; if (!Platform.isIOS) return;
LiveActivityHelper().backgroundJob(); LiveActivityHelper().backgroundJob();
} else { } else {
// NotificationsHelper().backgroundJob(); NotificationsHelper().backgroundJob();
} }
BackgroundFetch.finish(taskId); BackgroundFetch.finish(taskId);
}, (String taskId) async { }, (String taskId) async {
@ -279,9 +243,8 @@ void backgroundHeadlessTask(HeadlessTask task) {
if (!Platform.isIOS) return; if (!Platform.isIOS) return;
LiveActivityHelper().backgroundJob(); LiveActivityHelper().backgroundJob();
} else { } else {
// NotificationsHelper().backgroundJob(); NotificationsHelper().backgroundJob();
} } BackgroundFetch.finish(task.taskId);
BackgroundFetch.finish(task.taskId);
} }
Future<void> initAdditionalBackgroundFetch() async { Future<void> initAdditionalBackgroundFetch() async {

View File

@ -1,22 +0,0 @@
class CloudSyncData {
Map settings;
List<String> deviceIds;
String reFilcPlusId;
Map json;
CloudSyncData({
this.settings = const {},
this.deviceIds = const [],
this.reFilcPlusId = "",
required this.json,
});
factory CloudSyncData.fromJson(Map json) {
return CloudSyncData(
settings: json['settings'] ?? {},
deviceIds: List<String>.from(json['device_ids'] ?? []),
reFilcPlusId: json['refilc_plus_id'] ?? "",
json: json,
);
}
}

View File

@ -7,8 +7,6 @@ class News {
String platform; String platform;
bool emergency; bool emergency;
DateTime expireDate; DateTime expireDate;
List<String>? appVersions;
String? specificAppId;
Map? json; Map? json;
News({ News({
@ -20,8 +18,6 @@ class News {
required this.platform, required this.platform,
required this.emergency, required this.emergency,
required this.expireDate, required this.expireDate,
this.appVersions,
this.specificAppId,
this.json, this.json,
}); });
@ -35,10 +31,6 @@ class News {
platform: json["platform"] ?? "", platform: json["platform"] ?? "",
emergency: json["emergency"] ?? false, emergency: json["emergency"] ?? false,
expireDate: DateTime.parse(json["expire_date"] ?? ''), expireDate: DateTime.parse(json["expire_date"] ?? ''),
appVersions: json["app_versions"] != null
? List<String>.from(json["app_versions"])
: null,
specificAppId: json["specific_app_id"],
json: json, json: json,
); );
} }

View File

@ -60,7 +60,7 @@ class TodoItem {
); );
} }
Map<String, dynamic> get toJson => { get toJson => {
'id': id, 'id': id,
'title': title, 'title': title,
'content': content, 'content': content,

View File

@ -60,7 +60,6 @@ class SettingsProvider extends ChangeNotifier {
UpdateChannel _updateChannel; UpdateChannel _updateChannel;
Config _config; Config _config;
String _xFilcId; String _xFilcId;
bool _analyticsEnabled;
bool _graphClassAvg; bool _graphClassAvg;
bool _goodStudent; bool _goodStudent;
bool _presentationMode; bool _presentationMode;
@ -108,10 +107,6 @@ class SettingsProvider extends ChangeNotifier {
bool _newColors; bool _newColors;
bool _uwuMode; bool _uwuMode;
bool _newPopups; bool _newPopups;
List<String> _unseenNewFeatures;
bool _cloudSyncEnabled;
String _cloudSyncToken;
DateTime _updatedAt;
// quick settings // quick settings
bool _qTimetableLessonNum; bool _qTimetableLessonNum;
bool _qTimetableSubTiles; bool _qTimetableSubTiles;
@ -141,7 +136,6 @@ class SettingsProvider extends ChangeNotifier {
required UpdateChannel updateChannel, required UpdateChannel updateChannel,
required Config config, required Config config,
required String xFilcId, required String xFilcId,
required bool analyticsEnabled,
required bool graphClassAvg, required bool graphClassAvg,
required bool goodStudent, required bool goodStudent,
required bool presentationMode, required bool presentationMode,
@ -186,10 +180,6 @@ class SettingsProvider extends ChangeNotifier {
required bool newColors, required bool newColors,
required bool uwuMode, required bool uwuMode,
required bool newPopups, required bool newPopups,
required List<String> unseenNewFeatures,
required bool cloudSyncEnabled,
required String cloudSyncToken,
required DateTime updatedAt,
required bool qTimetableLessonNum, required bool qTimetableLessonNum,
required bool qTimetableSubTiles, required bool qTimetableSubTiles,
required bool qSubjectsSubTiles, required bool qSubjectsSubTiles,
@ -216,7 +206,6 @@ class SettingsProvider extends ChangeNotifier {
_updateChannel = updateChannel, _updateChannel = updateChannel,
_config = config, _config = config,
_xFilcId = xFilcId, _xFilcId = xFilcId,
_analyticsEnabled = analyticsEnabled,
_graphClassAvg = graphClassAvg, _graphClassAvg = graphClassAvg,
_goodStudent = goodStudent, _goodStudent = goodStudent,
_presentationMode = presentationMode, _presentationMode = presentationMode,
@ -261,10 +250,6 @@ class SettingsProvider extends ChangeNotifier {
_newColors = newColors, _newColors = newColors,
_uwuMode = uwuMode, _uwuMode = uwuMode,
_newPopups = newPopups, _newPopups = newPopups,
_unseenNewFeatures = unseenNewFeatures,
_cloudSyncEnabled = cloudSyncEnabled,
_cloudSyncToken = cloudSyncToken,
_updatedAt = updatedAt,
_qTimetableLessonNum = qTimetableLessonNum, _qTimetableLessonNum = qTimetableLessonNum,
_qTimetableSubTiles = qTimetableSubTiles, _qTimetableSubTiles = qTimetableSubTiles,
_qSubjectsSubTiles = qSubjectsSubTiles; _qSubjectsSubTiles = qSubjectsSubTiles;
@ -309,7 +294,6 @@ class SettingsProvider extends ChangeNotifier {
updateChannel: UpdateChannel.values[map["update_channel"]], updateChannel: UpdateChannel.values[map["update_channel"]],
config: Config.fromJson(configMap ?? {}), config: Config.fromJson(configMap ?? {}),
xFilcId: map["x_filc_id"], xFilcId: map["x_filc_id"],
analyticsEnabled: map["analytics_enabled"] == 1,
graphClassAvg: map["graph_class_avg"] == 1, graphClassAvg: map["graph_class_avg"] == 1,
goodStudent: false, goodStudent: false,
presentationMode: map["presentation_mode"] == 1, presentationMode: map["presentation_mode"] == 1,
@ -355,10 +339,6 @@ class SettingsProvider extends ChangeNotifier {
newColors: map['new_colors'] == 1, newColors: map['new_colors'] == 1,
uwuMode: map['uwu_mode'] == 1, uwuMode: map['uwu_mode'] == 1,
newPopups: map['new_popups'] == 1, newPopups: map['new_popups'] == 1,
unseenNewFeatures: jsonDecode(map["unseen_new_features"]).cast<String>(),
cloudSyncEnabled: map['cloud_sync_enabled'] == 1,
cloudSyncToken: map['cloud_sync_token'],
updatedAt: DateTime.tryParse(map['local_updated_at']) ?? DateTime.now(),
qTimetableLessonNum: map['q_timetable_lesson_num'] == 1, qTimetableLessonNum: map['q_timetable_lesson_num'] == 1,
qTimetableSubTiles: map['q_timetable_sub_tiles'] == 1, qTimetableSubTiles: map['q_timetable_sub_tiles'] == 1,
qSubjectsSubTiles: map['q_subjects_sub_tiles'] == 1, qSubjectsSubTiles: map['q_subjects_sub_tiles'] == 1,
@ -393,7 +373,6 @@ class SettingsProvider extends ChangeNotifier {
"notification_poll_interval": _notificationPollInterval, "notification_poll_interval": _notificationPollInterval,
"config": jsonEncode(config.json), "config": jsonEncode(config.json),
"x_filc_id": _xFilcId, "x_filc_id": _xFilcId,
"analytics_enabled": _analyticsEnabled ? 1 : 0,
"graph_class_avg": _graphClassAvg ? 1 : 0, "graph_class_avg": _graphClassAvg ? 1 : 0,
"presentation_mode": _presentationMode ? 1 : 0, "presentation_mode": _presentationMode ? 1 : 0,
"bell_delay_enabled": _bellDelayEnabled ? 1 : 0, "bell_delay_enabled": _bellDelayEnabled ? 1 : 0,
@ -437,10 +416,6 @@ class SettingsProvider extends ChangeNotifier {
"new_colors": _newColors ? 1 : 0, "new_colors": _newColors ? 1 : 0,
"uwu_mode": _uwuMode ? 1 : 0, "uwu_mode": _uwuMode ? 1 : 0,
"new_popups": _newPopups ? 1 : 0, "new_popups": _newPopups ? 1 : 0,
"unseen_new_features": jsonEncode(_unseenNewFeatures),
"cloud_sync_enabled": _cloudSyncEnabled ? 1 : 0,
"cloud_sync_token": _cloudSyncToken,
"local_updated_at": _updatedAt.toIso8601String(),
"q_timetable_lesson_num": _qTimetableLessonNum ? 1 : 0, "q_timetable_lesson_num": _qTimetableLessonNum ? 1 : 0,
"q_timetable_sub_tiles": _qTimetableSubTiles ? 1 : 0, "q_timetable_sub_tiles": _qTimetableSubTiles ? 1 : 0,
"q_subjects_sub_tiles": _qSubjectsSubTiles ? 1 : 0, "q_subjects_sub_tiles": _qSubjectsSubTiles ? 1 : 0,
@ -470,7 +445,7 @@ class SettingsProvider extends ChangeNotifier {
notificationsMessagesEnabled: true, notificationsMessagesEnabled: true,
notificationsLessonsEnabled: true, notificationsLessonsEnabled: true,
notificationsBitfield: 255, notificationsBitfield: 255,
developerMode: true, developerMode: false,
notificationPollInterval: 1, notificationPollInterval: 1,
vibrate: VibrationStrength.medium, vibrate: VibrationStrength.medium,
abWeeks: false, abWeeks: false,
@ -478,7 +453,6 @@ class SettingsProvider extends ChangeNotifier {
updateChannel: UpdateChannel.stable, updateChannel: UpdateChannel.stable,
config: Config.fromJson({}), config: Config.fromJson({}),
xFilcId: const Uuid().v4(), xFilcId: const Uuid().v4(),
analyticsEnabled: false,
graphClassAvg: false, graphClassAvg: false,
goodStudent: false, goodStudent: false,
presentationMode: false, presentationMode: false,
@ -500,13 +474,13 @@ class SettingsProvider extends ChangeNotifier {
renameSubjectsItalics: false, renameSubjectsItalics: false,
renameTeachersEnabled: false, renameTeachersEnabled: false,
renameTeachersItalics: false, renameTeachersItalics: false,
liveActivityColor: const Color(0x00000000), liveActivityColor: const Color(0xFF676767),
welcomeMessage: '', welcomeMessage: '',
appIcon: 'refilc_default', appIcon: 'refilc_default',
currentThemeId: '', currentThemeId: '',
currentThemeDisplayName: '', currentThemeDisplayName: '',
currentThemeCreator: 'reFilc', currentThemeCreator: 'reFilc',
showBreaks: false, showBreaks: true,
pinSetGeneral: '', pinSetGeneral: '',
pinSetPersonalize: '', pinSetPersonalize: '',
pinSetNotify: '', pinSetNotify: '',
@ -523,10 +497,6 @@ class SettingsProvider extends ChangeNotifier {
newColors: true, newColors: true,
uwuMode: false, uwuMode: false,
newPopups: true, newPopups: true,
unseenNewFeatures: ['grade_exporting'],
cloudSyncEnabled: false,
cloudSyncToken: '',
updatedAt: DateTime.now(),
qTimetableLessonNum: true, qTimetableLessonNum: true,
qTimetableSubTiles: true, qTimetableSubTiles: true,
qSubjectsSubTiles: true, qSubjectsSubTiles: true,
@ -556,7 +526,6 @@ class SettingsProvider extends ChangeNotifier {
UpdateChannel get updateChannel => _updateChannel; UpdateChannel get updateChannel => _updateChannel;
Config get config => _config; Config get config => _config;
String get xFilcId => _xFilcId; String get xFilcId => _xFilcId;
bool get analyticsEnabled => _analyticsEnabled;
bool get graphClassAvg => _graphClassAvg; bool get graphClassAvg => _graphClassAvg;
bool get goodStudent => _goodStudent; bool get goodStudent => _goodStudent;
bool get presentationMode => _presentationMode; bool get presentationMode => _presentationMode;
@ -600,10 +569,6 @@ class SettingsProvider extends ChangeNotifier {
bool get newColors => _newColors; bool get newColors => _newColors;
bool get uwuMode => _uwuMode; bool get uwuMode => _uwuMode;
bool get newPopups => _newPopups; bool get newPopups => _newPopups;
List<String> get unseenNewFeatures => _unseenNewFeatures;
bool get cloudSyncEnabled => _cloudSyncEnabled;
String get cloudSyncToken => _cloudSyncToken;
DateTime get updatedAt => _updatedAt;
bool get qTimetableLessonNum => _qTimetableLessonNum; bool get qTimetableLessonNum => _qTimetableLessonNum;
bool get qTimetableSubTiles => _qTimetableSubTiles; bool get qTimetableSubTiles => _qTimetableSubTiles;
bool get qSubjectsSubTiles => _qSubjectsSubTiles; bool get qSubjectsSubTiles => _qSubjectsSubTiles;
@ -618,7 +583,6 @@ class SettingsProvider extends ChangeNotifier {
List<Color>? gradeColors, List<Color>? gradeColors,
bool? newsEnabled, bool? newsEnabled,
String? seenNewsId, String? seenNewsId,
String? seenNews, // only for restoring from map
bool? notificationsEnabled, bool? notificationsEnabled,
bool? notificationsGradesEnabled, bool? notificationsGradesEnabled,
bool? notificationsAbsencesEnabled, bool? notificationsAbsencesEnabled,
@ -633,7 +597,6 @@ class SettingsProvider extends ChangeNotifier {
UpdateChannel? updateChannel, UpdateChannel? updateChannel,
Config? config, Config? config,
String? xFilcId, String? xFilcId,
bool? analyticsEnabled,
bool? graphClassAvg, bool? graphClassAvg,
bool? goodStudent, bool? goodStudent,
bool? presentationMode, bool? presentationMode,
@ -674,9 +637,6 @@ class SettingsProvider extends ChangeNotifier {
bool? newColors, bool? newColors,
bool? uwuMode, bool? uwuMode,
bool? newPopups, bool? newPopups,
List<String>? unseenNewFeatures,
bool? cloudSyncEnabled,
String? cloudSyncToken,
bool? qTimetableLessonNum, bool? qTimetableLessonNum,
bool? qTimetableSubTiles, bool? qTimetableSubTiles,
bool? qSubjectsSubTiles, bool? qSubjectsSubTiles,
@ -699,7 +659,6 @@ class SettingsProvider extends ChangeNotifier {
tempList.add(seenNewsId); tempList.add(seenNewsId);
_seenNews = tempList.join(','); _seenNews = tempList.join(',');
} }
if (seenNews != null && seenNews != _seenNews) _seenNews = seenNews;
if (notificationsEnabled != null && if (notificationsEnabled != null &&
notificationsEnabled != _notificationsEnabled) { notificationsEnabled != _notificationsEnabled) {
_notificationsEnabled = notificationsEnabled; _notificationsEnabled = notificationsEnabled;
@ -741,9 +700,6 @@ class SettingsProvider extends ChangeNotifier {
} }
if (config != null && config != _config) _config = config; if (config != null && config != _config) _config = config;
if (xFilcId != null && xFilcId != _xFilcId) _xFilcId = xFilcId; if (xFilcId != null && xFilcId != _xFilcId) _xFilcId = xFilcId;
if (analyticsEnabled != null && analyticsEnabled != _analyticsEnabled) {
_analyticsEnabled = analyticsEnabled;
}
if (graphClassAvg != null && graphClassAvg != _graphClassAvg) { if (graphClassAvg != null && graphClassAvg != _graphClassAvg) {
_graphClassAvg = graphClassAvg; _graphClassAvg = graphClassAvg;
} }
@ -872,15 +828,6 @@ class SettingsProvider extends ChangeNotifier {
if (newPopups != null && newPopups != _newPopups) { if (newPopups != null && newPopups != _newPopups) {
_newPopups = newPopups; _newPopups = newPopups;
} }
if (unseenNewFeatures != null && unseenNewFeatures != _unseenNewFeatures) {
_unseenNewFeatures = unseenNewFeatures;
}
if (cloudSyncEnabled != null && cloudSyncEnabled != _cloudSyncEnabled) {
_cloudSyncEnabled = cloudSyncEnabled;
}
if (cloudSyncToken != null && cloudSyncToken != _cloudSyncToken) {
_cloudSyncToken = cloudSyncToken;
}
if (qTimetableLessonNum != null && if (qTimetableLessonNum != null &&
qTimetableLessonNum != _qTimetableLessonNum) { qTimetableLessonNum != _qTimetableLessonNum) {
_qTimetableLessonNum = qTimetableLessonNum; _qTimetableLessonNum = qTimetableLessonNum;
@ -892,115 +839,11 @@ class SettingsProvider extends ChangeNotifier {
if (qSubjectsSubTiles != null && qSubjectsSubTiles != _qSubjectsSubTiles) { if (qSubjectsSubTiles != null && qSubjectsSubTiles != _qSubjectsSubTiles) {
_qSubjectsSubTiles = qSubjectsSubTiles; _qSubjectsSubTiles = qSubjectsSubTiles;
} }
// change updated at time
_updatedAt = DateTime.now();
// store or not // store or not
if (store) await _database?.store.storeSettings(this); if (store) await _database?.store.storeSettings(this);
notifyListeners(); notifyListeners();
} }
Future<void> updateFromMap({
required Map<dynamic, dynamic> map,
bool store = true,
}) async {
print(map);
await update(
store: store,
language: map["language"],
startPage: Pages.values[map["start_page"] ?? _startPage.index],
rounding: map["rounding"],
theme: ThemeMode.values[map["theme"] ?? _theme.index],
accentColor:
AccentColor.values[map["accent_color"] ?? _accentColor.index],
gradeColors: [
Color(map["grade_color1"] ?? _gradeColors[0].value),
Color(map["grade_color2"] ?? _gradeColors[1].value),
Color(map["grade_color3"] ?? _gradeColors[2].value),
Color(map["grade_color4"] ?? _gradeColors[3].value),
Color(map["grade_color5"] ?? _gradeColors[4].value),
],
newsEnabled: map["news"] == 1,
seenNews: map["seen_news"],
notificationsEnabled: map["notifications"] == 1,
notificationsGradesEnabled: map["notifications_grades"] == 1,
notificationsAbsencesEnabled: map["notifications_absences"] == 1,
notificationsMessagesEnabled: map["notifications_messages"] == 1,
notificationsLessonsEnabled: map["notifications_lessons"] == 1,
notificationsBitfield: map["notifications_bitfield"],
notificationPollInterval: map["notification_poll_interval"],
developerMode: map["developer_mode"] == 1,
vibrate:
VibrationStrength.values[map["vibration_strength"] ?? _vibrate.index],
abWeeks: map["ab_weeks"] == 1,
swapABweeks: map["swap_ab_weeks"] == 1,
updateChannel:
UpdateChannel.values[map["update_channel"] ?? _updateChannel.index],
config: Config.fromJson(jsonDecode(map["config"] ?? "{}")),
xFilcId: map["x_filc_id"],
analyticsEnabled: map["analytics_enabled"] == 1,
graphClassAvg: map["graph_class_avg"] == 1,
goodStudent: false,
presentationMode: map["presentation_mode"] == 1,
bellDelayEnabled: map["bell_delay_enabled"] == 1,
bellDelay: map["bell_delay"],
gradeOpeningFun: map["grade_opening_fun"] == 1,
iconPack: Map.fromEntries(
IconPack.values.map((e) => MapEntry(e.name, e)))[map["icon_pack"]]!,
customAccentColor:
Color(map["custom_accent_color"] ?? _customAccentColor.value),
customBackgroundColor:
Color(map["custom_background_color"] ?? _customBackgroundColor.value),
customHighlightColor:
Color(map["custom_highlight_color"] ?? _customHighlightColor.value),
customIconColor:
Color(map["custom_icon_color"] ?? _customIconColor.value),
customTextColor:
Color(map["custom_text_color"] ?? _customTextColor.value),
shadowEffect: map["shadow_effect"] == 1,
premiumScopes:
jsonDecode(map["premium_scopes"] ?? _premiumScopes).cast<String>(),
premiumAccessToken: map["premium_token"],
premiumLogin: map["premium_login"],
lastAccountId: map["last_account_id"],
renamedSubjectsEnabled: map["renamed_subjects_enabled"] == 1,
renamedSubjectsItalics: map["renamed_subjects_italics"] == 1,
renamedTeachersEnabled: map["renamed_teachers_enabled"] == 1,
renamedTeachersItalics: map["renamed_teachers_italics"] == 1,
liveActivityColor:
Color(map["live_activity_color"] ?? _liveActivityColor),
welcomeMessage: map["welcome_message"],
appIcon: map["app_icon"],
currentThemeId: map['current_theme_id'],
currentThemeDisplayName: map['current_theme_display_name'],
currentThemeCreator: map['current_theme_creator'],
showBreaks: map['show_breaks'] == 1,
// pinSetGeneral: map['general_s_pin'],
// pinSetPersonalize: map['personalize_s_pin'],
// pinSetNotify: map['notify_s_pin'],
// pinSetExtras: map['extras_s_pin'],
fontFamily: map['font_family'],
titleOnlyFont: map['title_only_font'] == 1,
plusSessionId: map['plus_session_id'],
calSyncRoomLocation: map['cal_sync_room_location'],
calSyncShowExams: map['cal_sync_show_exams'] == 1,
calSyncShowTeacher: map['cal_sync_show_teacher'] == 1,
calSyncRenamed: map['cal_sync_renamed'] == 1,
calendarId: map['calendar_id'],
navShadow: map['nav_shadow'] == 1,
newColors: map['new_colors'] == 1,
uwuMode: map['uwu_mode'] == 1,
newPopups: map['new_popups'] == 1,
unseenNewFeatures:
jsonDecode(map["unseen_new_features"] ?? "[]").cast<String>(),
cloudSyncEnabled: map['cloud_sync_enabled'] == 1,
cloudSyncToken: map['cloud_sync_token'],
qTimetableLessonNum: map['q_timetable_lesson_num'] == 1,
qTimetableSubTiles: map['q_timetable_sub_tiles'] == 1,
qSubjectsSubTiles: map['q_subjects_sub_tiles'] == 1,
);
}
void exportJson() { void exportJson() {
String sets = json.encode(toMap()); String sets = json.encode(toMap());
Clipboard.setData(ClipboardData(text: sets)); Clipboard.setData(ClipboardData(text: sets));

View File

@ -17,14 +17,6 @@ class User {
String nickname; String nickname;
String picture; String picture;
int gradeStreak; int gradeStreak;
// new login method
String accessToken;
DateTime accessTokenExpire;
String refreshToken;
// cloud sync
// String qwidAccessToken;
// DateTime? qwidAccessTokenExpire;
// String qwidRefreshToken;
String get displayName => nickname != '' ? nickname : name; String get displayName => nickname != '' ? nickname : name;
bool get hasStreak => gradeStreak > 0; bool get hasStreak => gradeStreak > 0;
@ -40,12 +32,6 @@ class User {
this.nickname = "", this.nickname = "",
this.picture = "", this.picture = "",
this.gradeStreak = 0, this.gradeStreak = 0,
required this.accessToken,
required this.accessTokenExpire,
required this.refreshToken,
// this.qwidAccessToken = "",
// this.qwidAccessTokenExpire,
// this.qwidRefreshToken = "",
}) { }) {
if (id != null) { if (id != null) {
this.id = id; this.id = id;
@ -70,22 +56,11 @@ class User {
birth: DateTime.now(), birth: DateTime.now(),
yearId: '1', yearId: '1',
parents: [], parents: [],
gradeDelay: 0,
), ),
role: Role.values[map["role"] ?? 0], role: Role.values[map["role"] ?? 0],
nickname: map["nickname"] ?? "", nickname: map["nickname"] ?? "",
picture: map["picture"] ?? "", picture: map["picture"] ?? "",
gradeStreak: map["grade_streak"] ?? 0, gradeStreak: map["grade_streak"] ?? 0,
accessToken: map["access_token"] ?? "",
accessTokenExpire: DateTime.parse(map["access_token_expire"] != ""
? map["access_token_expire"]
: DateTime.now().toIso8601String()),
refreshToken: map["refresh_token"] ?? "",
// qwidAccessToken: map["qwid_access_token"] ?? "",
// qwidAccessTokenExpire: map["qwid_access_token_expire"] != ""
// ? DateTime.parse(map["qwid_access_token_expire"])
// : null,
// qwidRefreshToken: map["qwid_refresh_token"] ?? "",
); );
} }
@ -100,15 +75,6 @@ class User {
"role": role.index, "role": role.index,
"nickname": nickname, "nickname": nickname,
"picture": picture, "picture": picture,
"grade_streak": gradeStreak,
"access_token": accessToken,
"access_token_expire": accessTokenExpire.toIso8601String(),
"refresh_token": refreshToken,
// "qwid_access_token": qwidAccessToken,
// "qwid_access_token_expire": qwidAccessTokenExpire != null
// ? qwidAccessTokenExpire!.toIso8601String()
// : "",
// "qwid_refresh_token": qwidRefreshToken,
}; };
} }

View File

@ -1,8 +1,8 @@
import 'dart:io'; import 'dart:io';
// import 'package:refilc/theme/colors/dark_desktop.dart'; import 'package:refilc/theme/colors/dark_desktop.dart';
import 'package:refilc/theme/colors/dark_mobile.dart'; import 'package:refilc/theme/colors/dark_mobile.dart';
// import 'package:refilc/theme/colors/light_desktop.dart'; import 'package:refilc/theme/colors/light_desktop.dart';
import 'package:refilc/theme/colors/light_mobile.dart'; import 'package:refilc/theme/colors/light_mobile.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -21,16 +21,10 @@ class AppColors {
} else { } else {
switch (brightness) { switch (brightness) {
case Brightness.light: case Brightness.light:
return LightMobileAppColors(); return LightDesktopAppColors();
case Brightness.dark: case Brightness.dark:
return DarkMobileAppColors(); return DarkDesktopAppColors();
} }
// switch (brightness) {
// case Brightness.light:
// return LightDesktopAppColors();
// case Brightness.dark:
// return DarkDesktopAppColors();
// }
} }
} }
} }

View File

@ -4,8 +4,6 @@ import 'package:flutter/material.dart';
import 'package:home_widget/home_widget.dart'; import 'package:home_widget/home_widget.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/services.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 { Future<bool?> updateWidget() async {
try { try {
@ -24,9 +22,7 @@ class ThemeModeObserver extends ChangeNotifier {
ThemeMode get themeMode => _themeMode; ThemeMode get themeMode => _themeMode;
bool get updateNavbarColor => _updateNavbarColor; bool get updateNavbarColor => _updateNavbarColor;
ThemeModeObserver( ThemeModeObserver({ThemeMode initialTheme = ThemeMode.system, bool updateNavbarColor = true})
{ThemeMode initialTheme = ThemeMode.system,
bool updateNavbarColor = true})
: _themeMode = initialTheme, : _themeMode = initialTheme,
_updateNavbarColor = updateNavbarColor; _updateNavbarColor = updateNavbarColor;
@ -35,12 +31,5 @@ class ThemeModeObserver extends ChangeNotifier {
_updateNavbarColor = updateNavbarColor; _updateNavbarColor = updateNavbarColor;
if (Platform.isAndroid) updateWidget(); if (Platform.isAndroid) updateWidget();
notifyListeners(); 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

@ -115,42 +115,44 @@ class AppTheme {
primary: accent, primary: accent,
onPrimary: onPrimary:
(accent.computeLuminance() > 0.5 ? Colors.black : Colors.white) (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withValues(alpha: .9), .withOpacity(.9),
secondary: newSecondary, secondary: newSecondary,
onSecondary: (newSecondary.computeLuminance() > 0.5 onSecondary: (newSecondary.computeLuminance() > 0.5
? Colors.black ? Colors.black
: Colors.white) : Colors.white)
.withValues(alpha: .9), .withOpacity(.9),
tertiary: newTertiary, tertiary: newTertiary,
onTertiary: onTertiary:
(newTertiary.computeLuminance() > 0.5 ? Colors.black : Colors.white) (newTertiary.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withValues(alpha: .9), .withOpacity(.9),
background: highlightColor,
onBackground: Colors.black.withOpacity(.9),
brightness: Brightness.light, brightness: Brightness.light,
error: lightColors.red, error: lightColors.red,
onError: Colors.white.withValues(alpha: .9), onError: Colors.white.withOpacity(.9),
surface: highlightColor, surface: highlightColor,
onSurface: Colors.black.withValues(alpha: .9), onSurface: Colors.black.withOpacity(.9),
), ),
shadowColor: lightColors.shadow.withValues(alpha: .5), shadowColor: lightColors.shadow.withOpacity(.5),
appBarTheme: AppBarTheme(backgroundColor: backgroundColor), appBarTheme: AppBarTheme(backgroundColor: backgroundColor),
indicatorColor: accent, indicatorColor: accent,
iconTheme: IconThemeData(color: lightColors.text.withValues(alpha: .75)), iconTheme: IconThemeData(color: lightColors.text.withOpacity(.75)),
navigationBarTheme: NavigationBarThemeData( navigationBarTheme: NavigationBarThemeData(
indicatorColor: accent.withValues( indicatorColor:
alpha: accentColor == AccentColor.adaptive ? 0.4 : 0.8), accent.withOpacity(accentColor == AccentColor.adaptive ? 0.4 : 0.8),
iconTheme: iconTheme:
WidgetStateProperty.all(IconThemeData(color: lightColors.text)), MaterialStateProperty.all(IconThemeData(color: lightColors.text)),
backgroundColor: highlightColor, backgroundColor: highlightColor,
labelTextStyle: WidgetStateProperty.all(TextStyle( labelTextStyle: MaterialStateProperty.all(TextStyle(
fontSize: 13.0, fontSize: 13.0,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: lightColors.text.withValues(alpha: 0.8), color: lightColors.text.withOpacity(0.8),
)), )),
labelBehavior: NavigationDestinationLabelBehavior.alwaysShow, labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
height: 76.0, height: 76.0,
), ),
sliderTheme: SliderThemeData( sliderTheme: SliderThemeData(
inactiveTrackColor: accent.withValues(alpha: .3), inactiveTrackColor: accent.withOpacity(.3),
), ),
progressIndicatorTheme: ProgressIndicatorThemeData(color: accent), progressIndicatorTheme: ProgressIndicatorThemeData(color: accent),
expansionTileTheme: ExpansionTileThemeData(iconColor: accent), expansionTileTheme: ExpansionTileThemeData(iconColor: accent),
@ -238,48 +240,50 @@ class AppTheme {
primary: accent, primary: accent,
onPrimary: onPrimary:
(accent.computeLuminance() > 0.5 ? Colors.black : Colors.white) (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withValues(alpha: .9), .withOpacity(.9),
secondary: newSecondary, secondary: newSecondary,
onSecondary: (newSecondary.computeLuminance() > 0.5 onSecondary: (newSecondary.computeLuminance() > 0.5
? Colors.black ? Colors.black
: Colors.white) : Colors.white)
.withValues(alpha: .9), .withOpacity(.9),
tertiary: newTertiary, tertiary: newTertiary,
onTertiary: onTertiary:
(newTertiary.computeLuminance() > 0.5 ? Colors.black : Colors.white) (newTertiary.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withValues(alpha: .9), .withOpacity(.9),
background: highlightColor,
onBackground: Colors.white.withOpacity(.9),
brightness: Brightness.dark, brightness: Brightness.dark,
error: darkColors.red, error: darkColors.red,
onError: Colors.black.withValues(alpha: .9), onError: Colors.black.withOpacity(.9),
surface: highlightColor, surface: highlightColor,
onSurface: Colors.white.withValues(alpha: .9), onSurface: Colors.white.withOpacity(.9),
), ),
shadowColor: highlightColor.withValues(alpha: .5), //darkColors.shadow, shadowColor: highlightColor.withOpacity(.5), //darkColors.shadow,
appBarTheme: AppBarTheme(backgroundColor: backgroundColor), appBarTheme: AppBarTheme(backgroundColor: backgroundColor),
indicatorColor: accent, indicatorColor: accent,
iconTheme: IconThemeData(color: darkColors.text.withValues(alpha: .75)), iconTheme: IconThemeData(color: darkColors.text.withOpacity(.75)),
navigationBarTheme: NavigationBarThemeData( navigationBarTheme: NavigationBarThemeData(
indicatorColor: accent.withValues( indicatorColor:
alpha: accentColor == AccentColor.adaptive ? 0.4 : 0.8), accent.withOpacity(accentColor == AccentColor.adaptive ? 0.4 : 0.8),
iconTheme: iconTheme:
WidgetStateProperty.all(IconThemeData(color: darkColors.text)), MaterialStateProperty.all(IconThemeData(color: darkColors.text)),
backgroundColor: highlightColor, backgroundColor: highlightColor,
labelTextStyle: WidgetStateProperty.all(TextStyle( labelTextStyle: MaterialStateProperty.all(TextStyle(
fontSize: 13.0, fontSize: 13.0,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: darkColors.text.withValues(alpha: 0.8), color: darkColors.text.withOpacity(0.8),
)), )),
labelBehavior: NavigationDestinationLabelBehavior.alwaysShow, labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
height: 76.0, height: 76.0,
), ),
sliderTheme: SliderThemeData( sliderTheme: SliderThemeData(
inactiveTrackColor: accent.withValues(alpha: .3), inactiveTrackColor: accent.withOpacity(.3),
), ),
progressIndicatorTheme: ProgressIndicatorThemeData(color: accent), progressIndicatorTheme: ProgressIndicatorThemeData(color: accent),
expansionTileTheme: ExpansionTileThemeData(iconColor: accent), expansionTileTheme: ExpansionTileThemeData(iconColor: accent),
cardColor: highlightColor, cardColor: highlightColor,
chipTheme: ChipThemeData( chipTheme: ChipThemeData(
backgroundColor: accent.withValues(alpha: .2), backgroundColor: accent.withOpacity(.2),
elevation: 1, elevation: 1,
), ),
bottomNavigationBarTheme: BottomNavigationBarThemeData( bottomNavigationBarTheme: BottomNavigationBarThemeData(

View File

@ -191,7 +191,7 @@ List<Widget> sortDateWidgets(
width: 150.0, width: 150.0,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0), borderRadius: BorderRadius.circular(12.0),
color: AppColors.of(context).text.withValues(alpha: .25), color: AppColors.of(context).text.withOpacity(.25),
), ),
), ),
), ),

View File

@ -178,7 +178,7 @@ Future<List<DateWidget>> getFilterWidgets(FilterType activeData,
// Ads // Ads
case FilterType.ads: case FilterType.ads:
if (adProvider.available) { if (adProvider.available) {
items = ad_filter.getWidgets(adProvider.ads, context); items = ad_filter.getWidgets(adProvider.ads);
} }
break; break;
} }
@ -232,8 +232,8 @@ Widget filterItemBuilder(
BoxShadow( BoxShadow(
offset: const Offset(0, 21), offset: const Offset(0, 21),
blurRadius: 23.0, blurRadius: 23.0,
color: Theme.of(context).shadowColor.withValues( color: Theme.of(context).shadowColor.withOpacity(
alpha: Theme.of(context).shadowColor.opacity * Theme.of(context).shadowColor.opacity *
CurvedAnimation( CurvedAnimation(
parent: CurvedAnimation( parent: CurvedAnimation(
parent: animation, parent: animation,
@ -259,7 +259,7 @@ Widget filterItemBuilder(
? const EdgeInsets.symmetric(vertical: 8.0) ? const EdgeInsets.symmetric(vertical: 8.0)
: const EdgeInsets.symmetric(vertical: 4.0), : const EdgeInsets.symmetric(vertical: 4.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface, color: Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.vertical( borderRadius: BorderRadius.vertical(
top: separated || isAfterSeparated top: separated || isAfterSeparated
? const Radius.circular(16.0) ? const Radius.circular(16.0)

View File

@ -1,70 +1,23 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:refilc/models/ad.dart'; import 'package:refilc/models/ad.dart';
import 'package:refilc/ui/date_widget.dart'; import 'package:refilc/ui/date_widget.dart';
import 'package:refilc_mobile_ui/common/widgets/ad/ad_tile.dart';
import 'package:refilc_mobile_ui/common/widgets/ad/ad_viewable.dart' as mobile; import 'package:refilc_mobile_ui/common/widgets/ad/ad_viewable.dart' as mobile;
import 'package:refilc_mobile_ui/plus/plus_screen.dart';
import 'package:refilc_plus/providers/plus_provider.dart';
import 'package:uuid/uuid.dart';
List<DateWidget> getWidgets(List<Ad> providerAds, BuildContext context) { List<DateWidget> getWidgets(List<Ad> providerAds) {
List<DateWidget> items = []; List<DateWidget> items = [];
bool hasPlus = Provider.of<PlusProvider>(context).hasPremium;
DateWidget plusWidget = DateWidget(
key: const Uuid().v4(),
date: DateTime.now(),
widget: AdTile(
Ad(
title: 'reFilc+',
description:
'Fizess elő reFilc+-ra, rejtsd el a hirdetéseket és támogasd az app működését!',
author: '',
logoUrl: Uri.parse('https://refilc.hu/image/brand/logo.png'),
overridePremium: false,
date: DateTime(2007, 6, 29, 9, 41),
expireDate: DateTime.now().add(const Duration(days: 11)),
launchUrl: Uri.parse('https://refilc.hu/plus'),
),
onTap: () => Navigator.of(context, rootNavigator: true)
.push(MaterialPageRoute(builder: (context) {
return const PlusScreen();
})),
padding: const EdgeInsets.symmetric(horizontal: 5.0),
showExternalIcon: false,
),
);
if (providerAds.isNotEmpty) { if (providerAds.isNotEmpty) {
for (var ad in providerAds) { for (var ad in providerAds) {
if (ad.date.isBefore(DateTime.now()) && if (ad.date.isBefore(DateTime.now()) &&
ad.expireDate.isAfter(DateTime.now()) && ad.expireDate.isAfter(DateTime.now())) {
DateTime.now().hour.isOdd) { providerAds.sort((a, b) => -a.date.compareTo(b.date));
if (!hasPlus || ad.overridePremium) {
providerAds.sort((a, b) => -a.date.compareTo(b.date));
items.add(DateWidget( items.add(DateWidget(
key: ad.description, key: ad.description,
date: ad.date, date: ad.date,
widget: mobile.AdViewable(ad), widget: mobile.AdViewable(ad),
)); ));
}
} else {
if (DateTime.now().weekday == DateTime.saturday &&
items.isEmpty &&
!hasPlus) {
items.add(plusWidget);
}
} }
} }
} else {
if (DateTime.now().weekday == DateTime.saturday &&
items.isEmpty &&
!hasPlus) {
items.add(plusWidget);
}
} }
return items; return items;

View File

@ -8,9 +8,7 @@ List<DateWidget> getWidgets(List<Grade> providerGrades) {
List<DateWidget> items = []; List<DateWidget> items = [];
for (var gradeType in GradeType.values) { for (var gradeType in GradeType.values) {
if ([GradeType.midYear, GradeType.unknown, GradeType.levelExam] if ([GradeType.midYear, GradeType.unknown, GradeType.levelExam]
.contains(gradeType)) { .contains(gradeType)) continue;
continue;
}
List<Grade> grades = List<Grade> grades =
providerGrades.where((grade) => grade.type == gradeType).toList(); providerGrades.where((grade) => grade.type == gradeType).toList();

Some files were not shown because too many files have changed in this diff Show More