Compare commits
213 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db58b54754 | ||
|
|
7de3d211bb | ||
|
|
d3e5fc99ea | ||
|
|
17cffc0576 | ||
|
|
f38ff3b862 | ||
|
|
89e67c369e | ||
|
|
6dd68c8f5d | ||
|
|
97b01e9f14 | ||
|
|
556ba9d289 | ||
|
|
64868e85f3 | ||
|
|
30ac155b4b | ||
|
|
36bd679644 | ||
|
|
75b03b95bc | ||
|
|
ac18cf62c3 | ||
|
|
3619a7a4a7 | ||
|
|
a71b365e4a | ||
|
|
20fa9a8aef | ||
|
|
da12ac8646 | ||
|
|
4b40692fe1 | ||
|
|
26f65a4144 | ||
|
|
f8cfa04d04 | ||
|
|
82671f5ec9 | ||
|
|
5d37de897f | ||
|
|
fcb1d8d6d9 | ||
|
|
446fad4c5f | ||
|
|
0f799375a1 | ||
|
|
29aa356cd0 | ||
|
|
3abaf2f96a | ||
|
|
5b48847cf2 | ||
|
|
b82a56ca65 | ||
|
|
94c57abdea | ||
|
|
e3c26987ec | ||
|
|
eac710a5b4 | ||
|
|
b8299c4daf | ||
|
|
7a671b6aa6 | ||
|
|
f51de83c88 | ||
|
|
d77cc081a9 | ||
|
|
18fa9a6de7 | ||
|
|
4467267e61 | ||
|
|
f39b9ffeb6 | ||
|
|
0df9de97d4 | ||
|
|
69a3090f16 | ||
|
|
818060bbcb | ||
|
|
38eb8c440b | ||
|
|
47a18c1ec2 | ||
|
|
cc33550331 | ||
|
|
4af3e51300 | ||
|
|
ea33d00f54 | ||
|
|
75eba2c83f | ||
|
|
4a81722747 | ||
|
|
ed67551164 | ||
|
|
c53502f16a | ||
|
|
d13de96ae9 | ||
|
|
53e9aca376 | ||
|
|
8a39086ca6 | ||
|
|
fd7793a20d | ||
|
|
7a793a3af0 | ||
|
|
cac21a4849 | ||
|
|
4c558157e8 | ||
|
|
043b669737 | ||
|
|
7b9ec6de2e | ||
|
|
b14821901c | ||
|
|
cc05524bea | ||
|
|
b3d791a4c3 | ||
|
|
9525d7d1df | ||
|
|
bc040185d0 | ||
|
|
65e98bf8a8 | ||
|
|
1a0558485e | ||
|
|
8f7c46d2d4 | ||
|
|
4f3d44dfed | ||
|
|
922e8984f8 | ||
|
|
ee475f8ee8 | ||
|
|
3c431cbce1 | ||
|
|
708c411339 | ||
|
|
1e9247652a | ||
|
|
551ed6ebdb | ||
|
|
c86ac68007 | ||
|
|
d309f11f19 | ||
|
|
e4acd4f872 | ||
|
|
3ee91e7543 | ||
|
|
f147ae328e | ||
|
|
aab1f605d4 | ||
|
|
c71a6d9468 | ||
|
|
165f836d93 | ||
|
|
6356206291 | ||
|
|
bf8ca49f98 | ||
|
|
0fca636311 | ||
|
|
8673a9e42a | ||
|
|
0390d0df39 | ||
|
|
4ec2f74fee | ||
|
|
e2078db34b | ||
|
|
1f39bdc301 | ||
|
|
029e841d7b | ||
|
|
6a16f93884 | ||
|
|
cfc0229f09 | ||
|
|
a68dd759d8 | ||
|
|
e7d0e3805d | ||
|
|
d617d9ef47 | ||
|
|
2564224a6e | ||
|
|
5c2b690bc8 | ||
|
|
ff72d146c0 | ||
|
|
088b6e4580 | ||
|
|
66793607e8 | ||
|
|
c91e792c6c | ||
|
|
16d0bd4163 | ||
|
|
e559338483 | ||
|
|
f2c29aa81b | ||
|
|
e44a3b7330 | ||
|
|
64606311bf | ||
|
|
43c4d2e454 | ||
|
|
9b579ad196 | ||
|
|
425a4aaa91 | ||
|
|
506c04aea9 | ||
|
|
cd18cfb220 | ||
|
|
f071e59e7a | ||
|
|
49f3a447b3 | ||
|
|
339dbea1ef | ||
|
|
79f6ef4c50 | ||
|
|
ae18fbab2e | ||
|
|
9003e13aa1 | ||
|
|
e58f4859b4 | ||
|
|
be809c6aaf | ||
|
|
a6b012035b | ||
|
|
a0ef512c55 | ||
|
|
4e1c1be6e4 | ||
|
|
92a93941ab | ||
|
|
ece621455c | ||
|
|
0787f97a6f | ||
|
|
c74975e3bc | ||
|
|
4b669b0069 | ||
|
|
d24286b61c | ||
|
|
40f3d2159a | ||
|
|
8df77b5c06 | ||
|
|
fd88b5ee55 | ||
|
|
ceaafb4897 | ||
|
|
6617882892 | ||
|
|
1b16b748d4 | ||
|
|
7014255b89 | ||
|
|
d86f2fffe5 | ||
|
|
de1b0444b6 | ||
|
|
bd1a8358f6 | ||
|
|
8a670b3a4c | ||
|
|
2917a2e913 | ||
|
|
414c183399 | ||
|
|
428d6ff975 | ||
|
|
c418a61133 | ||
|
|
7e83d7b969 | ||
|
|
bdf6cc20c7 | ||
|
|
da089da22b | ||
|
|
fa3c0954c4 | ||
|
|
f4843211f5 | ||
|
|
5e1727eadd | ||
|
|
dd103e7474 | ||
|
|
aa61301b17 | ||
|
|
af360fda53 | ||
|
|
a56453ab9d | ||
|
|
c9aed14d7c | ||
|
|
0cef766ee6 | ||
|
|
c8cd6bf9b8 | ||
|
|
d9e8b4f4ed | ||
|
|
8ab96a32c3 | ||
|
|
22c8a285ab | ||
|
|
d819245e31 | ||
|
|
6b55721ec5 | ||
|
|
13062c4a9b | ||
|
|
2188eaf1c6 | ||
|
|
922d252c57 | ||
|
|
7a5290efe5 | ||
|
|
d1e6cc1fbb | ||
|
|
b6a8696911 | ||
|
|
f7efd65f5e | ||
|
|
9963f65ab2 | ||
|
|
8d8c3a54c2 | ||
|
|
c49d93c7b1 | ||
|
|
b0a7ab20d9 | ||
|
|
59a9e0e236 | ||
|
|
e83202ba29 | ||
|
|
d4489dd9d4 | ||
|
|
debb4cac5b | ||
|
|
acbdf2aecb | ||
|
|
5d9ea4311a | ||
|
|
8aa24d7a32 | ||
|
|
9fbcef357e | ||
|
|
e9423a8535 | ||
|
|
2a7265256d | ||
|
|
d5ba231fcc | ||
|
|
68d92c4462 | ||
|
|
a46f6130cb | ||
|
|
c6021e7a69 | ||
|
|
3ceb40ddb8 | ||
|
|
593292e860 | ||
|
|
ab952daa10 | ||
|
|
56b6eb3d2b | ||
|
|
26be20ac28 | ||
|
|
afd004b980 | ||
|
|
903cbba69a | ||
|
|
6eb6a0cf16 | ||
|
|
abf9f9b13d | ||
|
|
0471843919 | ||
|
|
bb83dd2137 | ||
|
|
d9b07525a4 | ||
|
|
92334406c5 | ||
|
|
506af7fa71 | ||
|
|
f5be03e5ce | ||
|
|
2047784d8f | ||
|
|
037cf1df48 | ||
|
|
8238cc0678 | ||
|
|
f52a747268 | ||
|
|
c37bdc7aff | ||
|
|
9015ff2d6b | ||
|
|
a801503838 | ||
|
|
b0565ddcd9 | ||
|
|
d8b6ba9a64 |
2
.github/FUNDING.yml
vendored
@@ -1 +1 @@
|
|||||||
patreon: filcnaplo
|
github: filc
|
||||||
|
|||||||
11
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for all configuration options:
|
||||||
|
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "pub" # See documentation for possible values
|
||||||
|
directory: "/" # Location of package manifests
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
5
.gitignore
vendored
@@ -1,5 +1,8 @@
|
|||||||
# See https://www.dartlang.org/guides/libraries/private-files
|
# See https://www.dartlang.org/guides/libraries/private-files
|
||||||
|
|
||||||
|
termek.txt
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
# Files and directories created by pub
|
# Files and directories created by pub
|
||||||
.dart_tool/
|
.dart_tool/
|
||||||
.packages
|
.packages
|
||||||
@@ -19,3 +22,5 @@ doc/api/
|
|||||||
*.js_
|
*.js_
|
||||||
*.js.deps
|
*.js.deps
|
||||||
*.js.map
|
*.js.map
|
||||||
|
|
||||||
|
*.txt
|
||||||
5
.vscode/launch.json
vendored
@@ -8,7 +8,10 @@
|
|||||||
"name": "filcnaplo",
|
"name": "filcnaplo",
|
||||||
"cwd": "filcnaplo",
|
"cwd": "filcnaplo",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart"
|
"type": "dart",
|
||||||
|
"toolArgs": [
|
||||||
|
"--dart-define=APPVER=$(cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1)"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
16
README.md
@@ -9,16 +9,16 @@
|
|||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
### Clone the project:
|
### Clone the project
|
||||||
|
|
||||||
```
|
```sh
|
||||||
$ git clone --recursive https://github.com/filc/naplo
|
git clone --recursive https://github.com/filc/naplo
|
||||||
$ cd naplo
|
cd naplo
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run the app:
|
### Run the app
|
||||||
|
|
||||||
```
|
```sh
|
||||||
$ cd filcnaplo
|
cd filcnaplo
|
||||||
$ flutter run
|
flutter run
|
||||||
```
|
```
|
||||||
|
|||||||
6
changelog.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
What's new:
|
||||||
|
|
||||||
|
- Több szín lehetőség, egyedi hexadecimális szín választás
|
||||||
|
- Több tanuló esetén legutóbb kiválasztott tanuló mutatása indításkor
|
||||||
|
- Hibajavítások 🐛
|
||||||
|
- **Megérkezett a Filc Premium!** ✨
|
||||||
1
filcnaplo/.gitignore
vendored
@@ -8,7 +8,6 @@
|
|||||||
.buildlog/
|
.buildlog/
|
||||||
.history
|
.history
|
||||||
.svn/
|
.svn/
|
||||||
build.sh
|
|
||||||
|
|
||||||
# IntelliJ related
|
# IntelliJ related
|
||||||
*.iml
|
*.iml
|
||||||
|
|||||||
@@ -1,10 +1,30 @@
|
|||||||
# This file tracks properties of this Flutter project.
|
# This file tracks properties of this Flutter project.
|
||||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||||
#
|
#
|
||||||
# This file should be version controlled and should not be manually edited.
|
# This file should be version controlled.
|
||||||
|
|
||||||
version:
|
version:
|
||||||
revision: 06e2fd63574bad2edafbe4653104ed76871ee0b1
|
revision: 3c0bee85b8e43b860877922bdc411a7333db4d32
|
||||||
channel: beta
|
channel: beta
|
||||||
|
|
||||||
project_type: app
|
project_type: app
|
||||||
|
|
||||||
|
# Tracks metadata for the flutter migrate command
|
||||||
|
migration:
|
||||||
|
platforms:
|
||||||
|
- platform: root
|
||||||
|
create_revision: 3c0bee85b8e43b860877922bdc411a7333db4d32
|
||||||
|
base_revision: 3c0bee85b8e43b860877922bdc411a7333db4d32
|
||||||
|
- platform: macos
|
||||||
|
create_revision: 3c0bee85b8e43b860877922bdc411a7333db4d32
|
||||||
|
base_revision: 3c0bee85b8e43b860877922bdc411a7333db4d32
|
||||||
|
|
||||||
|
# User provided section
|
||||||
|
|
||||||
|
# List of Local paths (relative to this file) that should be
|
||||||
|
# ignored by the migrate tool.
|
||||||
|
#
|
||||||
|
# Files that are not part of the templates will be ignored by default.
|
||||||
|
unmanaged_files:
|
||||||
|
- 'lib/main.dart'
|
||||||
|
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||||
|
|||||||
29
filcnaplo/analysis_options.yaml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# This file configures the analyzer, which statically analyzes Dart code to
|
||||||
|
# check for errors, warnings, and lints.
|
||||||
|
#
|
||||||
|
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
||||||
|
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
||||||
|
# invoked from the command line by running `flutter analyze`.
|
||||||
|
|
||||||
|
# The following line activates a set of recommended lints for Flutter apps,
|
||||||
|
# packages, and plugins designed to encourage good coding practices.
|
||||||
|
include: package:flutter_lints/flutter.yaml
|
||||||
|
|
||||||
|
linter:
|
||||||
|
# The lint rules applied to this project can be customized in the
|
||||||
|
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||||
|
# included above or to enable additional rules. A list of all available lints
|
||||||
|
# and their documentation is published at
|
||||||
|
# https://dart-lang.github.io/linter/lints/index.html.
|
||||||
|
#
|
||||||
|
# Instead of disabling a lint rule for the entire project in the
|
||||||
|
# section below, it can also be suppressed for a single line of code
|
||||||
|
# or a specific dart file by using the `// ignore: name_of_lint` and
|
||||||
|
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||||
|
# producing the lint.
|
||||||
|
rules:
|
||||||
|
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||||
|
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||||
|
|
||||||
|
# Additional information about this file can be found at
|
||||||
|
# https://dart.dev/guides/language/analysis-options
|
||||||
@@ -26,13 +26,8 @@ apply plugin: 'kotlin-android'
|
|||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
def keystoreProperties = new Properties()
|
def keystoreProperties = new Properties()
|
||||||
def keystorePropertiesFile = rootProject.file("$System.env.ANDROID_SIGNING")
|
def keystorePropertiesFile = rootProject.file("$System.env.HOME/keys/filc3.properties")
|
||||||
if (keystorePropertiesFile.exists()) {
|
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
|
||||||
} else {
|
|
||||||
keystoreProperties.load(new FileInputStream(rootProject.file("signing/signing.properties")))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||||
|
|||||||
@@ -1,19 +1,62 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="hu.filc.naplo">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="hu.filc.naplo">
|
||||||
<application android:label="Filc Napló" android:icon="@mipmap/ic_launcher" android:requestLegacyExternalStorage="true">
|
<application android:label="Filc Napló" android:icon="@mipmap/ic_launcher" android:requestLegacyExternalStorage="true">
|
||||||
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
|
<activity android:exported="true" android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
|
||||||
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
|
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
<intent-filter android:autoVerify="true">
|
||||||
<meta-data android:name="flutterEmbedding" android:value="2" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
</application>
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<!-- Accepts URIs that begin with https://api.filcnaplo.hu -->
|
||||||
|
<data
|
||||||
|
android:scheme="https"
|
||||||
|
android:host="api.filcnaplo.hu"
|
||||||
|
android:pathPrefix="/callback" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<meta-data android:name="flutterEmbedding" android:value="2" />
|
||||||
|
|
||||||
<!-- Permissions -->
|
<!-- <receiver android:name=".WidgetTimetable.widget_timetable"
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
android:exported="true">
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<intent-filter>
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<action android:name="list_widget.ACTION_WIDGET_CLICK_NAV_LEFT" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
<action android:name="list_widget.ACTION_WIDGET_CLICK_NAV_RIGHT" />
|
||||||
|
<action android:name="list_widget.ACTION_WIDGET_CLICK_NAV_TODAY" />
|
||||||
|
<action android:name="list_widget.ACTION_WIDGET_CLICK_NAV_REFRESH" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.appwidget.provider"
|
||||||
|
android:resource="@xml/home_widget_test_info" />
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<service android:name=".WidgetTimetable.widget_timetable_service"
|
||||||
|
android:permission="android.permission.BIND_REMOTEVIEWS" />
|
||||||
|
|
||||||
|
<receiver android:name="es.antonborri.home_widget.HomeWidgetBackgroundReceiver"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="es.antonborri.home_widget.action.BACKGROUND" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<service android:name="es.antonborri.home_widget.HomeWidgetBackgroundService"
|
||||||
|
android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true" />
|
||||||
|
-->
|
||||||
|
</application>
|
||||||
|
|
||||||
|
<!-- Permissions -->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
</manifest>
|
</manifest>
|
||||||
BIN
filcnaplo/android/app/src/main/res/drawable/ic_absences.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
filcnaplo/android/app/src/main/res/drawable/ic_grades.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
filcnaplo/android/app/src/main/res/drawable/ic_home.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
filcnaplo/android/app/src/main/res/drawable/ic_messages.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
filcnaplo/android/app/src/main/res/drawable/ic_timetable.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
@@ -1,9 +1,9 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.50'
|
ext.kotlin_version = '1.6.10'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
compileSdkVersion = 30
|
compileSdkVersion = 33
|
||||||
targetSdkVersion = 30
|
targetSdkVersion = 33
|
||||||
appCompatVersion = "1.1.0"
|
appCompatVersion = "1.1.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,8 +33,8 @@ subprojects {
|
|||||||
afterEvaluate {project ->
|
afterEvaluate {project ->
|
||||||
if (project.plugins.hasPlugin('android') || project.plugins.hasPlugin('android-library')) {
|
if (project.plugins.hasPlugin('android') || project.plugins.hasPlugin('android-library')) {
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 33
|
||||||
buildToolsVersion '30.0.3'
|
buildToolsVersion '31.0.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
keyAlias=test
|
|
||||||
keyPassword=test123
|
|
||||||
storeFile=../signing/signing.keystore
|
|
||||||
storePassword=test123
|
|
||||||
BIN
filcnaplo/assets/animations/backpack-2.riv
Normal file
1
filcnaplo/assets/animations/bell-alert.json
Normal file
BIN
filcnaplo/assets/fonts/SpaceMono/SpaceMono-Bold.ttf
Normal file
BIN
filcnaplo/assets/fonts/SpaceMono/SpaceMono-BoldItalic.ttf
Normal file
BIN
filcnaplo/assets/fonts/SpaceMono/SpaceMono-Italic.ttf
Normal file
BIN
filcnaplo/assets/fonts/SpaceMono/SpaceMono-Regular.ttf
Normal file
@@ -1,5 +0,0 @@
|
|||||||
<svg width="20" height="22" viewBox="0 0 20 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path
|
|
||||||
d="M1 8L10 1L19 8V19C19 19.5304 18.7893 20.0391 18.4142 20.4142C18.0391 20.7893 17.5304 21 17 21H3C2.46957 21 1.96086 20.7893 1.58579 20.4142C1.21071 20.0391 1 19.5304 1 19V8Z"
|
|
||||||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 384 B |
@@ -1,3 +0,0 @@
|
|||||||
<svg width="288" height="288" viewBox="0 0 288 288" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M159.653 207.26C136.598 217.973 115.171 217.858 100.771 216.821C83.6064 215.583 69.7824 210.888 63.72 206.77C59.976 204.236 54.8928 205.215 52.3584 208.959C49.824 212.703 50.8032 217.786 54.5472 220.32C64.3104 226.93 81.5616 231.84 99.5904 233.136C102.643 233.367 105.998 233.496 109.613 233.496C125.309 233.496 145.238 231.999 166.55 222.092C170.64 220.176 172.426 215.324 170.51 211.22C168.61 207.13 163.742 205.344 159.653 207.26ZM250.574 195.135C251.352 124.057 258.667 -10.2371 122.616 0.620487C-11.7072 11.4348 23.904 153.332 21.9024 200.852C20.1312 225.994 11.7936 256.723 0 288H36.3024C40.0464 274.752 42.7824 261.634 43.9632 249.149C46.152 250.675 48.4992 252.144 51.0048 253.555C55.0656 255.96 58.5648 259.143 62.2656 262.512C70.9056 270.389 80.712 279.331 99.864 280.44C101.146 280.512 102.442 280.555 103.709 280.555C123.091 280.555 136.339 272.074 146.995 265.263C152.093 261.994 156.499 259.171 160.646 257.818C172.44 254.131 182.736 248.17 190.426 240.595C191.635 239.415 192.744 238.191 193.795 236.952C198.086 252.663 203.962 270.36 210.47 288H288C269.366 259.258 250.171 231.077 250.574 195.135ZM34.9056 156.471V156.457C33.5664 133.258 44.6688 113.761 59.688 112.882C74.7072 112.004 87.9696 130.105 89.3088 153.289C89.3088 153.303 89.3088 153.303 89.3088 153.303C89.3808 154.556 89.4096 155.794 89.4096 157.018C84.6576 158.213 80.352 159.956 76.5072 161.986C76.4928 161.813 76.4784 161.641 76.464 161.468V161.453C75.1824 148.292 68.1552 138.356 60.7536 139.249C53.3664 140.156 48.4128 151.561 49.7088 164.722C50.2704 170.468 51.912 175.594 54.216 179.482C53.64 179.929 52.0272 181.109 50.1696 182.477C48.7728 183.5 47.0592 184.738 45.0144 186.25C39.4272 178.906 35.5968 168.365 34.9056 156.471ZM187.099 213.797C186.566 226.051 170.525 237.586 155.722 242.208L155.635 242.237C149.472 244.239 143.986 247.752 138.168 251.467C128.405 257.717 118.296 264.183 103.709 264.183C102.744 264.183 101.765 264.154 100.8 264.096C87.4368 263.319 81.1872 257.631 73.2816 250.416C69.1056 246.615 64.7856 242.669 59.2272 239.415L59.0976 239.343C47.088 232.56 39.6288 224.136 39.1536 216.778C38.9232 213.135 40.5504 209.967 43.992 207.389C51.48 201.773 56.5056 198.101 59.8176 195.668C63.504 192.975 64.6272 192.168 65.448 191.376C66.0384 190.829 66.672 190.21 67.3632 189.533C74.232 182.852 85.7376 171.663 103.406 171.663C114.206 171.663 126.158 175.825 138.888 184.004C144.878 187.906 150.106 189.706 156.715 191.996C161.251 193.565 166.406 195.336 173.304 198.288L173.419 198.346C179.842 200.981 187.445 205.805 187.099 213.783V213.797ZM183.557 184.997C182.318 184.378 181.022 183.788 179.683 183.226C173.462 180.576 168.48 178.762 164.347 177.322C166.637 172.858 168.048 167.285 168.178 161.223C168.494 146.492 161.064 134.525 151.589 134.511C142.099 134.482 134.165 146.405 133.848 161.137C133.834 161.626 133.834 162.101 133.848 162.577C128.002 159.898 122.256 157.94 116.64 156.745C116.611 156.183 116.582 155.636 116.568 155.074V155.06C116.021 128.233 132.494 106.014 153.346 105.452C174.197 104.89 191.549 126.174 192.096 153.015V153.029C192.341 165.169 189.101 176.329 183.557 184.997Z" fill="black"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 3.2 KiB |
13
filcnaplo/build.sh
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
|
# With build number
|
||||||
|
function get_version_bn
|
||||||
|
cat pubspec.yaml | grep version: | cut -d' ' -f2
|
||||||
|
end
|
||||||
|
|
||||||
|
function get_version
|
||||||
|
cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1
|
||||||
|
end
|
||||||
|
|
||||||
|
flutter build apk --release --dart-define=APPVER=(get_version) --no-tree-shake-icons && \
|
||||||
|
cp -v "build/app/outputs/flutter-apk/app-release.apk" ~/"Desktop/hu.filc.naplo_"(get_version_bn).apk
|
||||||
@@ -21,6 +21,6 @@
|
|||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>MinimumOSVersion</key>
|
<key>MinimumOSVersion</key>
|
||||||
<string>8.0</string>
|
<string>11.0</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
|
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||||
#include "Generated.xcconfig"
|
#include "Generated.xcconfig"
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
|
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||||
#include "Generated.xcconfig"
|
#include "Generated.xcconfig"
|
||||||
|
|||||||
43
filcnaplo/ios/Podfile
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Uncomment this line to define a global platform for your project
|
||||||
|
# platform :ios, '11.0'
|
||||||
|
|
||||||
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
|
|
||||||
|
project 'Runner', {
|
||||||
|
'Debug' => :debug,
|
||||||
|
'Profile' => :release,
|
||||||
|
'Release' => :release,
|
||||||
|
}
|
||||||
|
|
||||||
|
def flutter_root
|
||||||
|
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||||
|
unless File.exist?(generated_xcode_build_settings_path)
|
||||||
|
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||||
|
end
|
||||||
|
|
||||||
|
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||||
|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||||
|
return matches[1].strip if matches
|
||||||
|
end
|
||||||
|
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||||
|
end
|
||||||
|
|
||||||
|
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||||
|
|
||||||
|
flutter_ios_podfile_setup
|
||||||
|
|
||||||
|
target 'Runner' do
|
||||||
|
use_frameworks!
|
||||||
|
use_modular_headers!
|
||||||
|
|
||||||
|
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||||
|
|
||||||
|
pod 'DKImagePickerController/PhotoGallery', :git => 'https://github.com/zhangao0086/DKImagePickerController.git'
|
||||||
|
end
|
||||||
|
|
||||||
|
post_install do |installer|
|
||||||
|
installer.pods_project.targets.each do |target|
|
||||||
|
flutter_additional_ios_build_settings(target)
|
||||||
|
end
|
||||||
|
end
|
||||||
146
filcnaplo/ios/Podfile.lock
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
PODS:
|
||||||
|
- connectivity_plus (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- ReachabilitySwift
|
||||||
|
- DKImagePickerController/Core (4.3.4):
|
||||||
|
- DKImagePickerController/ImageDataManager
|
||||||
|
- DKImagePickerController/Resource
|
||||||
|
- DKImagePickerController/ImageDataManager (4.3.4)
|
||||||
|
- DKImagePickerController/PhotoGallery (4.3.4):
|
||||||
|
- DKImagePickerController/Core
|
||||||
|
- DKPhotoGallery
|
||||||
|
- DKImagePickerController/Resource (4.3.4)
|
||||||
|
- DKPhotoGallery (0.0.17):
|
||||||
|
- DKPhotoGallery/Core (= 0.0.17)
|
||||||
|
- DKPhotoGallery/Model (= 0.0.17)
|
||||||
|
- DKPhotoGallery/Preview (= 0.0.17)
|
||||||
|
- DKPhotoGallery/Resource (= 0.0.17)
|
||||||
|
- SDWebImage
|
||||||
|
- SwiftyGif
|
||||||
|
- DKPhotoGallery/Core (0.0.17):
|
||||||
|
- DKPhotoGallery/Model
|
||||||
|
- DKPhotoGallery/Preview
|
||||||
|
- SDWebImage
|
||||||
|
- SwiftyGif
|
||||||
|
- DKPhotoGallery/Model (0.0.17):
|
||||||
|
- SDWebImage
|
||||||
|
- SwiftyGif
|
||||||
|
- DKPhotoGallery/Preview (0.0.17):
|
||||||
|
- DKPhotoGallery/Model
|
||||||
|
- DKPhotoGallery/Resource
|
||||||
|
- SDWebImage
|
||||||
|
- SwiftyGif
|
||||||
|
- DKPhotoGallery/Resource (0.0.17):
|
||||||
|
- SDWebImage
|
||||||
|
- SwiftyGif
|
||||||
|
- file_picker (0.0.1):
|
||||||
|
- DKImagePickerController/PhotoGallery
|
||||||
|
- Flutter
|
||||||
|
- Flutter (1.0.0)
|
||||||
|
- flutter_custom_tabs (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- FMDB (2.7.5):
|
||||||
|
- FMDB/standard (= 2.7.5)
|
||||||
|
- FMDB/standard (2.7.5)
|
||||||
|
- live_activities (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- open_file (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- path_provider_ios (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- permission_handler_apple (9.0.4):
|
||||||
|
- Flutter
|
||||||
|
- quick_actions_ios (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- ReachabilitySwift (5.0.0)
|
||||||
|
- SDWebImage (5.13.2):
|
||||||
|
- SDWebImage/Core (= 5.13.2)
|
||||||
|
- SDWebImage/Core (5.13.2)
|
||||||
|
- share_plus (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- sqflite (0.0.2):
|
||||||
|
- Flutter
|
||||||
|
- FMDB (>= 2.7.5)
|
||||||
|
- SwiftyGif (5.4.3)
|
||||||
|
- url_launcher_ios (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
|
||||||
|
DEPENDENCIES:
|
||||||
|
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||||
|
- DKImagePickerController/PhotoGallery (from `https://github.com/zhangao0086/DKImagePickerController.git`)
|
||||||
|
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
||||||
|
- Flutter (from `Flutter`)
|
||||||
|
- flutter_custom_tabs (from `.symlinks/plugins/flutter_custom_tabs/ios`)
|
||||||
|
- live_activities (from `.symlinks/plugins/live_activities/ios`)
|
||||||
|
- open_file (from `.symlinks/plugins/open_file/ios`)
|
||||||
|
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
||||||
|
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||||
|
- quick_actions_ios (from `.symlinks/plugins/quick_actions_ios/ios`)
|
||||||
|
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
||||||
|
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
||||||
|
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||||
|
|
||||||
|
SPEC REPOS:
|
||||||
|
trunk:
|
||||||
|
- DKPhotoGallery
|
||||||
|
- FMDB
|
||||||
|
- ReachabilitySwift
|
||||||
|
- SDWebImage
|
||||||
|
- SwiftyGif
|
||||||
|
|
||||||
|
EXTERNAL SOURCES:
|
||||||
|
connectivity_plus:
|
||||||
|
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||||
|
DKImagePickerController:
|
||||||
|
:git: https://github.com/zhangao0086/DKImagePickerController.git
|
||||||
|
file_picker:
|
||||||
|
:path: ".symlinks/plugins/file_picker/ios"
|
||||||
|
Flutter:
|
||||||
|
:path: Flutter
|
||||||
|
flutter_custom_tabs:
|
||||||
|
:path: ".symlinks/plugins/flutter_custom_tabs/ios"
|
||||||
|
live_activities:
|
||||||
|
:path: ".symlinks/plugins/live_activities/ios"
|
||||||
|
open_file:
|
||||||
|
:path: ".symlinks/plugins/open_file/ios"
|
||||||
|
path_provider_ios:
|
||||||
|
:path: ".symlinks/plugins/path_provider_ios/ios"
|
||||||
|
permission_handler_apple:
|
||||||
|
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
||||||
|
quick_actions_ios:
|
||||||
|
:path: ".symlinks/plugins/quick_actions_ios/ios"
|
||||||
|
share_plus:
|
||||||
|
:path: ".symlinks/plugins/share_plus/ios"
|
||||||
|
sqflite:
|
||||||
|
:path: ".symlinks/plugins/sqflite/ios"
|
||||||
|
url_launcher_ios:
|
||||||
|
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||||
|
|
||||||
|
CHECKOUT OPTIONS:
|
||||||
|
DKImagePickerController:
|
||||||
|
:commit: a727e44718a67e300089174e5591166045815ba4
|
||||||
|
:git: https://github.com/zhangao0086/DKImagePickerController.git
|
||||||
|
|
||||||
|
SPEC CHECKSUMS:
|
||||||
|
connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e
|
||||||
|
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
|
||||||
|
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
|
||||||
|
file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95
|
||||||
|
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||||
|
flutter_custom_tabs: 7a10a08686955cb748e5d26e0ae586d30689bf89
|
||||||
|
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||||
|
live_activities: 9ff56a06a2d43ecd68f56deeed13b18a8304789c
|
||||||
|
open_file: 02eb5cb6b21264bd3a696876f5afbfb7ca4f4b7d
|
||||||
|
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
||||||
|
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
|
||||||
|
quick_actions_ios: 56c03753992beabaa6c598e470e12d430d6e5e2f
|
||||||
|
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||||
|
SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866
|
||||||
|
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
|
||||||
|
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
|
||||||
|
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
|
||||||
|
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
|
||||||
|
|
||||||
|
PODFILE CHECKSUM: 862f939bb7e5390bdb8b2534eb81a9457ea9fbdc
|
||||||
|
|
||||||
|
COCOAPODS: 1.11.3
|
||||||
@@ -3,11 +3,19 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 46;
|
objectVersion = 51;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||||
|
3127F78D28EAEDE200C2EFB3 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3127F75528EAECC800C2EFB3 /* WidgetKit.framework */; };
|
||||||
|
3127F78E28EAEDE200C2EFB3 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3127F75728EAECC800C2EFB3 /* SwiftUI.framework */; };
|
||||||
|
3127F79828EAEDE300C2EFB3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3127F79728EAEDE300C2EFB3 /* Assets.xcassets */; };
|
||||||
|
3127F79E28EAEDE300C2EFB3 /* livecard.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 3127F78C28EAEDE200C2EFB3 /* livecard.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||||
|
3127F7A428EAEE3D00C2EFB3 /* livecard.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 3127F7A328EAEE3D00C2EFB3 /* livecard.intentdefinition */; };
|
||||||
|
3127F7A628EAEE5900C2EFB3 /* livecard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3127F7A528EAEE5900C2EFB3 /* livecard.swift */; };
|
||||||
|
3127F7A828EAEE8500C2EFB3 /* lesson_model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3127F7A728EAEE8500C2EFB3 /* lesson_model.swift */; };
|
||||||
|
373A6ECB5FC71FE9D8AF2EDB /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F0ADD56276103500A3016C8 /* Pods_Runner.framework */; };
|
||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||||
@@ -15,7 +23,28 @@
|
|||||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
3127F79C28EAEDE300C2EFB3 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 3127F78B28EAEDE200C2EFB3;
|
||||||
|
remoteInfo = livecardExtension;
|
||||||
|
};
|
||||||
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
3127F74F28EAEC8A00C2EFB3 /* Embed Foundation Extensions */ = {
|
||||||
|
isa = PBXCopyFilesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
dstPath = "";
|
||||||
|
dstSubfolderSpec = 13;
|
||||||
|
files = (
|
||||||
|
3127F79E28EAEDE300C2EFB3 /* livecard.appex in Embed Foundation Extensions */,
|
||||||
|
);
|
||||||
|
name = "Embed Foundation Extensions";
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
|
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
|
||||||
isa = PBXCopyFilesBuildPhase;
|
isa = PBXCopyFilesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -31,10 +60,23 @@
|
|||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||||
|
1F0ADD56276103500A3016C8 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
3127F73928EAEC3200C2EFB3 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
|
||||||
|
3127F73F28EAEC8A00C2EFB3 /* IntentsUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IntentsUI.framework; path = System/Library/Frameworks/IntentsUI.framework; sourceTree = SDKROOT; };
|
||||||
|
3127F75528EAECC800C2EFB3 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
|
||||||
|
3127F75728EAECC800C2EFB3 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
|
||||||
|
3127F78C28EAEDE200C2EFB3 /* livecard.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = livecard.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
3127F79728EAEDE300C2EFB3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
|
3127F79928EAEDE300C2EFB3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
3127F7A328EAEE3D00C2EFB3 /* livecard.intentdefinition */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.intentdefinition; path = livecard.intentdefinition; sourceTree = "<group>"; };
|
||||||
|
3127F7A528EAEE5900C2EFB3 /* livecard.swift */ = {isa = PBXFileReference; indentWidth = 2; lastKnownFileType = sourcecode.swift; path = livecard.swift; sourceTree = "<group>"; tabWidth = 2; };
|
||||||
|
3127F7A728EAEE8500C2EFB3 /* lesson_model.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = lesson_model.swift; sourceTree = "<group>"; };
|
||||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||||
|
707F8089D970F81C480F73C4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||||
|
80777CF254888CE770D5F909 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
@@ -42,19 +84,63 @@
|
|||||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
98578F0EBCC6D3FF8391AAEB /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
3127F78928EAEDE200C2EFB3 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
3127F78E28EAEDE200C2EFB3 /* SwiftUI.framework in Frameworks */,
|
||||||
|
3127F78D28EAEDE200C2EFB3 /* WidgetKit.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
97C146EB1CF9000F007C117D /* Frameworks */ = {
|
97C146EB1CF9000F007C117D /* Frameworks */ = {
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
373A6ECB5FC71FE9D8AF2EDB /* Pods_Runner.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
|
3127F78F28EAEDE200C2EFB3 /* livecard */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
3127F7A728EAEE8500C2EFB3 /* lesson_model.swift */,
|
||||||
|
3127F7A328EAEE3D00C2EFB3 /* livecard.intentdefinition */,
|
||||||
|
3127F79728EAEDE300C2EFB3 /* Assets.xcassets */,
|
||||||
|
3127F79928EAEDE300C2EFB3 /* Info.plist */,
|
||||||
|
3127F7A528EAEE5900C2EFB3 /* livecard.swift */,
|
||||||
|
);
|
||||||
|
path = livecard;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
6640A963014A9D4F31026053 /* Frameworks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
1F0ADD56276103500A3016C8 /* Pods_Runner.framework */,
|
||||||
|
3127F73F28EAEC8A00C2EFB3 /* IntentsUI.framework */,
|
||||||
|
3127F75528EAECC800C2EFB3 /* WidgetKit.framework */,
|
||||||
|
3127F75728EAECC800C2EFB3 /* SwiftUI.framework */,
|
||||||
|
);
|
||||||
|
name = Frameworks;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
91FEB6212755D596FFFFEC73 /* Pods */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
80777CF254888CE770D5F909 /* Pods-Runner.debug.xcconfig */,
|
||||||
|
98578F0EBCC6D3FF8391AAEB /* Pods-Runner.release.xcconfig */,
|
||||||
|
707F8089D970F81C480F73C4 /* Pods-Runner.profile.xcconfig */,
|
||||||
|
);
|
||||||
|
path = Pods;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -71,7 +157,10 @@
|
|||||||
children = (
|
children = (
|
||||||
9740EEB11CF90186004384FC /* Flutter */,
|
9740EEB11CF90186004384FC /* Flutter */,
|
||||||
97C146F01CF9000F007C117D /* Runner */,
|
97C146F01CF9000F007C117D /* Runner */,
|
||||||
|
3127F78F28EAEDE200C2EFB3 /* livecard */,
|
||||||
97C146EF1CF9000F007C117D /* Products */,
|
97C146EF1CF9000F007C117D /* Products */,
|
||||||
|
91FEB6212755D596FFFFEC73 /* Pods */,
|
||||||
|
6640A963014A9D4F31026053 /* Frameworks */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@@ -79,6 +168,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||||
|
3127F78C28EAEDE200C2EFB3 /* livecard.appex */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -86,6 +176,7 @@
|
|||||||
97C146F01CF9000F007C117D /* Runner */ = {
|
97C146F01CF9000F007C117D /* Runner */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
3127F73928EAEC3200C2EFB3 /* Runner.entitlements */,
|
||||||
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
||||||
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
||||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
||||||
@@ -101,20 +192,41 @@
|
|||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
|
3127F78B28EAEDE200C2EFB3 /* livecard */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = 3127F79F28EAEDE300C2EFB3 /* Build configuration list for PBXNativeTarget "livecard" */;
|
||||||
|
buildPhases = (
|
||||||
|
3127F78828EAEDE200C2EFB3 /* Sources */,
|
||||||
|
3127F78928EAEDE200C2EFB3 /* Frameworks */,
|
||||||
|
3127F78A28EAEDE200C2EFB3 /* Resources */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = livecard;
|
||||||
|
productName = livecardExtension;
|
||||||
|
productReference = 3127F78C28EAEDE200C2EFB3 /* livecard.appex */;
|
||||||
|
productType = "com.apple.product-type.app-extension";
|
||||||
|
};
|
||||||
97C146ED1CF9000F007C117D /* Runner */ = {
|
97C146ED1CF9000F007C117D /* Runner */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
|
779338C8D92BCBC36F75F791 /* [CP] Check Pods Manifest.lock */,
|
||||||
9740EEB61CF901F6004384FC /* Run Script */,
|
9740EEB61CF901F6004384FC /* Run Script */,
|
||||||
97C146EA1CF9000F007C117D /* Sources */,
|
97C146EA1CF9000F007C117D /* Sources */,
|
||||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||||
97C146EC1CF9000F007C117D /* Resources */,
|
97C146EC1CF9000F007C117D /* Resources */,
|
||||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||||
|
71459C0EB905E05018E3D78F /* [CP] Embed Pods Frameworks */,
|
||||||
|
3127F74F28EAEC8A00C2EFB3 /* Embed Foundation Extensions */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
|
3127F79D28EAEDE300C2EFB3 /* PBXTargetDependency */,
|
||||||
);
|
);
|
||||||
name = Runner;
|
name = Runner;
|
||||||
productName = Runner;
|
productName = Runner;
|
||||||
@@ -127,9 +239,13 @@
|
|||||||
97C146E61CF9000F007C117D /* Project object */ = {
|
97C146E61CF9000F007C117D /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastUpgradeCheck = 1020;
|
LastSwiftUpdateCheck = 1410;
|
||||||
|
LastUpgradeCheck = 1300;
|
||||||
ORGANIZATIONNAME = "";
|
ORGANIZATIONNAME = "";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
|
3127F78B28EAEDE200C2EFB3 = {
|
||||||
|
CreatedOnToolsVersion = 14.1;
|
||||||
|
};
|
||||||
97C146ED1CF9000F007C117D = {
|
97C146ED1CF9000F007C117D = {
|
||||||
CreatedOnToolsVersion = 7.3.1;
|
CreatedOnToolsVersion = 7.3.1;
|
||||||
LastSwiftMigration = 1100;
|
LastSwiftMigration = 1100;
|
||||||
@@ -150,11 +266,20 @@
|
|||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
targets = (
|
targets = (
|
||||||
97C146ED1CF9000F007C117D /* Runner */,
|
97C146ED1CF9000F007C117D /* Runner */,
|
||||||
|
3127F78B28EAEDE200C2EFB3 /* livecard */,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
|
|
||||||
/* Begin PBXResourcesBuildPhase section */
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
|
3127F78A28EAEDE200C2EFB3 /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
3127F79828EAEDE300C2EFB3 /* Assets.xcassets in Resources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
97C146EC1CF9000F007C117D /* Resources */ = {
|
97C146EC1CF9000F007C117D /* Resources */ = {
|
||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -183,6 +308,45 @@
|
|||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||||
};
|
};
|
||||||
|
71459C0EB905E05018E3D78F /* [CP] Embed Pods Frameworks */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||||
|
);
|
||||||
|
name = "[CP] Embed Pods Frameworks";
|
||||||
|
outputFileListPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
|
779338C8D92BCBC36F75F791 /* [CP] Check Pods Manifest.lock */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||||
|
"${PODS_ROOT}/Manifest.lock",
|
||||||
|
);
|
||||||
|
name = "[CP] Check Pods Manifest.lock";
|
||||||
|
outputFileListPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -200,6 +364,16 @@
|
|||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
3127F78828EAEDE200C2EFB3 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
3127F7A828EAEE8500C2EFB3 /* lesson_model.swift in Sources */,
|
||||||
|
3127F7A428EAEE3D00C2EFB3 /* livecard.intentdefinition in Sources */,
|
||||||
|
3127F7A628EAEE5900C2EFB3 /* livecard.swift in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
97C146EA1CF9000F007C117D /* Sources */ = {
|
97C146EA1CF9000F007C117D /* Sources */ = {
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -211,6 +385,14 @@
|
|||||||
};
|
};
|
||||||
/* End PBXSourcesBuildPhase section */
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXTargetDependency section */
|
||||||
|
3127F79D28EAEDE300C2EFB3 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 3127F78B28EAEDE200C2EFB3 /* livecard */;
|
||||||
|
targetProxy = 3127F79C28EAEDE300C2EFB3 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
|
/* End PBXTargetDependency section */
|
||||||
|
|
||||||
/* Begin PBXVariantGroup section */
|
/* Begin PBXVariantGroup section */
|
||||||
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
|
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
|
||||||
isa = PBXVariantGroup;
|
isa = PBXVariantGroup;
|
||||||
@@ -254,6 +436,7 @@
|
|||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
@@ -272,7 +455,7 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SUPPORTED_PLATFORMS = iphoneos;
|
SUPPORTED_PLATFORMS = iphoneos;
|
||||||
@@ -285,12 +468,18 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
|
DEVELOPMENT_TEAM = MYUTW2GF6J;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = hu.filc.naplo;
|
PRODUCT_BUNDLE_IDENTIFIER = hu.filc.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";
|
||||||
@@ -299,6 +488,125 @@
|
|||||||
};
|
};
|
||||||
name = Profile;
|
name = Profile;
|
||||||
};
|
};
|
||||||
|
3127F7A028EAEDE300C2EFB3 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
|
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEVELOPMENT_TEAM = MYUTW2GF6J;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_FILE = livecard/Info.plist;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = livecard;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
INFOPLIST_KEY_NSSupportsLiveActivities = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 16.1;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@executable_path/../../Frameworks",
|
||||||
|
);
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = hu.filc.naplo.livecardpro;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
3127F7A128EAEDE300C2EFB3 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
|
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEVELOPMENT_TEAM = MYUTW2GF6J;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_FILE = livecard/Info.plist;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = livecard;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
INFOPLIST_KEY_NSSupportsLiveActivities = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 16.1;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@executable_path/../../Frameworks",
|
||||||
|
);
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = hu.filc.naplo.livecardpro;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
3127F7A228EAEDE300C2EFB3 /* Profile */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
|
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEVELOPMENT_TEAM = MYUTW2GF6J;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_FILE = livecard/Info.plist;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = livecard;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
INFOPLIST_KEY_NSSupportsLiveActivities = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 16.1;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@executable_path/../../Frameworks",
|
||||||
|
);
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = hu.filc.naplo.livecardpro;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Profile;
|
||||||
|
};
|
||||||
97C147031CF9000F007C117D /* Debug */ = {
|
97C147031CF9000F007C117D /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
@@ -322,6 +630,7 @@
|
|||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
@@ -346,7 +655,7 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = YES;
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
@@ -377,6 +686,7 @@
|
|||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
@@ -395,10 +705,11 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SUPPORTED_PLATFORMS = iphoneos;
|
SUPPORTED_PLATFORMS = iphoneos;
|
||||||
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
@@ -409,12 +720,18 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
|
DEVELOPMENT_TEAM = MYUTW2GF6J;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = hu.filc.naplo;
|
PRODUCT_BUNDLE_IDENTIFIER = hu.filc.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";
|
||||||
@@ -428,12 +745,18 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
|
DEVELOPMENT_TEAM = MYUTW2GF6J;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = hu.filc.naplo;
|
PRODUCT_BUNDLE_IDENTIFIER = hu.filc.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";
|
||||||
@@ -445,6 +768,16 @@
|
|||||||
/* End XCBuildConfiguration section */
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
/* Begin XCConfigurationList section */
|
||||||
|
3127F79F28EAEDE300C2EFB3 /* Build configuration list for PBXNativeTarget "livecard" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
3127F7A028EAEDE300C2EFB3 /* Debug */,
|
||||||
|
3127F7A128EAEDE300C2EFB3 /* Release */,
|
||||||
|
3127F7A228EAEDE300C2EFB3 /* Profile */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
|
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1020"
|
LastUpgradeVersion = "1300"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
@@ -27,8 +27,6 @@
|
|||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
<Testables>
|
|
||||||
</Testables>
|
|
||||||
<MacroExpansion>
|
<MacroExpansion>
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
@@ -38,8 +36,8 @@
|
|||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
<AdditionalOptions>
|
<Testables>
|
||||||
</AdditionalOptions>
|
</Testables>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
@@ -61,8 +59,6 @@
|
|||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Profile"
|
buildConfiguration = "Profile"
|
||||||
|
|||||||
@@ -4,4 +4,7 @@
|
|||||||
<FileRef
|
<FileRef
|
||||||
location = "group:Runner.xcodeproj">
|
location = "group:Runner.xcodeproj">
|
||||||
</FileRef>
|
</FileRef>
|
||||||
|
<FileRef
|
||||||
|
location = "group:Pods/Pods.xcodeproj">
|
||||||
|
</FileRef>
|
||||||
</Workspace>
|
</Workspace>
|
||||||
|
|||||||
@@ -8,6 +8,18 @@ import Flutter
|
|||||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||||
) -> Bool {
|
) -> Bool {
|
||||||
GeneratedPluginRegistrant.register(with: self)
|
GeneratedPluginRegistrant.register(with: self)
|
||||||
|
|
||||||
|
// here, Without this code the task will not work.
|
||||||
|
//SwiftFlutterForegroundTaskPlugin.setPluginRegistrantCallback(registerPlugins)
|
||||||
|
if #available(iOS 10.0, *) {
|
||||||
|
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
|
||||||
|
}
|
||||||
|
|
||||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// here
|
||||||
|
func registerPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
GeneratedPluginRegistrant.register(with: registry)
|
||||||
|
}
|
||||||
|
|||||||
6
filcnaplo/ios/Runner/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
21
filcnaplo/ios/Runner/Assets.xcassets/ic_absences.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "icon.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
filcnaplo/ios/Runner/Assets.xcassets/ic_absences.imageset/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 570 B |
21
filcnaplo/ios/Runner/Assets.xcassets/ic_grades.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "icon.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
filcnaplo/ios/Runner/Assets.xcassets/ic_grades.imageset/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 404 B |
21
filcnaplo/ios/Runner/Assets.xcassets/ic_messages.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "icon.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
filcnaplo/ios/Runner/Assets.xcassets/ic_messages.imageset/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 347 B |
21
filcnaplo/ios/Runner/Assets.xcassets/ic_timetable.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "icon.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
filcnaplo/ios/Runner/Assets.xcassets/ic_timetable.imageset/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 422 B |
@@ -22,6 +22,8 @@
|
|||||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>NSSupportsLiveActivities</key>
|
||||||
|
<true/>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>LaunchScreen</string>
|
<string>LaunchScreen</string>
|
||||||
<key>UIMainStoryboardFile</key>
|
<key>UIMainStoryboardFile</key>
|
||||||
@@ -50,5 +52,9 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>NSPhotoLibraryUsageDescription</key>
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
<string>The app requires the photo library to set a custom profile picture.</string>
|
<string>The app requires the photo library to set a custom profile picture.</string>
|
||||||
</dict>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
|
<false/>
|
||||||
|
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
<?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>
|
<dict>
|
||||||
<key>aps-environment</key>
|
<key>aps-environment</key>
|
||||||
<string>production</string>
|
<string>development</string>
|
||||||
</dict>
|
<key>com.apple.developer.associated-domains</key>
|
||||||
|
<array>
|
||||||
|
<string>applinks:api.filcnaplo.hu</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
|
"size" : "1024x1024"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
6
filcnaplo/ios/livecard/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
11
filcnaplo/ios/livecard/Info.plist
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>NSExtension</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSExtensionPointIdentifier</key>
|
||||||
|
<string>com.apple.widgetkit-extension</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
27
filcnaplo/ios/livecard/lesson_model.swift
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import Foundation
|
||||||
|
|
||||||
|
class LessonData {
|
||||||
|
var icon: String
|
||||||
|
var index: String
|
||||||
|
var title: String
|
||||||
|
var subtitle: String
|
||||||
|
var description: String
|
||||||
|
var startDate: Date
|
||||||
|
var endDate: Date
|
||||||
|
var date: ClosedRange<Date>
|
||||||
|
var nextSubject: String
|
||||||
|
var nextRoom: String
|
||||||
|
|
||||||
|
init?(JSONData data:[String: String]) {
|
||||||
|
self.icon = data["icon"]!
|
||||||
|
self.index = data["index"]!
|
||||||
|
self.title = data["title"]!
|
||||||
|
self.subtitle = data["subtitle"]!
|
||||||
|
self.description = data["description"]!
|
||||||
|
self.startDate = Date(timeIntervalSince1970: Double(data["startDate"]!)! / 1000)
|
||||||
|
self.endDate = Date(timeIntervalSince1970: Double(data["endDate"]!)! / 1000)
|
||||||
|
date = self.startDate...self.endDate
|
||||||
|
self.nextSubject = data["nextSubject"]!
|
||||||
|
self.nextRoom = data["nextRoom"]!
|
||||||
|
}
|
||||||
|
}
|
||||||
59
filcnaplo/ios/livecard/livecard.intentdefinition
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>INEnums</key>
|
||||||
|
<array/>
|
||||||
|
<key>INIntentDefinitionModelVersion</key>
|
||||||
|
<string>1.2</string>
|
||||||
|
<key>INIntentDefinitionNamespace</key>
|
||||||
|
<string>88xZPY</string>
|
||||||
|
<key>INIntentDefinitionSystemVersion</key>
|
||||||
|
<string>20A294</string>
|
||||||
|
<key>INIntentDefinitionToolsBuildVersion</key>
|
||||||
|
<string>12A6144</string>
|
||||||
|
<key>INIntentDefinitionToolsVersion</key>
|
||||||
|
<string>12.0</string>
|
||||||
|
<key>INIntents</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>INIntentCategory</key>
|
||||||
|
<string>information</string>
|
||||||
|
<key>INIntentDescriptionID</key>
|
||||||
|
<string>tVvJ9c</string>
|
||||||
|
<key>INIntentEligibleForWidgets</key>
|
||||||
|
<true/>
|
||||||
|
<key>INIntentIneligibleForSuggestions</key>
|
||||||
|
<true/>
|
||||||
|
<key>INIntentName</key>
|
||||||
|
<string>Configuration</string>
|
||||||
|
<key>INIntentResponse</key>
|
||||||
|
<dict>
|
||||||
|
<key>INIntentResponseCodes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>INIntentResponseCodeName</key>
|
||||||
|
<string>success</string>
|
||||||
|
<key>INIntentResponseCodeSuccess</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>INIntentResponseCodeName</key>
|
||||||
|
<string>failure</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<key>INIntentTitle</key>
|
||||||
|
<string>Configuration</string>
|
||||||
|
<key>INIntentTitleID</key>
|
||||||
|
<string>gpCwrM</string>
|
||||||
|
<key>INIntentType</key>
|
||||||
|
<string>Custom</string>
|
||||||
|
<key>INIntentVerb</key>
|
||||||
|
<string>View</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>INTypes</key>
|
||||||
|
<array/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
137
filcnaplo/ios/livecard/livecard.swift
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
import ActivityKit
|
||||||
|
import WidgetKit
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
@main
|
||||||
|
struct Widgets: WidgetBundle {
|
||||||
|
var body: some Widget {
|
||||||
|
if #available(iOS 16.1, *) {
|
||||||
|
LiveCardWidget()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need to redefined live activities pipe
|
||||||
|
struct LiveActivitiesAppAttributes: ActivityAttributes, Identifiable {
|
||||||
|
public typealias LiveDeliveryData = ContentState
|
||||||
|
|
||||||
|
public struct ContentState: Codable, Hashable {
|
||||||
|
var data: Dictionary<String, String>
|
||||||
|
}
|
||||||
|
|
||||||
|
var id = UUID()
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOSApplicationExtension 16.1, *)
|
||||||
|
struct LiveCardWidget: Widget {
|
||||||
|
var body: some WidgetConfiguration {
|
||||||
|
/// Live Activity Notification
|
||||||
|
ActivityConfiguration(for: LiveActivitiesAppAttributes.self) { context in
|
||||||
|
let lesson = LessonData(JSONData: context.state.data)
|
||||||
|
|
||||||
|
HStack(alignment: .center) {
|
||||||
|
Image(systemName: lesson!.icon)
|
||||||
|
.resizable()
|
||||||
|
.aspectRatio(contentMode: .fit)
|
||||||
|
.frame(width: CGFloat(30), height: CGFloat(30))
|
||||||
|
.padding(.leading, CGFloat(8))
|
||||||
|
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Text(lesson!.index + lesson!.title)
|
||||||
|
.font(.title3)
|
||||||
|
.bold()
|
||||||
|
|
||||||
|
Text(lesson!.description)
|
||||||
|
.font(.subheadline)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
Image(systemName: "arrow.right")
|
||||||
|
.resizable()
|
||||||
|
.aspectRatio(contentMode: .fit)
|
||||||
|
.frame(width: CGFloat(12), height: CGFloat(12))
|
||||||
|
Text(lesson!.nextSubject)
|
||||||
|
.font(.caption)
|
||||||
|
Text(lesson!.nextRoom)
|
||||||
|
.font(.caption2)
|
||||||
|
}
|
||||||
|
}.padding(15)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Text(lesson!.subtitle)
|
||||||
|
.font(.subheadline)
|
||||||
|
.padding(.trailing, 12)
|
||||||
|
}.padding(12)
|
||||||
|
/// Dynamic Island
|
||||||
|
} dynamicIsland: { context in
|
||||||
|
let lesson = LessonData(JSONData: context.state.data)
|
||||||
|
|
||||||
|
/// Expanded
|
||||||
|
return DynamicIsland {
|
||||||
|
DynamicIslandExpandedRegion(.leading) {
|
||||||
|
VStack {
|
||||||
|
Spacer()
|
||||||
|
Image(systemName: lesson!.icon)
|
||||||
|
.resizable()
|
||||||
|
.aspectRatio(contentMode: .fit)
|
||||||
|
.frame(width: CGFloat(30), height: CGFloat(30))
|
||||||
|
.padding(.leading, CGFloat(6))
|
||||||
|
.padding(.bottom, CGFloat(6))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DynamicIslandExpandedRegion(.center) {
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Text(lesson!.index + lesson!.title)
|
||||||
|
.lineLimit(1)
|
||||||
|
.font(.title3)
|
||||||
|
.bold()
|
||||||
|
|
||||||
|
Text(lesson!.description)
|
||||||
|
.lineLimit(2)
|
||||||
|
.font(.caption)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DynamicIslandExpandedRegion(.trailing) {
|
||||||
|
VStack {
|
||||||
|
Spacer()
|
||||||
|
Text(lesson!.subtitle)
|
||||||
|
.lineLimit(1)
|
||||||
|
.font(.subheadline)
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Compact
|
||||||
|
} compactLeading: {
|
||||||
|
Label {
|
||||||
|
Text(lesson!.title)
|
||||||
|
} icon: {
|
||||||
|
Image(systemName: lesson!.icon)
|
||||||
|
}
|
||||||
|
.font(.caption2)
|
||||||
|
} compactTrailing: {
|
||||||
|
Text(timerInterval: lesson!.date, countsDown: true)
|
||||||
|
.multilineTextAlignment(.center)
|
||||||
|
.frame(width: 40)
|
||||||
|
.font(.caption2)
|
||||||
|
|
||||||
|
/// Collapsed
|
||||||
|
} minimal: {
|
||||||
|
VStack(alignment: .center) {
|
||||||
|
Image(systemName: lesson!.icon)
|
||||||
|
.resizable()
|
||||||
|
.aspectRatio(contentMode: .fit)
|
||||||
|
.frame(width: CGFloat(12), height: CGFloat(12))
|
||||||
|
|
||||||
|
Text(timerInterval: lesson!.date, countsDown: true)
|
||||||
|
.multilineTextAlignment(.center)
|
||||||
|
.monospacedDigit()
|
||||||
|
.font(.system(size: CGFloat(10)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.keylineTint(.accentColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +1,38 @@
|
|||||||
|
// ignore_for_file: avoid_print
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:filcnaplo/models/config.dart';
|
import 'package:filcnaplo/models/config.dart';
|
||||||
import 'package:filcnaplo/models/news.dart';
|
import 'package:filcnaplo/models/news.dart';
|
||||||
import 'package:filcnaplo/models/release.dart';
|
import 'package:filcnaplo/models/release.dart';
|
||||||
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
import 'package:filcnaplo/models/supporter.dart';
|
import 'package:filcnaplo/models/supporter.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/school.dart';
|
import 'package:filcnaplo_kreta_api/models/school.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
|
||||||
class FilcAPI {
|
class FilcAPI {
|
||||||
static const SCHOOL_LIST = "https://filcnaplo.hu/v2/school_list.json";
|
// Public API
|
||||||
static const CONFIG = "https://filcnaplo.hu/v2/config.json";
|
static const schoolList = "https://filcnaplo.hu/v2/school_list.json";
|
||||||
static const NEWS = "https://filcnaplo.hu/v2/news.json";
|
static const news = "https://filcnaplo.hu/v2/news.json";
|
||||||
static const SUPPORTERS = "https://filcnaplo.hu/v2/supporters.json";
|
static const supporters = "https://filcnaplo.hu/v2/supporters.json";
|
||||||
static const REPO = "filc/naplo";
|
|
||||||
static const RELEASES = "https://api.github.com/repos/$REPO/releases";
|
// Private API
|
||||||
|
static const config = "https://api.filcnaplo.hu/config";
|
||||||
|
static const reportApi = "https://api.filcnaplo.hu/report";
|
||||||
|
static const premiumApi = "https://api.filcnaplo.hu/premium/activate";
|
||||||
|
static const premiumScopesApi = "https://api.filcnaplo.hu/premium/scopes";
|
||||||
|
|
||||||
|
// Updates
|
||||||
|
static const repo = "filc/naplo";
|
||||||
|
static const releases = "https://api.github.com/repos/$repo/releases";
|
||||||
|
|
||||||
|
static Future<bool> checkConnectivity() async => (await Connectivity().checkConnectivity()) != ConnectivityResult.none;
|
||||||
|
|
||||||
static Future<List<School>?> getSchools() async {
|
static Future<List<School>?> getSchools() async {
|
||||||
try {
|
try {
|
||||||
http.Response res = await http.get(Uri.parse(SCHOOL_LIST));
|
http.Response res = await http.get(Uri.parse(schoolList));
|
||||||
|
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
List<School> schools = (jsonDecode(res.body) as List).cast<Map>().map((json) => School.fromJson(json)).toList();
|
List<School> schools = (jsonDecode(res.body) as List).cast<Map>().map((json) => School.fromJson(json)).toList();
|
||||||
@@ -33,25 +48,39 @@ class FilcAPI {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
print("ERROR: FilcAPI.getSchools: $error");
|
print("ERROR: FilcAPI.getSchools: $error");
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Config?> getConfig() async {
|
static Future<Config?> getConfig(SettingsProvider settings) async {
|
||||||
|
final userAgent = SettingsProvider.defaultSettings().config.userAgent;
|
||||||
|
|
||||||
|
Map<String, String> headers = {
|
||||||
|
"x-filc-id": settings.xFilcId,
|
||||||
|
"user-agent": userAgent,
|
||||||
|
};
|
||||||
|
|
||||||
|
log("[CONFIG] x-filc-id: \"${settings.xFilcId}\"");
|
||||||
|
log("[CONFIG] user-agent: \"$userAgent\"");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
http.Response res = await http.get(Uri.parse(CONFIG));
|
http.Response res = await http.get(Uri.parse(config), headers: headers);
|
||||||
|
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
return Config.fromJson(jsonDecode(res.body));
|
return Config.fromJson(jsonDecode(res.body));
|
||||||
} else {
|
} else if (res.statusCode == 429) {
|
||||||
throw "HTTP ${res.statusCode}: ${res.body}";
|
res = await http.get(Uri.parse(config));
|
||||||
|
if (res.statusCode == 200) return Config.fromJson(jsonDecode(res.body));
|
||||||
}
|
}
|
||||||
|
throw "HTTP ${res.statusCode}: ${res.body}";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
print("ERROR: FilcAPI.getConfig: $error");
|
print("ERROR: FilcAPI.getConfig: $error");
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<List<News>?> getNews() async {
|
static Future<List<News>?> getNews() async {
|
||||||
try {
|
try {
|
||||||
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) {
|
||||||
return (jsonDecode(res.body) as List).cast<Map>().map((e) => News.fromJson(e)).toList();
|
return (jsonDecode(res.body) as List).cast<Map>().map((e) => News.fromJson(e)).toList();
|
||||||
@@ -61,11 +90,12 @@ class FilcAPI {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
print("ERROR: FilcAPI.getNews: $error");
|
print("ERROR: FilcAPI.getNews: $error");
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Supporters?> getSupporters() async {
|
static Future<Supporters?> getSupporters() async {
|
||||||
try {
|
try {
|
||||||
http.Response res = await http.get(Uri.parse(SUPPORTERS));
|
http.Response res = await http.get(Uri.parse(supporters));
|
||||||
|
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
return Supporters.fromJson(jsonDecode(res.body));
|
return Supporters.fromJson(jsonDecode(res.body));
|
||||||
@@ -75,11 +105,12 @@ class FilcAPI {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
print("ERROR: FilcAPI.getSupporters: $error");
|
print("ERROR: FilcAPI.getSupporters: $error");
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<List<Release>?> getReleases() async {
|
static Future<List<Release>?> getReleases() async {
|
||||||
try {
|
try {
|
||||||
http.Response res = await http.get(Uri.parse(RELEASES));
|
http.Response res = await http.get(Uri.parse(releases));
|
||||||
|
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
return (jsonDecode(res.body) as List).cast<Map>().map((e) => Release.fromJson(e)).toList();
|
return (jsonDecode(res.body) as List).cast<Map>().map((e) => Release.fromJson(e)).toList();
|
||||||
@@ -89,19 +120,48 @@ class FilcAPI {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
print("ERROR: FilcAPI.getReleases: $error");
|
print("ERROR: FilcAPI.getReleases: $error");
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<http.StreamedResponse?> downloadRelease(Release release) {
|
static Future<http.StreamedResponse?> downloadRelease(ReleaseDownload release) {
|
||||||
if (release.downloads.length > 0) {
|
try {
|
||||||
try {
|
var client = http.Client();
|
||||||
var client = http.Client();
|
var request = http.Request('GET', Uri.parse(release.url));
|
||||||
var request = http.Request('GET', Uri.parse(release.downloads.first));
|
return client.send(request);
|
||||||
return client.send(request);
|
} catch (error) {
|
||||||
} catch (error) {
|
print("ERROR: FilcAPI.downloadRelease: $error");
|
||||||
print("ERROR: FilcAPI.downloadRelease: $error");
|
return Future.value(null);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Future.value(null);
|
static Future<void> sendReport(ErrorReport report) async {
|
||||||
|
try {
|
||||||
|
http.Response res = await http.post(Uri.parse(reportApi), body: {
|
||||||
|
"os": report.os,
|
||||||
|
"version": report.version,
|
||||||
|
"error": report.error,
|
||||||
|
"stack_trace": report.stack,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.statusCode != 200) {
|
||||||
|
throw "HTTP ${res.statusCode}: ${res.body}";
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
print("ERROR: FilcAPI.sendReport: $error");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ErrorReport {
|
||||||
|
String stack;
|
||||||
|
String os;
|
||||||
|
String version;
|
||||||
|
String error;
|
||||||
|
|
||||||
|
ErrorReport({
|
||||||
|
required this.stack,
|
||||||
|
required this.os,
|
||||||
|
required this.version,
|
||||||
|
required this.error,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// ignore_for_file: avoid_print, use_build_context_synchronously
|
||||||
|
|
||||||
|
import 'package:filcnaplo/utils/jwt.dart';
|
||||||
import 'package:filcnaplo_kreta_api/providers/absence_provider.dart';
|
import 'package:filcnaplo_kreta_api/providers/absence_provider.dart';
|
||||||
import 'package:filcnaplo_kreta_api/providers/event_provider.dart';
|
import 'package:filcnaplo_kreta_api/providers/event_provider.dart';
|
||||||
import 'package:filcnaplo_kreta_api/providers/exam_provider.dart';
|
import 'package:filcnaplo_kreta_api/providers/exam_provider.dart';
|
||||||
@@ -10,10 +13,8 @@ import 'package:filcnaplo/api/providers/user_provider.dart';
|
|||||||
import 'package:filcnaplo/api/providers/database_provider.dart';
|
import 'package:filcnaplo/api/providers/database_provider.dart';
|
||||||
import 'package:filcnaplo/models/settings.dart';
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
import 'package:filcnaplo/models/user.dart';
|
import 'package:filcnaplo/models/user.dart';
|
||||||
import 'package:filcnaplo/utils/jwt.dart';
|
|
||||||
import 'package:filcnaplo_kreta_api/client/api.dart';
|
import 'package:filcnaplo_kreta_api/client/api.dart';
|
||||||
import 'package:filcnaplo_kreta_api/client/client.dart';
|
import 'package:filcnaplo_kreta_api/client/client.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/message.dart';
|
|
||||||
import 'package:filcnaplo_kreta_api/models/student.dart';
|
import 'package:filcnaplo_kreta_api/models/student.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/week.dart';
|
import 'package:filcnaplo_kreta_api/models/week.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -22,9 +23,9 @@ import 'package:filcnaplo/api/nonce.dart';
|
|||||||
|
|
||||||
enum LoginState { missingFields, invalidGrant, failed, normal, inProgress, success }
|
enum LoginState { missingFields, invalidGrant, failed, normal, inProgress, success }
|
||||||
|
|
||||||
Nonce getNonce(BuildContext context, String nonce, String username, String instituteCode) {
|
Nonce getNonce(String nonce, String username, String instituteCode) {
|
||||||
Nonce nonceEncoder = Nonce(key: [53, 75, 109, 112, 109, 103, 100, 53, 102, 74], nonce: nonce);
|
Nonce nonceEncoder = Nonce(key: [98, 97, 83, 115, 120, 79, 119, 108, 85, 49, 106, 77], nonce: nonce);
|
||||||
nonceEncoder.encode(username.toLowerCase() + instituteCode.toLowerCase() + nonce);
|
nonceEncoder.encode(instituteCode.toUpperCase() + nonce + username.toUpperCase());
|
||||||
|
|
||||||
return nonceEncoder;
|
return nonceEncoder;
|
||||||
}
|
}
|
||||||
@@ -45,7 +46,7 @@ Future loginApi({
|
|||||||
|
|
||||||
String nonceStr = await Provider.of<KretaClient>(context, listen: false).getAPI(KretaAPI.nonce, json: false);
|
String nonceStr = await Provider.of<KretaClient>(context, listen: false).getAPI(KretaAPI.nonce, json: false);
|
||||||
|
|
||||||
Nonce nonce = getNonce(context, nonceStr, username, instituteCode);
|
Nonce nonce = getNonce(nonceStr, username, instituteCode);
|
||||||
headers.addAll(nonce.header());
|
headers.addAll(nonce.header());
|
||||||
|
|
||||||
Map? res = await Provider.of<KretaClient>(context, listen: false).postAPI(KretaAPI.login,
|
Map? res = await Provider.of<KretaClient>(context, listen: false).postAPI(KretaAPI.login,
|
||||||
@@ -65,12 +66,14 @@ Future loginApi({
|
|||||||
try {
|
try {
|
||||||
Provider.of<KretaClient>(context, listen: false).accessToken = res["access_token"];
|
Provider.of<KretaClient>(context, listen: false).accessToken = res["access_token"];
|
||||||
Map? studentJson = await Provider.of<KretaClient>(context, listen: false).getAPI(KretaAPI.student(instituteCode));
|
Map? studentJson = await Provider.of<KretaClient>(context, listen: false).getAPI(KretaAPI.student(instituteCode));
|
||||||
|
Student student = Student.fromJson(studentJson!);
|
||||||
var user = User(
|
var user = User(
|
||||||
username: username,
|
username: username,
|
||||||
password: password,
|
password: password,
|
||||||
instituteCode: instituteCode,
|
instituteCode: instituteCode,
|
||||||
name: JwtUtils.getNameFromJWT(res["access_token"]) ?? "?",
|
name: student.name,
|
||||||
student: Student.fromJson(studentJson!),
|
student: student,
|
||||||
|
role: JwtUtils.getRoleFromJWT(res["access_token"])!,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (onLogin != null) onLogin(user);
|
if (onLogin != null) onLogin(user);
|
||||||
@@ -82,14 +85,16 @@ Future loginApi({
|
|||||||
|
|
||||||
// Get user data
|
// Get user data
|
||||||
try {
|
try {
|
||||||
await Provider.of<GradeProvider>(context, listen: false).fetch();
|
await Future.wait([
|
||||||
await Provider.of<TimetableProvider>(context, listen: false).fetch(week: Week.current());
|
Provider.of<GradeProvider>(context, listen: false).fetch(),
|
||||||
await Provider.of<ExamProvider>(context, listen: false).fetch();
|
Provider.of<TimetableProvider>(context, listen: false).fetch(week: Week.current()),
|
||||||
await Provider.of<HomeworkProvider>(context, listen: false).fetch();
|
Provider.of<ExamProvider>(context, listen: false).fetch(),
|
||||||
await Provider.of<MessageProvider>(context, listen: false).fetch(type: MessageType.inbox);
|
Provider.of<HomeworkProvider>(context, listen: false).fetch(),
|
||||||
await Provider.of<NoteProvider>(context, listen: false).fetch();
|
Provider.of<MessageProvider>(context, listen: false).fetchAll(),
|
||||||
await Provider.of<EventProvider>(context, listen: false).fetch();
|
Provider.of<NoteProvider>(context, listen: false).fetch(),
|
||||||
await Provider.of<AbsenceProvider>(context, listen: false).fetch();
|
Provider.of<EventProvider>(context, listen: false).fetch(),
|
||||||
|
Provider.of<AbsenceProvider>(context, listen: false).fetch(),
|
||||||
|
]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
print("WARNING: failed to fetch user data: $error");
|
print("WARNING: failed to fetch user data: $error");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class Nonce {
|
|||||||
return {
|
return {
|
||||||
"X-Authorizationpolicy-Nonce": nonce,
|
"X-Authorizationpolicy-Nonce": nonce,
|
||||||
"X-Authorizationpolicy-Key": encoded ?? "",
|
"X-Authorizationpolicy-Key": encoded ?? "",
|
||||||
"X-Authorizationpolicy-Version": "v1",
|
"X-Authorizationpolicy-Version": "v2",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:filcnaplo/database/query.dart';
|
import 'package:filcnaplo/database/query.dart';
|
||||||
import 'package:filcnaplo/database/store.dart';
|
import 'package:filcnaplo/database/store.dart';
|
||||||
import 'package:sqflite/sqflite.dart';
|
import 'package:sqflite/sqflite.dart';
|
||||||
|
// ignore: depend_on_referenced_packages
|
||||||
|
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
||||||
|
|
||||||
class DatabaseProvider {
|
class DatabaseProvider {
|
||||||
// late Database _database;
|
// late Database _database;
|
||||||
@@ -10,8 +14,14 @@ class DatabaseProvider {
|
|||||||
late UserDatabaseStore userStore;
|
late UserDatabaseStore userStore;
|
||||||
|
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
var db = await openDatabase("app.db");
|
Database db;
|
||||||
// _database = 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);
|
||||||
userQuery = UserDatabaseQuery(db: db);
|
userQuery = UserDatabaseQuery(db: db);
|
||||||
|
|||||||
199
filcnaplo/lib/api/providers/live_card_provider.dart
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
// ignore_for_file: no_leading_underscores_for_local_identifiers
|
||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:filcnaplo/helpers/subject.dart';
|
||||||
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/lesson.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/week.dart';
|
||||||
|
import 'package:filcnaplo/utils/format.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/providers/timetable_provider.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:live_activities/live_activities.dart';
|
||||||
|
|
||||||
|
enum LiveCardState { empty, duringLesson, duringBreak, morning, afternoon, night }
|
||||||
|
|
||||||
|
class LiveCardProvider extends ChangeNotifier {
|
||||||
|
Lesson? currentLesson;
|
||||||
|
Lesson? nextLesson;
|
||||||
|
Lesson? prevLesson;
|
||||||
|
List<Lesson>? nextLessons;
|
||||||
|
|
||||||
|
LiveCardState currentState = LiveCardState.empty;
|
||||||
|
late Timer _timer;
|
||||||
|
late final TimetableProvider _timetable;
|
||||||
|
late final SettingsProvider _settings;
|
||||||
|
|
||||||
|
late Duration _delay;
|
||||||
|
|
||||||
|
final _liveActivitiesPlugin = LiveActivities();
|
||||||
|
String? _latestActivityId;
|
||||||
|
Map<String, String> _lastActivity = {};
|
||||||
|
|
||||||
|
LiveCardProvider({
|
||||||
|
required TimetableProvider timetable,
|
||||||
|
required SettingsProvider settings,
|
||||||
|
}) : _timetable = timetable,
|
||||||
|
_settings = settings {
|
||||||
|
_timer = Timer.periodic(const Duration(seconds: 1), (timer) => update());
|
||||||
|
timetable.restore().then((_) => update());
|
||||||
|
_delay = settings.bellDelayEnabled ? Duration(seconds: settings.bellDelay) : Duration.zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_timer.cancel();
|
||||||
|
if (_latestActivityId != null && Platform.isIOS) _liveActivitiesPlugin.endActivity(_latestActivityId!);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Debugging
|
||||||
|
static DateTime _now() {
|
||||||
|
return DateTime.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
String getFloorDifference() {
|
||||||
|
final prevFloor = prevLesson!.getFloor();
|
||||||
|
final nextFloor = nextLesson!.getFloor();
|
||||||
|
if (prevFloor == null || nextFloor == null || prevFloor == nextFloor) {
|
||||||
|
return "to room";
|
||||||
|
}
|
||||||
|
if (nextFloor == 0) {
|
||||||
|
return "ground floor";
|
||||||
|
}
|
||||||
|
if (nextFloor > prevFloor) {
|
||||||
|
return "up floor";
|
||||||
|
} else {
|
||||||
|
return "down floor";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> toMap() {
|
||||||
|
switch (currentState) {
|
||||||
|
case LiveCardState.duringLesson:
|
||||||
|
return {
|
||||||
|
"icon": currentLesson != null ? SubjectIcon.resolveName(subject: currentLesson?.subject) : "book",
|
||||||
|
"index": currentLesson != null ? '${currentLesson!.lessonIndex}. ' : "",
|
||||||
|
"title": currentLesson != null ? ShortSubject.resolve(subject: currentLesson?.subject).capital() : "",
|
||||||
|
"subtitle": currentLesson?.room.replaceAll("_", " ") ?? "",
|
||||||
|
"description": currentLesson?.description ?? "",
|
||||||
|
"startDate": ((currentLesson?.start.millisecondsSinceEpoch ?? 0) - _delay.inMilliseconds).toString(),
|
||||||
|
"endDate": ((currentLesson?.end.millisecondsSinceEpoch ?? 0) - _delay.inMilliseconds).toString(),
|
||||||
|
"nextSubject": nextLesson != null ? ShortSubject.resolve(subject: nextLesson?.subject).capital() : "",
|
||||||
|
"nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
|
||||||
|
};
|
||||||
|
case LiveCardState.duringBreak:
|
||||||
|
final iconFloorMap = {
|
||||||
|
"to room": "chevron.right.2",
|
||||||
|
"up floor": "arrow.up.right",
|
||||||
|
"down floor": "arrow.down.left",
|
||||||
|
"ground floor": "arrow.down.left",
|
||||||
|
};
|
||||||
|
|
||||||
|
final diff = getFloorDifference();
|
||||||
|
|
||||||
|
return {
|
||||||
|
"icon": iconFloorMap[diff] ?? "cup.and.saucer",
|
||||||
|
"title": "Szünet",
|
||||||
|
"description": "Maradj ebben a teremben.",
|
||||||
|
"startDate": ((prevLesson?.end.millisecondsSinceEpoch ?? 0) - _delay.inMilliseconds).toString(),
|
||||||
|
"endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - _delay.inMilliseconds).toString(),
|
||||||
|
"nextSubject": nextLesson != null ? ShortSubject.resolve(subject: nextLesson?.subject) : "",
|
||||||
|
"nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
|
||||||
|
"index": "",
|
||||||
|
"subtitle": "",
|
||||||
|
};
|
||||||
|
default:
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void update() async {
|
||||||
|
if (Platform.isIOS) {
|
||||||
|
final cmap = toMap();
|
||||||
|
if (cmap != _lastActivity) {
|
||||||
|
_lastActivity = cmap;
|
||||||
|
|
||||||
|
if (_lastActivity != {}) {
|
||||||
|
if (_latestActivityId == null) {
|
||||||
|
_liveActivitiesPlugin.createActivity(_lastActivity).then((value) => _latestActivityId = value);
|
||||||
|
} else {
|
||||||
|
_liveActivitiesPlugin.updateActivity(_latestActivityId!, _lastActivity);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (_latestActivityId != null) _liveActivitiesPlugin.endActivity(_latestActivityId!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Lesson> today = _today(_timetable);
|
||||||
|
|
||||||
|
if (today.isEmpty) {
|
||||||
|
await _timetable.fetch(week: Week.current());
|
||||||
|
today = _today(_timetable);
|
||||||
|
}
|
||||||
|
|
||||||
|
_delay = _settings.bellDelayEnabled ? Duration(seconds: _settings.bellDelay) : Duration.zero;
|
||||||
|
|
||||||
|
final now = _now().add(_delay);
|
||||||
|
|
||||||
|
// Filter cancelled lessons #20
|
||||||
|
// Filter label lessons #128
|
||||||
|
today = today.where((lesson) => lesson.status?.name != "Elmaradt" && lesson.subject.id != '' && !lesson.isEmpty).toList();
|
||||||
|
|
||||||
|
if (today.isNotEmpty) {
|
||||||
|
// sort
|
||||||
|
today.sort((a, b) => a.start.compareTo(b.start));
|
||||||
|
|
||||||
|
final _lesson = today.firstWhere((l) => l.start.isBefore(now) && l.end.isAfter(now), orElse: () => Lesson.fromJson({}));
|
||||||
|
|
||||||
|
if (_lesson.start.year != 0) {
|
||||||
|
currentLesson = _lesson;
|
||||||
|
} else {
|
||||||
|
currentLesson = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final _next = today.firstWhere((l) => l.start.isAfter(now), orElse: () => Lesson.fromJson({}));
|
||||||
|
nextLessons = today.where((l) => l.start.isAfter(now)).toList();
|
||||||
|
|
||||||
|
if (_next.start.year != 0) {
|
||||||
|
nextLesson = _next;
|
||||||
|
} else {
|
||||||
|
nextLesson = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final _prev = today.lastWhere((l) => l.end.isBefore(now), orElse: () => Lesson.fromJson({}));
|
||||||
|
|
||||||
|
if (_prev.start.year != 0) {
|
||||||
|
prevLesson = _prev;
|
||||||
|
} else {
|
||||||
|
prevLesson = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentLesson != null) {
|
||||||
|
currentState = LiveCardState.duringLesson;
|
||||||
|
} else if (nextLesson != null && prevLesson != null) {
|
||||||
|
currentState = LiveCardState.duringBreak;
|
||||||
|
} else if (now.hour >= 12 && now.hour < 20) {
|
||||||
|
currentState = LiveCardState.afternoon;
|
||||||
|
} else if (now.hour >= 20) {
|
||||||
|
currentState = LiveCardState.night;
|
||||||
|
} else if (now.hour >= 5 && now.hour <= 10) {
|
||||||
|
currentState = LiveCardState.morning;
|
||||||
|
} else {
|
||||||
|
currentState = LiveCardState.empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get show => currentState != LiveCardState.empty;
|
||||||
|
|
||||||
|
Duration get delay => _delay;
|
||||||
|
|
||||||
|
bool _sameDate(DateTime a, DateTime b) => (a.year == b.year && a.month == b.month && a.day == b.day);
|
||||||
|
|
||||||
|
List<Lesson> _today(TimetableProvider p) => p.lessons.where((l) => _sameDate(l.date, _now())).toList();
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:filcnaplo/api/client.dart';
|
import 'package:filcnaplo/api/client.dart';
|
||||||
@@ -39,7 +41,7 @@ class NewsProvider extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_state = state_;
|
_state = state_;
|
||||||
Provider.of<SettingsProvider>(_context, listen: false).update(_context, newsState: _state);
|
Provider.of<SettingsProvider>(_context, listen: false).update(newsState: _state);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetch() async {
|
Future<void> fetch() async {
|
||||||
@@ -51,7 +53,7 @@ class NewsProvider extends ChangeNotifier {
|
|||||||
|
|
||||||
if (_fresh < 0) {
|
if (_fresh < 0) {
|
||||||
_state = news_.length;
|
_state = news_.length;
|
||||||
Provider.of<SettingsProvider>(_context, listen: false).update(_context, newsState: _state);
|
Provider.of<SettingsProvider>(_context, listen: false).update(newsState: _state);
|
||||||
}
|
}
|
||||||
|
|
||||||
_fresh = max(_fresh, 0);
|
_fresh = max(_fresh, 0);
|
||||||
@@ -70,12 +72,13 @@ class NewsProvider extends ChangeNotifier {
|
|||||||
_fresh--;
|
_fresh--;
|
||||||
_state++;
|
_state++;
|
||||||
|
|
||||||
Provider.of<SettingsProvider>(_context, listen: false).update(_context, newsState: _state);
|
Provider.of<SettingsProvider>(_context, listen: false).update(newsState: _state);
|
||||||
|
|
||||||
if (_fresh > 0)
|
if (_fresh > 0) {
|
||||||
show = true;
|
show = true;
|
||||||
else
|
} else {
|
||||||
show = false;
|
show = false;
|
||||||
|
}
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|||||||
79
filcnaplo/lib/api/providers/status_provider.dart
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
enum Status { network, maintenance, syncing }
|
||||||
|
|
||||||
|
class StatusProvider extends ChangeNotifier {
|
||||||
|
final List<Status> _stack = [];
|
||||||
|
double _progress = 0.0;
|
||||||
|
ConnectivityResult _networkType = ConnectivityResult.none;
|
||||||
|
ConnectivityResult get networkType => _networkType;
|
||||||
|
|
||||||
|
StatusProvider() {
|
||||||
|
_handleNetworkChanges();
|
||||||
|
Connectivity().checkConnectivity().then((value) => _networkType = value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Status? getStatus() => _stack.isNotEmpty ? _stack[0] : null;
|
||||||
|
// Status progress from 0.0 to 1.0
|
||||||
|
double get progress => _progress;
|
||||||
|
|
||||||
|
void _handleNetworkChanges() {
|
||||||
|
Connectivity().onConnectivityChanged.listen((event) {
|
||||||
|
_networkType = event;
|
||||||
|
if (event == ConnectivityResult.none) {
|
||||||
|
if (!_stack.contains(Status.network)) {
|
||||||
|
_stack.insert(0, Status.network);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (_stack.contains(Status.network)) {
|
||||||
|
_stack.remove(Status.network);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void triggerRequest(http.Response res) {
|
||||||
|
if (res.headers.containsKey("x-maintenance-mode") || res.statusCode == 503) {
|
||||||
|
if (!_stack.contains(Status.maintenance)) {
|
||||||
|
_stack.insert(0, Status.maintenance);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (_stack.contains(Status.maintenance)) {
|
||||||
|
_stack.remove(Status.maintenance);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void triggerSync({required int current, required int max}) {
|
||||||
|
double prev = _progress;
|
||||||
|
|
||||||
|
if (!_stack.contains(Status.syncing)) {
|
||||||
|
_stack.add(Status.syncing);
|
||||||
|
_progress = 0.0;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (max == 0) {
|
||||||
|
_progress = 0.0;
|
||||||
|
} else {
|
||||||
|
_progress = current / max;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_progress == 1.0) {
|
||||||
|
notifyListeners();
|
||||||
|
// Wait for animation
|
||||||
|
Future.delayed(const Duration(milliseconds: 250), () {
|
||||||
|
_stack.remove(Status.syncing);
|
||||||
|
notifyListeners();
|
||||||
|
});
|
||||||
|
} else if (progress != prev) {
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
71
filcnaplo/lib/api/providers/sync.dart
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
|
import 'package:filcnaplo/api/providers/database_provider.dart';
|
||||||
|
import 'package:filcnaplo/api/providers/status_provider.dart';
|
||||||
|
import 'package:filcnaplo/api/providers/user_provider.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/client/api.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/client/client.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/student.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/week.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/providers/absence_provider.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/providers/event_provider.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/providers/exam_provider.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/providers/grade_provider.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/providers/homework_provider.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/providers/message_provider.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/providers/note_provider.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/providers/timetable_provider.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
// Mutex
|
||||||
|
bool lock = false;
|
||||||
|
|
||||||
|
Future<void> syncAll(BuildContext context) {
|
||||||
|
if (lock) return Future.value();
|
||||||
|
// Lock
|
||||||
|
lock = true;
|
||||||
|
|
||||||
|
// ignore: avoid_print
|
||||||
|
print("INFO Syncing all");
|
||||||
|
|
||||||
|
UserProvider user = Provider.of<UserProvider>(context, listen: false);
|
||||||
|
StatusProvider statusProvider = Provider.of<StatusProvider>(context, listen: false);
|
||||||
|
|
||||||
|
List<Future<void>> tasks = [];
|
||||||
|
int taski = 0;
|
||||||
|
|
||||||
|
Future<void> syncStatus(Future<void> future) async {
|
||||||
|
await future.onError((error, stackTrace) => null);
|
||||||
|
taski++;
|
||||||
|
statusProvider.triggerSync(current: taski, max: tasks.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
syncStatus(Provider.of<GradeProvider>(context, listen: false).fetch()),
|
||||||
|
syncStatus(Provider.of<TimetableProvider>(context, listen: false).fetch(week: Week.current())),
|
||||||
|
syncStatus(Provider.of<ExamProvider>(context, listen: false).fetch()),
|
||||||
|
syncStatus(Provider.of<HomeworkProvider>(context, listen: false).fetch(from: DateTime.now().subtract(const Duration(days: 30)))),
|
||||||
|
syncStatus(Provider.of<MessageProvider>(context, listen: false).fetchAll()),
|
||||||
|
syncStatus(Provider.of<NoteProvider>(context, listen: false).fetch()),
|
||||||
|
syncStatus(Provider.of<EventProvider>(context, listen: false).fetch()),
|
||||||
|
syncStatus(Provider.of<AbsenceProvider>(context, listen: false).fetch()),
|
||||||
|
|
||||||
|
// Sync student
|
||||||
|
syncStatus(() async {
|
||||||
|
if (user.user == null) return;
|
||||||
|
Map? studentJson = await Provider.of<KretaClient>(context, listen: false).getAPI(KretaAPI.student(user.instituteCode!));
|
||||||
|
if (studentJson == null) return;
|
||||||
|
Student student = Student.fromJson(studentJson);
|
||||||
|
|
||||||
|
user.user?.name = student.name;
|
||||||
|
|
||||||
|
// Store user
|
||||||
|
await Provider.of<DatabaseProvider>(context, listen: false).store.storeUser(user.user!);
|
||||||
|
}()),
|
||||||
|
];
|
||||||
|
|
||||||
|
return Future.wait(tasks)
|
||||||
|
// Unlock
|
||||||
|
.then((value) => lock = false);
|
||||||
|
}
|
||||||
@@ -3,14 +3,12 @@ import 'dart:io';
|
|||||||
import 'package:filcnaplo/api/client.dart';
|
import 'package:filcnaplo/api/client.dart';
|
||||||
import 'package:filcnaplo/models/release.dart';
|
import 'package:filcnaplo/models/release.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
|
||||||
|
|
||||||
class UpdateProvider extends ChangeNotifier {
|
class UpdateProvider extends ChangeNotifier {
|
||||||
// Private
|
// Private
|
||||||
late List<Release> _releases;
|
late List<Release> _releases;
|
||||||
bool _available = false;
|
bool _available = false;
|
||||||
bool get available => _available && _releases.length > 0;
|
bool get available => _available && _releases.isNotEmpty;
|
||||||
PackageInfo? _packageInfo;
|
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
List<Release> get releases => _releases;
|
List<Release> get releases => _releases;
|
||||||
@@ -20,9 +18,10 @@ class UpdateProvider extends ChangeNotifier {
|
|||||||
required BuildContext context,
|
required BuildContext context,
|
||||||
}) {
|
}) {
|
||||||
_releases = List.castFrom(initialReleases);
|
_releases = List.castFrom(initialReleases);
|
||||||
PackageInfo.fromPlatform().then((value) => _packageInfo = value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const currentVersion = String.fromEnvironment("APPVER", defaultValue: "1.0");
|
||||||
|
|
||||||
Future<void> fetch() async {
|
Future<void> fetch() async {
|
||||||
if (!Platform.isAndroid) return;
|
if (!Platform.isAndroid) return;
|
||||||
|
|
||||||
@@ -30,8 +29,9 @@ class UpdateProvider extends ChangeNotifier {
|
|||||||
_releases.sort((a, b) => -a.version.compareTo(b.version));
|
_releases.sort((a, b) => -a.version.compareTo(b.version));
|
||||||
|
|
||||||
// Check for new releases
|
// Check for new releases
|
||||||
if (_releases.length > 0) {
|
if (_releases.isNotEmpty) {
|
||||||
_available = _packageInfo != null && _releases.first.version.compareTo(Version.fromString(_packageInfo?.version ?? "")) == 1;
|
_available = _releases.first.version.compareTo(Version.fromString(currentVersion)) == 1;
|
||||||
|
// ignore: avoid_print
|
||||||
if (_available) print("INFO: New update: ${releases.first.version}");
|
if (_available) print("INFO: New update: ${releases.first.version}");
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
import 'package:filcnaplo/models/user.dart';
|
import 'package:filcnaplo/models/user.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/student.dart';
|
import 'package:filcnaplo_kreta_api/models/student.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
class UserProvider with ChangeNotifier {
|
class UserProvider with ChangeNotifier {
|
||||||
Map<String, User> _users = {};
|
final Map<String, User> _users = {};
|
||||||
String? _selectedUserId;
|
String? _selectedUserId;
|
||||||
User? get user => _users[_selectedUserId];
|
User? get user => _users[_selectedUserId];
|
||||||
|
|
||||||
@@ -13,16 +14,26 @@ class UserProvider with ChangeNotifier {
|
|||||||
String? get name => user?.name;
|
String? get name => user?.name;
|
||||||
String? get username => user?.username;
|
String? get username => user?.username;
|
||||||
String? get password => user?.password;
|
String? get password => user?.password;
|
||||||
|
Role? get role => user?.role;
|
||||||
Student? get student => user?.student;
|
Student? get student => user?.student;
|
||||||
|
String? get nickname => user?.nickname;
|
||||||
|
String? get displayName => user?.displayName;
|
||||||
|
|
||||||
|
final SettingsProvider _settings;
|
||||||
|
|
||||||
|
UserProvider({required SettingsProvider settings}) : _settings = settings;
|
||||||
|
|
||||||
void setUser(String userId) {
|
void setUser(String userId) {
|
||||||
_selectedUserId = userId;
|
_selectedUserId = userId;
|
||||||
|
_settings.update(lastAccountId: userId);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void addUser(User user) {
|
void addUser(User user) {
|
||||||
_users[user.id] = user;
|
_users[user.id] = user;
|
||||||
print("DEBUG: Added User: ${user.id} ${user.name}");
|
if (kDebugMode) {
|
||||||
|
print("DEBUG: Added User: ${user.id}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeUser(String userId) {
|
void removeUser(String userId) {
|
||||||
|
|||||||
@@ -1,23 +1,36 @@
|
|||||||
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:dynamic_color/dynamic_color.dart';
|
||||||
import 'package:filcnaplo/api/client.dart';
|
import 'package:filcnaplo/api/client.dart';
|
||||||
|
import 'package:filcnaplo/api/providers/live_card_provider.dart';
|
||||||
import 'package:filcnaplo/api/providers/news_provider.dart';
|
import 'package:filcnaplo/api/providers/news_provider.dart';
|
||||||
import 'package:filcnaplo/api/providers/database_provider.dart';
|
import 'package:filcnaplo/api/providers/database_provider.dart';
|
||||||
|
import 'package:filcnaplo/api/providers/status_provider.dart';
|
||||||
import 'package:filcnaplo/models/config.dart';
|
import 'package:filcnaplo/models/config.dart';
|
||||||
import 'package:filcnaplo/theme.dart';
|
import 'package:filcnaplo/theme/observer.dart';
|
||||||
|
import 'package:filcnaplo/theme/theme.dart';
|
||||||
import 'package:filcnaplo_kreta_api/client/client.dart';
|
import 'package:filcnaplo_kreta_api/client/client.dart';
|
||||||
import 'package:filcnaplo_mobile_ui/common/system_chrome.dart';
|
|
||||||
import 'package:filcnaplo_mobile_ui/screens/login/login_route.dart';
|
|
||||||
import 'package:filcnaplo_mobile_ui/screens/login/login_screen.dart';
|
|
||||||
import 'package:filcnaplo_mobile_ui/screens/navigation/navigation_screen.dart';
|
|
||||||
import 'package:filcnaplo_mobile_ui/screens/settings/settings_route.dart';
|
|
||||||
import 'package:filcnaplo_mobile_ui/screens/settings/settings_screen.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:i18n_extension/i18n_widget.dart';
|
import 'package:i18n_extension/i18n_widget.dart';
|
||||||
|
import 'package:material_color_utilities/palettes/core_palette.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
// Mobile UI
|
||||||
|
import 'package:filcnaplo_mobile_ui/common/system_chrome.dart' as mobile;
|
||||||
|
import 'package:filcnaplo_mobile_ui/screens/login/login_route.dart' as mobile;
|
||||||
|
import 'package:filcnaplo_mobile_ui/screens/login/login_screen.dart' as mobile;
|
||||||
|
import 'package:filcnaplo_mobile_ui/screens/navigation/navigation_screen.dart' as mobile;
|
||||||
|
import 'package:filcnaplo_mobile_ui/screens/settings/settings_route.dart' as mobile;
|
||||||
|
import 'package:filcnaplo_mobile_ui/screens/settings/settings_screen.dart' as mobile;
|
||||||
|
|
||||||
|
// Desktop UI
|
||||||
|
import 'package:filcnaplo_desktop_ui/screens/navigation/navigation_screen.dart' as desktop;
|
||||||
|
import 'package:filcnaplo_desktop_ui/screens/login/login_screen.dart' as desktop;
|
||||||
|
import 'package:filcnaplo_desktop_ui/screens/login/login_route.dart' as desktop;
|
||||||
|
|
||||||
// Providers
|
// Providers
|
||||||
import 'package:filcnaplo/models/settings.dart';
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
import 'package:filcnaplo_kreta_api/providers/absence_provider.dart';
|
import 'package:filcnaplo_kreta_api/providers/absence_provider.dart';
|
||||||
@@ -31,79 +44,99 @@ import 'package:filcnaplo_kreta_api/providers/timetable_provider.dart';
|
|||||||
import 'package:filcnaplo/api/providers/user_provider.dart';
|
import 'package:filcnaplo/api/providers/user_provider.dart';
|
||||||
import 'package:filcnaplo/api/providers/update_provider.dart';
|
import 'package:filcnaplo/api/providers/update_provider.dart';
|
||||||
import 'package:filcnaplo_mobile_ui/pages/grades/calculator/grade_calculator_provider.dart';
|
import 'package:filcnaplo_mobile_ui/pages/grades/calculator/grade_calculator_provider.dart';
|
||||||
|
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
||||||
|
import 'package:filcnaplo_premium/providers/premium_provider.dart';
|
||||||
|
|
||||||
class App extends StatelessWidget {
|
class App extends StatelessWidget {
|
||||||
final SettingsProvider settings;
|
final SettingsProvider settings;
|
||||||
final UserProvider user;
|
final UserProvider user;
|
||||||
final DatabaseProvider database;
|
final DatabaseProvider database;
|
||||||
|
|
||||||
App({Key? key, required this.database, required this.settings, required this.user}) : super(key: key) {
|
const App({Key? key, required this.database, required this.settings, required this.user}) : super(key: key);
|
||||||
if (user.getUsers().length > 0) user.setUser(user.getUsers().first.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
setSystemChrome(context);
|
mobile.setSystemChrome(context);
|
||||||
|
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((_) {
|
// Set high refresh mode #28
|
||||||
FilcAPI.getConfig().then((Config? config) {
|
if (Platform.isAndroid) FlutterDisplayMode.setHighRefreshRate();
|
||||||
settings.update(context, database: database, config: config ?? Config.fromJson({}));
|
|
||||||
|
CorePalette? corePalette;
|
||||||
|
|
||||||
|
final status = StatusProvider();
|
||||||
|
final kreta = KretaClient(user: user, settings: settings, status: status);
|
||||||
|
final timetable = TimetableProvider(user: user, database: database, kreta: kreta);
|
||||||
|
final premium = PremiumProvider(settings: settings);
|
||||||
|
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
FilcAPI.getConfig(settings).then((Config? config) {
|
||||||
|
if (config != null) settings.update(config: config);
|
||||||
});
|
});
|
||||||
|
premium.activate();
|
||||||
});
|
});
|
||||||
|
|
||||||
return I18n(
|
return MultiProvider(
|
||||||
initialLocale: Locale(settings.language, settings.language.toUpperCase()),
|
providers: [
|
||||||
child: MultiProvider(
|
ChangeNotifierProvider<PremiumProvider>(create: (_) => premium),
|
||||||
providers: [
|
ChangeNotifierProvider<SettingsProvider>(create: (_) => settings),
|
||||||
ChangeNotifierProvider<SettingsProvider>(create: (_) => settings),
|
ChangeNotifierProvider<UserProvider>(create: (_) => user),
|
||||||
ChangeNotifierProvider<UserProvider>(create: (_) => user),
|
ChangeNotifierProvider<StatusProvider>(create: (_) => status),
|
||||||
Provider<KretaClient>(create: (context) => KretaClient(context: context, userAgent: settings.config.userAgent)),
|
Provider<KretaClient>(create: (_) => kreta),
|
||||||
Provider<DatabaseProvider>(create: (context) => database),
|
Provider<DatabaseProvider>(create: (context) => database),
|
||||||
ChangeNotifierProvider<ThemeModeObserver>(create: (context) => ThemeModeObserver(initialTheme: settings.theme)),
|
ChangeNotifierProvider<ThemeModeObserver>(create: (context) => ThemeModeObserver(initialTheme: settings.theme)),
|
||||||
ChangeNotifierProvider<NewsProvider>(create: (context) => NewsProvider(context: context)),
|
ChangeNotifierProvider<NewsProvider>(create: (context) => NewsProvider(context: context)),
|
||||||
ChangeNotifierProvider<UpdateProvider>(create: (context) => UpdateProvider(context: context)),
|
ChangeNotifierProvider<UpdateProvider>(create: (context) => UpdateProvider(context: context)),
|
||||||
|
|
||||||
// User data providers
|
// User data providers
|
||||||
ChangeNotifierProvider<GradeProvider>(create: (context) => GradeProvider(context: context)),
|
ChangeNotifierProvider<GradeProvider>(create: (_) => GradeProvider(settings: settings, user: user, database: database, kreta: kreta)),
|
||||||
ChangeNotifierProvider<TimetableProvider>(create: (context) => TimetableProvider(context: context)),
|
ChangeNotifierProvider<TimetableProvider>(create: (_) => timetable),
|
||||||
ChangeNotifierProvider<ExamProvider>(create: (context) => ExamProvider(context: context)),
|
ChangeNotifierProvider<ExamProvider>(create: (context) => ExamProvider(context: context)),
|
||||||
ChangeNotifierProvider<HomeworkProvider>(create: (context) => HomeworkProvider(context: context)),
|
ChangeNotifierProvider<HomeworkProvider>(create: (context) => HomeworkProvider(context: context)),
|
||||||
ChangeNotifierProvider<MessageProvider>(create: (context) => MessageProvider(context: context)),
|
ChangeNotifierProvider<MessageProvider>(create: (context) => MessageProvider(context: context)),
|
||||||
ChangeNotifierProvider<NoteProvider>(create: (context) => NoteProvider(context: context)),
|
ChangeNotifierProvider<NoteProvider>(create: (context) => NoteProvider(context: context)),
|
||||||
ChangeNotifierProvider<EventProvider>(create: (context) => EventProvider(context: context)),
|
ChangeNotifierProvider<EventProvider>(create: (context) => EventProvider(context: context)),
|
||||||
ChangeNotifierProvider<AbsenceProvider>(create: (context) => AbsenceProvider(context: context)),
|
ChangeNotifierProvider<AbsenceProvider>(create: (context) => AbsenceProvider(context: context)),
|
||||||
|
|
||||||
ChangeNotifierProvider<GradeCalculatorProvider>(create: (context) => GradeCalculatorProvider(context)),
|
ChangeNotifierProvider<GradeCalculatorProvider>(
|
||||||
],
|
create: (_) => GradeCalculatorProvider(settings: settings, user: user, database: database, kreta: kreta)),
|
||||||
child: Consumer<ThemeModeObserver>(
|
ChangeNotifierProvider<LiveCardProvider>(create: (context) => LiveCardProvider(timetable: timetable, settings: settings))
|
||||||
builder: (context, themeMode, child) {
|
],
|
||||||
return MaterialApp(
|
child: Consumer<ThemeModeObserver>(
|
||||||
|
builder: (context, themeMode, child) {
|
||||||
|
return FutureBuilder<CorePalette?>(
|
||||||
|
future: DynamicColorPlugin.getCorePalette(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
corePalette = snapshot.data;
|
||||||
|
return MaterialApp(
|
||||||
builder: (context, child) {
|
builder: (context, child) {
|
||||||
// Limit font size scaling to 1.0
|
// Limit font size scaling to 1.0
|
||||||
double textScaleFactor = min(MediaQuery.of(context).textScaleFactor, 1.0);
|
double textScaleFactor = min(MediaQuery.of(context).textScaleFactor, 1.0);
|
||||||
|
|
||||||
return MediaQuery(
|
return I18n(
|
||||||
data: MediaQuery.of(context).copyWith(textScaleFactor: textScaleFactor),
|
initialLocale: Locale(settings.language, settings.language.toUpperCase()),
|
||||||
child: child ?? Container(),
|
child: MediaQuery(
|
||||||
|
data: MediaQuery.of(context).copyWith(textScaleFactor: textScaleFactor),
|
||||||
|
child: child ?? Container(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
title: "Filc Napló",
|
title: "Filc Napló",
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
theme: AppTheme.lightTheme(context),
|
theme: AppTheme.lightTheme(context, palette: corePalette),
|
||||||
darkTheme: AppTheme.darkTheme(context),
|
darkTheme: AppTheme.darkTheme(context, palette: corePalette),
|
||||||
themeMode: themeMode.themeMode,
|
themeMode: themeMode.themeMode,
|
||||||
localizationsDelegates: [
|
localizationsDelegates: const [
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalMaterialLocalizations.delegate,
|
||||||
GlobalWidgetsLocalizations.delegate,
|
GlobalWidgetsLocalizations.delegate,
|
||||||
GlobalCupertinoLocalizations.delegate,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
],
|
],
|
||||||
supportedLocales: [
|
supportedLocales: const [
|
||||||
const Locale('en', 'EN'),
|
Locale('en', 'EN'),
|
||||||
const Locale('hu', 'HU'),
|
Locale('hu', 'HU'),
|
||||||
const Locale('de', 'DE'),
|
Locale('de', 'DE'),
|
||||||
],
|
],
|
||||||
localeListResolutionCallback: (locales, supported) {
|
localeListResolutionCallback: (locales, supported) {
|
||||||
Locale locale = Locale('hu', 'HU');
|
Locale locale = const Locale('hu', 'HU');
|
||||||
|
|
||||||
for (var loc in locales ?? []) {
|
for (var loc in locales ?? []) {
|
||||||
if (supported.contains(loc)) {
|
if (supported.contains(loc)) {
|
||||||
@@ -115,28 +148,43 @@ class App extends StatelessWidget {
|
|||||||
return locale;
|
return locale;
|
||||||
},
|
},
|
||||||
onGenerateRoute: (settings) => rootNavigator(settings),
|
onGenerateRoute: (settings) => rootNavigator(settings),
|
||||||
initialRoute: user.getUsers().length > 0 ? "navigation" : "login");
|
initialRoute: user.getUsers().isNotEmpty ? "navigation" : "login",
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Route? rootNavigator(RouteSettings route) {
|
Route? rootNavigator(RouteSettings route) {
|
||||||
// if platform == android || platform == ios
|
// if platform == android || platform == ios
|
||||||
switch (route.name) {
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
case "login_back":
|
switch (route.name) {
|
||||||
return CupertinoPageRoute(builder: (context) => LoginScreen(back: true));
|
case "login_back":
|
||||||
case "login":
|
return CupertinoPageRoute(builder: (context) => const mobile.LoginScreen(back: true));
|
||||||
return _rootRoute(LoginScreen());
|
case "login":
|
||||||
case "navigation":
|
return _rootRoute(const mobile.LoginScreen());
|
||||||
return _rootRoute(Navigation());
|
case "navigation":
|
||||||
case "login_to_navigation":
|
return _rootRoute(const mobile.NavigationScreen());
|
||||||
return loginRoute(Navigation());
|
case "login_to_navigation":
|
||||||
case "settings":
|
return mobile.loginRoute(const mobile.NavigationScreen());
|
||||||
return settingsRoute(SettingsScreen());
|
case "settings":
|
||||||
|
return mobile.settingsRoute(const mobile.SettingsScreen());
|
||||||
|
}
|
||||||
|
} else if (Platform.isWindows || Platform.isMacOS || Platform.isLinux) {
|
||||||
|
switch (route.name) {
|
||||||
|
case "login_back":
|
||||||
|
return CupertinoPageRoute(builder: (context) => const desktop.LoginScreen(back: true));
|
||||||
|
case "login":
|
||||||
|
return _rootRoute(const desktop.LoginScreen());
|
||||||
|
case "navigation":
|
||||||
|
return _rootRoute(const desktop.NavigationScreen());
|
||||||
|
case "login_to_navigation":
|
||||||
|
return desktop.loginRoute(const desktop.NavigationScreen());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// else if platform == windows || ...
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Route _rootRoute(Widget widget) {
|
Route _rootRoute(Widget widget) {
|
||||||
|
|||||||
@@ -1,72 +1,134 @@
|
|||||||
|
// ignore_for_file: avoid_print
|
||||||
|
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:filcnaplo/api/providers/database_provider.dart';
|
||||||
import 'package:filcnaplo/database/struct.dart';
|
import 'package:filcnaplo/database/struct.dart';
|
||||||
import 'package:filcnaplo/models/settings.dart';
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
import 'package:sqflite/sqflite.dart';
|
import 'package:sqflite/sqflite.dart';
|
||||||
|
// ignore: depend_on_referenced_packages
|
||||||
|
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
||||||
|
|
||||||
Future<Database> initDB() async {
|
const settingsDB = DatabaseStruct("settings", {
|
||||||
// await deleteDatabase('app.db'); // for debugging
|
"language": String, "start_page": int, "rounding": int, "theme": int, "accent_color": int, "news": int, "news_state": int, "developer_mode": int,
|
||||||
var db = await openDatabase('app.db');
|
"update_channel": int, "config": String, "custom_accent_color": int, "custom_background_color": int, "custom_highlight_color": int, // general
|
||||||
|
"grade_color1": int, "grade_color2": int, "grade_color3": int, "grade_color4": int, "grade_color5": int, // grade colors
|
||||||
|
"vibration_strength": int, "ab_weeks": int, "swap_ab_weeks": int,
|
||||||
|
"notifications": int, "notifications_bitfield": int, "notification_poll_interval": int, // notifications
|
||||||
|
"x_filc_id": String, "graph_class_avg": int, "presentation_mode": int, "bell_delay": int, "bell_delay_enabled": int,
|
||||||
|
"grade_opening_fun": int, "icon_pack": String, "premium_scopes": String, "premium_token": String, "last_account_id": String,
|
||||||
|
});
|
||||||
|
const usersDB = DatabaseStruct("users", {
|
||||||
|
"id": String, "name": String, "username": String, "password": String, "institute_code": String, "student": String, "role": int,
|
||||||
|
"nickname": String // premium only
|
||||||
|
});
|
||||||
|
const userDataDB = DatabaseStruct("user_data", {
|
||||||
|
"id": String, "grades": String, "timetable": String, "exams": String, "homework": String, "messages": String, "notes": String,
|
||||||
|
"events": String, "absences": String, "group_averages": String,
|
||||||
|
// "subject_lesson_count": String, // non kreta data
|
||||||
|
"last_seen_grade": int,
|
||||||
|
});
|
||||||
|
|
||||||
var settingsDB = await createSettingsTable(db);
|
Future<void> createTable(Database db, DatabaseStruct struct) => db.execute("CREATE TABLE IF NOT EXISTS ${struct.table} ($struct)");
|
||||||
|
|
||||||
// Create table Users
|
Future<Database> initDB(DatabaseProvider database) async {
|
||||||
await db.execute("CREATE TABLE IF NOT EXISTS users (id TEXT NOT NULL, name TEXT, username TEXT, password TEXT, institute_code TEXT, student TEXT)");
|
Database db;
|
||||||
await db.execute("CREATE TABLE IF NOT EXISTS user_data ("
|
|
||||||
"id TEXT NOT NULL, grades TEXT, timetable TEXT, exams TEXT, homework TEXT, messages TEXT, notes TEXT, events TEXT, absences TEXT)");
|
if (Platform.isLinux || Platform.isWindows) {
|
||||||
|
sqfliteFfiInit();
|
||||||
|
db = await databaseFactoryFfi.openDatabase("app.db");
|
||||||
|
} else {
|
||||||
|
db = await openDatabase("app.db");
|
||||||
|
}
|
||||||
|
|
||||||
|
await createTable(db, settingsDB);
|
||||||
|
await createTable(db, usersDB);
|
||||||
|
await createTable(db, userDataDB);
|
||||||
|
|
||||||
if ((await db.rawQuery("SELECT COUNT(*) FROM settings"))[0].values.first == 0) {
|
if ((await db.rawQuery("SELECT COUNT(*) FROM settings"))[0].values.first == 0) {
|
||||||
// Set default values for table Settings
|
// Set default values for table Settings
|
||||||
await db.insert("settings", SettingsProvider.defaultSettings().toMap());
|
await db.insert("settings", SettingsProvider.defaultSettings(database: database).toMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
await migrateDB(db, settingsDB.struct.keys);
|
// Migrate Databases
|
||||||
|
try {
|
||||||
|
await migrateDB(
|
||||||
|
db,
|
||||||
|
struct: settingsDB,
|
||||||
|
defaultValues: SettingsProvider.defaultSettings(database: database).toMap(),
|
||||||
|
);
|
||||||
|
await migrateDB(
|
||||||
|
db,
|
||||||
|
struct: usersDB,
|
||||||
|
defaultValues: {"role": 0},
|
||||||
|
);
|
||||||
|
await migrateDB(db, struct: userDataDB, defaultValues: {
|
||||||
|
"grades": "[]", "timetable": "[]", "exams": "[]", "homework": "[]", "messages": "[]", "notes": "[]", "events": "[]", "absences": "[]",
|
||||||
|
"group_averages": "[]",
|
||||||
|
// "subject_lesson_count": "{}", // non kreta data
|
||||||
|
"last_seen_grade": 0,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
print("ERROR: migrateDB: $error");
|
||||||
|
}
|
||||||
|
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<DatabaseStruct> createSettingsTable(Database db) async {
|
Future<void> migrateDB(
|
||||||
var settingsDB = DatabaseStruct({
|
Database db, {
|
||||||
"language": String, "start_page": int, "rounding": int, "theme": int, "accent_color": int, "news": int, "news_state": int, "developer_mode": int,
|
required DatabaseStruct struct,
|
||||||
"update_channel": int, "config": String, // general
|
required Map<String, Object?> defaultValues,
|
||||||
"grade_color1": int, "grade_color2": int, "grade_color3": int, "grade_color4": int, "grade_color5": int, // grade colors
|
}) async {
|
||||||
"vibration_strength": int, "ab_weeks": int, "swap_ab_weeks": int,
|
var originalRows = await db.query(struct.table);
|
||||||
"notifications": int, "notifications_bitfield": int, "notification_poll_interval": int, // notifications
|
|
||||||
|
if (originalRows.isEmpty) {
|
||||||
|
await db.execute("drop table ${struct.table}");
|
||||||
|
await createTable(db, struct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Map<String, dynamic>> migrated = [];
|
||||||
|
|
||||||
|
// go through each row and add missing keys or delete non existing keys
|
||||||
|
await Future.forEach<Map<String, Object?>>(originalRows, (original) async {
|
||||||
|
bool migrationRequired = struct.struct.keys.any((key) => !original.containsKey(key) || original[key] == null) ||
|
||||||
|
original.keys.any((key) => !struct.struct.containsKey(key));
|
||||||
|
|
||||||
|
if (migrationRequired) {
|
||||||
|
print("INFO: Migrating ${struct.table}");
|
||||||
|
var copy = Map<String, Object?>.from(original);
|
||||||
|
|
||||||
|
// Fill missing columns
|
||||||
|
for (var key in struct.struct.keys) {
|
||||||
|
if (!original.containsKey(key) || original[key] == null) {
|
||||||
|
print("DEBUG: migrating $key");
|
||||||
|
copy[key] = defaultValues[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var key in original.keys) {
|
||||||
|
if (!struct.struct.keys.contains(key)) {
|
||||||
|
print("DEBUG: dropping $key");
|
||||||
|
copy.remove(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
migrated.add(copy);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create table Settings
|
// replace the old table with the migrated one
|
||||||
await db.execute("CREATE TABLE IF NOT EXISTS settings ($settingsDB)");
|
if (migrated.isNotEmpty) {
|
||||||
|
// Delete table
|
||||||
|
await db.execute("drop table ${struct.table}");
|
||||||
|
|
||||||
return settingsDB;
|
// Recreate table
|
||||||
}
|
await createTable(db, struct);
|
||||||
|
await Future.forEach(migrated, (Map<String, Object?> copy) async {
|
||||||
Future<void> migrateDB(Database db, Iterable<String> keys) async {
|
await db.insert(struct.table, copy);
|
||||||
var settings = (await db.query("settings"))[0];
|
|
||||||
|
|
||||||
bool migrationRequired = keys.any((key) => !settings.containsKey(key) || settings[key] == null);
|
|
||||||
|
|
||||||
if (migrationRequired) {
|
|
||||||
var defaultSettings = SettingsProvider.defaultSettings();
|
|
||||||
var settingsCopy = Map<String, dynamic>.from(settings);
|
|
||||||
|
|
||||||
// Delete settings
|
|
||||||
await db.execute("drop table settings");
|
|
||||||
|
|
||||||
// Fill missing columns
|
|
||||||
keys.forEach((key) {
|
|
||||||
if (!keys.contains(key)) {
|
|
||||||
print("debug: dropping $key");
|
|
||||||
settingsCopy.remove(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!settings.containsKey(key) || settings[key] == null) {
|
|
||||||
print("DEBUG: migrating $key");
|
|
||||||
settingsCopy[key] = defaultSettings.toMap()[key];
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Recreate settings
|
|
||||||
await createSettingsTable(db);
|
|
||||||
await db.insert("settings", settingsCopy);
|
|
||||||
|
|
||||||
print("INFO: Database migrated");
|
print("INFO: Database migrated");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'package:filcnaplo/api/providers/database_provider.dart';
|
||||||
|
import 'package:filcnaplo/models/subject_lesson_count.dart';
|
||||||
import 'package:filcnaplo/models/user.dart';
|
import 'package:filcnaplo/models/user.dart';
|
||||||
import 'package:sqflite/sqflite.dart';
|
// ignore: depend_on_referenced_packages
|
||||||
|
import 'package:sqflite_common/sqlite_api.dart';
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import 'package:filcnaplo/models/settings.dart';
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
@@ -13,24 +16,31 @@ import 'package:filcnaplo_kreta_api/models/message.dart';
|
|||||||
import 'package:filcnaplo_kreta_api/models/note.dart';
|
import 'package:filcnaplo_kreta_api/models/note.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/event.dart';
|
import 'package:filcnaplo_kreta_api/models/event.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/absence.dart';
|
import 'package:filcnaplo_kreta_api/models/absence.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/group_average.dart';
|
||||||
|
|
||||||
class DatabaseQuery {
|
class DatabaseQuery {
|
||||||
DatabaseQuery({required this.db});
|
DatabaseQuery({required this.db});
|
||||||
|
|
||||||
final Database db;
|
final Database db;
|
||||||
|
|
||||||
Future<SettingsProvider> getSettings() async {
|
Future<SettingsProvider> getSettings(DatabaseProvider database) async {
|
||||||
Map settingsMap = (await db.query("settings")).elementAt(0);
|
Map settingsMap = (await db.query("settings")).elementAt(0);
|
||||||
SettingsProvider settings = SettingsProvider.fromMap(settingsMap);
|
SettingsProvider settings = SettingsProvider.fromMap(settingsMap, database: database);
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<UserProvider> getUsers() async {
|
Future<UserProvider> getUsers(SettingsProvider settings) async {
|
||||||
var userProvider = UserProvider();
|
var userProvider = UserProvider(settings: settings);
|
||||||
List<Map> usersMap = await db.query("users");
|
List<Map> usersMap = await db.query("users");
|
||||||
usersMap.forEach((user) {
|
for (var user in usersMap) {
|
||||||
userProvider.addUser(User.fromMap(user));
|
userProvider.addUser(User.fromMap(user));
|
||||||
});
|
}
|
||||||
|
if (userProvider.getUsers().map((e) => e.id).contains(settings.lastAccountId)) {
|
||||||
|
userProvider.setUser(settings.lastAccountId);
|
||||||
|
} else {
|
||||||
|
userProvider.setUser(userProvider.getUsers().first.id);
|
||||||
|
settings.update(lastAccountId: userProvider.id);
|
||||||
|
}
|
||||||
return userProvider;
|
return userProvider;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,7 +52,7 @@ class UserDatabaseQuery {
|
|||||||
|
|
||||||
Future<List<Grade>> getGrades({required String userId}) async {
|
Future<List<Grade>> getGrades({required String userId}) async {
|
||||||
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
if (userData.length == 0) return [];
|
if (userData.isEmpty) return [];
|
||||||
String? gradesJson = userData.elementAt(0)["grades"] as String?;
|
String? gradesJson = userData.elementAt(0)["grades"] as String?;
|
||||||
if (gradesJson == null) return [];
|
if (gradesJson == null) return [];
|
||||||
List<Grade> grades = (jsonDecode(gradesJson) as List).map((e) => Grade.fromJson(e)).toList();
|
List<Grade> grades = (jsonDecode(gradesJson) as List).map((e) => Grade.fromJson(e)).toList();
|
||||||
@@ -51,7 +61,7 @@ class UserDatabaseQuery {
|
|||||||
|
|
||||||
Future<List<Lesson>> getLessons({required String userId}) async {
|
Future<List<Lesson>> getLessons({required String userId}) async {
|
||||||
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
if (userData.length == 0) return [];
|
if (userData.isEmpty) return [];
|
||||||
String? lessonsJson = userData.elementAt(0)["timetable"] as String?;
|
String? lessonsJson = userData.elementAt(0)["timetable"] as String?;
|
||||||
if (lessonsJson == null) return [];
|
if (lessonsJson == null) return [];
|
||||||
List<Lesson> lessons = (jsonDecode(lessonsJson) as List).map((e) => Lesson.fromJson(e)).toList();
|
List<Lesson> lessons = (jsonDecode(lessonsJson) as List).map((e) => Lesson.fromJson(e)).toList();
|
||||||
@@ -60,7 +70,7 @@ class UserDatabaseQuery {
|
|||||||
|
|
||||||
Future<List<Exam>> getExams({required String userId}) async {
|
Future<List<Exam>> getExams({required String userId}) async {
|
||||||
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
if (userData.length == 0) return [];
|
if (userData.isEmpty) return [];
|
||||||
String? examsJson = userData.elementAt(0)["exams"] as String?;
|
String? examsJson = userData.elementAt(0)["exams"] as String?;
|
||||||
if (examsJson == null) return [];
|
if (examsJson == null) return [];
|
||||||
List<Exam> exams = (jsonDecode(examsJson) as List).map((e) => Exam.fromJson(e)).toList();
|
List<Exam> exams = (jsonDecode(examsJson) as List).map((e) => Exam.fromJson(e)).toList();
|
||||||
@@ -69,7 +79,7 @@ class UserDatabaseQuery {
|
|||||||
|
|
||||||
Future<List<Homework>> getHomework({required String userId}) async {
|
Future<List<Homework>> getHomework({required String userId}) async {
|
||||||
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
if (userData.length == 0) return [];
|
if (userData.isEmpty) return [];
|
||||||
String? homeworkJson = userData.elementAt(0)["homework"] as String?;
|
String? homeworkJson = userData.elementAt(0)["homework"] as String?;
|
||||||
if (homeworkJson == null) return [];
|
if (homeworkJson == null) return [];
|
||||||
List<Homework> homework = (jsonDecode(homeworkJson) as List).map((e) => Homework.fromJson(e)).toList();
|
List<Homework> homework = (jsonDecode(homeworkJson) as List).map((e) => Homework.fromJson(e)).toList();
|
||||||
@@ -78,7 +88,7 @@ class UserDatabaseQuery {
|
|||||||
|
|
||||||
Future<List<Message>> getMessages({required String userId}) async {
|
Future<List<Message>> getMessages({required String userId}) async {
|
||||||
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
if (userData.length == 0) return [];
|
if (userData.isEmpty) return [];
|
||||||
String? messagesJson = userData.elementAt(0)["messages"] as String?;
|
String? messagesJson = userData.elementAt(0)["messages"] as String?;
|
||||||
if (messagesJson == null) return [];
|
if (messagesJson == null) return [];
|
||||||
List<Message> messages = (jsonDecode(messagesJson) as List).map((e) => Message.fromJson(e)).toList();
|
List<Message> messages = (jsonDecode(messagesJson) as List).map((e) => Message.fromJson(e)).toList();
|
||||||
@@ -87,7 +97,7 @@ class UserDatabaseQuery {
|
|||||||
|
|
||||||
Future<List<Note>> getNotes({required String userId}) async {
|
Future<List<Note>> getNotes({required String userId}) async {
|
||||||
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
if (userData.length == 0) return [];
|
if (userData.isEmpty) return [];
|
||||||
String? notesJson = userData.elementAt(0)["notes"] as String?;
|
String? notesJson = userData.elementAt(0)["notes"] as String?;
|
||||||
if (notesJson == null) return [];
|
if (notesJson == null) return [];
|
||||||
List<Note> notes = (jsonDecode(notesJson) as List).map((e) => Note.fromJson(e)).toList();
|
List<Note> notes = (jsonDecode(notesJson) as List).map((e) => Note.fromJson(e)).toList();
|
||||||
@@ -96,7 +106,7 @@ class UserDatabaseQuery {
|
|||||||
|
|
||||||
Future<List<Event>> getEvents({required String userId}) async {
|
Future<List<Event>> getEvents({required String userId}) async {
|
||||||
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
if (userData.length == 0) return [];
|
if (userData.isEmpty) return [];
|
||||||
String? eventsJson = userData.elementAt(0)["events"] as String?;
|
String? eventsJson = userData.elementAt(0)["events"] as String?;
|
||||||
if (eventsJson == null) return [];
|
if (eventsJson == null) return [];
|
||||||
List<Event> events = (jsonDecode(eventsJson) as List).map((e) => Event.fromJson(e)).toList();
|
List<Event> events = (jsonDecode(eventsJson) as List).map((e) => Event.fromJson(e)).toList();
|
||||||
@@ -105,10 +115,37 @@ class UserDatabaseQuery {
|
|||||||
|
|
||||||
Future<List<Absence>> getAbsences({required String userId}) async {
|
Future<List<Absence>> getAbsences({required String userId}) async {
|
||||||
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
if (userData.length == 0) return [];
|
if (userData.isEmpty) return [];
|
||||||
String? absebcesJson = userData.elementAt(0)["absences"] as String?;
|
String? absencesJson = userData.elementAt(0)["absences"] as String?;
|
||||||
if (absebcesJson == null) return [];
|
if (absencesJson == null) return [];
|
||||||
List<Absence> absebces = (jsonDecode(absebcesJson) as List).map((e) => Absence.fromJson(e)).toList();
|
List<Absence> absences = (jsonDecode(absencesJson) as List).map((e) => Absence.fromJson(e)).toList();
|
||||||
return absebces;
|
return absences;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<GroupAverage>> getGroupAverages({required String userId}) async {
|
||||||
|
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
|
if (userData.isEmpty) return [];
|
||||||
|
String? groupAveragesJson = userData.elementAt(0)["group_averages"] as String?;
|
||||||
|
if (groupAveragesJson == null) return [];
|
||||||
|
List<GroupAverage> groupAverages = (jsonDecode(groupAveragesJson) as List).map((e) => GroupAverage.fromJson(e)).toList();
|
||||||
|
return groupAverages;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<SubjectLessonCount> getSubjectLessonCount({required String userId}) async {
|
||||||
|
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
|
if (userData.isEmpty) return SubjectLessonCount.fromMap({});
|
||||||
|
String? lessonCountJson = userData.elementAt(0)["subject_lesson_count"] as String?;
|
||||||
|
if (lessonCountJson == null) return SubjectLessonCount.fromMap({});
|
||||||
|
SubjectLessonCount lessonCount = SubjectLessonCount.fromMap(jsonDecode(lessonCountJson) as Map);
|
||||||
|
return lessonCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<DateTime> lastSeenGrade({required String userId}) async {
|
||||||
|
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
|
if (userData.isEmpty) return DateTime(0);
|
||||||
|
int? lastSeenDate = userData.elementAt(0)["last_seen_grade"] as int?;
|
||||||
|
if (lastSeenDate == null) return DateTime(0);
|
||||||
|
DateTime lastSeen = DateTime.fromMillisecondsSinceEpoch(lastSeenDate);
|
||||||
|
return lastSeen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:sqflite/sqflite.dart';
|
import 'package:filcnaplo/models/subject_lesson_count.dart';
|
||||||
|
// ignore: depend_on_referenced_packages
|
||||||
|
import 'package:sqflite_common/sqlite_api.dart';
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import 'package:filcnaplo/models/settings.dart';
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
@@ -12,6 +14,7 @@ import 'package:filcnaplo_kreta_api/models/message.dart';
|
|||||||
import 'package:filcnaplo_kreta_api/models/note.dart';
|
import 'package:filcnaplo_kreta_api/models/note.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/event.dart';
|
import 'package:filcnaplo_kreta_api/models/event.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/absence.dart';
|
import 'package:filcnaplo_kreta_api/models/absence.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/group_average.dart';
|
||||||
|
|
||||||
class DatabaseStore {
|
class DatabaseStore {
|
||||||
DatabaseStore({required this.db});
|
DatabaseStore({required this.db});
|
||||||
@@ -24,7 +27,7 @@ class DatabaseStore {
|
|||||||
|
|
||||||
Future<void> storeUser(User user) async {
|
Future<void> storeUser(User user) async {
|
||||||
List userRes = await db.query("users", where: "id = ?", whereArgs: [user.id]);
|
List userRes = await db.query("users", where: "id = ?", whereArgs: [user.id]);
|
||||||
if (userRes.length > 0) {
|
if (userRes.isNotEmpty) {
|
||||||
await db.update("users", user.toMap(), where: "id = ?", whereArgs: [user.id]);
|
await db.update("users", user.toMap(), where: "id = ?", whereArgs: [user.id]);
|
||||||
} else {
|
} else {
|
||||||
await db.insert("users", user.toMap());
|
await db.insert("users", user.toMap());
|
||||||
@@ -43,43 +46,58 @@ class UserDatabaseStore {
|
|||||||
|
|
||||||
final Database db;
|
final Database db;
|
||||||
|
|
||||||
Future storeGrades(List<Grade> grades, {required String userId}) async {
|
Future<void> storeGrades(List<Grade> grades, {required String userId}) async {
|
||||||
String gradesJson = jsonEncode(grades.map((e) => e.json).toList());
|
String gradesJson = jsonEncode(grades.map((e) => e.json).toList());
|
||||||
await db.update("user_data", {"grades": gradesJson}, where: "id = ?", whereArgs: [userId]);
|
await db.update("user_data", {"grades": gradesJson}, where: "id = ?", whereArgs: [userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future storeLessons(List<Lesson> lessons, {required String userId}) async {
|
Future<void> storeLessons(List<Lesson> lessons, {required String userId}) async {
|
||||||
String lessonsJson = jsonEncode(lessons.map((e) => e.json).toList());
|
String lessonsJson = jsonEncode(lessons.map((e) => e.json).toList());
|
||||||
await db.update("user_data", {"timetable": lessonsJson}, where: "id = ?", whereArgs: [userId]);
|
await db.update("user_data", {"timetable": lessonsJson}, where: "id = ?", whereArgs: [userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future storeExams(List<Exam> exams, {required String userId}) async {
|
Future<void> storeExams(List<Exam> exams, {required String userId}) async {
|
||||||
String examsJson = jsonEncode(exams.map((e) => e.json).toList());
|
String examsJson = jsonEncode(exams.map((e) => e.json).toList());
|
||||||
await db.update("user_data", {"exams": examsJson}, where: "id = ?", whereArgs: [userId]);
|
await db.update("user_data", {"exams": examsJson}, where: "id = ?", whereArgs: [userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future storeHomework(List<Homework> homework, {required String userId}) async {
|
Future<void> storeHomework(List<Homework> homework, {required String userId}) async {
|
||||||
String homeworkJson = jsonEncode(homework.map((e) => e.json).toList());
|
String homeworkJson = jsonEncode(homework.map((e) => e.json).toList());
|
||||||
await db.update("user_data", {"homework": homeworkJson}, where: "id = ?", whereArgs: [userId]);
|
await db.update("user_data", {"homework": homeworkJson}, where: "id = ?", whereArgs: [userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future storeMessages(List<Message> messages, {required String userId}) async {
|
Future<void> storeMessages(List<Message> messages, {required String userId}) async {
|
||||||
String messagesJson = jsonEncode(messages.map((e) => e.json).toList());
|
String messagesJson = jsonEncode(messages.map((e) => e.json).toList());
|
||||||
await db.update("user_data", {"messages": messagesJson}, where: "id = ?", whereArgs: [userId]);
|
await db.update("user_data", {"messages": messagesJson}, where: "id = ?", whereArgs: [userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future storeNotes(List<Note> notes, {required String userId}) async {
|
Future<void> storeNotes(List<Note> notes, {required String userId}) async {
|
||||||
String notesJson = jsonEncode(notes.map((e) => e.json).toList());
|
String notesJson = jsonEncode(notes.map((e) => e.json).toList());
|
||||||
await db.update("user_data", {"notes": notesJson}, where: "id = ?", whereArgs: [userId]);
|
await db.update("user_data", {"notes": notesJson}, where: "id = ?", whereArgs: [userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future storeEvents(List<Event> events, {required String userId}) async {
|
Future<void> storeEvents(List<Event> events, {required String userId}) async {
|
||||||
String eventsJson = jsonEncode(events.map((e) => e.json).toList());
|
String eventsJson = jsonEncode(events.map((e) => e.json).toList());
|
||||||
await db.update("user_data", {"events": eventsJson}, where: "id = ?", whereArgs: [userId]);
|
await db.update("user_data", {"events": eventsJson}, where: "id = ?", whereArgs: [userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future storeAbsences(List<Absence> absences, {required String userId}) async {
|
Future<void> storeAbsences(List<Absence> absences, {required String userId}) async {
|
||||||
String absencesJson = jsonEncode(absences.map((e) => e.json).toList());
|
String absencesJson = jsonEncode(absences.map((e) => e.json).toList());
|
||||||
await db.update("user_data", {"absences": absencesJson}, where: "id = ?", whereArgs: [userId]);
|
await db.update("user_data", {"absences": absencesJson}, where: "id = ?", whereArgs: [userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> storeGroupAverages(List<GroupAverage> groupAverages, {required String userId}) async {
|
||||||
|
String groupAveragesJson = jsonEncode(groupAverages.map((e) => e.json).toList());
|
||||||
|
await db.update("user_data", {"group_averages": groupAveragesJson}, where: "id = ?", whereArgs: [userId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> storeSubjectLessonCount(SubjectLessonCount lessonCount, {required String userId}) async {
|
||||||
|
String lessonCountJson = jsonEncode(lessonCount.toMap());
|
||||||
|
await db.update("user_data", {"subject_lesson_count": lessonCountJson}, where: "id = ?", whereArgs: [userId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> storeLastSeenGrade(DateTime date, {required String userId}) async {
|
||||||
|
int lastSeenDate = date.millisecondsSinceEpoch;
|
||||||
|
await db.update("user_data", {"last_seen_grade": lastSeenDate}, where: "id = ?", whereArgs: [userId]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
class DatabaseStruct {
|
class DatabaseStruct {
|
||||||
|
final String table;
|
||||||
final Map<String, dynamic> struct;
|
final Map<String, dynamic> struct;
|
||||||
|
|
||||||
DatabaseStruct(this.struct);
|
const DatabaseStruct(this.table, this.struct);
|
||||||
|
|
||||||
String _toDBfield(String name, dynamic type) {
|
String _toDBfield(String name, dynamic type) {
|
||||||
String typeName = "";
|
String typeName = "";
|
||||||
@@ -15,7 +16,7 @@ class DatabaseStruct {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "${name} ${typeName.toUpperCase()}";
|
return "$name ${typeName.toUpperCase()} ${name == 'id' ? 'NOT NULL' : ''}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:filcnaplo/api/providers/user_provider.dart';
|
||||||
import 'package:filcnaplo/helpers/storage_helper.dart';
|
import 'package:filcnaplo/helpers/storage_helper.dart';
|
||||||
import 'package:filcnaplo_kreta_api/client/client.dart';
|
import 'package:filcnaplo_kreta_api/client/client.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/attachment.dart';
|
import 'package:filcnaplo_kreta_api/models/attachment.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/homework.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:open_file/open_file.dart';
|
import 'package:open_file/open_file.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -28,3 +32,25 @@ extension AttachmentHelper on Attachment {
|
|||||||
return result.type == ResultType.done;
|
return result.type == ResultType.done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension HomeworkAttachmentHelper on HomeworkAttachment {
|
||||||
|
Future<String> download(BuildContext context, {bool overwrite = false}) async {
|
||||||
|
String downloads = await StorageHelper.downloadsPath();
|
||||||
|
|
||||||
|
if (!overwrite && await File("$downloads/$name").exists()) return "$downloads/$name";
|
||||||
|
|
||||||
|
String url = downloadUrl(Provider.of<UserProvider>(context, listen: false).instituteCode ?? "");
|
||||||
|
Uint8List data = await Provider.of<KretaClient>(context, listen: false).getAPI(url, rawResponse: true);
|
||||||
|
if (!await StorageHelper.write("$downloads/$name", data)) return "";
|
||||||
|
|
||||||
|
return "$downloads/$name";
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> open(BuildContext context) async {
|
||||||
|
String downloads = await StorageHelper.downloadsPath();
|
||||||
|
|
||||||
|
if (!await File("$downloads/$name").exists()) await download(context);
|
||||||
|
var result = await OpenFile.open("$downloads/$name");
|
||||||
|
return result.type == ResultType.done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,19 +6,15 @@ class AverageHelper {
|
|||||||
|
|
||||||
List<String> ignoreInFinal = ["5,SzorgalomErtek", "4,MagatartasErtek"];
|
List<String> ignoreInFinal = ["5,SzorgalomErtek", "4,MagatartasErtek"];
|
||||||
|
|
||||||
if (finalAvg)
|
if (finalAvg) {
|
||||||
grades.removeWhere((e) =>
|
grades.removeWhere((e) => (e.value.value == 0) || (ignoreInFinal.contains(e.gradeType?.id)));
|
||||||
(e.value.value == 0) ||
|
}
|
||||||
(ignoreInFinal.contains(e.gradeType?.id)));
|
|
||||||
|
|
||||||
grades.forEach((e) {
|
for (var e in grades) {
|
||||||
average += e.value.value * ((finalAvg ? 100 : e.value.weight) / 100);
|
average += e.value.value * ((finalAvg ? 100 : e.value.weight) / 100);
|
||||||
});
|
}
|
||||||
|
|
||||||
average = average /
|
average = average / grades.map((e) => (finalAvg ? 100 : e.value.weight) / 100).fold(0.0, (a, b) => a + b);
|
||||||
grades
|
|
||||||
.map((e) => (finalAvg ? 100 : e.value.weight) / 100)
|
|
||||||
.fold(0.0, (a, b) => a + b);
|
|
||||||
|
|
||||||
return average.isNaN ? 0.0 : average;
|
return average.isNaN ? 0.0 : average;
|
||||||
}
|
}
|
||||||
|
|||||||
36
filcnaplo/lib/helpers/quick_actions.dart
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:quick_actions/quick_actions.dart';
|
||||||
|
import 'package:filcnaplo_mobile_ui/common/screens.i18n.dart';
|
||||||
|
|
||||||
|
const QuickActions quickActions = QuickActions();
|
||||||
|
|
||||||
|
void setupQuickActions() {
|
||||||
|
quickActions.setShortcutItems(<ShortcutItem>[
|
||||||
|
ShortcutItem(type: 'action_grades', localizedTitle: 'grades'.i18n, icon: 'ic_grades'),
|
||||||
|
ShortcutItem(type: 'action_timetable', localizedTitle: 'timetable'.i18n, icon: 'ic_timetable'),
|
||||||
|
ShortcutItem(type: 'action_messages', localizedTitle: 'messages'.i18n, icon: 'ic_messages'),
|
||||||
|
ShortcutItem(type: 'action_absences', localizedTitle: 'absences'.i18n, icon: 'ic_absences')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleQuickActions(BuildContext context, void Function(String) callback) {
|
||||||
|
quickActions.initialize((shortcutType) {
|
||||||
|
switch (shortcutType) {
|
||||||
|
case 'action_home':
|
||||||
|
callback("home");
|
||||||
|
break;
|
||||||
|
case 'action_grades':
|
||||||
|
callback("grades");
|
||||||
|
break;
|
||||||
|
case 'action_timetable':
|
||||||
|
callback("timetable");
|
||||||
|
break;
|
||||||
|
case 'action_messages':
|
||||||
|
callback("messages");
|
||||||
|
break;
|
||||||
|
case 'action_absences':
|
||||||
|
callback("absences");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import 'package:share_plus/share_plus.dart';
|
|||||||
|
|
||||||
class ShareHelper {
|
class ShareHelper {
|
||||||
static Future<void> shareText(String text, {String? subject}) => Share.share(text, subject: subject);
|
static Future<void> shareText(String text, {String? subject}) => Share.share(text, subject: subject);
|
||||||
|
// ignore: deprecated_member_use
|
||||||
static Future<void> shareFile(String path, {String? text, String? subject}) => Share.shareFiles([path], text: text, subject: subject);
|
static Future<void> shareFile(String path, {String? text, String? subject}) => Share.shareFiles([path], text: text, subject: subject);
|
||||||
|
|
||||||
static Future<void> shareAttachment(Attachment attachment, {required BuildContext context}) async {
|
static Future<void> shareAttachment(Attachment attachment, {required BuildContext context}) async {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// ignore_for_file: avoid_print
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
|||||||
144
filcnaplo/lib/helpers/subject.dart
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
import 'package:filcnaplo/icons/filc_icons.dart';
|
||||||
|
import 'package:filcnaplo/models/icon_pack.dart';
|
||||||
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
|
import 'package:filcnaplo/utils/format.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/subject.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
typedef SubjectIconVariants = Map<IconPack, IconData>;
|
||||||
|
|
||||||
|
class SubjectIconData {
|
||||||
|
final SubjectIconVariants data;
|
||||||
|
final String name; // for iOS live activities compatibilty
|
||||||
|
|
||||||
|
SubjectIconData({
|
||||||
|
this.data = const {
|
||||||
|
IconPack.material: Icons.widgets_outlined,
|
||||||
|
IconPack.cupertino: CupertinoIcons.rectangle_grid_2x2,
|
||||||
|
},
|
||||||
|
this.name = "square.grid.2x2",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
SubjectIconVariants createIcon({required IconData material, required IconData cupertino}) {
|
||||||
|
return {
|
||||||
|
IconPack.material: material,
|
||||||
|
IconPack.cupertino: cupertino,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class SubjectIcon {
|
||||||
|
static String resolveName({Subject? subject, String? subjectName}) => _resolve(subject: subject, subjectName: subjectName).name;
|
||||||
|
static IconData resolveVariant({Subject? subject, String? subjectName, required BuildContext context}) =>
|
||||||
|
_resolve(subject: subject, subjectName: subjectName).data[Provider.of<SettingsProvider>(context, listen: false).iconPack]!;
|
||||||
|
|
||||||
|
static SubjectIconData _resolve({Subject? subject, String? subjectName}) {
|
||||||
|
assert(!(subject == null && subjectName == null));
|
||||||
|
|
||||||
|
String name = (subject?.name ?? subjectName ?? "").toLowerCase().specialChars().trim();
|
||||||
|
String category = subject?.category.description.toLowerCase().specialChars() ?? "";
|
||||||
|
|
||||||
|
// todo: check for categories
|
||||||
|
if (RegExp("mate(k|matika)").hasMatch(name) || category == "matematika") {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.function, material: Icons.calculate_outlined), name: "function");
|
||||||
|
} else if (RegExp("magyar nyelv|nyelvtan").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.textformat_alt, material: Icons.spellcheck_outlined), name: "textformat.alt");
|
||||||
|
} else if (RegExp("irodalom").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.book, material: Icons.menu_book_outlined), name: "book");
|
||||||
|
} else if (RegExp("tor(i|tenelem)").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.compass, material: Icons.hourglass_empty_outlined), name: "safari");
|
||||||
|
} else if (RegExp("foldrajz").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.map, material: Icons.public_outlined), name: "map");
|
||||||
|
} else if (RegExp("rajz|muvtori|muveszet|vizualis").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.paintbrush, material: Icons.palette_outlined), name: "paintbrush");
|
||||||
|
} else if (RegExp("fizika").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.lightbulb, material: Icons.emoji_objects_outlined), name: "lightbulb");
|
||||||
|
} else if (RegExp("^enek|zene|szolfezs|zongora|korus").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.music_note, material: Icons.music_note_outlined), name: "music.note");
|
||||||
|
} else if (RegExp("^tes(i|tneveles)|sport").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.sportscourt, material: Icons.sports_soccer_outlined), name: "sportscourt");
|
||||||
|
} else if (RegExp("kemia").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.lab_flask, material: Icons.science_outlined), name: "testtube.2");
|
||||||
|
} else if (RegExp("biologia").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.paw, material: Icons.pets_outlined), name: "pawprint");
|
||||||
|
} else if (RegExp("kornyezet|termeszet ?(tudomany|ismeret)|hon( es nep)?ismeret").hasMatch(name)) {
|
||||||
|
return SubjectIconData(
|
||||||
|
data: createIcon(cupertino: CupertinoIcons.arrow_3_trianglepath, material: Icons.eco_outlined), name: "arrow.3.trianglepath");
|
||||||
|
} else if (RegExp("(hit|erkolcs)tan|vallas|etika").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.heart, material: Icons.favorite_border_outlined), name: "heart");
|
||||||
|
} else if (RegExp("penzugy").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.money_dollar, material: Icons.savings_outlined), name: "dollarsign");
|
||||||
|
} else if (RegExp("informatika|szoftver|iroda|digitalis").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.device_laptop, material: Icons.computer_outlined), name: "laptopcomputer");
|
||||||
|
} else if (RegExp("prog").hasMatch(name)) {
|
||||||
|
return SubjectIconData(
|
||||||
|
data: createIcon(cupertino: CupertinoIcons.chevron_left_slash_chevron_right, material: Icons.code_outlined),
|
||||||
|
name: "chevron.left.forwardslash.chevron.right");
|
||||||
|
} else if (RegExp("halozat").hasMatch(name)) {
|
||||||
|
return SubjectIconData(
|
||||||
|
data: createIcon(cupertino: CupertinoIcons.antenna_radiowaves_left_right, material: Icons.wifi_tethering_outlined),
|
||||||
|
name: "antenna.radiowaves.left.and.right");
|
||||||
|
} else if (RegExp("szinhaz").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.hifispeaker, material: Icons.theater_comedy_outlined), name: "hifispeaker");
|
||||||
|
} else if (RegExp("film|media").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.film, material: Icons.theaters_outlined), name: "film");
|
||||||
|
} else if (RegExp("elektro(tech)?nika").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.bolt, material: Icons.electrical_services_outlined), name: "bolt");
|
||||||
|
} else if (RegExp("gepesz|mernok|ipar").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.wrench, material: Icons.precision_manufacturing_outlined), name: "wrench");
|
||||||
|
} else if (RegExp("technika").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.hammer, material: Icons.build_outlined), name: "hammer");
|
||||||
|
} else if (RegExp("tanc").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.music_mic, material: Icons.speaker_outlined), name: "music.mic");
|
||||||
|
} else if (RegExp("filozofia").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.bubble_left, material: Icons.psychology_outlined), name: "bubble.left");
|
||||||
|
} else if (RegExp("osztaly(fonoki|kozosseg)").hasMatch(name) || name == "ofo") {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.group, material: Icons.groups_outlined), name: "person.3");
|
||||||
|
} else if (RegExp("gazdasag").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.chart_pie, material: Icons.account_balance_outlined), name: "chart.pie");
|
||||||
|
} else if (RegExp("szorgalom").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.checkmark_seal, material: Icons.verified_outlined), name: "checkmark.seal");
|
||||||
|
} else if (RegExp("magatartas").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.smiley, material: Icons.emoji_people_outlined), name: "face.smiling");
|
||||||
|
} else if (RegExp("angol|nemet|francia|olasz|orosz|spanyol|latin|kinai|nyelv").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.globe, material: Icons.translate_outlined), name: "globe");
|
||||||
|
} else if (RegExp("linux").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(material: FilcIcons.linux, cupertino: FilcIcons.linux));
|
||||||
|
}
|
||||||
|
|
||||||
|
return SubjectIconData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShortSubject {
|
||||||
|
static String resolve({Subject? subject, String? subjectName}) {
|
||||||
|
assert(!(subject == null && subjectName == null));
|
||||||
|
|
||||||
|
String name = (subject?.name ?? subjectName ?? "").toLowerCase().specialChars().trim();
|
||||||
|
// String category = subject?.category.description.toLowerCase().specialChars() ?? "";
|
||||||
|
|
||||||
|
if (RegExp("magyar irodalom").hasMatch(name)) {
|
||||||
|
return "Irodalom";
|
||||||
|
} else if (RegExp("magyar nyelv").hasMatch(name)) {
|
||||||
|
return "Nyelvtan";
|
||||||
|
} else if (RegExp("matematika").hasMatch(name)) {
|
||||||
|
return "Matek";
|
||||||
|
} else if (RegExp("digitalis kultura").hasMatch(name)) {
|
||||||
|
return "Dig. kult.";
|
||||||
|
} else if (RegExp("testneveles").hasMatch(name)) {
|
||||||
|
return "Tesi";
|
||||||
|
} else if (RegExp("tortenelem").hasMatch(name)) {
|
||||||
|
return "Töri";
|
||||||
|
} else if (RegExp("(angol|nemet|francia|olasz|orosz|spanyol|latin|kinai) nyelv").hasMatch(name)) {
|
||||||
|
return (subject?.name ?? subjectName ?? "?").replaceAll(" nyelv", "");
|
||||||
|
} else if (RegExp("informatika").hasMatch(name)) {
|
||||||
|
return "Infó";
|
||||||
|
} else if (RegExp("osztalyfonoki").hasMatch(name)) {
|
||||||
|
return "Ofő";
|
||||||
|
}
|
||||||
|
|
||||||
|
return subject?.name.capital() ?? subjectName?.capital() ?? "?";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
import 'package:filcnaplo/icons/filc_icons.dart';
|
|
||||||
import 'package:filcnaplo/utils/format.dart';
|
|
||||||
import 'package:filcnaplo_kreta_api/models/subject.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class SubjectIcon {
|
|
||||||
static IconData? lookup({Subject? subject, String? subjectName}) {
|
|
||||||
assert(!(subject == null && subjectName == null));
|
|
||||||
|
|
||||||
String name = subject?.name.toLowerCase().specialChars() ?? subjectName ?? "";
|
|
||||||
String category = subject?.category.description.toLowerCase().specialChars() ?? "";
|
|
||||||
|
|
||||||
// todo: check for categories
|
|
||||||
if (RegExp("mate(k|matika)").hasMatch(name) || category == "matematika") return Icons.calculate_outlined;
|
|
||||||
if (RegExp("magyar nyelv|nyelvtan").hasMatch(name)) return Icons.spellcheck_outlined;
|
|
||||||
if (RegExp("irodalom").hasMatch(name)) return Icons.menu_book_outlined;
|
|
||||||
if (RegExp("tor(i|tenelem)").hasMatch(name)) return Icons.hourglass_empty_outlined;
|
|
||||||
if (RegExp("foldrajz").hasMatch(name)) return Icons.public_outlined;
|
|
||||||
if (RegExp("rajz|muvtori|muveszet|kultura").hasMatch(name)) return Icons.palette_outlined;
|
|
||||||
if (RegExp("fizika").hasMatch(name)) return Icons.emoji_objects_outlined;
|
|
||||||
if (RegExp("^enek|zene|szolfezs|zongora|korus").hasMatch(name)) return Icons.music_note_outlined;
|
|
||||||
if (RegExp("^tes(i|tneveles)|sport").hasMatch(name)) return Icons.sports_soccer_outlined;
|
|
||||||
if (RegExp("kemia").hasMatch(name)) return Icons.science_outlined;
|
|
||||||
if (RegExp("biologia").hasMatch(name)) return Icons.pets_outlined;
|
|
||||||
if (RegExp("kornyezet|termeszet(tudomany|ismeret)|hon( es nep)?ismeret").hasMatch(name)) return Icons.eco_outlined;
|
|
||||||
if (RegExp("(hit|erkolcs)tan|vallas|etika").hasMatch(name)) return Icons.favorite_border_outlined;
|
|
||||||
if (RegExp("penzugy").hasMatch(name)) return Icons.savings_outlined;
|
|
||||||
if (RegExp("informatika|szoftver|iroda").hasMatch(name)) return Icons.computer_outlined;
|
|
||||||
if (RegExp("prog").hasMatch(name)) return Icons.code_outlined;
|
|
||||||
if (RegExp("halozat").hasMatch(name)) return Icons.wifi_tethering_outlined;
|
|
||||||
if (RegExp("szinhaz").hasMatch(name)) return Icons.theater_comedy_outlined;
|
|
||||||
if (RegExp("film|media").hasMatch(name)) return Icons.theaters_outlined;
|
|
||||||
if (RegExp("elektro(tech)?nika").hasMatch(name)) return Icons.electrical_services_outlined;
|
|
||||||
if (RegExp("gepesz|mernok|ipar").hasMatch(name)) return Icons.precision_manufacturing_outlined;
|
|
||||||
if (RegExp("technika").hasMatch(name)) return Icons.build_outlined;
|
|
||||||
if (RegExp("tanc").hasMatch(name)) return Icons.speaker_outlined;
|
|
||||||
if (RegExp("filozofia").hasMatch(name)) return Icons.psychology_outlined;
|
|
||||||
if (RegExp("osztaly(fonoki|kozosseg)").hasMatch(name)) return Icons.groups_outlined;
|
|
||||||
if (RegExp("gazdasag").hasMatch(name)) return Icons.account_balance_outlined;
|
|
||||||
if (RegExp("szorgalom").hasMatch(name)) return Icons.verified_outlined;
|
|
||||||
if (RegExp("magatartas").hasMatch(name)) return Icons.emoji_people_outlined;
|
|
||||||
if (RegExp("angol|nemet|francia|olasz|orosz|spanyol|latin|kinai|nyelv").hasMatch(name)) return Icons.translate_outlined;
|
|
||||||
if (RegExp("linux").hasMatch(name)) return FilcIcons.linux;
|
|
||||||
return Icons.widgets_outlined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,35 +7,40 @@ import 'package:filcnaplo/helpers/storage_helper.dart';
|
|||||||
import 'package:filcnaplo/models/release.dart';
|
import 'package:filcnaplo/models/release.dart';
|
||||||
import 'package:open_file/open_file.dart';
|
import 'package:open_file/open_file.dart';
|
||||||
|
|
||||||
enum UpdateState { prepare, downloading, installing }
|
enum UpdateState { none, preparing, downloading, installing }
|
||||||
typedef UpdateCallback = Function(double progress, UpdateState state);
|
typedef UpdateCallback = Function(double progress, UpdateState state);
|
||||||
|
|
||||||
|
// TODO: cleanup old apk files
|
||||||
|
|
||||||
extension UpdateHelper on Release {
|
extension UpdateHelper on Release {
|
||||||
Future<void> install({UpdateCallback? updateCallback}) async {
|
Future<void> install({UpdateCallback? updateCallback}) async {
|
||||||
|
updateCallback!(-1, UpdateState.preparing);
|
||||||
|
|
||||||
String downloads = await StorageHelper.downloadsPath();
|
String downloads = await StorageHelper.downloadsPath();
|
||||||
File apk = File("$downloads/filcnaplo-${version}.apk");
|
File apk = File("$downloads/filcnaplo-$version.apk");
|
||||||
|
|
||||||
if (!await apk.exists()) {
|
if (!await apk.exists()) {
|
||||||
updateCallback!(-1, UpdateState.downloading);
|
updateCallback(-1, UpdateState.downloading);
|
||||||
|
|
||||||
var bytes = await download(updateCallback: updateCallback);
|
var bytes = await download(updateCallback: updateCallback);
|
||||||
if (!await StorageHelper.write(apk.path, bytes)) throw "failed to write apk: permission denied";
|
if (!await StorageHelper.write(apk.path, bytes)) throw "failed to write apk: permission denied";
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCallback!(-1, UpdateState.installing);
|
updateCallback(-1, UpdateState.installing);
|
||||||
|
|
||||||
var result = await OpenFile.open(apk.path);
|
var result = await OpenFile.open(apk.path);
|
||||||
|
|
||||||
if (result.type != ResultType.done) {
|
if (result.type != ResultType.done) {
|
||||||
print("ERROR: installUpdate.openFile: " + result.message);
|
// ignore: avoid_print
|
||||||
|
print("ERROR: installUpdate.openFile: ${result.message}");
|
||||||
throw result.message;
|
throw result.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCallback(-1, UpdateState.prepare);
|
updateCallback(-1, UpdateState.none);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Uint8List> download({UpdateCallback? updateCallback}) async {
|
Future<Uint8List> download({UpdateCallback? updateCallback}) async {
|
||||||
var response = await FilcAPI.downloadRelease(this);
|
var response = await FilcAPI.downloadRelease(downloads.first);
|
||||||
|
|
||||||
List<List<int>> chunks = [];
|
List<List<int>> chunks = [];
|
||||||
int downloaded = 0;
|
int downloaded = 0;
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
class FilcIcons {
|
class FilcIcons {
|
||||||
static const IconData home = const FilcIconData(0x41);
|
FilcIcons._();
|
||||||
static const IconData linux = const FilcIconData(0x42);
|
|
||||||
}
|
|
||||||
|
|
||||||
class FilcIconData extends IconData {
|
static const iconFontFamily = 'FilcIcons';
|
||||||
const FilcIconData(int codePoint) : super(codePoint, fontFamily: "FilcIcons");
|
|
||||||
|
/// home
|
||||||
|
static const IconData home = IconData(0x00, fontFamily: iconFontFamily);
|
||||||
|
|
||||||
|
/// linux
|
||||||
|
static const IconData linux = IconData(0x01, fontFamily: iconFontFamily);
|
||||||
|
|
||||||
|
/// upstairs
|
||||||
|
static const IconData upstairs = IconData(0x02, fontFamily: iconFontFamily);
|
||||||
|
|
||||||
|
/// downstairs
|
||||||
|
static const IconData downstairs = IconData(0x03, fontFamily: iconFontFamily);
|
||||||
|
|
||||||
|
/// premium
|
||||||
|
static const IconData premium = IconData(0x04, fontFamily: iconFontFamily);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ import 'package:filcnaplo/api/providers/user_provider.dart';
|
|||||||
import 'package:filcnaplo/api/providers/database_provider.dart';
|
import 'package:filcnaplo/api/providers/database_provider.dart';
|
||||||
import 'package:filcnaplo/database/init.dart';
|
import 'package:filcnaplo/database/init.dart';
|
||||||
import 'package:filcnaplo/models/settings.dart';
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:filcnaplo/app.dart';
|
import 'package:filcnaplo/app.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:filcnaplo_mobile_ui/screens/error_screen.dart';
|
import 'package:filcnaplo_mobile_ui/screens/error_screen.dart';
|
||||||
|
import 'package:filcnaplo_mobile_ui/screens/error_report_screen.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
// Initalize
|
// Initalize
|
||||||
@@ -30,21 +32,34 @@ class Startup {
|
|||||||
late DatabaseProvider database;
|
late DatabaseProvider database;
|
||||||
|
|
||||||
Future<void> start() async {
|
Future<void> start() async {
|
||||||
var db = await initDB();
|
|
||||||
await db.close();
|
|
||||||
database = DatabaseProvider();
|
database = DatabaseProvider();
|
||||||
|
var db = await initDB(database);
|
||||||
|
await db.close();
|
||||||
await database.init();
|
await database.init();
|
||||||
settings = await database.query.getSettings();
|
settings = await database.query.getSettings(database);
|
||||||
user = await database.query.getUsers();
|
user = await database.query.getUsers(settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool errorShown = false;
|
||||||
|
String lastException = '';
|
||||||
|
|
||||||
Widget errorBuilder(FlutterErrorDetails details) {
|
Widget errorBuilder(FlutterErrorDetails details) {
|
||||||
return Builder(builder: (context) {
|
return Builder(builder: (context) {
|
||||||
if (Navigator.of(context).canPop()) Navigator.pop(context);
|
if (Navigator.of(context).canPop()) Navigator.pop(context);
|
||||||
|
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
Navigator.of(context, rootNavigator: true).push(MaterialPageRoute(builder: (ctx) => ErrorScreen(details)));
|
if (!errorShown && details.exceptionAsString() != lastException) {
|
||||||
|
errorShown = true;
|
||||||
|
lastException = details.exceptionAsString();
|
||||||
|
Navigator.of(context, rootNavigator: true).push(MaterialPageRoute(builder: (context) {
|
||||||
|
if (kReleaseMode) {
|
||||||
|
return ErrorReportScreen(details);
|
||||||
|
} else {
|
||||||
|
return ErrorScreen(details);
|
||||||
|
}
|
||||||
|
})).then((_) => errorShown = false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return Container();
|
return Container();
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
|
||||||
|
|
||||||
class Config {
|
class Config {
|
||||||
String _userAgent;
|
String _userAgent;
|
||||||
String? _version;
|
|
||||||
Map? json;
|
Map? json;
|
||||||
|
static const String _version = String.fromEnvironment("APPVER", defaultValue: "2.2.0");
|
||||||
|
|
||||||
Config({required String userAgent, this.json}) : _userAgent = userAgent {
|
Config({required String userAgent, this.json}) : _userAgent = userAgent;
|
||||||
PackageInfo.fromPlatform().then((value) => _version = value.version);
|
|
||||||
}
|
|
||||||
|
|
||||||
factory Config.fromJson(Map json) {
|
factory Config.fromJson(Map json) {
|
||||||
return Config(
|
return Config(
|
||||||
@@ -18,7 +14,7 @@ class Config {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String get userAgent => _userAgent.replaceAll("\$0", _version ?? "0").replaceAll("\$1", platform).replaceAll("\$2", "0");
|
String get userAgent => _userAgent.replaceAll("\$0", _version).replaceAll("\$1", platform).replaceAll("\$2", "0");
|
||||||
|
|
||||||
static String get platform {
|
static String get platform {
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
|
|||||||
1
filcnaplo/lib/models/icon_pack.dart
Normal file
@@ -0,0 +1 @@
|
|||||||
|
enum IconPack { material, cupertino }
|
||||||
@@ -1,9 +1,26 @@
|
|||||||
|
class ReleaseDownload {
|
||||||
|
String url;
|
||||||
|
int size;
|
||||||
|
|
||||||
|
ReleaseDownload({
|
||||||
|
required this.url,
|
||||||
|
required this.size,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory ReleaseDownload.fromJson(Map json) {
|
||||||
|
return ReleaseDownload(
|
||||||
|
url: json["browser_download_url"] ?? "",
|
||||||
|
size: json["size"] ?? 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Release {
|
class Release {
|
||||||
String tag;
|
String tag;
|
||||||
Version version;
|
Version version;
|
||||||
String author;
|
String author;
|
||||||
String body;
|
String body;
|
||||||
List<String> downloads;
|
List<ReleaseDownload> downloads;
|
||||||
bool prerelease;
|
bool prerelease;
|
||||||
|
|
||||||
Release({
|
Release({
|
||||||
@@ -20,7 +37,7 @@ class Release {
|
|||||||
tag: json["tag_name"] ?? Version.zero.toString(),
|
tag: json["tag_name"] ?? Version.zero.toString(),
|
||||||
author: json["author"] != null ? json["author"]["login"] ?? "" : "",
|
author: json["author"] != null ? json["author"]["login"] ?? "" : "",
|
||||||
body: json["body"] ?? "",
|
body: json["body"] ?? "",
|
||||||
downloads: json["assets"] != null ? json["assets"].map((a) => a["browser_download_url"] ?? "").toList().cast<String>() : [],
|
downloads: json["assets"] != null ? json["assets"].map((a) => ReleaseDownload.fromJson(a)).toList().cast<ReleaseDownload>() : [],
|
||||||
prerelease: json["prerelease"] ?? false,
|
prerelease: json["prerelease"] ?? false,
|
||||||
version: Version.fromString(json["tag_name"] ?? ""),
|
version: Version.fromString(json["tag_name"] ?? ""),
|
||||||
);
|
);
|
||||||
@@ -58,10 +75,11 @@ class Version {
|
|||||||
|
|
||||||
// check for valid prerelease name
|
// check for valid prerelease name
|
||||||
if (p[0] != "") {
|
if (p[0] != "") {
|
||||||
if (prereleases.contains(p[0].toLowerCase().trim()))
|
if (prereleases.contains(p[0].toLowerCase().trim())) {
|
||||||
pre = p[0];
|
pre = p[0];
|
||||||
else
|
} else {
|
||||||
throw "invalid prerelease name: ${p[0]}";
|
throw "invalid prerelease name: ${p[0]}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// core
|
// core
|
||||||
@@ -74,6 +92,7 @@ class Version {
|
|||||||
|
|
||||||
return Version(x, y, z, prerelease: pre, prever: prev);
|
return Version(x, y, z, prerelease: pre, prever: prev);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// ignore: avoid_print
|
||||||
print("WARNING: Failed to parse version ($o): $error");
|
print("WARNING: Failed to parse version ($o): $error");
|
||||||
return Version.zero;
|
return Version.zero;
|
||||||
}
|
}
|
||||||
@@ -125,5 +144,8 @@ class Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const zero = Version(0, 0, 0);
|
static const zero = Version(0, 0, 0);
|
||||||
static const List<String> prereleases = ["dev", "pre", "alpha", "beta", "rc"];
|
static const List<String> prereleases = ["dev", "pre", "alpha", "beta", "rc", "nightly", "test"];
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => toString().hashCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:filcnaplo/api/providers/database_provider.dart';
|
import 'package:filcnaplo/api/providers/database_provider.dart';
|
||||||
import 'package:filcnaplo/models/config.dart';
|
import 'package:filcnaplo/models/config.dart';
|
||||||
import 'package:filcnaplo/theme.dart';
|
import 'package:filcnaplo/models/icon_pack.dart';
|
||||||
|
import 'package:filcnaplo/theme/colors/accent.dart';
|
||||||
|
import 'package:filcnaplo/theme/colors/dark_mobile.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
enum Pages { home, grades, timetable, messages, absences }
|
enum Pages { home, grades, timetable, messages, absences }
|
||||||
|
|
||||||
enum UpdateChannel { stable, beta, dev }
|
enum UpdateChannel { stable, beta, dev }
|
||||||
|
|
||||||
enum VibrationStrength { off, light, medium, strong }
|
enum VibrationStrength { off, light, medium, strong }
|
||||||
|
|
||||||
class SettingsProvider extends ChangeNotifier {
|
class SettingsProvider extends ChangeNotifier {
|
||||||
PackageInfo? _packageInfo;
|
final DatabaseProvider? _database;
|
||||||
|
|
||||||
// en_en, hu_hu, de_de
|
// en_en, hu_hu, de_de
|
||||||
String _language;
|
String _language;
|
||||||
@@ -43,12 +47,27 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
int _notificationPollInterval;
|
int _notificationPollInterval;
|
||||||
bool _developerMode;
|
bool _developerMode;
|
||||||
VibrationStrength _vibrate;
|
VibrationStrength _vibrate;
|
||||||
bool _ABweeks;
|
bool _abWeeks;
|
||||||
bool _swapABweeks;
|
bool _swapABweeks;
|
||||||
UpdateChannel _updateChannel;
|
UpdateChannel _updateChannel;
|
||||||
Config _config;
|
Config _config;
|
||||||
|
String _xFilcId;
|
||||||
|
bool _graphClassAvg;
|
||||||
|
bool _goodStudent;
|
||||||
|
bool _presentationMode;
|
||||||
|
bool _bellDelayEnabled;
|
||||||
|
int _bellDelay;
|
||||||
|
bool _gradeOpeningFun;
|
||||||
|
IconPack _iconPack;
|
||||||
|
Color _customAccentColor;
|
||||||
|
Color _customBackgroundColor;
|
||||||
|
Color _customHighlightColor;
|
||||||
|
List<String> _premiumScopes;
|
||||||
|
String _premiumAccessToken;
|
||||||
|
String _lastAccountId;
|
||||||
|
|
||||||
SettingsProvider({
|
SettingsProvider({
|
||||||
|
DatabaseProvider? database,
|
||||||
required String language,
|
required String language,
|
||||||
required Pages startPage,
|
required Pages startPage,
|
||||||
required int rounding,
|
required int rounding,
|
||||||
@@ -62,11 +81,26 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
required bool developerMode,
|
required bool developerMode,
|
||||||
required int notificationPollInterval,
|
required int notificationPollInterval,
|
||||||
required VibrationStrength vibrate,
|
required VibrationStrength vibrate,
|
||||||
required bool ABweeks,
|
required bool abWeeks,
|
||||||
required bool swapABweeks,
|
required bool swapABweeks,
|
||||||
required UpdateChannel updateChannel,
|
required UpdateChannel updateChannel,
|
||||||
required Config config,
|
required Config config,
|
||||||
}) : _language = language,
|
required String xFilcId,
|
||||||
|
required bool graphClassAvg,
|
||||||
|
required bool goodStudent,
|
||||||
|
required bool presentationMode,
|
||||||
|
required bool bellDelayEnabled,
|
||||||
|
required int bellDelay,
|
||||||
|
required bool gradeOpeningFun,
|
||||||
|
required IconPack iconPack,
|
||||||
|
required Color customAccentColor,
|
||||||
|
required Color customBackgroundColor,
|
||||||
|
required Color customHighlightColor,
|
||||||
|
required List<String> premiumScopes,
|
||||||
|
required String premiumAccessToken,
|
||||||
|
required String lastAccountId,
|
||||||
|
}) : _database = database,
|
||||||
|
_language = language,
|
||||||
_startPage = startPage,
|
_startPage = startPage,
|
||||||
_rounding = rounding,
|
_rounding = rounding,
|
||||||
_theme = theme,
|
_theme = theme,
|
||||||
@@ -79,17 +113,36 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
_developerMode = developerMode,
|
_developerMode = developerMode,
|
||||||
_notificationPollInterval = notificationPollInterval,
|
_notificationPollInterval = notificationPollInterval,
|
||||||
_vibrate = vibrate,
|
_vibrate = vibrate,
|
||||||
_ABweeks = ABweeks,
|
_abWeeks = abWeeks,
|
||||||
_swapABweeks = swapABweeks,
|
_swapABweeks = swapABweeks,
|
||||||
_updateChannel = updateChannel,
|
_updateChannel = updateChannel,
|
||||||
_config = config {
|
_config = config,
|
||||||
PackageInfo.fromPlatform().then((PackageInfo packageInfo) {
|
_xFilcId = xFilcId,
|
||||||
_packageInfo = packageInfo;
|
_graphClassAvg = graphClassAvg,
|
||||||
});
|
_goodStudent = goodStudent,
|
||||||
}
|
_presentationMode = presentationMode,
|
||||||
|
_bellDelayEnabled = bellDelayEnabled,
|
||||||
|
_bellDelay = bellDelay,
|
||||||
|
_gradeOpeningFun = gradeOpeningFun,
|
||||||
|
_iconPack = iconPack,
|
||||||
|
_customAccentColor = customAccentColor,
|
||||||
|
_customBackgroundColor = customBackgroundColor,
|
||||||
|
_customHighlightColor = customHighlightColor,
|
||||||
|
_premiumScopes = premiumScopes,
|
||||||
|
_premiumAccessToken = premiumAccessToken,
|
||||||
|
_lastAccountId = lastAccountId;
|
||||||
|
|
||||||
|
factory SettingsProvider.fromMap(Map map, {required DatabaseProvider database}) {
|
||||||
|
Map<String, Object?>? configMap;
|
||||||
|
|
||||||
|
try {
|
||||||
|
configMap = jsonDecode(map["config"] ?? "{}");
|
||||||
|
} catch (e) {
|
||||||
|
log("[ERROR] SettingsProvider.fromMap: $e");
|
||||||
|
}
|
||||||
|
|
||||||
factory SettingsProvider.fromMap(Map map) {
|
|
||||||
return SettingsProvider(
|
return SettingsProvider(
|
||||||
|
database: database,
|
||||||
language: map["language"],
|
language: map["language"],
|
||||||
startPage: Pages.values[map["start_page"]],
|
startPage: Pages.values[map["start_page"]],
|
||||||
rounding: map["rounding"],
|
rounding: map["rounding"],
|
||||||
@@ -102,17 +155,31 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
Color(map["grade_color4"]),
|
Color(map["grade_color4"]),
|
||||||
Color(map["grade_color5"]),
|
Color(map["grade_color5"]),
|
||||||
],
|
],
|
||||||
newsEnabled: map["news"] == 1 ? true : false,
|
newsEnabled: map["news"] == 1,
|
||||||
newsState: map["news_state"],
|
newsState: map["news_state"],
|
||||||
notificationsEnabled: map["notifications"] == 1 ? true : false,
|
notificationsEnabled: map["notifications"] == 1,
|
||||||
notificationsBitfield: map["notifications_bitfield"],
|
notificationsBitfield: map["notifications_bitfield"],
|
||||||
notificationPollInterval: map["notification_poll_interval"],
|
notificationPollInterval: map["notification_poll_interval"],
|
||||||
developerMode: map["developer_mode"] == 1 ? true : false,
|
developerMode: map["developer_mode"] == 1,
|
||||||
vibrate: VibrationStrength.values[map["vibration_strength"]],
|
vibrate: VibrationStrength.values[map["vibration_strength"]],
|
||||||
ABweeks: map["ab_weeks"] == 1 ? true : false,
|
abWeeks: map["ab_weeks"] == 1,
|
||||||
swapABweeks: map["swap_ab_weeks"] == 1 ? true : false,
|
swapABweeks: map["swap_ab_weeks"] == 1,
|
||||||
updateChannel: UpdateChannel.values[map["update_channel"]],
|
updateChannel: UpdateChannel.values[map["update_channel"]],
|
||||||
config: Config.fromJson(jsonDecode(map["config"] ?? "{}")),
|
config: Config.fromJson(configMap ?? {}),
|
||||||
|
xFilcId: map["x_filc_id"],
|
||||||
|
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"]),
|
||||||
|
customBackgroundColor: Color(map["custom_background_color"]),
|
||||||
|
customHighlightColor: Color(map["custom_highlight_color"]),
|
||||||
|
premiumScopes: jsonDecode(map["premium_scopes"]).cast<String>(),
|
||||||
|
premiumAccessToken: map["premium_token"],
|
||||||
|
lastAccountId: map["last_account_id"],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,26 +202,40 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
"grade_color5": _gradeColors[4].value,
|
"grade_color5": _gradeColors[4].value,
|
||||||
"update_channel": _updateChannel.index,
|
"update_channel": _updateChannel.index,
|
||||||
"vibration_strength": _vibrate.index,
|
"vibration_strength": _vibrate.index,
|
||||||
"ab_weeks": _ABweeks ? 1 : 0,
|
"ab_weeks": _abWeeks ? 1 : 0,
|
||||||
"swap_ab_weeks": _swapABweeks ? 1 : 0,
|
"swap_ab_weeks": _swapABweeks ? 1 : 0,
|
||||||
"notification_poll_interval": _notificationPollInterval,
|
"notification_poll_interval": _notificationPollInterval,
|
||||||
"config": jsonEncode(config.json),
|
"config": jsonEncode(config.json),
|
||||||
|
"x_filc_id": _xFilcId,
|
||||||
|
"graph_class_avg": _graphClassAvg ? 1 : 0,
|
||||||
|
"presentation_mode": _presentationMode ? 1 : 0,
|
||||||
|
"bell_delay_enabled": _bellDelayEnabled ? 1 : 0,
|
||||||
|
"bell_delay": _bellDelay,
|
||||||
|
"grade_opening_fun": _gradeOpeningFun ? 1 : 0,
|
||||||
|
"icon_pack": _iconPack.name,
|
||||||
|
"custom_accent_color": _customAccentColor.value,
|
||||||
|
"custom_background_color": _customBackgroundColor.value,
|
||||||
|
"custom_highlight_color": _customHighlightColor.value,
|
||||||
|
"premium_scopes": jsonEncode(_premiumScopes),
|
||||||
|
"premium_token": _premiumAccessToken,
|
||||||
|
"last_account_id": _lastAccountId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
factory SettingsProvider.defaultSettings() {
|
factory SettingsProvider.defaultSettings({DatabaseProvider? database}) {
|
||||||
return SettingsProvider(
|
return SettingsProvider(
|
||||||
|
database: database,
|
||||||
language: "hu",
|
language: "hu",
|
||||||
startPage: Pages.home,
|
startPage: Pages.home,
|
||||||
rounding: 5,
|
rounding: 5,
|
||||||
theme: ThemeMode.system,
|
theme: ThemeMode.system,
|
||||||
accentColor: AccentColor.filc,
|
accentColor: AccentColor.filc,
|
||||||
gradeColors: [
|
gradeColors: [
|
||||||
DarkAppColors().red,
|
DarkMobileAppColors().red,
|
||||||
DarkAppColors().orange,
|
DarkMobileAppColors().orange,
|
||||||
DarkAppColors().yellow,
|
DarkMobileAppColors().yellow,
|
||||||
DarkAppColors().green,
|
DarkMobileAppColors().green,
|
||||||
DarkAppColors().filc,
|
DarkMobileAppColors().filc,
|
||||||
],
|
],
|
||||||
newsEnabled: true,
|
newsEnabled: true,
|
||||||
newsState: -1,
|
newsState: -1,
|
||||||
@@ -163,10 +244,24 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
developerMode: false,
|
developerMode: false,
|
||||||
notificationPollInterval: 1,
|
notificationPollInterval: 1,
|
||||||
vibrate: VibrationStrength.medium,
|
vibrate: VibrationStrength.medium,
|
||||||
ABweeks: false,
|
abWeeks: false,
|
||||||
swapABweeks: false,
|
swapABweeks: false,
|
||||||
updateChannel: UpdateChannel.stable,
|
updateChannel: UpdateChannel.stable,
|
||||||
config: Config.fromJson({}),
|
config: Config.fromJson({}),
|
||||||
|
xFilcId: const Uuid().v4(),
|
||||||
|
graphClassAvg: false,
|
||||||
|
goodStudent: false,
|
||||||
|
presentationMode: false,
|
||||||
|
bellDelayEnabled: false,
|
||||||
|
bellDelay: 0,
|
||||||
|
gradeOpeningFun: true,
|
||||||
|
iconPack: IconPack.cupertino,
|
||||||
|
customAccentColor: const Color(0xff20AC9B),
|
||||||
|
customBackgroundColor: const Color(0xff000000),
|
||||||
|
customHighlightColor: const Color(0xff222222),
|
||||||
|
premiumScopes: [],
|
||||||
|
premiumAccessToken: "",
|
||||||
|
lastAccountId: "",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,15 +279,27 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
bool get developerMode => _developerMode;
|
bool get developerMode => _developerMode;
|
||||||
int get notificationPollInterval => _notificationPollInterval;
|
int get notificationPollInterval => _notificationPollInterval;
|
||||||
VibrationStrength get vibrate => _vibrate;
|
VibrationStrength get vibrate => _vibrate;
|
||||||
bool get ABweeks => _ABweeks;
|
bool get abWeeks => _abWeeks;
|
||||||
bool get swapABweeks => _swapABweeks;
|
bool get swapABweeks => _swapABweeks;
|
||||||
UpdateChannel get updateChannel => _updateChannel;
|
UpdateChannel get updateChannel => _updateChannel;
|
||||||
PackageInfo? get packageInfo => _packageInfo;
|
|
||||||
Config get config => _config;
|
Config get config => _config;
|
||||||
|
String get xFilcId => _xFilcId;
|
||||||
|
bool get graphClassAvg => _graphClassAvg;
|
||||||
|
bool get goodStudent => _goodStudent;
|
||||||
|
bool get presentationMode => _presentationMode;
|
||||||
|
bool get bellDelayEnabled => _bellDelayEnabled;
|
||||||
|
int get bellDelay => _bellDelay;
|
||||||
|
bool get gradeOpeningFun => _gradeOpeningFun;
|
||||||
|
IconPack get iconPack => _iconPack;
|
||||||
|
Color? get customAccentColor => _customAccentColor == accentColorMap[AccentColor.custom] ? null : _customAccentColor;
|
||||||
|
Color? get customBackgroundColor => _customBackgroundColor;
|
||||||
|
Color? get customHighlightColor => _customHighlightColor;
|
||||||
|
List<String> get premiumScopes => _premiumScopes;
|
||||||
|
String get premiumAccessToken => _premiumAccessToken;
|
||||||
|
String get lastAccountId => _lastAccountId;
|
||||||
|
|
||||||
Future<void> update(
|
Future<void> update({
|
||||||
BuildContext context, {
|
bool store = true,
|
||||||
DatabaseProvider? database,
|
|
||||||
String? language,
|
String? language,
|
||||||
Pages? startPage,
|
Pages? startPage,
|
||||||
int? rounding,
|
int? rounding,
|
||||||
@@ -206,10 +313,24 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
bool? developerMode,
|
bool? developerMode,
|
||||||
int? notificationPollInterval,
|
int? notificationPollInterval,
|
||||||
VibrationStrength? vibrate,
|
VibrationStrength? vibrate,
|
||||||
bool? ABweeks,
|
bool? abWeeks,
|
||||||
bool? swapABweeks,
|
bool? swapABweeks,
|
||||||
UpdateChannel? updateChannel,
|
UpdateChannel? updateChannel,
|
||||||
Config? config,
|
Config? config,
|
||||||
|
String? xFilcId,
|
||||||
|
bool? graphClassAvg,
|
||||||
|
bool? goodStudent,
|
||||||
|
bool? presentationMode,
|
||||||
|
bool? bellDelayEnabled,
|
||||||
|
int? bellDelay,
|
||||||
|
bool? gradeOpeningFun,
|
||||||
|
IconPack? iconPack,
|
||||||
|
Color? customAccentColor,
|
||||||
|
Color? customBackgroundColor,
|
||||||
|
Color? customHighlightColor,
|
||||||
|
List<String>? premiumScopes,
|
||||||
|
String? premiumAccessToken,
|
||||||
|
String? lastAccountId,
|
||||||
}) async {
|
}) async {
|
||||||
if (language != null && language != _language) _language = language;
|
if (language != null && language != _language) _language = language;
|
||||||
if (startPage != null && startPage != _startPage) _startPage = startPage;
|
if (startPage != null && startPage != _startPage) _startPage = startPage;
|
||||||
@@ -222,16 +343,30 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
if (notificationsEnabled != null && notificationsEnabled != _notificationsEnabled) _notificationsEnabled = notificationsEnabled;
|
if (notificationsEnabled != null && notificationsEnabled != _notificationsEnabled) _notificationsEnabled = notificationsEnabled;
|
||||||
if (notificationsBitfield != null && notificationsBitfield != _notificationsBitfield) _notificationsBitfield = notificationsBitfield;
|
if (notificationsBitfield != null && notificationsBitfield != _notificationsBitfield) _notificationsBitfield = notificationsBitfield;
|
||||||
if (developerMode != null && developerMode != _developerMode) _developerMode = developerMode;
|
if (developerMode != null && developerMode != _developerMode) _developerMode = developerMode;
|
||||||
if (notificationPollInterval != null && notificationPollInterval != _notificationPollInterval)
|
if (notificationPollInterval != null && notificationPollInterval != _notificationPollInterval) {
|
||||||
_notificationPollInterval = notificationPollInterval;
|
_notificationPollInterval = notificationPollInterval;
|
||||||
|
}
|
||||||
if (vibrate != null && vibrate != _vibrate) _vibrate = vibrate;
|
if (vibrate != null && vibrate != _vibrate) _vibrate = vibrate;
|
||||||
if (ABweeks != null && ABweeks != _ABweeks) _ABweeks = ABweeks;
|
if (abWeeks != null && abWeeks != _abWeeks) _abWeeks = abWeeks;
|
||||||
if (swapABweeks != null && swapABweeks != _swapABweeks) _swapABweeks = swapABweeks;
|
if (swapABweeks != null && swapABweeks != _swapABweeks) _swapABweeks = swapABweeks;
|
||||||
if (updateChannel != null && updateChannel != _updateChannel) _updateChannel = updateChannel;
|
if (updateChannel != null && updateChannel != _updateChannel) _updateChannel = updateChannel;
|
||||||
if (config != null && config != _config) _config = config;
|
if (config != null && config != _config) _config = config;
|
||||||
|
if (xFilcId != null && xFilcId != _xFilcId) _xFilcId = xFilcId;
|
||||||
|
if (graphClassAvg != null && graphClassAvg != _graphClassAvg) _graphClassAvg = graphClassAvg;
|
||||||
|
if (goodStudent != null) _goodStudent = goodStudent;
|
||||||
|
if (presentationMode != null && presentationMode != _presentationMode) _presentationMode = presentationMode;
|
||||||
|
if (bellDelay != null && bellDelay != _bellDelay) _bellDelay = bellDelay;
|
||||||
|
if (bellDelayEnabled != null && bellDelayEnabled != _bellDelayEnabled) _bellDelayEnabled = bellDelayEnabled;
|
||||||
|
if (gradeOpeningFun != null && gradeOpeningFun != _gradeOpeningFun) _gradeOpeningFun = gradeOpeningFun;
|
||||||
|
if (iconPack != null && iconPack != _iconPack) _iconPack = iconPack;
|
||||||
|
if (customAccentColor != null && customAccentColor != _customAccentColor) _customAccentColor = customAccentColor;
|
||||||
|
if (customBackgroundColor != null && customBackgroundColor != _customBackgroundColor) _customBackgroundColor = customBackgroundColor;
|
||||||
|
if (customHighlightColor != null && customHighlightColor != _customHighlightColor) _customHighlightColor = customHighlightColor;
|
||||||
|
if (premiumScopes != null && premiumScopes != _premiumScopes) _premiumScopes = premiumScopes;
|
||||||
|
if (premiumAccessToken != null && premiumAccessToken != _premiumAccessToken) _premiumAccessToken = premiumAccessToken;
|
||||||
|
if (lastAccountId != null && lastAccountId != _lastAccountId) _lastAccountId = lastAccountId;
|
||||||
|
|
||||||
if (database == null) database = Provider.of<DatabaseProvider>(context, listen: false);
|
if (store) await _database?.store.storeSettings(this);
|
||||||
await database.store.storeSettings(this);
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
31
filcnaplo/lib/models/subject_lesson_count.dart
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import 'package:filcnaplo_kreta_api/models/category.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/subject.dart';
|
||||||
|
|
||||||
|
enum SubjectLessonCountUpdateState { ready, updating }
|
||||||
|
|
||||||
|
class SubjectLessonCount {
|
||||||
|
DateTime lastUpdated;
|
||||||
|
Map<Subject, int> subjects;
|
||||||
|
SubjectLessonCountUpdateState state;
|
||||||
|
|
||||||
|
SubjectLessonCount({required this.lastUpdated, required this.subjects, this.state = SubjectLessonCountUpdateState.ready});
|
||||||
|
|
||||||
|
factory SubjectLessonCount.fromMap(Map json) {
|
||||||
|
return SubjectLessonCount(
|
||||||
|
lastUpdated: DateTime.fromMillisecondsSinceEpoch(json["last_updated"] ?? 0),
|
||||||
|
subjects: ((json["subjects"] as Map?) ?? {}).map(
|
||||||
|
(key, value) => MapEntry(
|
||||||
|
Subject(id: key, name: "", category: Category.fromJson({})),
|
||||||
|
value,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map toMap() {
|
||||||
|
return {
|
||||||
|
"last_updated": lastUpdated.millisecondsSinceEpoch,
|
||||||
|
"subjects": subjects.map((key, value) => MapEntry(key.id, value)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ class Supporter {
|
|||||||
|
|
||||||
factory Supporter.fromJson(Map json) {
|
factory Supporter.fromJson(Map json) {
|
||||||
return Supporter(
|
return Supporter(
|
||||||
json["name"] ?? "",
|
(json["name"] ?? "").trim(),
|
||||||
json["amount"] ?? "",
|
json["amount"] ?? "",
|
||||||
json["platform"] ?? "",
|
json["platform"] ?? "",
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import 'package:filcnaplo_kreta_api/client/api.dart';
|
|||||||
import 'package:filcnaplo_kreta_api/models/student.dart';
|
import 'package:filcnaplo_kreta_api/models/student.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
|
enum Role { student, parent }
|
||||||
|
|
||||||
class User {
|
class User {
|
||||||
late String id;
|
late String id;
|
||||||
String username;
|
String username;
|
||||||
@@ -10,6 +12,10 @@ class User {
|
|||||||
String instituteCode;
|
String instituteCode;
|
||||||
String name;
|
String name;
|
||||||
Student student;
|
Student student;
|
||||||
|
Role role;
|
||||||
|
String nickname;
|
||||||
|
|
||||||
|
String get displayName => nickname != '' ? nickname : name;
|
||||||
|
|
||||||
User({
|
User({
|
||||||
String? id,
|
String? id,
|
||||||
@@ -18,11 +24,13 @@ class User {
|
|||||||
required this.password,
|
required this.password,
|
||||||
required this.instituteCode,
|
required this.instituteCode,
|
||||||
required this.student,
|
required this.student,
|
||||||
|
required this.role,
|
||||||
|
this.nickname = "",
|
||||||
}) {
|
}) {
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
} else {
|
} else {
|
||||||
this.id = Uuid().v4();
|
this.id = const Uuid().v4();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,8 +40,10 @@ class User {
|
|||||||
instituteCode: map["institute_code"],
|
instituteCode: map["institute_code"],
|
||||||
username: map["username"],
|
username: map["username"],
|
||||||
password: map["password"],
|
password: map["password"],
|
||||||
name: map["name"],
|
name: map["name"].trim(),
|
||||||
student: Student.fromJson(jsonDecode(map["student"])),
|
student: Student.fromJson(jsonDecode(map["student"])),
|
||||||
|
role: Role.values[map["role"] ?? 0],
|
||||||
|
nickname: map["nickname"] ?? "",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,9 +55,14 @@ class User {
|
|||||||
"institute_code": instituteCode,
|
"institute_code": instituteCode,
|
||||||
"name": name,
|
"name": name,
|
||||||
"student": jsonEncode(student.json),
|
"student": jsonEncode(student.json),
|
||||||
|
"role": role.index,
|
||||||
|
"nickname": nickname,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => jsonEncode(toMap());
|
||||||
|
|
||||||
static Map<String, Object?> loginBody({
|
static Map<String, Object?> loginBody({
|
||||||
required String username,
|
required String username,
|
||||||
required String password,
|
required String password,
|
||||||
@@ -58,7 +73,20 @@ class User {
|
|||||||
"password": password,
|
"password": password,
|
||||||
"institute_code": instituteCode,
|
"institute_code": instituteCode,
|
||||||
"grant_type": "password",
|
"grant_type": "password",
|
||||||
"client_id": KretaAPI.CLIENT_ID,
|
"client_id": KretaAPI.clientId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, Object?> refreshBody({
|
||||||
|
required String refreshToken,
|
||||||
|
required String instituteCode,
|
||||||
|
}) {
|
||||||
|
return {
|
||||||
|
"refresh_token": refreshToken,
|
||||||
|
"institute_code": instituteCode,
|
||||||
|
"client_id": KretaAPI.clientId,
|
||||||
|
"grant_type": "refresh_token",
|
||||||
|
"refresh_user_data": "false",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,145 +0,0 @@
|
|||||||
import 'package:filcnaplo/models/settings.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
class AppTheme {
|
|
||||||
// Dev note: All of these could be constant variables, but this is better for
|
|
||||||
// development (you don't have to hot-restart)
|
|
||||||
|
|
||||||
static const String _fontFamily = "Montserrat";
|
|
||||||
|
|
||||||
// Light Theme
|
|
||||||
static ThemeData lightTheme(BuildContext context) {
|
|
||||||
var lightColors = LightAppColors();
|
|
||||||
Color accent = accentColorMap[Provider.of<SettingsProvider>(context, listen: false).accentColor] ?? Color(0);
|
|
||||||
return ThemeData(
|
|
||||||
brightness: Brightness.light,
|
|
||||||
fontFamily: _fontFamily,
|
|
||||||
scaffoldBackgroundColor: lightColors.background,
|
|
||||||
backgroundColor: lightColors.highlight,
|
|
||||||
primaryColor: lightColors.filc,
|
|
||||||
dividerColor: Color(0),
|
|
||||||
colorScheme: ColorScheme.fromSwatch(
|
|
||||||
accentColor: accent,
|
|
||||||
backgroundColor: lightColors.background,
|
|
||||||
brightness: Brightness.light,
|
|
||||||
cardColor: lightColors.highlight,
|
|
||||||
errorColor: lightColors.red,
|
|
||||||
primaryColorDark: lightColors.filc,
|
|
||||||
primarySwatch: Colors.teal,
|
|
||||||
),
|
|
||||||
shadowColor: lightColors.shadow,
|
|
||||||
appBarTheme: AppBarTheme(backgroundColor: lightColors.background),
|
|
||||||
indicatorColor: accent,
|
|
||||||
iconTheme: IconThemeData(color: lightColors.text.withOpacity(.75)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dark Theme
|
|
||||||
static ThemeData darkTheme(BuildContext context) {
|
|
||||||
var darkColors = DarkAppColors();
|
|
||||||
Color accent = accentColorMap[Provider.of<SettingsProvider>(context, listen: false).accentColor] ?? Color(0);
|
|
||||||
return ThemeData(
|
|
||||||
brightness: Brightness.dark,
|
|
||||||
fontFamily: _fontFamily,
|
|
||||||
scaffoldBackgroundColor: darkColors.background,
|
|
||||||
backgroundColor: darkColors.highlight,
|
|
||||||
primaryColor: darkColors.filc,
|
|
||||||
dividerColor: Color(0),
|
|
||||||
colorScheme: ColorScheme.fromSwatch(
|
|
||||||
accentColor: accent,
|
|
||||||
backgroundColor: darkColors.background,
|
|
||||||
brightness: Brightness.dark,
|
|
||||||
cardColor: darkColors.highlight,
|
|
||||||
errorColor: darkColors.red,
|
|
||||||
primaryColorDark: darkColors.filc,
|
|
||||||
primarySwatch: Colors.teal,
|
|
||||||
),
|
|
||||||
shadowColor: darkColors.shadow,
|
|
||||||
appBarTheme: AppBarTheme(backgroundColor: darkColors.background),
|
|
||||||
indicatorColor: accent,
|
|
||||||
iconTheme: IconThemeData(color: darkColors.text.withOpacity(.75)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AppColors {
|
|
||||||
static ThemeAppColors of(BuildContext context) {
|
|
||||||
return Theme.of(context).brightness == Brightness.light ? LightAppColors() : DarkAppColors();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum AccentColor { filc, blue, green, lime, yellow, orange, red, pink, purple }
|
|
||||||
|
|
||||||
Map<AccentColor, Color> accentColorMap = {
|
|
||||||
AccentColor.filc: Color(0xff20AC9B),
|
|
||||||
AccentColor.blue: Colors.blue.shade300,
|
|
||||||
AccentColor.green: Colors.green.shade300,
|
|
||||||
AccentColor.lime: Colors.lime.shade300,
|
|
||||||
AccentColor.yellow: Colors.yellow.shade300,
|
|
||||||
AccentColor.orange: Colors.deepOrange.shade300,
|
|
||||||
AccentColor.red: Colors.red.shade300,
|
|
||||||
AccentColor.pink: Colors.pink.shade300,
|
|
||||||
AccentColor.purple: Colors.purple.shade300,
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract class ThemeAppColors {
|
|
||||||
final Color shadow = Color(0);
|
|
||||||
final Color text = Color(0);
|
|
||||||
final Color background = Color(0);
|
|
||||||
final Color highlight = Color(0);
|
|
||||||
final Color red = Color(0);
|
|
||||||
final Color orange = Color(0);
|
|
||||||
final Color yellow = Color(0);
|
|
||||||
final Color green = Color(0);
|
|
||||||
final Color filc = Color(0);
|
|
||||||
final Color teal = Color(0);
|
|
||||||
final Color blue = Color(0);
|
|
||||||
final Color indigo = Color(0);
|
|
||||||
final Color purple = Color(0);
|
|
||||||
final Color pink = Color(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
class LightAppColors implements ThemeAppColors {
|
|
||||||
final shadow = Color(0xffE8E8E8);
|
|
||||||
final text = Colors.black;
|
|
||||||
final background = Color(0xffF4F9FF);
|
|
||||||
final highlight = Color(0xffFFFFFF);
|
|
||||||
final red = Color(0xffFF3B30);
|
|
||||||
final orange = Color(0xffFF9500);
|
|
||||||
final yellow = Color(0xffFFCC00);
|
|
||||||
final green = Color(0xff34C759);
|
|
||||||
final filc = Color(0xff247665);
|
|
||||||
final teal = Color(0xff5AC8FA);
|
|
||||||
final blue = Color(0xff007AFF);
|
|
||||||
final indigo = Color(0xff5856D6);
|
|
||||||
final purple = Color(0xffAF52DE);
|
|
||||||
final pink = Color(0xffFF2D55);
|
|
||||||
}
|
|
||||||
|
|
||||||
class DarkAppColors implements ThemeAppColors {
|
|
||||||
final shadow = Color(0);
|
|
||||||
final text = Colors.white;
|
|
||||||
final background = Color(0xff000000);
|
|
||||||
final highlight = Color(0xff141516);
|
|
||||||
final red = Color(0xffFF453A);
|
|
||||||
final orange = Color(0xffFF9F0A);
|
|
||||||
final yellow = Color(0xffFFD60A);
|
|
||||||
final green = Color(0xff32D74B);
|
|
||||||
final filc = Color(0xff29826F);
|
|
||||||
final teal = Color(0xff64D2FF);
|
|
||||||
final blue = Color(0xff0A84FF);
|
|
||||||
final indigo = Color(0xff5E5CE6);
|
|
||||||
final purple = Color(0xffBF5AF2);
|
|
||||||
final pink = Color(0xffFF375F);
|
|
||||||
}
|
|
||||||
|
|
||||||
class ThemeModeObserver extends ChangeNotifier {
|
|
||||||
ThemeMode _themeMode;
|
|
||||||
ThemeMode get themeMode => _themeMode;
|
|
||||||
|
|
||||||
ThemeModeObserver({ThemeMode initialTheme = ThemeMode.system}) : _themeMode = initialTheme;
|
|
||||||
|
|
||||||
void changeTheme(ThemeMode mode) {
|
|
||||||
_themeMode = mode;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
17
filcnaplo/lib/theme/colors/accent.dart
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
enum AccentColor { filc, blue, green, lime, yellow, orange, red, pink, purple, adaptive, custom }
|
||||||
|
|
||||||
|
Map<AccentColor, Color> accentColorMap = {
|
||||||
|
AccentColor.filc: const Color(0xff20AC9B),
|
||||||
|
AccentColor.blue: Colors.blue.shade300,
|
||||||
|
AccentColor.green: Colors.green.shade400,
|
||||||
|
AccentColor.lime: Colors.lightGreen.shade400,
|
||||||
|
AccentColor.yellow: Colors.orange.shade300,
|
||||||
|
AccentColor.orange: Colors.deepOrange.shade300,
|
||||||
|
AccentColor.red: Colors.red.shade300,
|
||||||
|
AccentColor.pink: Colors.pink.shade300,
|
||||||
|
AccentColor.purple: Colors.purple.shade300,
|
||||||
|
AccentColor.adaptive: const Color(0xff20AC9B),
|
||||||
|
AccentColor.custom: const Color(0xff20AC9B),
|
||||||
|
};
|
||||||
46
filcnaplo/lib/theme/colors/colors.dart
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:filcnaplo/theme/colors/dark_desktop.dart';
|
||||||
|
import 'package:filcnaplo/theme/colors/dark_mobile.dart';
|
||||||
|
import 'package:filcnaplo/theme/colors/light_desktop.dart';
|
||||||
|
import 'package:filcnaplo/theme/colors/light_mobile.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AppColors {
|
||||||
|
static ThemeAppColors of(BuildContext context) => fromBrightness(Theme.of(context).brightness);
|
||||||
|
|
||||||
|
static fromBrightness(Brightness brightness) {
|
||||||
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
|
switch (brightness) {
|
||||||
|
case Brightness.light:
|
||||||
|
return LightMobileAppColors();
|
||||||
|
case Brightness.dark:
|
||||||
|
return DarkMobileAppColors();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (brightness) {
|
||||||
|
case Brightness.light:
|
||||||
|
return LightDesktopAppColors();
|
||||||
|
case Brightness.dark:
|
||||||
|
return DarkDesktopAppColors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class ThemeAppColors {
|
||||||
|
final Color shadow = const Color(0x00000000);
|
||||||
|
final Color text = const Color(0x00000000);
|
||||||
|
final Color background = const Color(0x00000000);
|
||||||
|
final Color highlight = const Color(0x00000000);
|
||||||
|
final Color red = const Color(0x00000000);
|
||||||
|
final Color orange = const Color(0x00000000);
|
||||||
|
final Color yellow = const Color(0x00000000);
|
||||||
|
final Color green = const Color(0x00000000);
|
||||||
|
final Color filc = const Color(0x00000000);
|
||||||
|
final Color teal = const Color(0x00000000);
|
||||||
|
final Color blue = const Color(0x00000000);
|
||||||
|
final Color indigo = const Color(0x00000000);
|
||||||
|
final Color purple = const Color(0x00000000);
|
||||||
|
final Color pink = const Color(0x00000000);
|
||||||
|
}
|
||||||
33
filcnaplo/lib/theme/colors/dark_desktop.dart
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class DarkDesktopAppColors implements ThemeAppColors {
|
||||||
|
@override
|
||||||
|
final shadow = const Color(0x00000000);
|
||||||
|
@override
|
||||||
|
final text = Colors.white;
|
||||||
|
@override
|
||||||
|
final background = const Color.fromARGB(255, 42, 42, 42);
|
||||||
|
@override
|
||||||
|
final highlight = const Color.fromARGB(255, 46, 48, 50);
|
||||||
|
@override
|
||||||
|
final red = const Color(0xffFF453A);
|
||||||
|
@override
|
||||||
|
final orange = const Color(0xffFF9F0A);
|
||||||
|
@override
|
||||||
|
final yellow = const Color(0xffFFD60A);
|
||||||
|
@override
|
||||||
|
final green = const Color(0xff32D74B);
|
||||||
|
@override
|
||||||
|
final filc = const Color(0xff29826F);
|
||||||
|
@override
|
||||||
|
final teal = const Color(0xff64D2FF);
|
||||||
|
@override
|
||||||
|
final blue = const Color(0xff0A84FF);
|
||||||
|
@override
|
||||||
|
final indigo = const Color(0xff5E5CE6);
|
||||||
|
@override
|
||||||
|
final purple = const Color(0xffBF5AF2);
|
||||||
|
@override
|
||||||
|
final pink = const Color(0xffFF375F);
|
||||||
|
}
|
||||||
33
filcnaplo/lib/theme/colors/dark_mobile.dart
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class DarkMobileAppColors implements ThemeAppColors {
|
||||||
|
@override
|
||||||
|
final shadow = const Color(0x00000000);
|
||||||
|
@override
|
||||||
|
final text = Colors.white;
|
||||||
|
@override
|
||||||
|
final background = const Color(0xff000000);
|
||||||
|
@override
|
||||||
|
final highlight = const Color(0xff141516);
|
||||||
|
@override
|
||||||
|
final red = const Color(0xffFF453A);
|
||||||
|
@override
|
||||||
|
final orange = const Color(0xffFF9F0A);
|
||||||
|
@override
|
||||||
|
final yellow = const Color(0xffFFD60A);
|
||||||
|
@override
|
||||||
|
final green = const Color(0xff32D74B);
|
||||||
|
@override
|
||||||
|
final filc = const Color(0xff29826F);
|
||||||
|
@override
|
||||||
|
final teal = const Color(0xff64D2FF);
|
||||||
|
@override
|
||||||
|
final blue = const Color(0xff0A84FF);
|
||||||
|
@override
|
||||||
|
final indigo = const Color(0xff5E5CE6);
|
||||||
|
@override
|
||||||
|
final purple = const Color(0xffBF5AF2);
|
||||||
|
@override
|
||||||
|
final pink = const Color(0xffFF375F);
|
||||||
|
}
|
||||||
33
filcnaplo/lib/theme/colors/light_desktop.dart
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class LightDesktopAppColors implements ThemeAppColors {
|
||||||
|
@override
|
||||||
|
final shadow = const Color(0xffE8E8E8);
|
||||||
|
@override
|
||||||
|
final text = Colors.black;
|
||||||
|
@override
|
||||||
|
final background = const Color(0xffF4F9FF);
|
||||||
|
@override
|
||||||
|
final highlight = const Color(0xffFFFFFF);
|
||||||
|
@override
|
||||||
|
final red = const Color(0xffFF3B30);
|
||||||
|
@override
|
||||||
|
final orange = const Color(0xffFF9500);
|
||||||
|
@override
|
||||||
|
final yellow = const Color(0xffFFCC00);
|
||||||
|
@override
|
||||||
|
final green = const Color(0xff34C759);
|
||||||
|
@override
|
||||||
|
final filc = const Color(0xff247665);
|
||||||
|
@override
|
||||||
|
final teal = const Color(0xff5AC8FA);
|
||||||
|
@override
|
||||||
|
final blue = const Color(0xff007AFF);
|
||||||
|
@override
|
||||||
|
final indigo = const Color(0xff5856D6);
|
||||||
|
@override
|
||||||
|
final purple = const Color(0xffAF52DE);
|
||||||
|
@override
|
||||||
|
final pink = const Color(0xffFF2D55);
|
||||||
|
}
|
||||||
33
filcnaplo/lib/theme/colors/light_mobile.dart
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class LightMobileAppColors implements ThemeAppColors {
|
||||||
|
@override
|
||||||
|
final shadow = const Color(0xffE8E8E8);
|
||||||
|
@override
|
||||||
|
final text = Colors.black;
|
||||||
|
@override
|
||||||
|
final background = const Color(0xffF4F9FF);
|
||||||
|
@override
|
||||||
|
final highlight = const Color(0xffFFFFFF);
|
||||||
|
@override
|
||||||
|
final red = const Color(0xffFF3B30);
|
||||||
|
@override
|
||||||
|
final orange = const Color(0xffFF9500);
|
||||||
|
@override
|
||||||
|
final yellow = const Color(0xffFFCC00);
|
||||||
|
@override
|
||||||
|
final green = const Color(0xff34C759);
|
||||||
|
@override
|
||||||
|
final filc = const Color(0xff247665);
|
||||||
|
@override
|
||||||
|
final teal = const Color(0xff5AC8FA);
|
||||||
|
@override
|
||||||
|
final blue = const Color(0xff007AFF);
|
||||||
|
@override
|
||||||
|
final indigo = const Color(0xff5856D6);
|
||||||
|
@override
|
||||||
|
final purple = const Color(0xffAF52DE);
|
||||||
|
@override
|
||||||
|
final pink = const Color(0xffFF2D55);
|
||||||
|
}
|
||||||
13
filcnaplo/lib/theme/observer.dart
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ThemeModeObserver extends ChangeNotifier {
|
||||||
|
ThemeMode _themeMode;
|
||||||
|
ThemeMode get themeMode => _themeMode;
|
||||||
|
|
||||||
|
ThemeModeObserver({ThemeMode initialTheme = ThemeMode.system}) : _themeMode = initialTheme;
|
||||||
|
|
||||||
|
void changeTheme(ThemeMode mode) {
|
||||||
|
_themeMode = mode;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
138
filcnaplo/lib/theme/theme.dart
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
|
import 'package:filcnaplo/theme/colors/accent.dart';
|
||||||
|
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:material_color_utilities/material_color_utilities.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class AppTheme {
|
||||||
|
// Dev note: All of these could be constant variables, but this is better for
|
||||||
|
// development (you don't have to hot-restart)
|
||||||
|
|
||||||
|
static const String _fontFamily = "Montserrat";
|
||||||
|
|
||||||
|
static Color? _paletteAccentLight(CorePalette? palette) => palette != null ? Color(palette.primary.get(70)) : null;
|
||||||
|
static Color? _paletteHighlightLight(CorePalette? palette) => palette != null ? Color(palette.neutral.get(100)) : null;
|
||||||
|
static Color? _paletteBackgroundLight(CorePalette? palette) => palette != null ? Color(palette.neutral.get(95)) : null;
|
||||||
|
|
||||||
|
static Color? _paletteAccentDark(CorePalette? palette) => palette != null ? Color(palette.primary.get(80)) : null;
|
||||||
|
static Color? _paletteBackgroundDark(CorePalette? palette) => palette != null ? Color(palette.neutralVariant.get(10)) : null;
|
||||||
|
static Color? _paletteHighlightDark(CorePalette? palette) => palette != null ? Color(palette.neutralVariant.get(20)) : null;
|
||||||
|
|
||||||
|
// Light Theme
|
||||||
|
static ThemeData lightTheme(BuildContext context, {CorePalette? palette}) {
|
||||||
|
var lightColors = AppColors.fromBrightness(Brightness.light);
|
||||||
|
final settings = Provider.of<SettingsProvider>(context, listen: false);
|
||||||
|
AccentColor accentColor = settings.accentColor;
|
||||||
|
final customAccentColor = accentColor == AccentColor.custom ? settings.customAccentColor : null;
|
||||||
|
Color accent = customAccentColor ?? accentColorMap[accentColor] ?? const Color(0x00000000);
|
||||||
|
|
||||||
|
if (accentColor == AccentColor.adaptive) {
|
||||||
|
if (palette != null) accent = _paletteAccentLight(palette)!;
|
||||||
|
} else {
|
||||||
|
palette = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Color backgroundColor =
|
||||||
|
accentColor == AccentColor.custom ? settings.customBackgroundColor : _paletteBackgroundLight(palette) ?? lightColors.background;
|
||||||
|
Color highlighColor =
|
||||||
|
accentColor == AccentColor.custom ? settings.customHighlightColor : _paletteHighlightLight(palette) ?? lightColors.highlight;
|
||||||
|
|
||||||
|
return ThemeData(
|
||||||
|
brightness: Brightness.light,
|
||||||
|
useMaterial3: false,
|
||||||
|
fontFamily: _fontFamily,
|
||||||
|
scaffoldBackgroundColor: backgroundColor,
|
||||||
|
backgroundColor: highlighColor,
|
||||||
|
primaryColor: lightColors.filc,
|
||||||
|
dividerColor: const Color(0x00000000),
|
||||||
|
colorScheme: ColorScheme.fromSwatch(
|
||||||
|
accentColor: accent,
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
brightness: Brightness.light,
|
||||||
|
cardColor: highlighColor,
|
||||||
|
errorColor: lightColors.red,
|
||||||
|
primaryColorDark: lightColors.filc,
|
||||||
|
),
|
||||||
|
shadowColor: highlighColor.withOpacity(.5), //lightColors.shadow,
|
||||||
|
appBarTheme: AppBarTheme(backgroundColor: backgroundColor),
|
||||||
|
indicatorColor: accent,
|
||||||
|
iconTheme: IconThemeData(color: lightColors.text.withOpacity(.75)),
|
||||||
|
navigationBarTheme: NavigationBarThemeData(
|
||||||
|
indicatorColor: accent.withOpacity(accentColor == AccentColor.adaptive ? 0.4 : 0.8),
|
||||||
|
iconTheme: MaterialStateProperty.all(IconThemeData(color: lightColors.text)),
|
||||||
|
backgroundColor: highlighColor,
|
||||||
|
labelTextStyle: MaterialStateProperty.all(TextStyle(
|
||||||
|
fontSize: 13.0,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: lightColors.text.withOpacity(0.8),
|
||||||
|
)),
|
||||||
|
labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
|
||||||
|
height: 76.0,
|
||||||
|
),
|
||||||
|
sliderTheme: SliderThemeData(
|
||||||
|
inactiveTrackColor: accent.withOpacity(.3),
|
||||||
|
),
|
||||||
|
progressIndicatorTheme: ProgressIndicatorThemeData(color: accent),
|
||||||
|
expansionTileTheme: ExpansionTileThemeData(iconColor: accent),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dark Theme
|
||||||
|
static ThemeData darkTheme(BuildContext context, {CorePalette? palette}) {
|
||||||
|
var darkColors = AppColors.fromBrightness(Brightness.dark);
|
||||||
|
final settings = Provider.of<SettingsProvider>(context, listen: false);
|
||||||
|
AccentColor accentColor = settings.accentColor;
|
||||||
|
final customAccentColor = accentColor == AccentColor.custom ? settings.customAccentColor : null;
|
||||||
|
Color accent = customAccentColor ?? accentColorMap[accentColor] ?? const Color(0x00000000);
|
||||||
|
|
||||||
|
if (accentColor == AccentColor.adaptive) {
|
||||||
|
if (palette != null) accent = _paletteAccentDark(palette)!;
|
||||||
|
} else {
|
||||||
|
palette = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Color backgroundColor =
|
||||||
|
accentColor == AccentColor.custom ? settings.customBackgroundColor : _paletteBackgroundDark(palette) ?? darkColors.background;
|
||||||
|
Color highlightColor = accentColor == AccentColor.custom ? settings.customHighlightColor : _paletteHighlightDark(palette) ?? darkColors.highlight;
|
||||||
|
|
||||||
|
return ThemeData(
|
||||||
|
brightness: Brightness.dark,
|
||||||
|
useMaterial3: false,
|
||||||
|
fontFamily: _fontFamily,
|
||||||
|
scaffoldBackgroundColor: backgroundColor,
|
||||||
|
backgroundColor: highlightColor,
|
||||||
|
primaryColor: darkColors.filc,
|
||||||
|
dividerColor: const Color(0x00000000),
|
||||||
|
colorScheme: ColorScheme.fromSwatch(
|
||||||
|
accentColor: accent,
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
brightness: Brightness.dark,
|
||||||
|
cardColor: highlightColor,
|
||||||
|
errorColor: darkColors.red,
|
||||||
|
primaryColorDark: darkColors.filc,
|
||||||
|
),
|
||||||
|
shadowColor: highlightColor.withOpacity(.5), //darkColors.shadow,
|
||||||
|
appBarTheme: AppBarTheme(backgroundColor: backgroundColor),
|
||||||
|
indicatorColor: accent,
|
||||||
|
iconTheme: IconThemeData(color: darkColors.text.withOpacity(.75)),
|
||||||
|
navigationBarTheme: NavigationBarThemeData(
|
||||||
|
indicatorColor: accent.withOpacity(accentColor == AccentColor.adaptive ? 0.4 : 0.8),
|
||||||
|
iconTheme: MaterialStateProperty.all(IconThemeData(color: darkColors.text)),
|
||||||
|
backgroundColor: highlightColor,
|
||||||
|
labelTextStyle: MaterialStateProperty.all(TextStyle(
|
||||||
|
fontSize: 13.0,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: darkColors.text.withOpacity(0.8),
|
||||||
|
)),
|
||||||
|
labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
|
||||||
|
height: 76.0,
|
||||||
|
),
|
||||||
|
sliderTheme: SliderThemeData(
|
||||||
|
inactiveTrackColor: accent.withOpacity(.3),
|
||||||
|
),
|
||||||
|
progressIndicatorTheme: ProgressIndicatorThemeData(color: accent),
|
||||||
|
expansionTileTheme: ExpansionTileThemeData(iconColor: accent),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
8
filcnaplo/lib/ui/date_widget.dart
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
|
class DateWidget {
|
||||||
|
final DateTime date;
|
||||||
|
final Widget widget;
|
||||||
|
final String? key;
|
||||||
|
const DateWidget({required this.date, required this.widget, this.key});
|
||||||
|
}
|
||||||
159
filcnaplo/lib/ui/filter/sort.dart
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||||
|
import 'package:filcnaplo/ui/date_widget.dart';
|
||||||
|
import 'package:filcnaplo/ui/filter/widgets.dart';
|
||||||
|
import 'package:filcnaplo/ui/widgets/message/message_tile.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/message.dart';
|
||||||
|
import 'package:filcnaplo_mobile_ui/common/panel/panel.dart';
|
||||||
|
import 'package:filcnaplo_mobile_ui/common/widgets/absence/absence_viewable.dart';
|
||||||
|
import 'package:filcnaplo_mobile_ui/common/widgets/absence_group/absence_group_tile.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:implicitly_animated_reorderable_list/implicitly_animated_reorderable_list.dart';
|
||||||
|
import 'package:filcnaplo_mobile_ui/common/widgets/lesson/changed_lesson_tile.dart';
|
||||||
|
import 'package:filcnaplo/utils/format.dart';
|
||||||
|
|
||||||
|
// difference.inDays is not reliable
|
||||||
|
bool _sameDate(DateTime a, DateTime b) => (a.year == b.year && a.month == b.month && a.day == b.day);
|
||||||
|
|
||||||
|
List<Widget> sortDateWidgets(
|
||||||
|
BuildContext context, {
|
||||||
|
required List<DateWidget> dateWidgets,
|
||||||
|
bool showTitle = true,
|
||||||
|
bool showDivider = false,
|
||||||
|
bool hasShadow = false,
|
||||||
|
EdgeInsetsGeometry? padding,
|
||||||
|
}) {
|
||||||
|
dateWidgets.sort((a, b) => -a.date.compareTo(b.date));
|
||||||
|
|
||||||
|
List<Conversation> conversations = [];
|
||||||
|
List<DateWidget> convMessages = [];
|
||||||
|
|
||||||
|
// Group messages into conversations
|
||||||
|
for (var w in dateWidgets) {
|
||||||
|
if (w.widget.runtimeType == MessageTile) {
|
||||||
|
Message message = (w.widget as MessageTile).message;
|
||||||
|
|
||||||
|
if (message.conversationId != null) {
|
||||||
|
convMessages.add(w);
|
||||||
|
|
||||||
|
Conversation conv = conversations.firstWhere((e) => e.id == message.conversationId, orElse: () => Conversation(id: message.conversationId!));
|
||||||
|
conv.add(message);
|
||||||
|
if (conv.messages.length == 1) conversations.add(conv);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (conversations.any((c) => c.id == message.messageId)) {
|
||||||
|
Conversation conv = conversations.firstWhere((e) => e.id == message.messageId);
|
||||||
|
convMessages.add(w);
|
||||||
|
conv.add(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove individual messages
|
||||||
|
for (var e in convMessages) {
|
||||||
|
dateWidgets.remove(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add conversations
|
||||||
|
for (var conv in conversations) {
|
||||||
|
conv.sort();
|
||||||
|
|
||||||
|
dateWidgets.add(DateWidget(
|
||||||
|
key: "${conv.newest.date.millisecondsSinceEpoch}-msg",
|
||||||
|
date: conv.newest.date,
|
||||||
|
widget: MessageTile(
|
||||||
|
conv.newest,
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
dateWidgets.sort((a, b) => -a.date.compareTo(b.date));
|
||||||
|
|
||||||
|
List<List<DateWidget>> groupedDateWidgets = [[]];
|
||||||
|
for (var element in dateWidgets) {
|
||||||
|
if (groupedDateWidgets.last.isNotEmpty) {
|
||||||
|
if (!_sameDate(element.date, groupedDateWidgets.last.last.date)) {
|
||||||
|
groupedDateWidgets.add([element]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
groupedDateWidgets.last.add(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DateWidget> items = [];
|
||||||
|
|
||||||
|
if (groupedDateWidgets.first.isNotEmpty) {
|
||||||
|
for (var elements in groupedDateWidgets) {
|
||||||
|
bool cst = showTitle;
|
||||||
|
|
||||||
|
// Group Absence Tiles
|
||||||
|
List<DateWidget> absenceTileWidgets = elements.where((element) {
|
||||||
|
return element.widget is AbsenceViewable && (element.widget as AbsenceViewable).absence.delay == 0;
|
||||||
|
}).toList();
|
||||||
|
List<AbsenceViewable> absenceTiles = absenceTileWidgets.map((e) => e.widget as AbsenceViewable).toList();
|
||||||
|
if (absenceTiles.length > 1) {
|
||||||
|
elements.removeWhere((element) => element.widget.runtimeType == AbsenceViewable && (element.widget as AbsenceViewable).absence.delay == 0);
|
||||||
|
if (elements.isEmpty) {
|
||||||
|
cst = false;
|
||||||
|
}
|
||||||
|
elements.add(DateWidget(
|
||||||
|
widget: AbsenceGroupTile(absenceTiles, showDate: !cst),
|
||||||
|
date: absenceTileWidgets.first.date,
|
||||||
|
key: "${absenceTileWidgets.first.date.millisecondsSinceEpoch}-absence-group"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bring Lesson Tiles to front & sort by index asc
|
||||||
|
List<DateWidget> lessonTiles = elements.where((element) {
|
||||||
|
return element.widget.runtimeType == ChangedLessonTile;
|
||||||
|
}).toList();
|
||||||
|
lessonTiles.sort((a, b) => (a.widget as ChangedLessonTile).lesson.lessonIndex.compareTo((b.widget as ChangedLessonTile).lesson.lessonIndex));
|
||||||
|
elements.removeWhere((element) => element.widget.runtimeType == ChangedLessonTile);
|
||||||
|
elements.insertAll(0, lessonTiles);
|
||||||
|
|
||||||
|
final date = (elements + absenceTileWidgets).first.date;
|
||||||
|
items.add(DateWidget(
|
||||||
|
date: date,
|
||||||
|
widget: Panel(
|
||||||
|
key: ValueKey(date),
|
||||||
|
padding: padding ?? const EdgeInsets.symmetric(vertical: 6.0),
|
||||||
|
title: cst ? Text(date.format(context, forceToday: true)) : null,
|
||||||
|
hasShadow: hasShadow,
|
||||||
|
child: ImplicitlyAnimatedList<DateWidget>(
|
||||||
|
areItemsTheSame: (a, b) => a.key == b.key,
|
||||||
|
spawnIsolate: false,
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
itemBuilder: (context, animation, item, index) => filterItemBuilder(context, animation, item.widget, index),
|
||||||
|
items: elements,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final nh = DateTime.now();
|
||||||
|
final now = DateTime(nh.year, nh.month, nh.day).subtract(const Duration(seconds: 1));
|
||||||
|
|
||||||
|
if (showDivider && items.any((i) => i.date.isBefore(now)) && items.any((i) => i.date.isAfter(now))) {
|
||||||
|
items.add(
|
||||||
|
DateWidget(
|
||||||
|
date: now,
|
||||||
|
widget: Center(
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 12.0),
|
||||||
|
height: 3.0,
|
||||||
|
width: 150.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12.0),
|
||||||
|
color: AppColors.of(context).text.withOpacity(.25),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort future dates asc, past dates desc
|
||||||
|
items.sort((a, b) => (a.date.isAfter(now) && b.date.isAfter(now) ? 1 : -1) * a.date.compareTo(b.date));
|
||||||
|
|
||||||
|
return items.map((e) => e.widget).toList();
|
||||||
|
}
|
||||||