Compare commits
296 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acbffd6d72 | ||
|
|
b19da9cb66 | ||
|
|
fd80aec51f | ||
|
|
5776622276 | ||
|
|
69ea3e1a7f | ||
|
|
3d451f6f91 | ||
|
|
387e2e46db | ||
|
|
a7f1681902 | ||
|
|
4b127bdf56 | ||
|
|
dbb6125ab5 | ||
|
|
b6d4ac6168 | ||
|
|
9d20d08838 | ||
|
|
f39ac80770 | ||
|
|
41991b3b66 | ||
|
|
53ec3e567a | ||
|
|
176608bfc5 | ||
|
|
92b4094550 | ||
|
|
45c6fccb89 | ||
|
|
014329d7fe | ||
|
|
dca01d0ed0 | ||
|
|
493adaa5f2 | ||
|
|
8451983163 | ||
|
|
2b7e143812 | ||
|
|
9845a35c6e | ||
|
|
b92ac9ffbc | ||
|
|
f435f31523 | ||
|
|
6abc61db7b | ||
|
|
cd8ab8bfdb | ||
|
|
24a6393aca | ||
|
|
64fb22de74 | ||
|
|
14ce4c82fb | ||
|
|
7d1f4e992c | ||
|
|
17b8b96767 | ||
|
|
7ac5d64d19 | ||
|
|
d9bd555e6a | ||
|
|
b5bf994b8d | ||
|
|
8b216bd27b | ||
|
|
a9bd11a4d7 | ||
|
|
129a95f359 | ||
|
|
8b65d4d519 | ||
|
|
353297bc90 | ||
|
|
63d24f7e89 | ||
|
|
4b93c891c8 | ||
|
|
6f85a4ebc1 | ||
|
|
b37af9f5a5 | ||
|
|
3a26fd9ec9 | ||
|
|
9cda8c5d29 | ||
|
|
6212489001 | ||
|
|
b4ff2fa815 | ||
|
|
a11ebce6fb | ||
|
|
fa75c1ec06 | ||
|
|
79677d657e | ||
|
|
50d1803a18 | ||
|
|
34f9929b16 | ||
|
|
7b517b333a | ||
|
|
d1a9625d93 | ||
|
|
056bf7ab58 | ||
|
|
c4dc03f41d | ||
|
|
6d7a21dc02 | ||
|
|
9406efee8d | ||
|
|
151e97b243 | ||
|
|
1ba0f4d8d3 | ||
|
|
4b8dbf0691 | ||
|
|
98d7468f24 | ||
|
|
fa46d6cbd3 | ||
|
|
a0c68a4e5a | ||
|
|
f2f35b2fbd | ||
|
|
a782dbd22f | ||
|
|
c9da66d38f | ||
|
|
dc93985834 | ||
|
|
3e487ba22a | ||
|
|
6293bb4017 | ||
|
|
03a5057269 | ||
|
|
4a15514ba0 | ||
|
|
bb2853d857 | ||
|
|
be84935ac3 | ||
|
|
19691a1dc0 | ||
|
|
5c6e54864d | ||
|
|
dda1ae23c9 | ||
|
|
f08c691b25 | ||
|
|
0340406bd8 | ||
|
|
32fb702872 | ||
|
|
b510dbd0ec | ||
|
|
e7f8dd6d80 | ||
|
|
f985889811 | ||
|
|
eb20fc1457 | ||
|
|
67721112cc | ||
|
|
070e3cf18c | ||
|
|
991097fa34 | ||
|
|
c4e87f66e6 | ||
|
|
8d01653714 | ||
|
|
db7b126bda | ||
|
|
023329f021 | ||
|
|
e66fdbaeac | ||
|
|
bbbaea9224 | ||
|
|
c7c18cf684 | ||
|
|
4d501fed3e | ||
|
|
8168ef5329 | ||
|
|
608bc58771 | ||
|
|
2cba1ec286 | ||
|
|
b6eb65814f | ||
|
|
a5a43ea0b9 | ||
|
|
da356bb212 | ||
|
|
c29ab3de29 | ||
|
|
fceb4e050f | ||
|
|
8feea02f68 | ||
|
|
939e4f4d48 | ||
|
|
a401ff32d9 | ||
|
|
84e7fc60c2 | ||
|
|
6821887263 | ||
|
|
8f8ceb0597 | ||
|
|
deb2403c23 | ||
|
|
d65c722ef0 | ||
|
|
1bdc1409e4 | ||
|
|
467eca6c14 | ||
|
|
da3abb7fb7 | ||
|
|
a8a818225e | ||
|
|
5e650869f2 | ||
|
|
6e06d82b1a | ||
|
|
79370f6a02 | ||
|
|
d0dee1002d | ||
|
|
7517fd976a | ||
|
|
ac9e3e9ff3 | ||
|
|
a8dce30022 | ||
|
|
dac2e6e52e | ||
|
|
b7c3534751 | ||
|
|
2c04b7ca7c | ||
|
|
4a43f1607c | ||
|
|
fef0857050 | ||
|
|
9078634fb7 | ||
|
|
e71c56a146 | ||
|
|
8f85116353 | ||
|
|
1d6b9dd5d8 | ||
|
|
2bd534fde9 | ||
|
|
c05b358b49 | ||
|
|
91255182d2 | ||
|
|
5052f57ee6 | ||
|
|
d651f6acf0 | ||
|
|
ea2b91ca15 | ||
|
|
e280227ee1 | ||
|
|
bc4e4e9b5a | ||
|
|
e732b36cb8 | ||
|
|
894f370dad | ||
|
|
ec04a0ff81 | ||
|
|
b4be0f66dc | ||
|
|
8bfbaee1f5 | ||
|
|
458cfdd8a7 | ||
|
|
2406e9a45d | ||
|
|
d952b23b85 | ||
|
|
0245ddb99e | ||
|
|
40dd967903 | ||
|
|
d524d452bd | ||
|
|
0ac0586fba | ||
|
|
3e470981a8 | ||
|
|
09e416ab74 | ||
|
|
1314b2f068 | ||
|
|
4b70b6e035 | ||
|
|
856b48675b | ||
|
|
534a223cbf | ||
|
|
625c43d786 | ||
|
|
d1f79a63a1 | ||
|
|
f4bf509fa7 | ||
|
|
8ff4f0b88f | ||
|
|
ee2a42bbe2 | ||
|
|
bc1ec45855 | ||
|
|
6d4939d88a | ||
|
|
f7d263570d | ||
|
|
1ea0f95863 | ||
|
|
6003f6fd2a | ||
|
|
ded029e4cb | ||
|
|
e64ab75753 | ||
|
|
2d11c45972 | ||
|
|
63e5ccb7c3 | ||
|
|
568d4cb769 | ||
|
|
88297cc181 | ||
|
|
e5ed6c33ed | ||
|
|
1e7fbfd0a4 | ||
|
|
87cd1a40f4 | ||
|
|
0d7d6738df | ||
|
|
c3dd4a3b7e | ||
|
|
76b2492ba8 | ||
|
|
758bcda581 | ||
|
|
520d2f2ce0 | ||
|
|
8855dc4820 | ||
|
|
6fda457bbb | ||
|
|
360426d851 | ||
|
|
bad9ed000b | ||
|
|
18b1b00f45 | ||
|
|
7bd5653a5f | ||
|
|
fb4e0f644a | ||
|
|
7766832d5f | ||
|
|
11ae42cb03 | ||
|
|
de6ddb42ae | ||
|
|
c100a032d6 | ||
|
|
6b8eb120f0 | ||
|
|
b9b79fdde2 | ||
|
|
40ca5fe0a1 | ||
|
|
e183c17c9f | ||
|
|
d2003893e8 | ||
|
|
22cd08165b | ||
|
|
1f62a71cd5 | ||
|
|
93fab8196d | ||
|
|
5523a2a919 | ||
|
|
d79045e47f | ||
|
|
cffd93bfe6 | ||
|
|
d2c762d29a | ||
|
|
9d9f99a955 | ||
|
|
2c5939fab4 | ||
|
|
95ed503e53 | ||
|
|
51e2c63134 | ||
|
|
50bc03f403 | ||
|
|
f5bc16ba42 | ||
|
|
f4501ce251 | ||
|
|
3317472773 | ||
|
|
acdd47a49a | ||
|
|
fa8be89aaf | ||
|
|
5034af2fb4 | ||
|
|
87842de421 | ||
|
|
1f46a0509f | ||
|
|
8e9713e436 | ||
|
|
fe0a7d81ae | ||
|
|
f9e14349b7 | ||
|
|
a1f087758f | ||
|
|
4068abdb95 | ||
|
|
9314c613bc | ||
|
|
458e93e19f | ||
|
|
ba8d26d250 | ||
|
|
33e3495d9f | ||
|
|
f71e72e443 | ||
|
|
c615a33bd2 | ||
|
|
7ad0ea26e2 | ||
|
|
0ad663beb3 | ||
|
|
1366984c15 | ||
|
|
62d3895373 | ||
|
|
3579c4e821 | ||
|
|
5c39865d40 | ||
|
|
551b2849fe | ||
|
|
633601a0f3 | ||
|
|
ce1c5eb0d8 | ||
|
|
d929c804df | ||
|
|
19c128eecd | ||
|
|
57cf764804 | ||
|
|
ea812e0b67 | ||
|
|
1c517a99f2 | ||
|
|
2687cb146b | ||
|
|
1a9080dcc2 | ||
|
|
580c92b13d | ||
|
|
ae4c4aa89c | ||
|
|
ded7c51f44 | ||
|
|
485e85ddaa | ||
|
|
3c0082a786 | ||
|
|
c474512088 | ||
|
|
f78a542be2 | ||
|
|
131454b99d | ||
|
|
e255182b93 | ||
|
|
3857896d6c | ||
|
|
301e8cb638 | ||
|
|
ae7c724f65 | ||
|
|
751cd04ce2 | ||
|
|
a88ccfa3fc | ||
|
|
9e914974b7 | ||
|
|
9cfa8296b8 | ||
|
|
27ef942723 | ||
|
|
fe03554fbf | ||
|
|
8c2227df73 | ||
|
|
0274c2f070 | ||
|
|
8f85c6a33b | ||
|
|
cf81ca8207 | ||
|
|
07bbafe7dd | ||
|
|
3eee2c7a55 | ||
|
|
1cdde3b6ce | ||
|
|
67aea46c06 | ||
|
|
7adec7dfa5 | ||
|
|
95fa819ed2 | ||
|
|
1e87d344e2 | ||
|
|
9223375304 | ||
|
|
bb862f15bd | ||
|
|
261c94e9bb | ||
|
|
06016514e5 | ||
|
|
cead24b65a | ||
|
|
6eaab57468 | ||
|
|
5852fc233d | ||
|
|
d7e21f6332 | ||
|
|
c78b8d3b97 | ||
|
|
940e3d8ca1 | ||
|
|
e31d0753d1 | ||
|
|
526c66f358 | ||
|
|
d6833a952d | ||
|
|
4760761bb7 | ||
|
|
a33e6dae3b | ||
|
|
d393181f10 | ||
|
|
12df8b82c7 | ||
|
|
1c7eba7af3 | ||
|
|
d39cdaef10 | ||
|
|
cc40fb9c0f | ||
|
|
85c6d548ad |
18
.gitignore
vendored
@@ -1,5 +1,7 @@
|
|||||||
# See https://www.dartlang.org/guides/libraries/private-files
|
# See https://www.dartlang.org/guides/libraries/private-files
|
||||||
|
|
||||||
|
.gitignore
|
||||||
|
|
||||||
termek.txt
|
termek.txt
|
||||||
.DS_Store
|
.DS_Store
|
||||||
filc3.properties
|
filc3.properties
|
||||||
@@ -25,9 +27,6 @@ doc/api/
|
|||||||
*.js.map
|
*.js.map
|
||||||
|
|
||||||
*.txt
|
*.txt
|
||||||
filcnaplo/linux/flutter/generated_plugin_registrant.cc
|
|
||||||
filcnaplo/linux/flutter/generated_plugin_registrant.h
|
|
||||||
filcnaplo/linux/flutter/generated_plugins.cmake
|
|
||||||
filcnaplo/macos/Flutter/GeneratedPluginRegistrant.swift
|
filcnaplo/macos/Flutter/GeneratedPluginRegistrant.swift
|
||||||
filcnaplo/windows/flutter/ephemeral/.plugin_symlinks/connectivity_plus
|
filcnaplo/windows/flutter/ephemeral/.plugin_symlinks/connectivity_plus
|
||||||
filcnaplo/windows/flutter/ephemeral/.plugin_symlinks/dynamic_color
|
filcnaplo/windows/flutter/ephemeral/.plugin_symlinks/dynamic_color
|
||||||
@@ -43,10 +42,11 @@ filcnaplo/windows/flutter/generated_plugins.cmake
|
|||||||
filcnaplo/linux/flutter/generated_plugin_registrant.cc
|
filcnaplo/linux/flutter/generated_plugin_registrant.cc
|
||||||
filcnaplo/linux/flutter/generated_plugin_registrant.h
|
filcnaplo/linux/flutter/generated_plugin_registrant.h
|
||||||
filcnaplo/linux/flutter/generated_plugins.cmake
|
filcnaplo/linux/flutter/generated_plugins.cmake
|
||||||
filcnaplo/macos/Flutter/GeneratedPluginRegistrant.swift
|
filcnaplo/macos/Flutter/*
|
||||||
filcnaplo/linux/flutter/generated_plugin_registrant.cc
|
filcnaplo/ios/Podfile.lock
|
||||||
filcnaplo/linux/flutter/generated_plugin_registrant.h
|
|
||||||
filcnaplo/linux/flutter/generated_plugins.cmake
|
|
||||||
filcnaplo/macos/Flutter/GeneratedPluginRegistrant.swift
|
|
||||||
.vscode/
|
.vscode/
|
||||||
|
key.properties
|
||||||
|
|
||||||
|
.flutter-plugins*
|
||||||
|
filcnaplo/ios/Flutter/flutter_export_environment 4.sh
|
||||||
|
filcnaplo/ios/Flutter/Generated 4.xcconfig
|
||||||
|
|||||||
1286
.idea/libraries/Dart_Packages.xml
generated
Normal file
27
.idea/libraries/Dart_SDK.xml
generated
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Dart SDK">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/async" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/cli" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/collection" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/convert" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/core" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/developer" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/ffi" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/html" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/indexed_db" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/io" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/isolate" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/js" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/js_util" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/math" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/mirrors" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/svg" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/typed_data" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/web_audio" />
|
||||||
|
<root url="file:///opt/flutter/bin/cache/dart-sdk/lib/web_gl" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
4
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Android API 33, extension level 3 Platform" project-jdk-type="Android SDK" />
|
||||||
|
</project>
|
||||||
60
.idea/naplo.iml
generated
@@ -2,7 +2,65 @@
|
|||||||
<module type="JAVA_MODULE" version="4">
|
<module type="JAVA_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/flutter_acrylic/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/flutter_acrylic/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/flutter_acrylic/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo_desktop_ui/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo_desktop_ui/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo_desktop_ui/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/share_plus/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/share_plus/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/share_plus/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/dynamic_color/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/dynamic_color/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/dynamic_color/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/dynamic_color/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/dynamic_color/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/dynamic_color/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo_premium/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo_premium/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo_premium/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/share_plus/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/share_plus/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/share_plus/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/connectivity_plus/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/connectivity_plus/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/connectivity_plus/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/connectivity_plus/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/connectivity_plus/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/connectivity_plus/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/package_info_plus/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/package_info_plus/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/package_info_plus/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo_kreta_api/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo_kreta_api/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo_kreta_api/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo_mobile_ui/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo_mobile_ui/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo_mobile_ui/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/package_info_plus/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/package_info_plus/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/package_info_plus/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/flutter_acrylic/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/flutter_acrylic/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/filcnaplo/linux/flutter/ephemeral/.plugin_symlinks/flutter_acrylic/.dart_tool" />
|
||||||
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
29
.vscode/launch.json
vendored
@@ -10,17 +10,16 @@
|
|||||||
"--dart-define=APPVER=$(cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1)"
|
"--dart-define=APPVER=$(cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
"name": "filcnaplo release",
|
// "name": "filcnaplo release",
|
||||||
"cwd": "filcnaplo release",
|
// "cwd": "filcnaplo release",
|
||||||
"request": "launch",
|
// "request": "launch",
|
||||||
"type": "dart",
|
// "type": "dart",
|
||||||
"flutterMode": "release",
|
// "program": "lib/main.dart",
|
||||||
"program": "lib/main.dart",
|
// "toolArgs": [
|
||||||
"toolArgs": [
|
// "--dart-define=APPVER=$(cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1)"
|
||||||
"--dart-define=APPVER=$(cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1)"
|
// ]
|
||||||
]
|
// },
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Flutter",
|
"name": "Flutter",
|
||||||
"program": "lib/main.dart",
|
"program": "lib/main.dart",
|
||||||
@@ -28,6 +27,14 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"flutterMode": "debug"
|
"flutterMode": "debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Flutter (release)",
|
||||||
|
"program": "lib/main.dart",
|
||||||
|
"cwd": "filcnaplo",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "release"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,39 +1,36 @@
|
|||||||
|
|
||||||
# Contributing Guide
|
# Contribution guide
|
||||||
Köszönjük, ha programozással segíted a munkánkat!
|
Köszönjük, ha programozással segíted a munkánkat!
|
||||||
A folytatáshoz szükséged lesz egy Linuxot vagy Windowst futtató számítógépre, minimális programozási tapasztalatra és egy kis angoltudásra.
|
A folytatáshoz szükséged lesz egy Linux-ot vagy Windows-t futtató számítógépre, minimális programozási tapasztalatra és egy kis angoltudásra.
|
||||||
Segít, ha nem csak kicsit tudsz programozni, és ha ismered a Gitet és a GitHubot ;)
|
Segít, ha már gyakorlottabb vagy a programozásban, és ha ismered a [Git](https://git-scm.com/) és a [GitHub](https://github.com/) működését. ;)
|
||||||
|
|
||||||
## Miben segítsek?
|
## Miben segítsek?
|
||||||
Kérünk, **olyan dologgal járulj hozzá** a reFilchez, ami valószínűleg **sok embernek hasznos lesz** majd. Szeretnénk egy minél teljeskörűbb iskolai asszisztenst létrehozni, de az iskolaspecifikus, vagy külön neked hasznos funkciók helye inkább legyen a saját forkod.
|
Kérünk, **olyan dologgal járulj hozzá** a **reFilc**hez, ami valószínűleg **sok embernek hasznos lehet**. Szeretnénk egy minél teljeskörűbb iskolai asszisztenst létrehozni, de az iskolaspecifikus, vagy külön neked hasznos funkciók helye inkább legyen a saját Fork-od.
|
||||||
|
|
||||||
Fontos, hogy **mielőtt egy nagy volumenű projektbe belekezdesz, futtasd meg ötletedet a [Discord szerverünkön](https://dc.refilc.hu/),** ahol még azelőtt tudunk tanácsot adni, mielőtt sok-sok órát beleöltél volna egy esetleg felesleges dologba.
|
Fontos, hogy **mielőtt egy nagyobb méretű projektbe belekezdenél, futtasd meg ötletedet a [Discord szerverünkön](https://dc.refilc.hu/)**, ahol még azelőtt tudunk tanácsot adni, hogy sok-sok órát beleöltél volna egy esetleg felesleges dologba.
|
||||||
|
|
||||||
A legjobban annak örülünk, ha az [Issues](https://github.com/refilc/filcnaplo/issues) oldalról szemezgetsz, **ha lehet, a [priority taggel megjelöltekkel kezdd](https://github.com/refilc/filcnaplo/issues?q=is%3Aissue+is%3Aopen+label%3Apriority),** vagy ha új vagy a Flutterhez, ajánljuk figyelmedbe [ezeket a viszonylag könnyen javítható hibákat](https://github.com/refilc/filcnaplo/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) (ha épp van ilyen).
|
A legjobban annak örülünk, ha az [Issues](https://github.com/refilc/naplo/issues) oldalról szemezgetsz. Ha még új vagy a Flutterben, ajánljuk figyelmedbe ezeket a [viszonylag könnyen javítható hibákat](https://github.com/refilc/naplo/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22), ha éppen van ilyen.
|
||||||
|
|
||||||
## Hogyan segítsek?
|
## Hogyan segítsek?
|
||||||
|
Nem ígérhetünk itt sem programozás-, sem Git-kurzust, de a projektspecifikus dolgokat leírjuk, és segítünk a Flutter telepítésében.
|
||||||
|
|
||||||
Nem ígérhetünk itt sem programozás-, sem git-kurzust, de a projektspecifikus dolgokat leírjuk, és segítünk a Flutter feltelepítésében.
|
A **reFilc** a Google által pár éve létrehozott **[Flutter](https://flutter.dev/)** keretrendszert használja, aminek nyelve a **[Dart](https://dart.dev/)**. Ha ismered a C#, Java, C++, vagy egyéb hasonló programnyelvek működését, **nem fog nagy gondot okozni a használata.** A felhasználói felület létrehozásában az is segíthet, ha foglalkoztál már korábban weboldalakkal vagy alkalmazásfejlesztéssel.
|
||||||
|
Ha még nem használtad a Flutter-t, mindenképp böngészd át a [YouTube csatornájukat](https://www.youtube.com/channel/UCwXdFgeE9KYzlDdR7TG9cMw).
|
||||||
|
Kód vagy UI teszteléséhez Flutter telepítése nélkül is használhatod a [DartPad](https://dartpad.dev/)-et.
|
||||||
|
|
||||||
A reFilc a Google által pár éve létrehozott **[Fluttert](https://flutter.dev/)** használja, aminek nyelve a **[Dart](https://dart.dev/)**. Ha ismered a C#-ot, Javát, C++t, vagy egyéb hasonló nyelvet, **nem fog gondot okozni a használata.** A felhasználói felület létrehozásában az is segíthet, ha foglalkoztál már korábban weboldalakkal.
|
#### [Segítség a Flutter telepítéséhez](https://docs.flutter.dev/get-started/install)
|
||||||
Ha még nem használtál Fluttert, mindenképp böngészd át a [YouTube csatornájukat](https://www.youtube.com/channel/UCwXdFgeE9KYzlDdR7TG9cMw).
|
**Használd a Flutter stable verzióját!** Írd be a terminálba: `flutter channel stable`
|
||||||
Könnyen tudsz kódot, vagy akár UI-t is tesztelni a [DartPad](https://dartpad.dev/) oldalon.
|
|
||||||
|
|
||||||
#### [Segítség a Flutter telepítéséhez és a forráskód futtatásához](/.github/SETUP.md)
|
Ha nem értessz a Git-hez vagy a GitHub-hoz, ajánljuk figyelmedbe [ezt a cikket](https://medium.com/envienta-magyarorsz%C3%A1g/git-%C3%A9s-github-gyorstalpal%C3%B3-f2d78a732deb), viszont arra kérünk, hogy a használatukat ne a **reFilc**en próbáld ki először. Hozz létre egy saját Repo-t és abban tesztelgess. Ha már nagyjából kitapasztaltad, várjuk hozzájárulásodat.
|
||||||
Fontos: **Legyél a flutter beta verzióján!** Írd be: `flutter channel beta`
|
|
||||||
|
|
||||||
|
Készíts egy Fork-ot a saját GitHub fiókod alá.
|
||||||
|
A **reFilc** legfrissebb, **épp fejlesztés alatt álló verzióját a [master branch](https://github.com/refilc/naplo/tree/master)-en találod**. Kérjük ide Commit-olj és ide célozd a Fork-odból a Pull Request-edet. Írd le benne, hogy mit változtattál és ha lehet, csatolj képernyőképet is.
|
||||||
Ha nem értesz a Githez, ajánljuk figyelmedbe [ezt a cikket](https://medium.com/envienta-magyarorsz%C3%A1g/git-%C3%A9s-github-gyorstalpal%C3%B3-f2d78a732deb). Viszont arra kérünk, a Git használatát ne a reFilcen próbáld ki először, hozz létre előbb egy saját Repót, és abba tesztelgess. Ha már nagyjából kitapasztaltad, várjuk hozzájárulásodat.
|
Minél gyakrabban készíts minél részletesebben elnevezett Commit-okat, hogy mások is el tudjanak igazodni az általad beküldött kódban.
|
||||||
|
|
||||||
Készíts egy forkot a saját fiókod alá.
|
|
||||||
A reFilc legfrissebb, épp fejlesztés alatt álló verzióját a [dev brancen](https://github.com/refilc/filcnaplo/tree/dev) találod, kérjük ide commitolj, és ide célozd a forkodból a Pull Requested. Írd le benne, mit változtattál, és ha lehet, csatolj képernyőképet is.
|
|
||||||
Minél gyakrabban készíts minél részletesebben elnevezett commitokat, hogy el tudjunk tájékozódni az általad beküldött kódon.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Az általad fejlesztett funkciók mellé a changelogban odakerül GitHub felhasználóneved.
|
Az általad fejlesztett funkciók mellé a Changelog-ba odakerül a GitHub felhasználóneved.
|
||||||
Ha jelentős és rendszeres hozzájáruló vagy, Discordon megkapod a `DEV` rangot.
|
Ha jelentős és rendszeres hozzájáruló vagy, Discord-on megkaphatod a `DEV` rangot.
|
||||||
|
|
||||||
Ha bárhol elakadtál, keress minket Discordon.
|
Ha bárhol elakadtál vagy kérdésed van, keress bátran Discordon!
|
||||||
Jó fejlesztést kívánunk!
|
**Jó fejlesztést kívánunk!**
|
||||||
|
|||||||
678
LICENSE
@@ -1,29 +1,661 @@
|
|||||||
BSD 3-Clause License
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
Copyright (c) 2023, reFilc
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
All rights reserved.
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Preamble
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice, this
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
list of conditions and the following disclaimer.
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
The licenses for most software and other practical works are designed
|
||||||
this list of conditions and the following disclaimer in the documentation
|
to take away your freedom to share and change the works. By contrast,
|
||||||
and/or other materials provided with the distribution.
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users.
|
||||||
|
|
||||||
3. Neither the name of the copyright holder nor the names of its
|
When we speak of free software, we are referring to freedom, not
|
||||||
contributors may be used to endorse or promote products derived from
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
this software without specific prior written permission.
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
Developers that use our General Public Licenses protect your rights
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
you this License which gives you legal permission to copy, distribute
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
and/or modify the software.
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
A secondary benefit of defending all users' freedom is that
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
improvements made in alternate versions of the program, if they
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
receive widespread use, become available for other developers to
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
incorporate. Many developers of free software are heartened and
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|||||||
24
README.md
@@ -3,16 +3,16 @@
|
|||||||
<h1 align=center><b>reFilc</b></h1>
|
<h1 align=center><b>reFilc</b></h1>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
#### Nem hivatalos e-napló alkalmazás az eKRÉTA rendszerhez - tanulóktól, tanulóknak.
|
#### Nem hivatalos e-napló alkalmazás az e-KRÉTA rendszerhez - tanulóktól, tanulóknak.
|
||||||
|
|
||||||
[](https://github.com/refilc/naplo/releases) [](http://dc.refilc.hu)
|
[](https://github.com/refilc/naplo/releases) [](https://dc.refilc.hu)
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
### Clone the project
|
### Clone the project
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone --recursive https://github.com/refilc/naplo
|
git clone https://github.com/refilc/naplo
|
||||||
cd naplo
|
cd naplo
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -29,14 +29,24 @@ flutter run
|
|||||||
|
|
||||||
### Contribution
|
### Contribution
|
||||||
|
|
||||||
|
**Nézd meg a [Contribution guide](CONTRIBUTING.md)-ot!**
|
||||||
|
|
||||||
Az összes (ugyan azon verzióhoz tartozó) contribution meg fog jelenni a release-nél. Kérjük, írd le a Discord nevedet a Description-be, hogy adhassunk rangot.
|
Az összes (ugyan azon verzióhoz tartozó) contribution meg fog jelenni a release-nél. Kérjük, írd le a Discord nevedet a Description-be, hogy adhassunk rangot.
|
||||||
|
|
||||||
-------
|
-------
|
||||||
|
|
||||||
# Kudo
|
# Team
|
||||||
|
|
||||||
**annon:** a Filc napló készítője (ez az app a Filcen alapul)
|
**kima:** head developer / project manager
|
||||||
|
|
||||||
**kima, mog, WolfY:** fő fejlesztők
|
**Reiner, pdf, Pearoo, Zizi:** community- and project manager / developer
|
||||||
|
|
||||||
**Regő, Pearoo:** weboldal design és community management
|
**vrolandd, TMarccci:** head developer
|
||||||
|
|
||||||
|
**dwe., xou, SebRHQ:** designer
|
||||||
|
|
||||||
|
**Péter:** video editor
|
||||||
|
|
||||||
|
**annon:** a régi Filc Napló fejlesztője (ez az app, ha bár sokban változott, alapjaiban a Filc-re épül)
|
||||||
|
|
||||||
|
<sup>Ez a projekt egy fork; az eredeti projektet megtaláljátok itt: [filc/naplo-archive](https://github.com/filc/naplo-archive) (köszi, annon)</sup>
|
||||||
|
|||||||
1
filcnaplo/.gitignore
vendored
@@ -44,3 +44,4 @@ app.*.map.json
|
|||||||
/android/app/debug
|
/android/app/debug
|
||||||
/android/app/profile
|
/android/app/profile
|
||||||
/android/app/release
|
/android/app/release
|
||||||
|
key.properties
|
||||||
|
|||||||
@@ -1,30 +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.
|
# This file should be version controlled.
|
||||||
|
|
||||||
version:
|
version:
|
||||||
revision: 3c0bee85b8e43b860877922bdc411a7333db4d32
|
revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||||
channel: beta
|
channel: stable
|
||||||
|
|
||||||
project_type: app
|
project_type: app
|
||||||
|
|
||||||
# Tracks metadata for the flutter migrate command
|
# Tracks metadata for the flutter migrate command
|
||||||
migration:
|
migration:
|
||||||
platforms:
|
platforms:
|
||||||
- platform: root
|
- platform: root
|
||||||
create_revision: 3c0bee85b8e43b860877922bdc411a7333db4d32
|
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||||
base_revision: 3c0bee85b8e43b860877922bdc411a7333db4d32
|
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||||
- platform: macos
|
- platform: web
|
||||||
create_revision: 3c0bee85b8e43b860877922bdc411a7333db4d32
|
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||||
base_revision: 3c0bee85b8e43b860877922bdc411a7333db4d32
|
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||||
|
|
||||||
# User provided section
|
# User provided section
|
||||||
|
|
||||||
# List of Local paths (relative to this file) that should be
|
# List of Local paths (relative to this file) that should be
|
||||||
# ignored by the migrate tool.
|
# ignored by the migrate tool.
|
||||||
#
|
#
|
||||||
# Files that are not part of the templates will be ignored by default.
|
# Files that are not part of the templates will be ignored by default.
|
||||||
unmanaged_files:
|
unmanaged_files:
|
||||||
- 'lib/main.dart'
|
- 'lib/main.dart'
|
||||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools" package="hu.refilc.naplo">
|
xmlns:tools="http://schemas.android.com/tools" package="hu.refilc.naplo">
|
||||||
<application android:label="reFilc" tools:replace="android:label" android:icon="@mipmap/ic_launcher"
|
<application android:name="${applicationName}" android:label="reFilc" tools:replace="android:label" android:icon="@mipmap/ic_launcher"
|
||||||
android:requestLegacyExternalStorage="true">
|
android:requestLegacyExternalStorage="true">
|
||||||
<activity android:exported="true" android:name=".MainActivity"
|
<activity android:exported="true" android:name="hu.refilc.naplo.MainActivity"
|
||||||
android:launchMode="singleTop" android:theme="@style/LaunchTheme"
|
android:launchMode="singleTop" android:theme="@style/LaunchTheme"
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"
|
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"
|
||||||
android:showWhenLocked="true"
|
android:showWhenLocked="true"
|
||||||
android:turnScreenOn="true">
|
android:turnScreenOn="true">
|
||||||
|
<meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable"
|
||||||
|
android:resource="@drawable/launch_background" />
|
||||||
<meta-data android:name="io.flutter.embedding.android.NormalTheme"
|
<meta-data android:name="io.flutter.embedding.android.NormalTheme"
|
||||||
android:resource="@style/NormalTheme" />
|
android:resource="@style/NormalTheme" />
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@@ -18,16 +20,26 @@
|
|||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<!-- Accepts URIs that begin with https://api.filcnaplo.hu -->
|
<!-- Accepts URIs that begin with https://api.refilcapp.hu -->
|
||||||
<data
|
<data
|
||||||
android:scheme="https"
|
android:scheme="https"
|
||||||
android:host="api.filcnaplo.hu"
|
android:host="api.refilcapp.hu"
|
||||||
android:pathPrefix="/callback" />
|
android:pathPrefix="/v1/auth/callback" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<!-- Accepts URIs that begin with https://refilc.hu -->
|
||||||
|
<data
|
||||||
|
android:scheme="https"
|
||||||
|
android:host="refilc.hu"
|
||||||
|
android:pathPrefix="/app" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<meta-data android:name="flutterEmbedding" android:value="2" />
|
<meta-data android:name="flutterEmbedding" android:value="2" />
|
||||||
|
|
||||||
<receiver android:name=".widget_timetable.WidgetTimetable"
|
<receiver android:name="hu.refilc.naplo.widget_timetable.WidgetTimetable"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||||
@@ -43,7 +55,7 @@
|
|||||||
android:resource="@xml/home_widget_test_info" />
|
android:resource="@xml/home_widget_test_info" />
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<service android:name=".widget_timetable.WidgetTimetableService"
|
<service android:name="hu.refilc.naplo.widget_timetable.WidgetTimetableService"
|
||||||
android:permission="android.permission.BIND_REMOTEVIEWS" />
|
android:permission="android.permission.BIND_REMOTEVIEWS" />
|
||||||
|
|
||||||
<receiver android:name="es.antonborri.home_widget.HomeWidgetBackgroundReceiver"
|
<receiver android:name="es.antonborri.home_widget.HomeWidgetBackgroundReceiver"
|
||||||
@@ -57,14 +69,18 @@
|
|||||||
android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true" />
|
android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
<meta-data android:name="flutterEmbedding" android:value="2" />
|
||||||
|
|
||||||
<!-- Permissions -->
|
<!-- Permissions -->
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
package hu.refilc.naplo;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import io.flutter.embedding.android.FlutterActivity;
|
|
||||||
import io.flutter.plugins.GeneratedPluginRegistrant;
|
|
||||||
|
|
||||||
import io.flutter.embedding.engine.FlutterEngine;
|
|
||||||
|
|
||||||
public class MainActivity extends FlutterActivity {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
GeneratedPluginRegistrant.registerWith(new FlutterEngine(this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../../../../../../filcnaplo_premium/android/database
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../../../../../../filcnaplo_premium/android/utils
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../../../../../../filcnaplo_premium/android/widget_timetable
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package hu.refilc.naplo;
|
||||||
|
|
||||||
|
import io.flutter.embedding.android.FlutterActivity;
|
||||||
|
|
||||||
|
public class MainActivity extends FlutterActivity {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,119 +1,119 @@
|
|||||||
package hu.refilc.naplo.database;
|
package hu.refilc.naplo.database;
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import hu.refilc.naplo.database.SQLiteHelper;
|
import hu.refilc.naplo.database.SQLiteHelper;
|
||||||
|
|
||||||
public class DBManager {
|
public class DBManager {
|
||||||
private Context context;
|
private Context context;
|
||||||
private SQLiteDatabase database;
|
private SQLiteDatabase database;
|
||||||
private SQLiteHelper dbHelper;
|
private SQLiteHelper dbHelper;
|
||||||
|
|
||||||
public DBManager(Context c) {
|
public DBManager(Context c) {
|
||||||
this.context = c;
|
this.context = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DBManager open() throws SQLException {
|
public DBManager open() throws SQLException {
|
||||||
this.dbHelper = new SQLiteHelper(this.context);
|
this.dbHelper = new SQLiteHelper(this.context);
|
||||||
this.database = this.dbHelper.getWritableDatabase();
|
this.database = this.dbHelper.getWritableDatabase();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
this.dbHelper.close();
|
this.dbHelper.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor fetchWidget(int wid) {
|
public Cursor fetchWidget(int wid) {
|
||||||
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_WIDGETS, new String[]{SQLiteHelper._ID, SQLiteHelper.DAY_SEL}, SQLiteHelper._ID + " = " + wid, null, null, null, null);
|
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_WIDGETS, new String[]{SQLiteHelper._ID, SQLiteHelper.DAY_SEL}, SQLiteHelper._ID + " = " + wid, null, null, null, null);
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
}
|
}
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor fetchTimetable() {
|
public Cursor fetchTimetable() {
|
||||||
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_USER_DATA, new String[]{SQLiteHelper.TIMETABLE}, null, null, null, null, null);
|
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_USER_DATA, new String[]{SQLiteHelper.TIMETABLE}, null, null, null, null, null);
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
}
|
}
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor fetchLastUser() {
|
public Cursor fetchLastUser() {
|
||||||
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.LAST_ACCOUNT_ID}, null, null, null, null, null);
|
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.LAST_ACCOUNT_ID}, null, null, null, null, null);
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
}
|
}
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor fetchTheme() {
|
public Cursor fetchTheme() {
|
||||||
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.THEME, SQLiteHelper.ACCENT_COLOR}, null, null, null, null, null);
|
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.THEME, SQLiteHelper.ACCENT_COLOR}, null, null, null, null, null);
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
}
|
}
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor fetchPremiumToken() {
|
public Cursor fetchPremiumToken() {
|
||||||
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.PREMIUM_TOKEN}, null, null, null, null, null);
|
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.PREMIUM_TOKEN}, null, null, null, null, null);
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
}
|
}
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor fetchPremiumScopes() {
|
public Cursor fetchPremiumScopes() {
|
||||||
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.PREMIUM_SCOPES}, null, null, null, null, null);
|
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.PREMIUM_SCOPES}, null, null, null, null, null);
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
}
|
}
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor fetchLocale() {
|
public Cursor fetchLocale() {
|
||||||
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.LOCALE}, null, null, null, null, null);
|
Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.LOCALE}, null, null, null, null, null);
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
}
|
}
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteWidget(int _id) {
|
public void deleteWidget(int _id) {
|
||||||
this.database.delete(SQLiteHelper.TABLE_NAME_WIDGETS, "_id=" + _id, null);
|
this.database.delete(SQLiteHelper.TABLE_NAME_WIDGETS, "_id=" + _id, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void changeSettings(int _id, Map<String, String> map) {
|
/*public void changeSettings(int _id, Map<String, String> map) {
|
||||||
ContentValues con = new ContentValues();
|
ContentValues con = new ContentValues();
|
||||||
for(Map.Entry<String, String> e: map.entrySet()){
|
for(Map.Entry<String, String> e: map.entrySet()){
|
||||||
con.put(e.getKey(), e.getValue());
|
con.put(e.getKey(), e.getValue());
|
||||||
}
|
}
|
||||||
this.database.update(SQLiteHelper.TABLE_NAME_WIDGETS, con, "_id = " + _id, null);
|
this.database.update(SQLiteHelper.TABLE_NAME_WIDGETS, con, "_id = " + _id, null);
|
||||||
}
|
}
|
||||||
public void insertSettings(int _id, Map<String, String> map) {
|
public void insertSettings(int _id, Map<String, String> map) {
|
||||||
ContentValues con = new ContentValues();
|
ContentValues con = new ContentValues();
|
||||||
for(Map.Entry<String, String> e: map.entrySet()){
|
for(Map.Entry<String, String> e: map.entrySet()){
|
||||||
con.put(e.getKey(), e.getValue());
|
con.put(e.getKey(), e.getValue());
|
||||||
//Log.d("Settings added", e.getKey() + " - " + e.getValue());
|
//Log.d("Settings added", e.getKey() + " - " + e.getValue());
|
||||||
}
|
}
|
||||||
this.database.insert(SQLiteHelper.TABLE_NAME_WIDGETS, null, con);
|
this.database.insert(SQLiteHelper.TABLE_NAME_WIDGETS, null, con);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public void insertSelDay(int _id, int day_sel) {
|
public void insertSelDay(int _id, int day_sel) {
|
||||||
ContentValues con = new ContentValues();
|
ContentValues con = new ContentValues();
|
||||||
con.put(SQLiteHelper._ID, _id);
|
con.put(SQLiteHelper._ID, _id);
|
||||||
con.put(SQLiteHelper.DAY_SEL, day_sel);
|
con.put(SQLiteHelper.DAY_SEL, day_sel);
|
||||||
this.database.insert(SQLiteHelper.TABLE_NAME_WIDGETS, null, con);
|
this.database.insert(SQLiteHelper.TABLE_NAME_WIDGETS, null, con);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int update(int _id, int day_sel) {
|
public int update(int _id, int day_sel) {
|
||||||
ContentValues con = new ContentValues();
|
ContentValues con = new ContentValues();
|
||||||
con.put(SQLiteHelper.DAY_SEL, day_sel);
|
con.put(SQLiteHelper.DAY_SEL, day_sel);
|
||||||
return this.database.update(SQLiteHelper.TABLE_NAME_WIDGETS, con, SQLiteHelper._ID + " = " + _id, null);
|
return this.database.update(SQLiteHelper.TABLE_NAME_WIDGETS, con, SQLiteHelper._ID + " = " + _id, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,36 +1,36 @@
|
|||||||
package hu.refilc.naplo.database;
|
package hu.refilc.naplo.database;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
|
||||||
public class SQLiteHelper extends SQLiteOpenHelper {
|
public class SQLiteHelper extends SQLiteOpenHelper {
|
||||||
private static final String CREATE_TABLE_WIDGET = " create table widgets ( _id INTEGER NOT NULL, day_sel INTEGER NOT NULL);";
|
private static final String CREATE_TABLE_WIDGET = " create table widgets ( _id INTEGER NOT NULL, day_sel INTEGER NOT NULL);";
|
||||||
private static final String DB_NAME = "app.db";
|
private static final String DB_NAME = "app.db";
|
||||||
private static final int DB_VERSION = 1;
|
private static final int DB_VERSION = 1;
|
||||||
public static final String _ID = "_id";
|
public static final String _ID = "_id";
|
||||||
public static final String DAY_SEL = "day_sel";
|
public static final String DAY_SEL = "day_sel";
|
||||||
public static final String TIMETABLE = "timetable";
|
public static final String TIMETABLE = "timetable";
|
||||||
public static final String LAST_ACCOUNT_ID = "last_account_id";
|
public static final String LAST_ACCOUNT_ID = "last_account_id";
|
||||||
public static final String THEME = "theme";
|
public static final String THEME = "theme";
|
||||||
public static final String PREMIUM_TOKEN = "premium_token";
|
public static final String PREMIUM_TOKEN = "premium_token";
|
||||||
public static final String PREMIUM_SCOPES = "premium_scopes";
|
public static final String PREMIUM_SCOPES = "premium_scopes";
|
||||||
public static final String LOCALE = "language";
|
public static final String LOCALE = "language";
|
||||||
public static final String ACCENT_COLOR = "accent_color";
|
public static final String ACCENT_COLOR = "accent_color";
|
||||||
public static final String TABLE_NAME_WIDGETS = "widgets";
|
public static final String TABLE_NAME_WIDGETS = "widgets";
|
||||||
public static final String TABLE_NAME_USER_DATA = "user_data";
|
public static final String TABLE_NAME_USER_DATA = "user_data";
|
||||||
public static final String TABLE_NAME_SETTINGS = "settings";
|
public static final String TABLE_NAME_SETTINGS = "settings";
|
||||||
|
|
||||||
public SQLiteHelper(Context context) {
|
public SQLiteHelper(Context context) {
|
||||||
super(context, DB_NAME, null, 7);
|
super(context, DB_NAME, null, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCreate(SQLiteDatabase db) {
|
public void onCreate(SQLiteDatabase db) {
|
||||||
db.execSQL(CREATE_TABLE_WIDGET);
|
db.execSQL(CREATE_TABLE_WIDGET);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
db.execSQL("DROP TABLE IF EXISTS widgets");
|
db.execSQL("DROP TABLE IF EXISTS widgets");
|
||||||
onCreate(db);
|
onCreate(db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,36 +1,36 @@
|
|||||||
package hu.refilc.naplo.utils;
|
package hu.refilc.naplo.utils;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
public static boolean hasNetwork(Context context) {
|
public static boolean hasNetwork(Context context) {
|
||||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
NetworkInfo netInfo = cm.getActiveNetworkInfo();
|
NetworkInfo netInfo = cm.getActiveNetworkInfo();
|
||||||
if (netInfo != null && netInfo.isConnectedOrConnecting()) {
|
if (netInfo != null && netInfo.isConnectedOrConnecting()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date getWeekStartDate() {
|
public static Date getWeekStartDate() {
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
|
while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
|
||||||
calendar.add(Calendar.DATE, -1);
|
calendar.add(Calendar.DATE, -1);
|
||||||
}
|
}
|
||||||
return calendar.getTime();
|
return calendar.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date getWeekEndDate() {
|
public static Date getWeekEndDate() {
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
|
while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
|
||||||
calendar.add(Calendar.DATE, 1);
|
calendar.add(Calendar.DATE, 1);
|
||||||
}
|
}
|
||||||
calendar.add(Calendar.DATE, -1);
|
calendar.add(Calendar.DATE, -1);
|
||||||
return calendar.getTime();
|
return calendar.getTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,65 +1,65 @@
|
|||||||
package hu.refilc.naplo.utils;
|
package hu.refilc.naplo.utils;
|
||||||
|
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
public class Week {
|
public class Week {
|
||||||
private final LocalDate start;
|
private final LocalDate start;
|
||||||
private final LocalDate end;
|
private final LocalDate end;
|
||||||
|
|
||||||
private Week(LocalDate start, LocalDate end) {
|
private Week(LocalDate start, LocalDate end) {
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Week current() {
|
public static Week current() {
|
||||||
return fromDate(LocalDate.now());
|
return fromDate(LocalDate.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Week fromId(int id) {
|
public static Week fromId(int id) {
|
||||||
LocalDate _now = getYearStart().plusDays(id * 7L);
|
LocalDate _now = getYearStart().plusDays(id * 7L);
|
||||||
return new Week(_now.minusDays(_now.getDayOfWeek().getValue() - 1), _now.plusDays(7 - _now.getDayOfWeek().getValue()));
|
return new Week(_now.minusDays(_now.getDayOfWeek().getValue() - 1), _now.plusDays(7 - _now.getDayOfWeek().getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Week fromDate(LocalDate date) {
|
public static Week fromDate(LocalDate date) {
|
||||||
|
|
||||||
return new Week(date.minusDays(date.getDayOfWeek().getValue() - 1), date.plusDays(7 - date.getDayOfWeek().getValue()));
|
return new Week(date.minusDays(date.getDayOfWeek().getValue() - 1), date.plusDays(7 - date.getDayOfWeek().getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Week next() {
|
public Week next() {
|
||||||
return Week.fromDate(start.plusDays(8));
|
return Week.fromDate(start.plusDays(8));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int id() {
|
public int id() {
|
||||||
return (int) Math.ceil(Duration.between(getYearStart().atStartOfDay(), start.atStartOfDay()).toDays() / 7f);
|
return (int) Math.ceil(Duration.between(getYearStart().atStartOfDay(), start.atStartOfDay()).toDays() / 7f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static LocalDate getYearStart() {
|
private static LocalDate getYearStart() {
|
||||||
LocalDate now = LocalDate.now();
|
LocalDate now = LocalDate.now();
|
||||||
LocalDate start = getYearStart(now.getYear());
|
LocalDate start = getYearStart(now.getYear());
|
||||||
return start.isBefore(now) ? start : getYearStart(now.getYear() -1);
|
return start.isBefore(now) ? start : getYearStart(now.getYear() -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static LocalDate getYearStart(int year) {
|
private static LocalDate getYearStart(int year) {
|
||||||
LocalDate time = LocalDate.of(year, 9, 1);
|
LocalDate time = LocalDate.of(year, 9, 1);
|
||||||
if (time.getDayOfWeek() == DayOfWeek.SATURDAY)
|
if (time.getDayOfWeek() == DayOfWeek.SATURDAY)
|
||||||
return time.plusDays(2);
|
return time.plusDays(2);
|
||||||
else if (time.getDayOfWeek() == DayOfWeek.SUNDAY)
|
else if (time.getDayOfWeek() == DayOfWeek.SUNDAY)
|
||||||
return time.plusDays(1);
|
return time.plusDays(1);
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
Week week = (Week) o;
|
Week week = (Week) o;
|
||||||
return this.id() == week.id();
|
return this.id() == week.id();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return id();
|
return id();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,397 +1,392 @@
|
|||||||
package hu.refilc.naplo.widget_timetable;
|
package hu.refilc.naplo.widget_timetable;
|
||||||
|
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.appwidget.AppWidgetManager;
|
import android.appwidget.AppWidgetManager;
|
||||||
import android.appwidget.AppWidgetProvider;
|
import android.appwidget.AppWidgetProvider;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.format.TextStyle;
|
import java.time.format.TextStyle;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
import hu.refilc.naplo.database.DBManager;
|
import java.util.HashMap;
|
||||||
import hu.refilc.naplo.MainActivity;
|
import java.text.ParseException;
|
||||||
import hu.refilc.naplo.R;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import hu.refilc.naplo.utils.Week;
|
|
||||||
|
import hu.refilc.naplo.database.DBManager;
|
||||||
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
|
import hu.refilc.naplo.MainActivity;
|
||||||
|
import hu.refilc.naplo.R;
|
||||||
import es.antonborri.home_widget.HomeWidgetBackgroundIntent;
|
|
||||||
import es.antonborri.home_widget.HomeWidgetLaunchIntent;
|
import hu.refilc.naplo.utils.Week;
|
||||||
import es.antonborri.home_widget.HomeWidgetProvider;
|
|
||||||
|
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
|
||||||
public class WidgetTimetable extends HomeWidgetProvider {
|
|
||||||
|
import es.antonborri.home_widget.HomeWidgetBackgroundIntent;
|
||||||
private static final String ACTION_WIDGET_CLICK_NAV_LEFT = "list_widget.ACTION_WIDGET_CLICK_NAV_LEFT";
|
import es.antonborri.home_widget.HomeWidgetLaunchIntent;
|
||||||
private static final String ACTION_WIDGET_CLICK_NAV_RIGHT = "list_widget.ACTION_WIDGET_CLICK_NAV_RIGHT";
|
import es.antonborri.home_widget.HomeWidgetProvider;
|
||||||
private static final String ACTION_WIDGET_CLICK_NAV_TODAY = "list_widget.ACTION_WIDGET_CLICK_NAV_TODAY";
|
|
||||||
private static final String ACTION_WIDGET_CLICK_NAV_REFRESH = "list_widget.ACTION_WIDGET_CLICK_NAV_REFRESH";
|
public class WidgetTimetable extends HomeWidgetProvider {
|
||||||
private static final String ACTION_WIDGET_CLICK_BUY_PREMIUM = "list_widget.ACTION_WIDGET_CLICK_BUY_PREMIUM";
|
|
||||||
|
private static final String ACTION_WIDGET_CLICK_NAV_LEFT = "list_widget.ACTION_WIDGET_CLICK_NAV_LEFT";
|
||||||
@Override
|
private static final String ACTION_WIDGET_CLICK_NAV_RIGHT = "list_widget.ACTION_WIDGET_CLICK_NAV_RIGHT";
|
||||||
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds, SharedPreferences widgetData) {
|
private static final String ACTION_WIDGET_CLICK_NAV_TODAY = "list_widget.ACTION_WIDGET_CLICK_NAV_TODAY";
|
||||||
for (int i = 0; i < appWidgetIds.length; i++) {
|
private static final String ACTION_WIDGET_CLICK_NAV_REFRESH = "list_widget.ACTION_WIDGET_CLICK_NAV_REFRESH";
|
||||||
RemoteViews views = generateView(context, appWidgetIds[i]);
|
private static final String ACTION_WIDGET_CLICK_BUY_PREMIUM = "list_widget.ACTION_WIDGET_CLICK_BUY_PREMIUM";
|
||||||
|
|
||||||
if(premiumEnabled(context) && userLoggedIn(context)) {
|
@Override
|
||||||
int rday = selectDay(context, appWidgetIds[i], 0, true);
|
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds, SharedPreferences widgetData) {
|
||||||
views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday));
|
for (int i = 0; i < appWidgetIds.length; i++) {
|
||||||
}
|
RemoteViews views = generateView(context, appWidgetIds[i]);
|
||||||
|
|
||||||
pushUpdate(context, views, appWidgetIds[i]);
|
if(premiumEnabled(context) && userLoggedIn(context)) {
|
||||||
}
|
int rday = selectDay(context, appWidgetIds[i], 0, true);
|
||||||
}
|
views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday));
|
||||||
|
}
|
||||||
public static void pushUpdate(Context context, RemoteViews remoteViews, int appWidgetSingleId) {
|
|
||||||
AppWidgetManager manager = AppWidgetManager.getInstance(context);
|
pushUpdate(context, views, appWidgetIds[i]);
|
||||||
|
}
|
||||||
manager.updateAppWidget(appWidgetSingleId, remoteViews);
|
}
|
||||||
manager.notifyAppWidgetViewDataChanged(appWidgetSingleId, R.id.widget_list);
|
|
||||||
}
|
public static void pushUpdate(Context context, RemoteViews remoteViews, int appWidgetSingleId) {
|
||||||
|
AppWidgetManager manager = AppWidgetManager.getInstance(context);
|
||||||
public static RemoteViews generateView(Context context, int appId) {
|
|
||||||
Intent serviceIntent = new Intent(context, WidgetTimetableService.class);
|
manager.updateAppWidget(appWidgetSingleId, remoteViews);
|
||||||
serviceIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appId);
|
manager.notifyAppWidgetViewDataChanged(appWidgetSingleId, R.id.widget_list);
|
||||||
serviceIntent.setData(Uri.parse(serviceIntent.toUri(Intent.URI_INTENT_SCHEME)));
|
}
|
||||||
|
|
||||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_timetable);
|
public static RemoteViews generateView(Context context, int appId) {
|
||||||
|
Intent serviceIntent = new Intent(context, WidgetTimetableService.class);
|
||||||
views.setViewVisibility(R.id.need_premium, View.GONE);
|
serviceIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appId);
|
||||||
views.setViewVisibility(R.id.need_login, View.GONE);
|
serviceIntent.setData(Uri.parse(serviceIntent.toUri(Intent.URI_INTENT_SCHEME)));
|
||||||
views.setViewVisibility(R.id.tt_grid_cont, View.GONE);
|
|
||||||
|
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_timetable);
|
||||||
if(!userLoggedIn(context)) {
|
|
||||||
views.setViewVisibility(R.id.need_login, View.VISIBLE);
|
views.setViewVisibility(R.id.need_premium, View.GONE);
|
||||||
views.setOnClickPendingIntent(R.id.open_login, makePending(context, ACTION_WIDGET_CLICK_BUY_PREMIUM, appId));
|
views.setViewVisibility(R.id.need_login, View.GONE);
|
||||||
} else if(premiumEnabled(context)) {
|
views.setViewVisibility(R.id.tt_grid_cont, View.GONE);
|
||||||
views.setViewVisibility(R.id.tt_grid_cont, View.VISIBLE);
|
|
||||||
views.setOnClickPendingIntent(R.id.nav_to_left, makePending(context, ACTION_WIDGET_CLICK_NAV_LEFT, appId));
|
if(!userLoggedIn(context)) {
|
||||||
views.setOnClickPendingIntent(R.id.nav_to_right, makePending(context, ACTION_WIDGET_CLICK_NAV_RIGHT, appId));
|
views.setViewVisibility(R.id.need_login, View.VISIBLE);
|
||||||
views.setOnClickPendingIntent(R.id.nav_current, makePending(context, ACTION_WIDGET_CLICK_NAV_TODAY, appId));
|
views.setOnClickPendingIntent(R.id.open_login, makePending(context, ACTION_WIDGET_CLICK_BUY_PREMIUM, appId));
|
||||||
views.setOnClickPendingIntent(R.id.nav_refresh, makePending(context, ACTION_WIDGET_CLICK_NAV_REFRESH, appId));
|
} else if(premiumEnabled(context)) {
|
||||||
views.setRemoteAdapter(R.id.widget_list, serviceIntent);
|
views.setViewVisibility(R.id.tt_grid_cont, View.VISIBLE);
|
||||||
views.setEmptyView(R.id.widget_list, R.id.empty_view);
|
views.setOnClickPendingIntent(R.id.nav_to_left, makePending(context, ACTION_WIDGET_CLICK_NAV_LEFT, appId));
|
||||||
} else {
|
views.setOnClickPendingIntent(R.id.nav_to_right, makePending(context, ACTION_WIDGET_CLICK_NAV_RIGHT, appId));
|
||||||
views.setViewVisibility(R.id.need_premium, View.VISIBLE);
|
views.setOnClickPendingIntent(R.id.nav_current, makePending(context, ACTION_WIDGET_CLICK_NAV_TODAY, appId));
|
||||||
views.setOnClickPendingIntent(R.id.buy_premium, makePending(context, ACTION_WIDGET_CLICK_BUY_PREMIUM, appId));
|
views.setOnClickPendingIntent(R.id.nav_refresh, makePending(context, ACTION_WIDGET_CLICK_NAV_REFRESH, appId));
|
||||||
}
|
views.setRemoteAdapter(R.id.widget_list, serviceIntent);
|
||||||
|
views.setEmptyView(R.id.widget_list, R.id.empty_view);
|
||||||
return views;
|
} else {
|
||||||
}
|
views.setViewVisibility(R.id.need_premium, View.VISIBLE);
|
||||||
|
views.setOnClickPendingIntent(R.id.buy_premium, makePending(context, ACTION_WIDGET_CLICK_BUY_PREMIUM, appId));
|
||||||
static PendingIntent makePending(Context context, String action, int appWidgetId) {
|
}
|
||||||
Intent activebtnnext = new Intent(context, WidgetTimetable.class);
|
|
||||||
activebtnnext.setAction(action);
|
return views;
|
||||||
activebtnnext.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
|
}
|
||||||
return PendingIntent.getBroadcast(context, appWidgetId, activebtnnext , PendingIntent.FLAG_IMMUTABLE);
|
|
||||||
}
|
static PendingIntent makePending(Context context, String action, int appWidgetId) {
|
||||||
|
Intent activebtnnext = new Intent(context, WidgetTimetable.class);
|
||||||
@Override
|
activebtnnext.setAction(action);
|
||||||
public void onReceive(Context context, Intent intent) {
|
activebtnnext.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
|
||||||
super.onReceive(context, intent);
|
return PendingIntent.getBroadcast(context, appWidgetId, activebtnnext , PendingIntent.FLAG_IMMUTABLE);
|
||||||
|
}
|
||||||
if(intent.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) {
|
|
||||||
int appId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
|
@Override
|
||||||
RemoteViews views = generateView(context, appId);
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
super.onReceive(context, intent);
|
||||||
try {
|
|
||||||
if(premiumEnabled(context) && userLoggedIn(context)) {
|
if(intent.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) {
|
||||||
if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_LEFT)) {
|
int appId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
|
||||||
int rday = selectDay(context, appId, -1, false);
|
RemoteViews views = generateView(context, appId);
|
||||||
views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday));
|
|
||||||
|
try {
|
||||||
pushUpdate(context, views, appId);
|
if(premiumEnabled(context) && userLoggedIn(context)) {
|
||||||
} else if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_RIGHT)) {
|
if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_LEFT)) {
|
||||||
int rday = selectDay(context, appId, 1, false);
|
int rday = selectDay(context, appId, -1, false);
|
||||||
views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday));
|
views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday));
|
||||||
|
|
||||||
pushUpdate(context, views, appId);
|
pushUpdate(context, views, appId);
|
||||||
} else if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_TODAY)) {
|
} else if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_RIGHT)) {
|
||||||
int rday = getToday(context);
|
int rday = selectDay(context, appId, 1, false);
|
||||||
setSelectedDay(context, appId, rday);
|
views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday));
|
||||||
|
|
||||||
views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday));
|
pushUpdate(context, views, appId);
|
||||||
|
} else if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_TODAY)) {
|
||||||
pushUpdate(context, views, appId);
|
int rday = getToday(context);
|
||||||
} else if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_REFRESH)) {
|
setSelectedDay(context, appId, rday);
|
||||||
PendingIntent pendingIntent = HomeWidgetLaunchIntent.INSTANCE.getActivity(context, MainActivity.class, Uri.parse("timetable://refresh"));
|
|
||||||
pendingIntent.send();
|
views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday));
|
||||||
} else if (intent.getAction().equals("android.appwidget.action.APPWIDGET_DELETED")) {
|
|
||||||
DBManager dbManager = new DBManager(context.getApplicationContext());
|
pushUpdate(context, views, appId);
|
||||||
|
} else if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_REFRESH)) {
|
||||||
try {
|
PendingIntent pendingIntent = HomeWidgetLaunchIntent.INSTANCE.getActivity(context, MainActivity.class, Uri.parse("timetable://refresh"));
|
||||||
dbManager.open();
|
pendingIntent.send();
|
||||||
dbManager.deleteWidget(appId);
|
} else if (intent.getAction().equals("android.appwidget.action.APPWIDGET_DELETED")) {
|
||||||
dbManager.close();
|
DBManager dbManager = new DBManager(context.getApplicationContext());
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
try {
|
||||||
}
|
dbManager.open();
|
||||||
}
|
dbManager.deleteWidget(appId);
|
||||||
}
|
dbManager.close();
|
||||||
|
} catch (Exception e) {
|
||||||
if(intent.getAction().equals(ACTION_WIDGET_CLICK_BUY_PREMIUM)) {
|
e.printStackTrace();
|
||||||
PendingIntent pendingIntent = HomeWidgetLaunchIntent.INSTANCE.getActivity(context, MainActivity.class, Uri.parse("settings://premium"));
|
}
|
||||||
pendingIntent.send();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e) {
|
if(intent.getAction().equals(ACTION_WIDGET_CLICK_BUY_PREMIUM)) {
|
||||||
e.printStackTrace();
|
PendingIntent pendingIntent = HomeWidgetLaunchIntent.INSTANCE.getActivity(context, MainActivity.class, Uri.parse("settings://premium"));
|
||||||
}
|
pendingIntent.send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e) {
|
||||||
public static String convertDayOfWeek(Context context, int rday) {
|
e.printStackTrace();
|
||||||
|
}
|
||||||
/*if(rday == -1) return DayOfWeek.of(1).getDisplayName(TextStyle.FULL, new Locale("hu", "HU"));
|
}
|
||||||
|
}
|
||||||
String dayOfWeek = DayOfWeek.of(rday + 1).getDisplayName(TextStyle.FULL, new Locale("hu", "HU"));*/
|
|
||||||
|
public static String convertDayOfWeek(Context context, int rday) {
|
||||||
String dayOfWeek = "Unknown";
|
|
||||||
|
/*if(rday == -1) return DayOfWeek.of(1).getDisplayName(TextStyle.FULL, new Locale("hu", "HU"));
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
Locale loc = getLocale(context);
|
String dayOfWeek = DayOfWeek.of(rday + 1).getDisplayName(TextStyle.FULL, new Locale("hu", "HU"));*/
|
||||||
|
|
||||||
if (rday == -1)
|
String dayOfWeek = "Unknown";
|
||||||
return DayOfWeek.of(1).getDisplayName(TextStyle.FULL, loc);
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
dayOfWeek = DayOfWeek.of(rday + 1).getDisplayName(TextStyle.FULL, loc);
|
Locale loc = getLocale(context);
|
||||||
}
|
|
||||||
|
if (rday == -1)
|
||||||
return dayOfWeek.substring(0, 1).toUpperCase() + dayOfWeek.substring(1).toLowerCase();
|
return DayOfWeek.of(1).getDisplayName(TextStyle.FULL, loc);
|
||||||
}
|
|
||||||
|
dayOfWeek = DayOfWeek.of(rday + 1).getDisplayName(TextStyle.FULL, loc);
|
||||||
public static void setSelectedDay(Context context, int wid, int day) {
|
}
|
||||||
DBManager dbManager = new DBManager(context.getApplicationContext());
|
|
||||||
|
return dayOfWeek.substring(0, 1).toUpperCase() + dayOfWeek.substring(1).toLowerCase();
|
||||||
try {
|
}
|
||||||
dbManager.open();
|
|
||||||
dbManager.update(wid, day);
|
public static void setSelectedDay(Context context, int wid, int day) {
|
||||||
dbManager.close();
|
DBManager dbManager = new DBManager(context.getApplicationContext());
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
try {
|
||||||
}
|
dbManager.open();
|
||||||
}
|
dbManager.update(wid, day);
|
||||||
|
dbManager.close();
|
||||||
public static int getToday(Context context) {
|
} catch (Exception e) {
|
||||||
int rday = new DateTime().getDayOfWeek() - 1;
|
e.printStackTrace();
|
||||||
List<JSONArray> s = genJsonDays(context);
|
}
|
||||||
|
}
|
||||||
try {
|
|
||||||
if(checkIsAfter(s, rday)) rday += 1;
|
public static int getToday(Context context) {
|
||||||
} catch (Exception e) {
|
int rday = new DateTime().getDayOfWeek() - 1;
|
||||||
e.printStackTrace();
|
List<JSONArray> s = genJsonDays(context);
|
||||||
}
|
|
||||||
return retDay(rday, s.size());
|
try {
|
||||||
}
|
if(checkIsAfter(s, rday)) rday += 1;
|
||||||
|
} catch (Exception e) {
|
||||||
public static int selectDay(Context context, int wid, int add, Boolean afterSubjects) {
|
e.printStackTrace();
|
||||||
DBManager dbManager = new DBManager(context.getApplicationContext());
|
}
|
||||||
|
return retDay(rday, s.size());
|
||||||
try {
|
}
|
||||||
dbManager.open();
|
|
||||||
Cursor cursor = dbManager.fetchWidget(wid);
|
public static int selectDay(Context context, int wid, int add, Boolean afterSubjects) {
|
||||||
|
DBManager dbManager = new DBManager(context.getApplicationContext());
|
||||||
List<JSONArray> s = genJsonDays(context);
|
|
||||||
int retday = new DateTime().getDayOfWeek() - 1;
|
try {
|
||||||
|
dbManager.open();
|
||||||
if(cursor.getCount() != 0) retday = retDay(cursor.getInt(1) + add, s.size());
|
Cursor cursor = dbManager.fetchWidget(wid);
|
||||||
|
|
||||||
if(afterSubjects) if(checkIsAfter(s, retday)) retday += 1;
|
List<JSONArray> s = genJsonDays(context);
|
||||||
retday = retDay(retday, s.size());
|
int retday = new DateTime().getDayOfWeek() - 1;
|
||||||
|
|
||||||
if(cursor.getCount() == 0) dbManager.insertSelDay(wid, retday);
|
if(cursor.getCount() != 0) retday = retDay(cursor.getInt(1) + add, s.size());
|
||||||
else dbManager.update(wid, retday);
|
|
||||||
|
if(afterSubjects) if(checkIsAfter(s, retday)) retday += 1;
|
||||||
dbManager.close();
|
retday = retDay(retday, s.size());
|
||||||
|
|
||||||
return retday;
|
if(cursor.getCount() == 0) dbManager.insertSelDay(wid, retday);
|
||||||
} catch (Exception e) {
|
else dbManager.update(wid, retday);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
dbManager.close();
|
||||||
|
|
||||||
return 0;
|
return retday;
|
||||||
}
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
public static Boolean checkIsAfter(List<JSONArray> s, int retday) throws Exception {
|
}
|
||||||
retday = retDay(retday, s.size());
|
|
||||||
|
return 0;
|
||||||
String vegIdopont = s.get(retday).getJSONObject(s.get(retday).length() - 1).getString("VegIdopont");
|
}
|
||||||
|
|
||||||
return new DateTime().isAfter(new DateTime(vegIdopont));
|
public static Boolean checkIsAfter(List<JSONArray> s, int retday) throws Exception {
|
||||||
}
|
retday = retDay(retday, s.size());
|
||||||
|
|
||||||
public static int retDay(int retday, int size) {
|
String vegIdopont = s.get(retday).getJSONObject(s.get(retday).length() - 1).getString("VegIdopont");
|
||||||
if (retday < 0) retday = size - 1;
|
|
||||||
else if (retday > size - 1) retday = 0;
|
return new DateTime().isAfter(new DateTime(vegIdopont));
|
||||||
|
}
|
||||||
return retday;
|
|
||||||
}
|
public static int retDay(int retday, int size) {
|
||||||
|
if (retday < 0) retday = size - 1;
|
||||||
public static List<JSONArray> genJsonDays(Context context) {
|
else if (retday > size - 1) retday = 0;
|
||||||
List<JSONArray> gen_days = new ArrayList<>();
|
|
||||||
|
return retday;
|
||||||
DBManager dbManager = new DBManager(context.getApplicationContext());
|
}
|
||||||
try {
|
|
||||||
dbManager.open();
|
public static List<JSONArray> genJsonDays(Context context) {
|
||||||
Cursor ct = dbManager.fetchTimetable();
|
List<JSONArray> genDays = new ArrayList<>();
|
||||||
dbManager.close();
|
Map<String, JSONArray> dayMap = new HashMap<>();
|
||||||
|
|
||||||
if(ct.getCount() == 0) {
|
DBManager dbManager = new DBManager(context.getApplicationContext());
|
||||||
return gen_days;
|
|
||||||
}
|
try {
|
||||||
|
dbManager.open();
|
||||||
JSONObject fecthtt = new JSONObject(ct.getString(0));
|
Cursor ct = dbManager.fetchTimetable();
|
||||||
|
|
||||||
JSONArray dayArray = new JSONArray();
|
if (ct.getCount() == 0) {
|
||||||
String currday = "";
|
return genDays;
|
||||||
|
}
|
||||||
String currweek = String.valueOf(Week.current().id());
|
|
||||||
|
JSONObject fetchedTimetable = new JSONObject(ct.getString(0));
|
||||||
JSONArray week = fecthtt.getJSONArray(currweek);
|
String currentWeek = String.valueOf(Week.current().id());
|
||||||
|
JSONArray week = fetchedTimetable.getJSONArray(currentWeek);
|
||||||
for (int i=0; i < week.length(); i++)
|
|
||||||
{
|
// Organize lessons into dates
|
||||||
try {
|
for (int i = 0; i < week.length(); i++) {
|
||||||
if(i == 0) currday = week.getJSONObject(0).getString("Datum");
|
try {
|
||||||
JSONObject oraObj = week.getJSONObject(i);
|
JSONObject entry = week.getJSONObject(i);
|
||||||
|
String date = entry.getString("Datum");
|
||||||
if(!currday.equals(oraObj.getString("Datum"))) {
|
dayMap.computeIfAbsent(date, k -> new JSONArray()).put(entry);
|
||||||
gen_days.add(dayArray);
|
} catch (JSONException e) {
|
||||||
currday = week.getJSONObject(i).getString("Datum");
|
e.printStackTrace();
|
||||||
dayArray = new JSONArray();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dayArray.put(oraObj);
|
genDays.addAll(dayMap.values());
|
||||||
if(i == week.length() - 1) {
|
|
||||||
gen_days.add(dayArray);
|
// Sort the 'genDays' list of JSON based on the start time of the first entry
|
||||||
}
|
genDays.sort((day1, day2) -> {
|
||||||
} catch (Exception e) {
|
try {
|
||||||
e.printStackTrace();
|
// Extract the start time of the first entry in each day's JSON
|
||||||
}
|
String startTime1 = day1.getJSONObject(0).getString("KezdetIdopont");
|
||||||
}
|
String startTime2 = day2.getJSONObject(0).getString("KezdetIdopont");
|
||||||
} catch (Exception e) {
|
// Compare the start times and return the result for sorting
|
||||||
e.printStackTrace();
|
return startTime1.compareTo(startTime2);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
Collections.sort(gen_days, new Comparator<JSONArray>() {
|
return 0;
|
||||||
|
}
|
||||||
public int compare(JSONArray a, JSONArray b) {
|
});
|
||||||
long valA = 0;
|
|
||||||
long valB = 0;
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
try {
|
} finally {
|
||||||
valA = (long) new DateTime( a.getJSONObject(0).getString("Datum")).getMillis();
|
dbManager.close();
|
||||||
valB = (long) new DateTime( b.getJSONObject(0).getString("Datum")).getMillis();
|
}
|
||||||
}
|
|
||||||
catch (JSONException ignored) {
|
return genDays;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) (valA - valB);
|
|
||||||
}
|
|
||||||
});
|
public static String zeroPad(int value, int padding){
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
return gen_days;
|
b.append(value);
|
||||||
}
|
while(b.length() < padding){
|
||||||
|
b.insert(0,"0");
|
||||||
public static String zeroPad(int value, int padding){
|
}
|
||||||
StringBuilder b = new StringBuilder();
|
return b.toString();
|
||||||
b.append(value);
|
}
|
||||||
while(b.length() < padding){
|
|
||||||
b.insert(0,"0");
|
public static Locale getLocale(Context context) {
|
||||||
}
|
DBManager dbManager = new DBManager(context.getApplicationContext());
|
||||||
return b.toString();
|
|
||||||
}
|
try {
|
||||||
|
dbManager.open();
|
||||||
public static Locale getLocale(Context context) {
|
String loc = dbManager.fetchLocale().getString(0);
|
||||||
DBManager dbManager = new DBManager(context.getApplicationContext());
|
dbManager.close();
|
||||||
|
|
||||||
try {
|
if(loc.equals("hu") || loc.equals("de")) {
|
||||||
dbManager.open();
|
return new Locale(loc, loc.toUpperCase());
|
||||||
String loc = dbManager.fetchLocale().getString(0);
|
}
|
||||||
dbManager.close();
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
if(loc.equals("hu") || loc.equals("de")) {
|
}
|
||||||
return new Locale(loc, loc.toUpperCase());
|
|
||||||
}
|
return new Locale("en", "GB");
|
||||||
} catch (Exception e) {
|
}
|
||||||
e.printStackTrace();
|
|
||||||
}
|
public static boolean premiumEnabled(Context context) {
|
||||||
|
DBManager dbManager = new DBManager(context.getApplicationContext());
|
||||||
return new Locale("en", "GB");
|
|
||||||
}
|
try {
|
||||||
|
dbManager.open();
|
||||||
public static boolean premiumEnabled(Context context) {
|
String premium_token = dbManager.fetchPremiumToken().getString(0);
|
||||||
DBManager dbManager = new DBManager(context.getApplicationContext());
|
String premium_scopes_raw = dbManager.fetchPremiumScopes().getString(0);
|
||||||
|
dbManager.close();
|
||||||
try {
|
|
||||||
dbManager.open();
|
JSONArray arr = new JSONArray(premium_scopes_raw);
|
||||||
String premium_token = dbManager.fetchPremiumToken().getString(0);
|
List<String> premium_scopes = new ArrayList<>();
|
||||||
String premium_scopes_raw = dbManager.fetchPremiumScopes().getString(0);
|
for(int i = 0; i < arr.length(); i++){
|
||||||
dbManager.close();
|
String scope = arr.getString(i);
|
||||||
|
premium_scopes.add(scope.substring(scope.lastIndexOf('.') + 1));
|
||||||
JSONArray arr = new JSONArray(premium_scopes_raw);
|
}
|
||||||
List<String> premium_scopes = new ArrayList<>();
|
|
||||||
for(int i = 0; i < arr.length(); i++){
|
if(!premium_token.equals("") && (premium_scopes.contains("*") || premium_scopes.contains("TIMETALBE_WIDGET"))) {
|
||||||
String scope = arr.getString(i);
|
return true;
|
||||||
premium_scopes.add(scope.substring(scope.lastIndexOf('.') + 1));
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
if(!premium_token.equals("") && (premium_scopes.contains("*") || premium_scopes.contains("TIMETALBE_WIDGET"))) {
|
}
|
||||||
return true;
|
|
||||||
}
|
return false;
|
||||||
} catch (Exception e) {
|
}
|
||||||
e.printStackTrace();
|
|
||||||
}
|
public static boolean userLoggedIn(Context context) {
|
||||||
|
return !lastUserId(context).equals("");
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
public static String lastUserId(Context context) {
|
||||||
public static boolean userLoggedIn(Context context) {
|
DBManager dbManager = new DBManager(context.getApplicationContext());
|
||||||
return !lastUserId(context).equals("");
|
try {
|
||||||
}
|
dbManager.open();
|
||||||
|
Cursor cursor = dbManager.fetchLastUser();
|
||||||
public static String lastUserId(Context context) {
|
dbManager.close();
|
||||||
DBManager dbManager = new DBManager(context.getApplicationContext());
|
|
||||||
try {
|
if(cursor != null && !cursor.getString(0).equals("")) {
|
||||||
dbManager.open();
|
String last_user = cursor.getString(0);
|
||||||
Cursor cursor = dbManager.fetchLastUser();
|
return last_user;
|
||||||
dbManager.close();
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
if(cursor != null && !cursor.getString(0).equals("")) {
|
e.printStackTrace();
|
||||||
String last_user = cursor.getString(0);
|
}
|
||||||
return last_user;
|
|
||||||
}
|
return "";
|
||||||
} catch (Exception e) {
|
}
|
||||||
e.printStackTrace();
|
|
||||||
}
|
@Override
|
||||||
|
public void onEnabled(Context context) {
|
||||||
return "";
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public void onDisabled(Context context) {
|
||||||
public void onEnabled(Context context) {
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisabled(Context context) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,354 +1,356 @@
|
|||||||
package hu.refilc.naplo.widget_timetable;
|
package hu.refilc.naplo.widget_timetable;
|
||||||
|
|
||||||
import android.appwidget.AppWidgetManager;
|
import android.appwidget.AppWidgetManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
import android.widget.RemoteViewsService;
|
import android.widget.RemoteViewsService;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import hu.refilc.naplo.database.DBManager;
|
import hu.refilc.naplo.database.DBManager;
|
||||||
import hu.refilc.naplo.R;
|
import hu.refilc.naplo.R;
|
||||||
|
|
||||||
public class WidgetTimetableDataProvider implements RemoteViewsService.RemoteViewsFactory {
|
public class WidgetTimetableDataProvider implements RemoteViewsService.RemoteViewsFactory {
|
||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
private int appWidgetId;
|
private int appWidgetId;
|
||||||
|
|
||||||
private int rday = 0;
|
private int rday = 0;
|
||||||
|
|
||||||
private int theme;
|
private int theme;
|
||||||
|
|
||||||
private Integer[] colorValues;
|
private Integer[] colorValues;
|
||||||
|
|
||||||
List<Lesson> day_subjects = new ArrayList<>();
|
List<Lesson> day_subjects = new ArrayList<>();
|
||||||
List<Integer> lessonIndexes = new ArrayList<>();
|
List<Integer> lessonIndexes = new ArrayList<>();
|
||||||
|
|
||||||
Item witem;
|
Item witem;
|
||||||
|
|
||||||
/* Default values */
|
/* Default values */
|
||||||
|
|
||||||
static class Item {
|
static class Item {
|
||||||
int Layout;
|
int Layout;
|
||||||
|
|
||||||
int NumVisibility;
|
int NumVisibility;
|
||||||
int NameVisibility;
|
int NameVisibility;
|
||||||
int NameNodescVisibility;
|
int NameNodescVisibility;
|
||||||
int DescVisibility;
|
int DescVisibility;
|
||||||
int RoomVisibility;
|
int RoomVisibility;
|
||||||
int TimeVisibility;
|
int TimeVisibility;
|
||||||
|
|
||||||
int NumColor;
|
int NumColor;
|
||||||
int NameColor;
|
int NameColor;
|
||||||
int NameNodescColor;
|
int NameNodescColor;
|
||||||
int DescColor;
|
int DescColor;
|
||||||
|
|
||||||
Integer[] NameNodescPadding = {0, 0, 0, 0};
|
Integer[] NameNodescPadding = {0, 0, 0, 0};
|
||||||
|
|
||||||
public Item(int Layout, int NumVisibility,int NameVisibility,int NameNodescVisibility,int DescVisibility,int RoomVisibility,int TimeVisibility,int NumColor,int NameColor,int NameNodescColor,int DescColor) {
|
public Item(int Layout, int NumVisibility,int NameVisibility,int NameNodescVisibility,int DescVisibility,int RoomVisibility,int TimeVisibility,int NumColor,int NameColor,int NameNodescColor,int DescColor) {
|
||||||
this.Layout = Layout;
|
this.Layout = Layout;
|
||||||
this.NumVisibility = NumVisibility;
|
this.NumVisibility = NumVisibility;
|
||||||
this.NameVisibility = NameVisibility;
|
this.NameVisibility = NameVisibility;
|
||||||
this.NameNodescVisibility = NameNodescVisibility;
|
this.NameNodescVisibility = NameNodescVisibility;
|
||||||
this.DescVisibility = DescVisibility;
|
this.DescVisibility = DescVisibility;
|
||||||
this.RoomVisibility = RoomVisibility;
|
this.RoomVisibility = RoomVisibility;
|
||||||
this.TimeVisibility = TimeVisibility;
|
this.TimeVisibility = TimeVisibility;
|
||||||
|
|
||||||
this.NumColor = NumColor;
|
this.NumColor = NumColor;
|
||||||
this.NameColor = NameColor;
|
this.NameColor = NameColor;
|
||||||
this.NameNodescColor = NameNodescColor;
|
this.NameNodescColor = NameNodescColor;
|
||||||
this.DescColor = DescColor;
|
this.DescColor = DescColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Lesson {
|
static class Lesson {
|
||||||
String status;
|
String status;
|
||||||
String lessonIndex;
|
String lessonIndex;
|
||||||
String lessonName;
|
String lessonName;
|
||||||
String lessonTopic;
|
String lessonTopic;
|
||||||
String lessonRoom;
|
String lessonRoom;
|
||||||
long lessonStart;
|
long lessonStart;
|
||||||
long lessonEnd;
|
long lessonEnd;
|
||||||
String substituteTeacher;
|
String substituteTeacher;
|
||||||
|
|
||||||
public Lesson(String status, String lessonIndex,String lessonName,String lessonTopic, String lessonRoom,long lessonStart,long lessonEnd,String substituteTeacher) {
|
public Lesson(String status, String lessonIndex,String lessonName,String lessonTopic, String lessonRoom,long lessonStart,long lessonEnd,String substituteTeacher) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.lessonIndex = lessonIndex;
|
this.lessonIndex = lessonIndex;
|
||||||
this.lessonName = lessonName;
|
this.lessonName = lessonName;
|
||||||
this.lessonTopic = lessonTopic;
|
this.lessonTopic = lessonTopic;
|
||||||
this.lessonRoom = lessonRoom;
|
this.lessonRoom = lessonRoom;
|
||||||
this.lessonStart = lessonStart;
|
this.lessonStart = lessonStart;
|
||||||
this.lessonEnd = lessonEnd;
|
this.lessonEnd = lessonEnd;
|
||||||
this.substituteTeacher = substituteTeacher;
|
this.substituteTeacher = substituteTeacher;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer[] itemNameNodescPadding = {0, 0, 0, 0};
|
Integer[] itemNameNodescPadding = {0, 0, 0, 0};
|
||||||
|
|
||||||
public WidgetTimetableDataProvider(Context context, Intent intent) {
|
public WidgetTimetableDataProvider(Context context, Intent intent) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
|
this.appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
|
||||||
|
|
||||||
this.theme = getThemeAccent(context);
|
this.theme = getThemeAccent(context);
|
||||||
|
|
||||||
this.colorValues = new Integer[]{R.color.filc,
|
this.colorValues = new Integer[]{R.color.filc,
|
||||||
R.color.blue_shade300,
|
R.color.blue_shade300,
|
||||||
R.color.green_shade300,
|
R.color.green_shade300,
|
||||||
R.color.lime_shade300,
|
R.color.lime_shade300,
|
||||||
R.color.yellow_shade300,
|
R.color.yellow_shade300,
|
||||||
R.color.orange_shade300,
|
R.color.orange_shade300,
|
||||||
R.color.red_shade300,
|
R.color.red_shade300,
|
||||||
R.color.pink_shade300,
|
R.color.pink_shade300,
|
||||||
R.color.purple_shade300};
|
R.color.purple_shade300};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
initData();
|
initData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataSetChanged() {
|
public void onDataSetChanged() {
|
||||||
initData();
|
initData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
|
|
||||||
return day_subjects.size();
|
return day_subjects.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLayout(final RemoteViews view) {
|
public void setLayout(final RemoteViews view) {
|
||||||
/* Visibilities */
|
/* Visibilities */
|
||||||
view.setViewVisibility(R.id.tt_item_num, witem.NumVisibility);
|
view.setViewVisibility(R.id.tt_item_num, witem.NumVisibility);
|
||||||
view.setViewVisibility(R.id.tt_item_name, witem.NameVisibility);
|
view.setViewVisibility(R.id.tt_item_name, witem.NameVisibility);
|
||||||
view.setViewVisibility(R.id.tt_item_name_nodesc, witem.NameNodescVisibility);
|
view.setViewVisibility(R.id.tt_item_name_nodesc, witem.NameNodescVisibility);
|
||||||
view.setViewVisibility(R.id.tt_item_desc, witem.DescVisibility);
|
view.setViewVisibility(R.id.tt_item_desc, witem.DescVisibility);
|
||||||
view.setViewVisibility(R.id.tt_item_room, witem.RoomVisibility);
|
view.setViewVisibility(R.id.tt_item_room, witem.RoomVisibility);
|
||||||
view.setViewVisibility(R.id.tt_item_time, witem.TimeVisibility);
|
view.setViewVisibility(R.id.tt_item_time, witem.TimeVisibility);
|
||||||
|
|
||||||
/* backgroundResources */
|
/* backgroundResources */
|
||||||
view.setInt(R.id.main_lay, "setBackgroundResource", witem.Layout);
|
view.setInt(R.id.main_lay, "setBackgroundResource", witem.Layout);
|
||||||
|
|
||||||
/* Paddings */
|
/* Paddings */
|
||||||
view.setViewPadding(R.id.tt_item_name_nodesc, witem.NameNodescPadding[0], witem.NameNodescPadding[1], witem.NameNodescPadding[2], witem.NameNodescPadding[3]);
|
view.setViewPadding(R.id.tt_item_name_nodesc, witem.NameNodescPadding[0], witem.NameNodescPadding[1], witem.NameNodescPadding[2], witem.NameNodescPadding[3]);
|
||||||
|
|
||||||
/* Text Colors */
|
/* Text Colors */
|
||||||
view.setInt(R.id.tt_item_num, "setTextColor", getColor(context, witem.NumColor));
|
view.setInt(R.id.tt_item_num, "setTextColor", getColor(context, witem.NumColor));
|
||||||
view.setInt(R.id.tt_item_name, "setTextColor", getColor(context, witem.NameColor));
|
view.setInt(R.id.tt_item_name, "setTextColor", getColor(context, witem.NameColor));
|
||||||
view.setInt(R.id.tt_item_name_nodesc, "setTextColor", getColor(context, witem.NameNodescColor));
|
view.setInt(R.id.tt_item_name_nodesc, "setTextColor", getColor(context, witem.NameNodescColor));
|
||||||
view.setInt(R.id.tt_item_desc, "setTextColor", getColor(context, witem.DescColor));
|
view.setInt(R.id.tt_item_desc, "setTextColor", getColor(context, witem.DescColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColor(Context context, int color) {
|
public int getColor(Context context, int color) {
|
||||||
return context.getResources().getColor(color);
|
return context.getResources().getColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RemoteViews getViewAt(int position) {
|
public RemoteViews getViewAt(int position) {
|
||||||
RemoteViews view = new RemoteViews(context.getPackageName(), R.layout.timetable_item);
|
RemoteViews view = new RemoteViews(context.getPackageName(), R.layout.timetable_item);
|
||||||
|
|
||||||
witem = defaultItem(theme);
|
witem = defaultItem(theme);
|
||||||
|
|
||||||
Lesson curr_subject = day_subjects.get(position);
|
Lesson curr_subject = day_subjects.get(position);
|
||||||
|
|
||||||
if (curr_subject.status.equals("empty")) {
|
if (curr_subject.status.equals("empty")) {
|
||||||
witem.NumColor = R.color.text_miss_num;
|
witem.NumColor = R.color.text_miss_num;
|
||||||
|
|
||||||
witem.TimeVisibility = View.GONE;
|
witem.TimeVisibility = View.GONE;
|
||||||
witem.RoomVisibility = View.GONE;
|
witem.RoomVisibility = View.GONE;
|
||||||
|
|
||||||
witem.NameNodescColor = R.color.text_miss;
|
witem.NameNodescColor = R.color.text_miss;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!curr_subject.substituteTeacher.equals("null")) {
|
if (!curr_subject.substituteTeacher.equals("null")) {
|
||||||
witem.NumColor = R.color.yellow;
|
witem.NumColor = R.color.yellow;
|
||||||
witem.Layout = R.drawable.card_layout_tile_helyetesitett;
|
witem.Layout = R.drawable.card_layout_tile_helyetesitett;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curr_subject.status.equals("Elmaradt")) {
|
if (curr_subject.status.equals("Elmaradt")) {
|
||||||
witem.NumColor = R.color.red;
|
witem.NumColor = R.color.red;
|
||||||
witem.Layout = R.drawable.card_layout_tile_elmarad;
|
witem.Layout = R.drawable.card_layout_tile_elmarad;
|
||||||
} else if (curr_subject.status.equals("TanevRendjeEsemeny")) {
|
} else if (curr_subject.status.equals("TanevRendjeEsemeny")) {
|
||||||
witem.NumVisibility = View.GONE;
|
witem.NumVisibility = View.GONE;
|
||||||
witem.TimeVisibility = View.GONE;
|
witem.TimeVisibility = View.GONE;
|
||||||
witem.RoomVisibility = View.GONE;
|
witem.RoomVisibility = View.GONE;
|
||||||
|
|
||||||
witem.NameNodescPadding[0] = 50;
|
witem.NameNodescPadding[0] = 50;
|
||||||
witem.NameNodescPadding[2] = 50;
|
witem.NameNodescPadding[2] = 50;
|
||||||
|
|
||||||
witem.NameNodescColor = R.color.text_miss;
|
witem.NameNodescColor = R.color.text_miss;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curr_subject.lessonTopic.equals("null")) {
|
if (curr_subject.lessonTopic.equals("null")) {
|
||||||
witem.DescVisibility = View.GONE;
|
witem.DescVisibility = View.GONE;
|
||||||
witem.NameVisibility = View.GONE;
|
witem.NameVisibility = View.GONE;
|
||||||
|
|
||||||
witem.NameNodescVisibility = View.VISIBLE;
|
witem.NameNodescVisibility = View.VISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
setLayout(view);
|
setLayout(view);
|
||||||
|
|
||||||
String lessonIndexTrailing = curr_subject.lessonIndex.equals("+") ? "" : ".";
|
String lessonIndexTrailing = curr_subject.lessonIndex.equals("+") ? "" : ".";
|
||||||
|
|
||||||
view.setTextViewText(R.id.tt_item_num, curr_subject.lessonIndex + lessonIndexTrailing);
|
view.setTextViewText(R.id.tt_item_num, curr_subject.lessonIndex + lessonIndexTrailing);
|
||||||
view.setTextViewText(R.id.tt_item_name, curr_subject.lessonName);
|
view.setTextViewText(R.id.tt_item_name, curr_subject.lessonName);
|
||||||
view.setTextViewText(R.id.tt_item_name_nodesc, curr_subject.lessonName);
|
view.setTextViewText(R.id.tt_item_name_nodesc, curr_subject.lessonName);
|
||||||
view.setTextViewText(R.id.tt_item_desc, curr_subject.lessonTopic);
|
view.setTextViewText(R.id.tt_item_desc, curr_subject.lessonTopic);
|
||||||
view.setTextViewText(R.id.tt_item_room, curr_subject.lessonRoom);
|
view.setTextViewText(R.id.tt_item_room, curr_subject.lessonRoom);
|
||||||
if(curr_subject.lessonStart != 0 && curr_subject.lessonEnd != 0)
|
if(curr_subject.lessonStart != 0 && curr_subject.lessonEnd != 0)
|
||||||
view.setTextViewText(R.id.tt_item_time, WidgetTimetable.zeroPad(new DateTime(curr_subject.lessonStart).getHourOfDay(), 2) + ":" + WidgetTimetable.zeroPad(new DateTime(curr_subject.lessonStart).getMinuteOfHour(), 2) +
|
view.setTextViewText(R.id.tt_item_time, WidgetTimetable.zeroPad(new DateTime(curr_subject.lessonStart).getHourOfDay(), 2) + ":" + WidgetTimetable.zeroPad(new DateTime(curr_subject.lessonStart).getMinuteOfHour(), 2) +
|
||||||
"\n" + WidgetTimetable.zeroPad(new DateTime(curr_subject.lessonEnd).getHourOfDay(), 2) + ":" + WidgetTimetable.zeroPad(new DateTime(curr_subject.lessonEnd).getMinuteOfHour(),2));
|
"\n" + WidgetTimetable.zeroPad(new DateTime(curr_subject.lessonEnd).getHourOfDay(), 2) + ":" + WidgetTimetable.zeroPad(new DateTime(curr_subject.lessonEnd).getMinuteOfHour(),2));
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RemoteViews getLoadingView() {
|
public RemoteViews getLoadingView() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getViewTypeCount() {
|
public int getViewTypeCount() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getItemId(int position) {
|
public long getItemId(int position) {
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasStableIds() {
|
public boolean hasStableIds() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initData() {
|
private void initData() {
|
||||||
|
|
||||||
theme = getThemeAccent(context);
|
theme = getThemeAccent(context);
|
||||||
|
|
||||||
rday = WidgetTimetable.selectDay(context, appWidgetId, 0, false);
|
rday = WidgetTimetable.selectDay(context, appWidgetId, 0, false);
|
||||||
|
|
||||||
day_subjects.clear();
|
day_subjects.clear();
|
||||||
lessonIndexes.clear();
|
lessonIndexes.clear();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<JSONArray> arr = WidgetTimetable.genJsonDays(context);
|
List<JSONArray> arr = WidgetTimetable.genJsonDays(context);
|
||||||
|
|
||||||
if(arr.isEmpty()) {
|
if(arr.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONArray arr_lessons = WidgetTimetable.genJsonDays(context).get(rday);
|
JSONArray arr_lessons = WidgetTimetable.genJsonDays(context).get(rday);
|
||||||
|
|
||||||
for (int i = 0; i < arr_lessons.length(); i++) {
|
for (int i = 0; i < arr_lessons.length(); i++) {
|
||||||
JSONObject obj_lessons = arr_lessons.getJSONObject(i);
|
JSONObject obj_lessons = arr_lessons.getJSONObject(i);
|
||||||
|
|
||||||
day_subjects.add(jsonToLesson(obj_lessons));
|
day_subjects.add(jsonToLesson(obj_lessons));
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(day_subjects.size() > 0) {
|
if(day_subjects.size() > 0) {
|
||||||
Collections.sort(day_subjects, new Comparator<Lesson>() {
|
Collections.sort(day_subjects, new Comparator<Lesson>() {
|
||||||
public int compare(Lesson o1, Lesson o2) {
|
public int compare(Lesson o1, Lesson o2) {
|
||||||
return new DateTime(o1.lessonStart).compareTo(new DateTime(o2.lessonStart));
|
return new DateTime(o1.lessonStart).compareTo(new DateTime(o2.lessonStart));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (int i = 0; i < day_subjects.size(); i++) {
|
for (int i = 0; i < day_subjects.size(); i++) {
|
||||||
if(!day_subjects.get(i).lessonIndex.equals("+")) {
|
if(!day_subjects.get(i).lessonIndex.equals("+")) {
|
||||||
lessonIndexes.add(Integer.valueOf(day_subjects.get(i).lessonIndex));
|
lessonIndexes.add(Integer.valueOf(day_subjects.get(i).lessonIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lessonIndexes.size() > 0) {
|
if(lessonIndexes.size() > 0) {
|
||||||
|
|
||||||
int lessonsChecked = Collections.min(lessonIndexes);
|
int lessonsChecked = Collections.min(lessonIndexes);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while(lessonsChecked < Collections.max(lessonIndexes)) {
|
while(lessonsChecked < Collections.max(lessonIndexes)) {
|
||||||
if(!lessonIndexes.contains(lessonsChecked)) {
|
if(!lessonIndexes.contains(lessonsChecked)) {
|
||||||
day_subjects.add(i, emptyLesson(lessonsChecked));
|
day_subjects.add(i, emptyLesson(lessonsChecked));
|
||||||
}
|
}
|
||||||
lessonsChecked++;
|
lessonsChecked++;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getThemeAccent(Context context) {
|
public static Integer getThemeAccent(Context context) {
|
||||||
DBManager dbManager = new DBManager(context.getApplicationContext());
|
DBManager dbManager = new DBManager(context.getApplicationContext());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dbManager.open();
|
dbManager.open();
|
||||||
Cursor cursor = dbManager.fetchTheme();
|
Cursor cursor = dbManager.fetchTheme();
|
||||||
dbManager.close();
|
dbManager.close();
|
||||||
|
|
||||||
return cursor.getInt(1);
|
return cursor.getInt(1);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item defaultItem(int theme) {
|
public Item defaultItem(int theme) {
|
||||||
return new Item(
|
return new Item(
|
||||||
R.drawable.card_layout_tile,
|
R.drawable.card_layout_tile,
|
||||||
View.VISIBLE,
|
View.VISIBLE,
|
||||||
View.VISIBLE,
|
View.VISIBLE,
|
||||||
View.INVISIBLE,
|
View.INVISIBLE,
|
||||||
View.VISIBLE,
|
View.VISIBLE,
|
||||||
View.VISIBLE,
|
View.VISIBLE,
|
||||||
View.VISIBLE,
|
View.VISIBLE,
|
||||||
colorValues[theme >= colorValues.length ? 0 : theme],
|
colorValues[theme >= colorValues.length ? 0 : theme],
|
||||||
R.color.text,
|
R.color.text,
|
||||||
R.color.text,
|
R.color.text,
|
||||||
R.color.text_desc
|
R.color.text_desc
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Lesson emptyLesson(int lessonIndex) {
|
public Lesson emptyLesson(int lessonIndex) {
|
||||||
return new Lesson("empty", String.valueOf(lessonIndex), "Lyukasóra", "null", "null", 0, 0, "null");
|
return new Lesson("empty", String.valueOf(lessonIndex), "Lyukasóra", "null", "null", 0, 0, "null");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Lesson jsonToLesson(JSONObject json) {
|
public Lesson jsonToLesson(JSONObject json) {
|
||||||
try {
|
try {
|
||||||
return new Lesson(
|
String name = json.getString("Nev");
|
||||||
json.getJSONObject("Allapot").getString("Nev"),
|
name = name.substring(0, 1).toUpperCase() + name.substring(1); // Capitalize name
|
||||||
!json.getString("Oraszam").equals("null") ? json.getString("Oraszam") : "+",
|
return new Lesson(
|
||||||
json.getString("Nev"),
|
json.getJSONObject("Allapot").getString("Nev"),
|
||||||
json.getString("Tema"),
|
!json.getString("Oraszam").equals("null") ? json.getString("Oraszam") : "+",
|
||||||
json.getString("TeremNeve"),
|
name,
|
||||||
new DateTime(json.getString("KezdetIdopont")).getMillis(),
|
json.getString("Tema"),
|
||||||
new DateTime(json.getString("VegIdopont")).getMillis(),
|
json.getString("TeremNeve"),
|
||||||
json.getString("HelyettesTanarNeve")
|
new DateTime(json.getString("KezdetIdopont")).getMillis(),
|
||||||
);
|
new DateTime(json.getString("VegIdopont")).getMillis(),
|
||||||
}catch (Exception e) {
|
json.getString("HelyettesTanarNeve")
|
||||||
Log.d("Filc", "exception: " + e);
|
);
|
||||||
};
|
}catch (Exception e) {
|
||||||
|
Log.d("Filc", "exception: " + e);
|
||||||
return null;
|
};
|
||||||
}
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package hu.refilc.naplo.widget_timetable;
|
package hu.refilc.naplo.widget_timetable;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.widget.RemoteViewsService;
|
import android.widget.RemoteViewsService;
|
||||||
|
|
||||||
public class WidgetTimetableService extends RemoteViewsService {
|
public class WidgetTimetableService extends RemoteViewsService {
|
||||||
@Override
|
@Override
|
||||||
public RemoteViewsFactory onGetViewFactory(Intent intent) {
|
public RemoteViewsFactory onGetViewFactory(Intent intent) {
|
||||||
return new WidgetTimetableDataProvider(getApplicationContext(), intent);
|
return new WidgetTimetableDataProvider(getApplicationContext(), intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<gradient
|
|
||||||
android:startColor="#123323"
|
|
||||||
android:endColor="#20AC9B"
|
|
||||||
android:angle="135" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</selector>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/launch_gradient_background" />
|
|
||||||
<item>
|
|
||||||
<bitmap android:gravity="center" android:src="@mipmap/ic_splash"/>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<gradient
|
|
||||||
android:startColor="#123323"
|
|
||||||
android:endColor="#20AC9B"
|
|
||||||
android:angle="135" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</selector>
|
|
||||||
BIN
filcnaplo/android/app/src/main/res/drawable/ic_notification.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<gradient
|
|
||||||
android:startColor="#123323"
|
|
||||||
android:endColor="#20AC9B"
|
|
||||||
android:angle="135" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</selector>
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/main_lay"
|
android:id="@+id/main_lay"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
@@ -15,12 +16,14 @@
|
|||||||
android:id="@+id/tt_item_num"
|
android:id="@+id/tt_item_num"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:fontFamily="@font/montserrat_medium"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="1."
|
||||||
|
android:textColor="@color/filc"
|
||||||
|
android:textColorLink="#ff3D7BF4"
|
||||||
android:textSize="30sp"
|
android:textSize="30sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:fontFamily="@font/montserrat_medium"
|
tools:ignore="HardcodedText" />
|
||||||
android:text="1."
|
|
||||||
android:gravity="center"
|
|
||||||
android:textColor="@color/filc"></TextView>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tt_item_name"
|
android:id="@+id/tt_item_name"
|
||||||
@@ -33,10 +36,11 @@
|
|||||||
android:text="Óra neve"
|
android:text="Óra neve"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:layout_toLeftOf="@id/tt_item_room"
|
android:layout_toStartOf="@id/tt_item_room"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_toRightOf="@id/tt_item_num"
|
android:layout_toEndOf="@id/tt_item_num"
|
||||||
android:textColor="@color/text"></TextView>
|
android:textColor="@color/text"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tt_item_name_nodesc"
|
android:id="@+id/tt_item_name_nodesc"
|
||||||
@@ -47,13 +51,14 @@
|
|||||||
android:fontFamily="@font/montserrat_medium"
|
android:fontFamily="@font/montserrat_medium"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_marginTop="2.5dp"
|
android:layout_marginTop="2.5dp"
|
||||||
android:layout_toLeftOf="@id/tt_item_room"
|
android:layout_toStartOf="@id/tt_item_room"
|
||||||
android:text="Óra neve"
|
android:text="Óra neve"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_toRightOf="@id/tt_item_num"
|
android:layout_toEndOf="@id/tt_item_num"
|
||||||
android:textColor="@color/text"></TextView>
|
android:textColor="@color/text"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tt_item_desc"
|
android:id="@+id/tt_item_desc"
|
||||||
@@ -67,10 +72,11 @@
|
|||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_toRightOf="@id/tt_item_num"
|
android:layout_toEndOf="@id/tt_item_num"
|
||||||
android:layout_toLeftOf="@id/tt_item_room"
|
android:layout_toStartOf="@id/tt_item_room"
|
||||||
android:layout_below="@id/tt_item_name"
|
android:layout_below="@id/tt_item_name"
|
||||||
android:textColor="@color/text_desc"></TextView>
|
android:textColor="@color/text_desc"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tt_item_room"
|
android:id="@+id/tt_item_room"
|
||||||
@@ -84,8 +90,9 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_toLeftOf="@id/tt_item_time"
|
android:layout_toStartOf="@id/tt_item_time"
|
||||||
android:textColor="@color/text_desc"></TextView>
|
android:textColor="@color/text_desc"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tt_item_time"
|
android:id="@+id/tt_item_time"
|
||||||
@@ -95,11 +102,12 @@
|
|||||||
android:textFontWeight="500"
|
android:textFontWeight="500"
|
||||||
android:fontFamily="@font/montserrat_medium"
|
android:fontFamily="@font/montserrat_medium"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:layout_marginLeft="2dp"
|
android:layout_marginStart="2dp"
|
||||||
android:layout_marginTop="-2dp"
|
android:layout_marginTop="-2dp"
|
||||||
android:text="8:30\n9:10"
|
android:text="8:30\n9:10"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:textColor="@color/white"></TextView>
|
android:textColor="@color/white"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Empty"
|
android:text="Üres / Empty"
|
||||||
|
android:background="@drawable/widget_card_bottom_dark"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/widget_list"
|
android:id="@+id/widget_list"
|
||||||
@@ -43,57 +45,63 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="45dp"
|
android:layout_height="45dp"
|
||||||
android:background="@drawable/widget_card_top_dark">
|
android:background="@drawable/widget_card_top_dark">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/nav_refresh"
|
android:id="@+id/nav_refresh"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_toStartOf="@id/nav_to_left"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:padding="10dp"
|
||||||
android:src="@drawable/ic_refresh_cw"
|
android:src="@drawable/ic_refresh_cw"
|
||||||
android:layout_toLeftOf="@id/nav_to_left"
|
|
||||||
android:tint="@color/text_desc"
|
android:tint="@color/text_desc"
|
||||||
tools:ignore="UseAppTint"
|
tools:ignore="UseAppTint"
|
||||||
android:padding="10dp" />
|
android:focusable="true" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/nav_to_left"
|
android:id="@+id/nav_to_left"
|
||||||
android:layout_width="50dp"
|
android:layout_width="45dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_toStartOf="@id/nav_to_right"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:padding="10dp"
|
||||||
android:src="@drawable/ic_chevron_left"
|
android:src="@drawable/ic_chevron_left"
|
||||||
android:layout_toLeftOf="@id/nav_to_right"
|
|
||||||
android:tint="@color/text_desc"
|
android:tint="@color/text_desc"
|
||||||
tools:ignore="UseAppTint"
|
tools:ignore="UseAppTint"
|
||||||
android:padding="10dp" />
|
android:focusable="true" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/nav_to_right"
|
android:id="@+id/nav_to_right"
|
||||||
android:layout_width="50dp"
|
android:layout_width="45dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:padding="10dp"
|
||||||
android:src="@drawable/ic_chevron_right"
|
android:src="@drawable/ic_chevron_right"
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:tint="@color/text_desc"
|
android:tint="@color/text_desc"
|
||||||
tools:ignore="UseAppTint"
|
tools:ignore="UseAppTint"
|
||||||
android:padding="10dp" />
|
android:focusable="true" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/nav_current"
|
android:id="@+id/nav_current"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_marginLeft="20sp"
|
android:layout_marginStart="15sp"
|
||||||
android:layout_toLeftOf="@id/nav_refresh"
|
android:layout_marginTop="2sp"
|
||||||
|
android:layout_toStartOf="@id/nav_refresh"
|
||||||
android:fontFamily="@font/montserrat_medium"
|
android:fontFamily="@font/montserrat_medium"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:text="Timetable"
|
android:text="Órarend"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
android:textSize="24sp"
|
android:textSize="22sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
@@ -128,11 +136,12 @@
|
|||||||
android:layout_below="@id/iv_1"
|
android:layout_below="@id/iv_1"
|
||||||
android:layout_marginHorizontal="15dp"
|
android:layout_marginHorizontal="15dp"
|
||||||
android:fontFamily="@font/montserrat_medium"
|
android:fontFamily="@font/montserrat_medium"
|
||||||
android:text="A widget használatához, bejelentkezés szükséges."
|
android:text="A widget használatához bejelentkezés szükséges."
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
android:textSize="17dp"
|
android:textSize="17sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/open_login"
|
android:id="@+id/open_login"
|
||||||
@@ -145,8 +154,9 @@
|
|||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:fontFamily="@font/montserrat_medium"
|
android:fontFamily="@font/montserrat_medium"
|
||||||
android:textSize="16dp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
@@ -185,8 +195,9 @@
|
|||||||
android:text="Órák a kezdőképernyőd kényelméből."
|
android:text="Órák a kezdőképernyőd kényelméből."
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
android:textSize="16dp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -197,7 +208,8 @@
|
|||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:layout_marginTop="0dp"
|
android:layout_marginTop="0dp"
|
||||||
android:layout_marginHorizontal="15dp"
|
android:layout_marginHorizontal="15dp"
|
||||||
android:textSize="14dp" />
|
android:textSize="14sp"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buy_premium"
|
android:id="@+id/buy_premium"
|
||||||
@@ -211,8 +223,9 @@
|
|||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:textColor="#ff691A9B"
|
android:textColor="#ff691A9B"
|
||||||
android:fontFamily="@font/montserrat_medium"
|
android:fontFamily="@font/montserrat_medium"
|
||||||
android:textSize="16dp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 11 KiB |
@@ -1,12 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<style name="Widget.Android.AppWidget.Container" parent="android:Widget">
|
|
||||||
<item name="android:padding">?attr/appWidgetPadding</item>
|
|
||||||
<item name="android:background">@drawable/app_widget_background</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Widget.Android.AppWidget.InnerView" parent="android:Widget">
|
|
||||||
<item name="android:padding">?attr/appWidgetPadding</item>
|
|
||||||
<item name="android:background">@drawable/app_widget_inner_view_background</item>
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
<color name="yellow_light">#ffFFCC00</color>
|
<color name="yellow_light">#ffFFCC00</color>
|
||||||
<color name="light_yellow_light">#40FFD60A</color>
|
<color name="light_yellow_light">#40FFD60A</color>
|
||||||
<color name="green_light">#ff34C759</color>
|
<color name="green_light">#ff34C759</color>
|
||||||
<color name="filc_light">#ff247665</color>
|
<color name="filc_light">#ff3D7BF4</color>
|
||||||
<color name="teal_light">#ff5AC8FA</color>
|
<color name="teal_light">#ff5AC8FA</color>
|
||||||
<color name="blue_light">#ff007AFF</color>
|
<color name="blue_light">#ff007AFF</color>
|
||||||
<color name="indigo_light">#ff5856D6</color>
|
<color name="indigo_light">#ff5856D6</color>
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
<color name="yellow">#ffFFD60A</color>
|
<color name="yellow">#ffFFD60A</color>
|
||||||
<color name="light_yellow">#40FFD60A</color>
|
<color name="light_yellow">#40FFD60A</color>
|
||||||
<color name="green">#ff32D74B</color>
|
<color name="green">#ff32D74B</color>
|
||||||
<color name="filc">#ff29826F</color>
|
<color name="filc">#ff3D7BF4</color>
|
||||||
<color name="teal">#ff64D2FF</color>
|
<color name="teal">#ff64D2FF</color>
|
||||||
<color name="blue">#ff0A84FF</color>
|
<color name="blue">#ff0A84FF</color>
|
||||||
<color name="indigo">#ff5E5CE6</color>
|
<color name="indigo">#ff5E5CE6</color>
|
||||||
|
|||||||
BIN
filcnaplo/assets/images/card_border.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
filcnaplo/assets/images/static_confetti.png
Normal file
|
After Width: | Height: | Size: 126 KiB |
BIN
filcnaplo/assets/images/subject_covers/math_light.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
@@ -1,3 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
flutter clean
|
||||||
|
dart pub get
|
||||||
|
flutter doctor -v
|
||||||
|
|
||||||
flutter build ipa --release --dart-define=APPVER=$(cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1) --no-tree-shake-icons
|
flutter build ipa --release --dart-define=APPVER=$(cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1) --no-tree-shake-icons
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
// This is a generated file; do not edit or check into version control.
|
|
||||||
FLUTTER_ROOT=/Users/kima/development/flutter
|
|
||||||
FLUTTER_APPLICATION_PATH=/Users/kima/Documents/refilc/app/naplo/filcnaplo
|
|
||||||
COCOAPODS_PARALLEL_CODE_SIGN=true
|
|
||||||
FLUTTER_TARGET=/Users/kima/Documents/refilc/app/naplo/filcnaplo/lib/main.dart
|
|
||||||
FLUTTER_BUILD_DIR=build
|
|
||||||
FLUTTER_BUILD_NAME=3.5.1
|
|
||||||
FLUTTER_BUILD_NUMBER=197
|
|
||||||
EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386
|
|
||||||
EXCLUDED_ARCHS[sdk=iphoneos*]=armv7
|
|
||||||
DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9iNGZiMTEyMTRkZDJkZGE2Y2UwMTJkZDk4ZWE0OThlOWU4YjkxMjYyLw==
|
|
||||||
DART_OBFUSCATION=false
|
|
||||||
TRACK_WIDGET_CREATION=true
|
|
||||||
TREE_SHAKE_ICONS=false
|
|
||||||
PACKAGE_CONFIG=/Users/kima/Documents/refilc/app/naplo/filcnaplo/.dart_tool/package_config.json
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# Uncomment this line to define a global platform for your project
|
# Uncomment this line to define a global platform for your project
|
||||||
# platform :ios, '11.0'
|
platform :ios, '12.0'
|
||||||
|
|
||||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
@@ -39,5 +39,8 @@ end
|
|||||||
post_install do |installer|
|
post_install do |installer|
|
||||||
installer.pods_project.targets.each do |target|
|
installer.pods_project.targets.each do |target|
|
||||||
flutter_additional_ios_build_settings(target)
|
flutter_additional_ios_build_settings(target)
|
||||||
|
target.build_configurations.each do |config|
|
||||||
|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,237 +0,0 @@
|
|||||||
PODS:
|
|
||||||
- app_group_directory (1.0.0):
|
|
||||||
- Flutter
|
|
||||||
- background_fetch (1.1.6):
|
|
||||||
- Flutter
|
|
||||||
- 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
|
|
||||||
- flutter_image_compress (1.0.0):
|
|
||||||
- Flutter
|
|
||||||
- Mantle
|
|
||||||
- SDWebImage
|
|
||||||
- SDWebImageWebPCoder
|
|
||||||
- flutter_local_notifications (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- flutter_native_image (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- flutter_native_splash (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- FMDB (2.7.5):
|
|
||||||
- FMDB/standard (= 2.7.5)
|
|
||||||
- FMDB/standard (2.7.5)
|
|
||||||
- home_widget (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- image_picker_ios (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- libwebp (1.2.4):
|
|
||||||
- libwebp/demux (= 1.2.4)
|
|
||||||
- libwebp/mux (= 1.2.4)
|
|
||||||
- libwebp/webp (= 1.2.4)
|
|
||||||
- libwebp/demux (1.2.4):
|
|
||||||
- libwebp/webp
|
|
||||||
- libwebp/mux (1.2.4):
|
|
||||||
- libwebp/demux
|
|
||||||
- libwebp/webp (1.2.4)
|
|
||||||
- live_activities (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- Mantle (2.2.0):
|
|
||||||
- Mantle/extobjc (= 2.2.0)
|
|
||||||
- Mantle/extobjc (2.2.0)
|
|
||||||
- open_file (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- package_info_plus (0.4.5):
|
|
||||||
- Flutter
|
|
||||||
- path_provider_foundation (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- FlutterMacOS
|
|
||||||
- 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)
|
|
||||||
- SDWebImageWebPCoder (0.9.1):
|
|
||||||
- libwebp (~> 1.0)
|
|
||||||
- SDWebImage/Core (~> 5.13)
|
|
||||||
- share_plus (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- sqflite (0.0.3):
|
|
||||||
- Flutter
|
|
||||||
- FMDB (>= 2.7.5)
|
|
||||||
- SwiftyGif (5.4.3)
|
|
||||||
- uni_links (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- url_launcher_ios (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- workmanager (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
|
|
||||||
DEPENDENCIES:
|
|
||||||
- app_group_directory (from `.symlinks/plugins/app_group_directory/ios`)
|
|
||||||
- background_fetch (from `.symlinks/plugins/background_fetch/ios`)
|
|
||||||
- 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`)
|
|
||||||
- flutter_image_compress (from `.symlinks/plugins/flutter_image_compress/ios`)
|
|
||||||
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
|
||||||
- flutter_native_image (from `.symlinks/plugins/flutter_native_image/ios`)
|
|
||||||
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
|
||||||
- home_widget (from `.symlinks/plugins/home_widget/ios`)
|
|
||||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
|
||||||
- live_activities (from `.symlinks/plugins/live_activities/ios`)
|
|
||||||
- open_file (from `.symlinks/plugins/open_file/ios`)
|
|
||||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
|
||||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
|
||||||
- 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`)
|
|
||||||
- uni_links (from `.symlinks/plugins/uni_links/ios`)
|
|
||||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
|
||||||
- workmanager (from `.symlinks/plugins/workmanager/ios`)
|
|
||||||
|
|
||||||
SPEC REPOS:
|
|
||||||
trunk:
|
|
||||||
- DKPhotoGallery
|
|
||||||
- FMDB
|
|
||||||
- libwebp
|
|
||||||
- Mantle
|
|
||||||
- ReachabilitySwift
|
|
||||||
- SDWebImage
|
|
||||||
- SDWebImageWebPCoder
|
|
||||||
- SwiftyGif
|
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
|
||||||
app_group_directory:
|
|
||||||
:path: ".symlinks/plugins/app_group_directory/ios"
|
|
||||||
background_fetch:
|
|
||||||
:path: ".symlinks/plugins/background_fetch/ios"
|
|
||||||
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"
|
|
||||||
flutter_image_compress:
|
|
||||||
:path: ".symlinks/plugins/flutter_image_compress/ios"
|
|
||||||
flutter_local_notifications:
|
|
||||||
:path: ".symlinks/plugins/flutter_local_notifications/ios"
|
|
||||||
flutter_native_image:
|
|
||||||
:path: ".symlinks/plugins/flutter_native_image/ios"
|
|
||||||
flutter_native_splash:
|
|
||||||
:path: ".symlinks/plugins/flutter_native_splash/ios"
|
|
||||||
home_widget:
|
|
||||||
:path: ".symlinks/plugins/home_widget/ios"
|
|
||||||
image_picker_ios:
|
|
||||||
:path: ".symlinks/plugins/image_picker_ios/ios"
|
|
||||||
live_activities:
|
|
||||||
:path: ".symlinks/plugins/live_activities/ios"
|
|
||||||
open_file:
|
|
||||||
:path: ".symlinks/plugins/open_file/ios"
|
|
||||||
package_info_plus:
|
|
||||||
:path: ".symlinks/plugins/package_info_plus/ios"
|
|
||||||
path_provider_foundation:
|
|
||||||
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
|
||||||
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"
|
|
||||||
uni_links:
|
|
||||||
:path: ".symlinks/plugins/uni_links/ios"
|
|
||||||
url_launcher_ios:
|
|
||||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
|
||||||
workmanager:
|
|
||||||
:path: ".symlinks/plugins/workmanager/ios"
|
|
||||||
|
|
||||||
CHECKOUT OPTIONS:
|
|
||||||
DKImagePickerController:
|
|
||||||
:commit: a727e44718a67e300089174e5591166045815ba4
|
|
||||||
:git: https://github.com/zhangao0086/DKImagePickerController.git
|
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
|
||||||
app_group_directory: 7bf9f8f9819ead554de29da7c25fb7a680d6a9a0
|
|
||||||
background_fetch: bc9b44b0bf8b434e282a2ac9be8662800a0296ed
|
|
||||||
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
|
|
||||||
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
|
|
||||||
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
|
|
||||||
file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95
|
|
||||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
|
||||||
flutter_custom_tabs: 7a10a08686955cb748e5d26e0ae586d30689bf89
|
|
||||||
flutter_image_compress: 5a5e9aee05b6553048b8df1c3bc456d0afaac433
|
|
||||||
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
|
|
||||||
flutter_native_image: 9c0b7451838484458e5b0fae007b86a4c2d4bdfe
|
|
||||||
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
|
|
||||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
|
||||||
home_widget: 2829415127ee92e876f816cbbe44c0b6601b8a37
|
|
||||||
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
|
|
||||||
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
|
|
||||||
live_activities: 9ff56a06a2d43ecd68f56deeed13b18a8304789c
|
|
||||||
Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d
|
|
||||||
open_file: 02eb5cb6b21264bd3a696876f5afbfb7ca4f4b7d
|
|
||||||
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
|
|
||||||
path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8
|
|
||||||
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
|
|
||||||
quick_actions_ios: 9e80dcfadfbc5d47d9cf8f47bcf428b11cf383d4
|
|
||||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
|
||||||
SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866
|
|
||||||
SDWebImageWebPCoder: 18503de6621dd2c420d680e33d46bf8e1d5169b0
|
|
||||||
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
|
|
||||||
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
|
|
||||||
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
|
|
||||||
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
|
|
||||||
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
|
|
||||||
workmanager: 0afdcf5628bbde6924c21af7836fed07b42e30e6
|
|
||||||
|
|
||||||
PODFILE CHECKSUM: efe5e2e257c61a1c3d5be693ef1a8ea1c4b81d8f
|
|
||||||
|
|
||||||
COCOAPODS: 1.12.1
|
|
||||||
@@ -198,9 +198,9 @@
|
|||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 3127F79F28EAEDE300C2EFB3 /* Build configuration list for PBXNativeTarget "livecard" */;
|
buildConfigurationList = 3127F79F28EAEDE300C2EFB3 /* Build configuration list for PBXNativeTarget "livecard" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
|
3127F78A28EAEDE200C2EFB3 /* Resources */,
|
||||||
3127F78828EAEDE200C2EFB3 /* Sources */,
|
3127F78828EAEDE200C2EFB3 /* Sources */,
|
||||||
3127F78928EAEDE200C2EFB3 /* Frameworks */,
|
3127F78928EAEDE200C2EFB3 /* Frameworks */,
|
||||||
3127F78A28EAEDE200C2EFB3 /* Resources */,
|
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@@ -221,9 +221,9 @@
|
|||||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||||
97C146EC1CF9000F007C117D /* Resources */,
|
97C146EC1CF9000F007C117D /* Resources */,
|
||||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||||
|
3127F74F28EAEC8A00C2EFB3 /* Embed Foundation Extensions */,
|
||||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||||
71459C0EB905E05018E3D78F /* [CP] Embed Pods Frameworks */,
|
71459C0EB905E05018E3D78F /* [CP] Embed Pods Frameworks */,
|
||||||
3127F74F28EAEC8A00C2EFB3 /* Embed Foundation Extensions */,
|
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@@ -299,7 +299,7 @@
|
|||||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
alwaysOutOfDate = 1;
|
alwaysOutOfDate = 1;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 12;
|
||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
inputPaths = (
|
inputPaths = (
|
||||||
@@ -310,11 +310,11 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
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\n";
|
||||||
};
|
};
|
||||||
71459C0EB905E05018E3D78F /* [CP] Embed Pods Frameworks */ = {
|
71459C0EB905E05018E3D78F /* [CP] Embed Pods Frameworks */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 12;
|
||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
inputFileListPaths = (
|
inputFileListPaths = (
|
||||||
@@ -364,7 +364,7 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
|
||||||
};
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
@@ -478,7 +478,7 @@
|
|||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 195;
|
CURRENT_PROJECT_VERSION = 195;
|
||||||
DEVELOPMENT_TEAM = 48XS7JAZB7;
|
DEVELOPMENT_TEAM = 4DKAF249F3;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = reFilc;
|
INFOPLIST_KEY_CFBundleDisplayName = reFilc;
|
||||||
@@ -488,7 +488,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 3.6.0;
|
MARKETING_VERSION = 3.6.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.refilc.naplo;
|
PRODUCT_BUNDLE_IDENTIFIER = com.refilc2.naplo;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@@ -510,7 +510,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = 48XS7JAZB7;
|
DEVELOPMENT_TEAM = 4DKAF249F3;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = livecard/Info.plist;
|
INFOPLIST_FILE = livecard/Info.plist;
|
||||||
@@ -526,7 +526,7 @@
|
|||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.refilc.naplo.livecardpro;
|
PRODUCT_BUNDLE_IDENTIFIER = com.refilc2.naplo.livecardpro;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
@@ -552,7 +552,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = 48XS7JAZB7;
|
DEVELOPMENT_TEAM = 4DKAF249F3;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = livecard/Info.plist;
|
INFOPLIST_FILE = livecard/Info.plist;
|
||||||
@@ -567,7 +567,7 @@
|
|||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.refilc.naplo.livecardpro;
|
PRODUCT_BUNDLE_IDENTIFIER = com.refilc2.naplo.livecardpro;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
@@ -592,7 +592,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = 48XS7JAZB7;
|
DEVELOPMENT_TEAM = 4DKAF249F3;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = livecard/Info.plist;
|
INFOPLIST_FILE = livecard/Info.plist;
|
||||||
@@ -607,7 +607,7 @@
|
|||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.refilc.naplo.livecardpro;
|
PRODUCT_BUNDLE_IDENTIFIER = com.refilc2.naplo.livecardpro;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
@@ -736,7 +736,7 @@
|
|||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 195;
|
CURRENT_PROJECT_VERSION = 195;
|
||||||
DEVELOPMENT_TEAM = 48XS7JAZB7;
|
DEVELOPMENT_TEAM = 4DKAF249F3;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = reFilc;
|
INFOPLIST_KEY_CFBundleDisplayName = reFilc;
|
||||||
@@ -746,7 +746,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 3.6.0;
|
MARKETING_VERSION = 3.6.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.refilc.naplo;
|
PRODUCT_BUNDLE_IDENTIFIER = com.refilc2.naplo;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
@@ -764,7 +764,7 @@
|
|||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 195;
|
CURRENT_PROJECT_VERSION = 195;
|
||||||
DEVELOPMENT_TEAM = 48XS7JAZB7;
|
DEVELOPMENT_TEAM = 4DKAF249F3;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = reFilc;
|
INFOPLIST_KEY_CFBundleDisplayName = reFilc;
|
||||||
@@ -774,7 +774,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 3.6.0;
|
MARKETING_VERSION = 3.6.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.refilc.naplo;
|
PRODUCT_BUNDLE_IDENTIFIER = com.refilc2.naplo;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
<!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>
|
||||||
|
<string>development</string>
|
||||||
<key>com.apple.security.application-groups</key>
|
<key>com.apple.security.application-groups</key>
|
||||||
<array>
|
<array>
|
||||||
<string>group.refilcnaplo.livecard</string>
|
<string>group.refilc2.livecard</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class LessonData {
|
class LessonData {
|
||||||
|
var color: String
|
||||||
var icon: String
|
var icon: String
|
||||||
var index: String
|
var index: String
|
||||||
var title: String
|
var title: String
|
||||||
@@ -13,8 +14,9 @@ class LessonData {
|
|||||||
var nextRoom: String
|
var nextRoom: String
|
||||||
|
|
||||||
init?() {
|
init?() {
|
||||||
let sharedDefault = UserDefaults(suiteName: "group.refilc.livecard")!
|
let sharedDefault = UserDefaults(suiteName: "group.refilc2.livecard")!
|
||||||
|
|
||||||
|
self.color = sharedDefault.string(forKey: "color")!
|
||||||
self.icon = sharedDefault.string(forKey: "icon")!
|
self.icon = sharedDefault.string(forKey: "icon")!
|
||||||
self.index = sharedDefault.string(forKey: "index")!
|
self.index = sharedDefault.string(forKey: "index")!
|
||||||
self.title = sharedDefault.string(forKey: "title")!
|
self.title = sharedDefault.string(forKey: "title")!
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
<!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>
|
||||||
|
<string>development</string>
|
||||||
<key>com.apple.security.application-groups</key>
|
<key>com.apple.security.application-groups</key>
|
||||||
<array>
|
<array>
|
||||||
<string>group.refilcnaplo.livecard</string>
|
<string>group.refilc2.livecard</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -11,6 +11,33 @@ struct Widgets: WidgetBundle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Color Converter
|
||||||
|
extension Color {
|
||||||
|
init(hex: String, alpha: Double = 1.0) {
|
||||||
|
var hexValue = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
|
||||||
|
|
||||||
|
if hexValue.hasPrefix("#") {
|
||||||
|
hexValue.remove(at: hexValue.startIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
var rgbValue: UInt64 = 0
|
||||||
|
Scanner(string: hexValue).scanHexInt64(&rgbValue)
|
||||||
|
|
||||||
|
let red = Double((rgbValue & 0xFF0000) >> 16) / 255.0
|
||||||
|
let green = Double((rgbValue & 0x00FF00) >> 8) / 255.0
|
||||||
|
let blue = Double(rgbValue & 0x0000FF) / 255.0
|
||||||
|
|
||||||
|
self.init(
|
||||||
|
.sRGB,
|
||||||
|
red: red,
|
||||||
|
green: green,
|
||||||
|
blue: blue,
|
||||||
|
opacity: alpha
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// We need to redefined live activities pipe
|
// We need to redefined live activities pipe
|
||||||
struct LiveActivitiesAppAttributes: ActivityAttributes, Identifiable {
|
struct LiveActivitiesAppAttributes: ActivityAttributes, Identifiable {
|
||||||
public struct ContentState: Codable, Hashable { }
|
public struct ContentState: Codable, Hashable { }
|
||||||
@@ -64,10 +91,16 @@ struct LockScreenLiveActivityView: View {
|
|||||||
Text(timerInterval: lesson!.date, countsDown: true)
|
Text(timerInterval: lesson!.date, countsDown: true)
|
||||||
.multilineTextAlignment(.center)
|
.multilineTextAlignment(.center)
|
||||||
.frame(width: 85)
|
.frame(width: 85)
|
||||||
.font(.title)
|
.font(.title2)
|
||||||
.monospacedDigit()
|
.monospacedDigit()
|
||||||
.padding(.trailing, CGFloat(24))
|
.padding(.trailing, CGFloat(24))
|
||||||
}
|
}
|
||||||
|
.activityBackgroundTint(
|
||||||
|
lesson!.color != "#676767"
|
||||||
|
? Color(hex: lesson!.color)
|
||||||
|
// Ha nem megy hat nem megy
|
||||||
|
: Color.clear
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,12 +119,22 @@ struct LiveCardWidget: Widget {
|
|||||||
DynamicIslandExpandedRegion(.leading) {
|
DynamicIslandExpandedRegion(.leading) {
|
||||||
VStack {
|
VStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
Image(systemName: lesson!.icon)
|
ProgressView(
|
||||||
.resizable()
|
timerInterval: lesson!.date,
|
||||||
.aspectRatio(contentMode: .fit)
|
countsDown: true,
|
||||||
.frame(width: CGFloat(30), height: CGFloat(30))
|
label: {
|
||||||
.padding(.leading, CGFloat(6))
|
Image(systemName: lesson!.icon)
|
||||||
.padding(.bottom, CGFloat(6))
|
.resizable()
|
||||||
|
.aspectRatio(contentMode: .fit)
|
||||||
|
.frame(width: CGFloat(32), height: CGFloat(32))
|
||||||
|
},
|
||||||
|
currentValueLabel: {
|
||||||
|
Image(systemName: lesson!.icon)
|
||||||
|
.resizable()
|
||||||
|
.aspectRatio(contentMode: .fit)
|
||||||
|
.frame(width: CGFloat(32), height: CGFloat(32))
|
||||||
|
}
|
||||||
|
).progressViewStyle(.circular)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DynamicIslandExpandedRegion(.center) {
|
DynamicIslandExpandedRegion(.center) {
|
||||||
@@ -104,7 +147,7 @@ struct LiveCardWidget: Widget {
|
|||||||
Text(lesson!.description)
|
Text(lesson!.description)
|
||||||
.lineLimit(2)
|
.lineLimit(2)
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
}
|
}.padding(EdgeInsets(top: 0.0, leading: 5.0, bottom: 0.0, trailing: 0.0))
|
||||||
}
|
}
|
||||||
DynamicIslandExpandedRegion(.trailing) {
|
DynamicIslandExpandedRegion(.trailing) {
|
||||||
VStack {
|
VStack {
|
||||||
@@ -124,7 +167,8 @@ struct LiveCardWidget: Widget {
|
|||||||
Image(systemName: lesson!.icon)
|
Image(systemName: lesson!.icon)
|
||||||
}
|
}
|
||||||
.font(.caption2)
|
.font(.caption2)
|
||||||
} compactTrailing: {
|
}
|
||||||
|
compactTrailing: {
|
||||||
Text(timerInterval: lesson!.date, countsDown: true)
|
Text(timerInterval: lesson!.date, countsDown: true)
|
||||||
.multilineTextAlignment(.center)
|
.multilineTextAlignment(.center)
|
||||||
.frame(width: 40)
|
.frame(width: 40)
|
||||||
@@ -132,19 +176,30 @@ struct LiveCardWidget: Widget {
|
|||||||
|
|
||||||
/// Collapsed
|
/// Collapsed
|
||||||
} minimal: {
|
} minimal: {
|
||||||
VStack(alignment: .center) {
|
VStack(alignment: .center, content: {
|
||||||
Image(systemName: lesson!.icon)
|
ProgressView(
|
||||||
.resizable()
|
timerInterval: lesson!.date,
|
||||||
.aspectRatio(contentMode: .fit)
|
countsDown: true,
|
||||||
.frame(width: CGFloat(12), height: CGFloat(12))
|
label: {
|
||||||
|
Image(systemName: lesson!.icon)
|
||||||
Text(timerInterval: lesson!.date, countsDown: true)
|
.resizable()
|
||||||
.multilineTextAlignment(.center)
|
.aspectRatio(contentMode: .fit)
|
||||||
.monospacedDigit()
|
.frame(width: CGFloat(12), height: CGFloat(12))
|
||||||
.font(.system(size: CGFloat(10)))
|
},
|
||||||
}
|
currentValueLabel: {
|
||||||
|
Image(systemName: lesson!.icon)
|
||||||
|
.resizable()
|
||||||
|
.aspectRatio(contentMode: .fit)
|
||||||
|
.frame(width: CGFloat(12), height: CGFloat(12))
|
||||||
|
}
|
||||||
|
).progressViewStyle(.circular)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
.keylineTint(.accentColor)
|
.keylineTint(
|
||||||
|
lesson!.color != "#676767"
|
||||||
|
? Color(hex: lesson!.color)
|
||||||
|
: Color.clear
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,32 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:filcnaplo/models/ad.dart';
|
||||||
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/settings.dart';
|
||||||
|
import 'package:filcnaplo/models/shared_theme.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:flutter/foundation.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
|
||||||
class FilcAPI {
|
class FilcAPI {
|
||||||
|
// API base
|
||||||
|
static const baseUrl = "https://api.refilc.hu";
|
||||||
|
|
||||||
// Public API
|
// Public API
|
||||||
static const schoolList = "https://api.refilc.hu/v1/public/school-list";
|
static const schoolList = "$baseUrl/v1/public/school-list";
|
||||||
static const news = "https://api.refilc.hu/v1/public/news";
|
static const news = "$baseUrl/v1/public/news";
|
||||||
static const supporters = "https://api.refilc.hu/v1/public/supporters";
|
static const supporters = "$baseUrl/v1/public/supporters";
|
||||||
|
|
||||||
// Private API
|
// Private API
|
||||||
static const config = "https://api.refilc.hu/v1/private/config";
|
static const ads = "$baseUrl/v1/private/ads";
|
||||||
static const reportApi = "https://api.refilc.hu/v1/private/crash-report";
|
static const config = "$baseUrl/v1/private/config";
|
||||||
|
static const reportApi = "$baseUrl/v1/private/crash-report";
|
||||||
static const premiumApi = "https://api.filcnaplo.hu/premium/activate";
|
static const premiumApi = "https://api.filcnaplo.hu/premium/activate";
|
||||||
// static const premiumScopesApi = "https://api.filcnaplo.hu/premium/scopes";
|
// static const premiumScopesApi = "https://api.filcnaplo.hu/premium/scopes";
|
||||||
|
|
||||||
@@ -26,6 +34,17 @@ class FilcAPI {
|
|||||||
static const repo = "refilc/naplo";
|
static const repo = "refilc/naplo";
|
||||||
static const releases = "https://api.github.com/repos/$repo/releases";
|
static const releases = "https://api.github.com/repos/$repo/releases";
|
||||||
|
|
||||||
|
// Share API
|
||||||
|
static const themeShare = "$baseUrl/v2/shared/theme/add";
|
||||||
|
static const themeGet = "$baseUrl/v2/shared/theme/get";
|
||||||
|
static const allThemes = "$themeGet/all";
|
||||||
|
static const themeByID = "$themeGet/";
|
||||||
|
|
||||||
|
static const gradeColorsShare = "$baseUrl/v2/shared/grade-colors/add";
|
||||||
|
static const gradeColorsGet = "$baseUrl/v2/shared/grade-colors/get";
|
||||||
|
static const allGradeColors = "$gradeColorsGet/all";
|
||||||
|
static const gradeColorsByID = "$gradeColorsGet/";
|
||||||
|
|
||||||
static Future<bool> checkConnectivity() async =>
|
static Future<bool> checkConnectivity() async =>
|
||||||
(await Connectivity().checkConnectivity()) != ConnectivityResult.none;
|
(await Connectivity().checkConnectivity()) != ConnectivityResult.none;
|
||||||
|
|
||||||
@@ -39,9 +58,14 @@ class FilcAPI {
|
|||||||
.map((json) => School.fromJson(json))
|
.map((json) => School.fromJson(json))
|
||||||
.toList();
|
.toList();
|
||||||
schools.add(School(
|
schools.add(School(
|
||||||
city: "Tiszabura",
|
city: "Stockholm",
|
||||||
instituteCode: "supporttest-reni-tiszabura-teszt01",
|
instituteCode: "refilc-test-sweden",
|
||||||
name: "FILC Éles Reni tiszabura-teszt",
|
name: "reFilc Test SE - Leo Ekström High School",
|
||||||
|
));
|
||||||
|
schools.add(School(
|
||||||
|
city: "Madrid",
|
||||||
|
instituteCode: "refilc-test-spain",
|
||||||
|
name: "reFilc Test ES - Emilio Obrero University",
|
||||||
));
|
));
|
||||||
return schools;
|
return schools;
|
||||||
} else {
|
} else {
|
||||||
@@ -68,7 +92,9 @@ class FilcAPI {
|
|||||||
http.Response res = await http.get(Uri.parse(config), headers: headers);
|
http.Response res = await http.get(Uri.parse(config), headers: headers);
|
||||||
|
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
print(jsonDecode(res.body));
|
if (kDebugMode) {
|
||||||
|
print(jsonDecode(res.body));
|
||||||
|
}
|
||||||
return Config.fromJson(jsonDecode(res.body));
|
return Config.fromJson(jsonDecode(res.body));
|
||||||
} else if (res.statusCode == 429) {
|
} else if (res.statusCode == 429) {
|
||||||
res = await http.get(Uri.parse(config));
|
res = await http.get(Uri.parse(config));
|
||||||
@@ -114,6 +140,24 @@ class FilcAPI {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<List<Ad>?> getAds() async {
|
||||||
|
try {
|
||||||
|
http.Response res = await http.get(Uri.parse(ads));
|
||||||
|
|
||||||
|
if (res.statusCode == 200) {
|
||||||
|
return (jsonDecode(res.body) as List)
|
||||||
|
.cast<Map>()
|
||||||
|
.map((e) => Ad.fromJson(e))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
throw "HTTP ${res.statusCode}: ${res.body}";
|
||||||
|
}
|
||||||
|
} on Exception catch (error, stacktrace) {
|
||||||
|
log("ERROR: FilcAPI.getAds: $error $stacktrace");
|
||||||
|
}
|
||||||
|
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));
|
||||||
@@ -160,6 +204,91 @@ class FilcAPI {
|
|||||||
log("ERROR: FilcAPI.sendReport: $error $stacktrace");
|
log("ERROR: FilcAPI.sendReport: $error $stacktrace");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sharing
|
||||||
|
static Future<void> addSharedTheme(SharedTheme theme) async {
|
||||||
|
try {
|
||||||
|
theme.json.remove('json');
|
||||||
|
theme.json['is_public'] = theme.isPublic.toString();
|
||||||
|
theme.json['background_color'] = theme.backgroundColor.value.toString();
|
||||||
|
theme.json['panels_color'] = theme.panelsColor.value.toString();
|
||||||
|
theme.json['accent_color'] = theme.accentColor.value.toString();
|
||||||
|
|
||||||
|
// set linked grade colors
|
||||||
|
theme.json['grade_colors_id'] = theme.gradeColors.id;
|
||||||
|
|
||||||
|
http.Response res = await http.post(
|
||||||
|
Uri.parse(themeShare),
|
||||||
|
body: theme.json,
|
||||||
|
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (res.statusCode != 201) {
|
||||||
|
throw "HTTP ${res.statusCode}: ${res.body}";
|
||||||
|
}
|
||||||
|
|
||||||
|
log('Shared theme successfully with ID: ${theme.id}');
|
||||||
|
} on Exception catch (error, stacktrace) {
|
||||||
|
log("ERROR: FilcAPI.addSharedTheme: $error $stacktrace");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<Map?> getSharedTheme(String id) async {
|
||||||
|
try {
|
||||||
|
http.Response res = await http.get(Uri.parse(themeByID + id));
|
||||||
|
|
||||||
|
if (res.statusCode == 200) {
|
||||||
|
return (jsonDecode(res.body) as Map);
|
||||||
|
} else {
|
||||||
|
throw "HTTP ${res.statusCode}: ${res.body}";
|
||||||
|
}
|
||||||
|
} on Exception catch (error, stacktrace) {
|
||||||
|
log("ERROR: FilcAPI.getSharedTheme: $error $stacktrace");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> addSharedGradeColors(
|
||||||
|
SharedGradeColors gradeColors) async {
|
||||||
|
try {
|
||||||
|
gradeColors.json.remove('json');
|
||||||
|
gradeColors.json['is_public'] = gradeColors.isPublic.toString();
|
||||||
|
gradeColors.json['five_color'] = gradeColors.fiveColor.value.toString();
|
||||||
|
gradeColors.json['four_color'] = gradeColors.fourColor.value.toString();
|
||||||
|
gradeColors.json['three_color'] = gradeColors.threeColor.value.toString();
|
||||||
|
gradeColors.json['two_color'] = gradeColors.twoColor.value.toString();
|
||||||
|
gradeColors.json['one_color'] = gradeColors.oneColor.value.toString();
|
||||||
|
|
||||||
|
http.Response res = await http.post(
|
||||||
|
Uri.parse(gradeColorsShare),
|
||||||
|
body: gradeColors.json,
|
||||||
|
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (res.statusCode != 201) {
|
||||||
|
throw "HTTP ${res.statusCode}: ${res.body}";
|
||||||
|
}
|
||||||
|
|
||||||
|
log('Shared grade colors successfully with ID: ${gradeColors.id}');
|
||||||
|
} on Exception catch (error, stacktrace) {
|
||||||
|
log("ERROR: FilcAPI.addSharedGradeColors: $error $stacktrace");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<Map?> getSharedGradeColors(String id) async {
|
||||||
|
try {
|
||||||
|
http.Response res = await http.get(Uri.parse(gradeColorsByID + id));
|
||||||
|
|
||||||
|
if (res.statusCode == 200) {
|
||||||
|
return (jsonDecode(res.body) as Map);
|
||||||
|
} else {
|
||||||
|
throw "HTTP ${res.statusCode}: ${res.body}";
|
||||||
|
}
|
||||||
|
} on Exception catch (error, stacktrace) {
|
||||||
|
log("ERROR: FilcAPI.getSharedGradeColors: $error $stacktrace");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ErrorReport {
|
class ErrorReport {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// ignore_for_file: avoid_print, use_build_context_synchronously
|
// ignore_for_file: avoid_print, use_build_context_synchronously
|
||||||
|
|
||||||
import 'package:filcnaplo/utils/jwt.dart';
|
import 'package:filcnaplo/utils/jwt.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/school.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';
|
||||||
@@ -20,6 +21,7 @@ import 'package:filcnaplo_kreta_api/models/week.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:filcnaplo/api/nonce.dart';
|
import 'package:filcnaplo/api/nonce.dart';
|
||||||
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
enum LoginState {
|
enum LoginState {
|
||||||
missingFields,
|
missingFields,
|
||||||
@@ -27,7 +29,7 @@ enum LoginState {
|
|||||||
failed,
|
failed,
|
||||||
normal,
|
normal,
|
||||||
inProgress,
|
inProgress,
|
||||||
success
|
success,
|
||||||
}
|
}
|
||||||
|
|
||||||
Nonce getNonce(String nonce, String username, String instituteCode) {
|
Nonce getNonce(String nonce, String username, String instituteCode) {
|
||||||
@@ -39,7 +41,7 @@ Nonce getNonce(String nonce, String username, String instituteCode) {
|
|||||||
return nonceEncoder;
|
return nonceEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future loginApi({
|
Future loginAPI({
|
||||||
required String username,
|
required String username,
|
||||||
required String password,
|
required String password,
|
||||||
required String instituteCode,
|
required String instituteCode,
|
||||||
@@ -47,87 +49,141 @@ Future loginApi({
|
|||||||
void Function(User)? onLogin,
|
void Function(User)? onLogin,
|
||||||
void Function()? onSuccess,
|
void Function()? onSuccess,
|
||||||
}) async {
|
}) async {
|
||||||
Provider.of<KretaClient>(context, listen: false).userAgent =
|
Future testLogin(School school) async {
|
||||||
Provider.of<SettingsProvider>(context, listen: false).config.userAgent;
|
var user = User(
|
||||||
|
username: username,
|
||||||
|
password: password,
|
||||||
|
instituteCode: instituteCode,
|
||||||
|
name: 'Teszt Lajos',
|
||||||
|
student: Student(
|
||||||
|
birth: DateTime.now(),
|
||||||
|
id: const Uuid().v4(),
|
||||||
|
name: 'Teszt Lajos',
|
||||||
|
school: school,
|
||||||
|
yearId: '1',
|
||||||
|
parents: ['Teszt András', 'Teszt Linda'],
|
||||||
|
json: {"a": "b"},
|
||||||
|
address: '1117 Budapest, Gábor Dénes utca 4.',
|
||||||
|
),
|
||||||
|
role: Role.parent,
|
||||||
|
);
|
||||||
|
|
||||||
Map<String, String> headers = {
|
if (onLogin != null) onLogin(user);
|
||||||
"content-type": "application/x-www-form-urlencoded",
|
|
||||||
};
|
|
||||||
|
|
||||||
String nonceStr = await Provider.of<KretaClient>(context, listen: false)
|
// store test user in db
|
||||||
.getAPI(KretaAPI.nonce, json: false);
|
await Provider.of<DatabaseProvider>(context, listen: false)
|
||||||
|
.store
|
||||||
|
.storeUser(user);
|
||||||
|
Provider.of<UserProvider>(context, listen: false).addUser(user);
|
||||||
|
Provider.of<UserProvider>(context, listen: false).setUser(user.id);
|
||||||
|
|
||||||
Nonce nonce = getNonce(nonceStr, username.replaceAll(' ', '') + ' ', instituteCode);
|
if (onSuccess != null) onSuccess();
|
||||||
headers.addAll(nonce.header());
|
|
||||||
|
|
||||||
Map? res = await Provider.of<KretaClient>(context, listen: false)
|
return LoginState.success;
|
||||||
.postAPI(KretaAPI.login,
|
}
|
||||||
headers: headers,
|
|
||||||
body: User.loginBody(
|
|
||||||
username: username.replaceAll(' ', '') + ' ',
|
|
||||||
password: password,
|
|
||||||
instituteCode: instituteCode,
|
|
||||||
));
|
|
||||||
if (res != null) {
|
|
||||||
if (res.containsKey("error")) {
|
|
||||||
if (res["error"] == "invalid_grant") {
|
|
||||||
return LoginState.invalidGrant;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (res.containsKey("access_token")) {
|
|
||||||
try {
|
|
||||||
Provider.of<KretaClient>(context, listen: false).accessToken =
|
|
||||||
res["access_token"];
|
|
||||||
Map? studentJson =
|
|
||||||
await Provider.of<KretaClient>(context, listen: false)
|
|
||||||
.getAPI(KretaAPI.student(instituteCode));
|
|
||||||
Student student = Student.fromJson(studentJson!);
|
|
||||||
var user = User(
|
|
||||||
username: username.replaceAll(' ', '') + ' ',
|
|
||||||
password: password,
|
|
||||||
instituteCode: instituteCode,
|
|
||||||
name: student.name,
|
|
||||||
student: student,
|
|
||||||
role: JwtUtils.getRoleFromJWT(res["access_token"])!,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (onLogin != null) onLogin(user);
|
// if institute matches one of test things do test login
|
||||||
|
if (instituteCode == 'refilc-test-sweden') {
|
||||||
|
School school = School(
|
||||||
|
city: "Stockholm",
|
||||||
|
instituteCode: "refilc-test-sweden",
|
||||||
|
name: "reFilc Test SE - Leo Ekström High School",
|
||||||
|
);
|
||||||
|
|
||||||
// Store User in the database
|
await testLogin(school);
|
||||||
await Provider.of<DatabaseProvider>(context, listen: false)
|
} else if (instituteCode == 'refilc-test-spain') {
|
||||||
.store
|
School school = School(
|
||||||
.storeUser(user);
|
city: "Madrid",
|
||||||
Provider.of<UserProvider>(context, listen: false).addUser(user);
|
instituteCode: "refilc-test-spain",
|
||||||
Provider.of<UserProvider>(context, listen: false).setUser(user.id);
|
name: "reFilc Test ES - Emilio Obrero University",
|
||||||
|
);
|
||||||
|
|
||||||
// Get user data
|
await testLogin(school);
|
||||||
|
} else {
|
||||||
|
// normal login from here
|
||||||
|
Provider.of<KretaClient>(context, listen: false).userAgent =
|
||||||
|
Provider.of<SettingsProvider>(context, listen: false).config.userAgent;
|
||||||
|
|
||||||
|
Map<String, String> headers = {
|
||||||
|
"content-type": "application/x-www-form-urlencoded",
|
||||||
|
};
|
||||||
|
|
||||||
|
String nonceStr = await Provider.of<KretaClient>(context, listen: false)
|
||||||
|
.getAPI(KretaAPI.nonce, json: false);
|
||||||
|
|
||||||
|
Nonce nonce = getNonce(nonceStr, username, instituteCode);
|
||||||
|
headers.addAll(nonce.header());
|
||||||
|
|
||||||
|
Map? res = await Provider.of<KretaClient>(context, listen: false)
|
||||||
|
.postAPI(KretaAPI.login,
|
||||||
|
headers: headers,
|
||||||
|
body: User.loginBody(
|
||||||
|
username: username,
|
||||||
|
password: password,
|
||||||
|
instituteCode: instituteCode,
|
||||||
|
));
|
||||||
|
if (res != null) {
|
||||||
|
if (res.containsKey("error")) {
|
||||||
|
if (res["error"] == "invalid_grant") {
|
||||||
|
return LoginState.invalidGrant;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (res.containsKey("access_token")) {
|
||||||
try {
|
try {
|
||||||
await Future.wait([
|
Provider.of<KretaClient>(context, listen: false).accessToken =
|
||||||
Provider.of<GradeProvider>(context, listen: false).fetch(),
|
res["access_token"];
|
||||||
Provider.of<TimetableProvider>(context, listen: false)
|
Map? studentJson =
|
||||||
.fetch(week: Week.current()),
|
await Provider.of<KretaClient>(context, listen: false)
|
||||||
Provider.of<ExamProvider>(context, listen: false).fetch(),
|
.getAPI(KretaAPI.student(instituteCode));
|
||||||
Provider.of<HomeworkProvider>(context, listen: false).fetch(),
|
Student student = Student.fromJson(studentJson!);
|
||||||
Provider.of<MessageProvider>(context, listen: false).fetchAll(),
|
var user = User(
|
||||||
Provider.of<NoteProvider>(context, listen: false).fetch(),
|
username: username,
|
||||||
Provider.of<EventProvider>(context, listen: false).fetch(),
|
password: password,
|
||||||
Provider.of<AbsenceProvider>(context, listen: false).fetch(),
|
instituteCode: instituteCode,
|
||||||
]);
|
name: student.name,
|
||||||
|
student: student,
|
||||||
|
role: JwtUtils.getRoleFromJWT(res["access_token"])!,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (onLogin != null) onLogin(user);
|
||||||
|
|
||||||
|
// Store User in the database
|
||||||
|
await Provider.of<DatabaseProvider>(context, listen: false)
|
||||||
|
.store
|
||||||
|
.storeUser(user);
|
||||||
|
Provider.of<UserProvider>(context, listen: false).addUser(user);
|
||||||
|
Provider.of<UserProvider>(context, listen: false).setUser(user.id);
|
||||||
|
|
||||||
|
// Get user data
|
||||||
|
try {
|
||||||
|
await Future.wait([
|
||||||
|
Provider.of<GradeProvider>(context, listen: false).fetch(),
|
||||||
|
Provider.of<TimetableProvider>(context, listen: false)
|
||||||
|
.fetch(week: Week.current()),
|
||||||
|
Provider.of<ExamProvider>(context, listen: false).fetch(),
|
||||||
|
Provider.of<HomeworkProvider>(context, listen: false).fetch(),
|
||||||
|
Provider.of<MessageProvider>(context, listen: false).fetchAll(),
|
||||||
|
Provider.of<NoteProvider>(context, listen: false).fetch(),
|
||||||
|
Provider.of<EventProvider>(context, listen: false).fetch(),
|
||||||
|
Provider.of<AbsenceProvider>(context, listen: false).fetch(),
|
||||||
|
]);
|
||||||
|
} catch (error) {
|
||||||
|
print("WARNING: failed to fetch user data: $error");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onSuccess != null) onSuccess();
|
||||||
|
|
||||||
|
return LoginState.success;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
print("WARNING: failed to fetch user data: $error");
|
print("ERROR: loginAPI: $error");
|
||||||
|
// maybe check debug mode
|
||||||
|
// ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("ERROR: $error")));
|
||||||
|
return LoginState.failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onSuccess != null) onSuccess();
|
|
||||||
|
|
||||||
return LoginState.success;
|
|
||||||
} catch (error) {
|
|
||||||
print("ERROR: loginApi: $error");
|
|
||||||
// maybe check debug mode
|
|
||||||
// ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("ERROR: $error")));
|
|
||||||
return LoginState.failed;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return LoginState.failed;
|
return LoginState.failed;
|
||||||
}
|
}
|
||||||
|
|||||||
29
filcnaplo/lib/api/providers/ad_provider.dart
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import 'package:filcnaplo/api/client.dart';
|
||||||
|
import 'package:filcnaplo/models/ad.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AdProvider extends ChangeNotifier {
|
||||||
|
// private
|
||||||
|
late List<Ad> _ads;
|
||||||
|
bool get available => _ads.isNotEmpty;
|
||||||
|
|
||||||
|
// public
|
||||||
|
List<Ad> get ads => _ads;
|
||||||
|
|
||||||
|
AdProvider({
|
||||||
|
List<Ad> initialAds = const [],
|
||||||
|
required BuildContext context,
|
||||||
|
}) {
|
||||||
|
_ads = List.castFrom(initialAds);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> fetch() async {
|
||||||
|
_ads = await FilcAPI.getAds() ?? [];
|
||||||
|
_ads.sort((a, b) => -a.date.compareTo(b.date));
|
||||||
|
|
||||||
|
// check for new ads
|
||||||
|
if (_ads.isNotEmpty) {
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@ 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';
|
|
||||||
// ignore: depend_on_referenced_packages
|
// ignore: depend_on_referenced_packages
|
||||||
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ enum LiveCardState {
|
|||||||
duringBreak,
|
duringBreak,
|
||||||
morning,
|
morning,
|
||||||
afternoon,
|
afternoon,
|
||||||
night
|
night,
|
||||||
|
summary
|
||||||
}
|
}
|
||||||
|
|
||||||
class LiveCardProvider extends ChangeNotifier {
|
class LiveCardProvider extends ChangeNotifier {
|
||||||
@@ -39,15 +40,30 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
String? _latestActivityId;
|
String? _latestActivityId;
|
||||||
Map<String, String> _lastActivity = {};
|
Map<String, String> _lastActivity = {};
|
||||||
|
|
||||||
|
bool _hasCheckedTimetable = false;
|
||||||
|
|
||||||
LiveCardProvider({
|
LiveCardProvider({
|
||||||
required TimetableProvider timetable,
|
required TimetableProvider timetable,
|
||||||
required SettingsProvider settings,
|
required SettingsProvider settings,
|
||||||
}) : _timetable = timetable,
|
}) : _timetable = timetable,
|
||||||
_settings = settings {
|
_settings = settings {
|
||||||
_liveActivitiesPlugin.init(appGroupId: "group.refilc.livecard");
|
if (Platform.isIOS) {
|
||||||
_liveActivitiesPlugin.getAllActivitiesIds().then((value) {
|
_liveActivitiesPlugin.areActivitiesEnabled().then((value) {
|
||||||
_latestActivityId = value.isNotEmpty ? value.first : null;
|
// Console log
|
||||||
});
|
if (kDebugMode) {
|
||||||
|
print("iOS LiveActivity enabled: $value");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
_liveActivitiesPlugin.init(appGroupId: "group.refilc2.livecard");
|
||||||
|
|
||||||
|
_liveActivitiesPlugin.getAllActivitiesIds().then((value) {
|
||||||
|
_latestActivityId = value.isNotEmpty ? value.first : null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
_timer = Timer.periodic(const Duration(seconds: 1), (timer) => update());
|
_timer = Timer.periodic(const Duration(seconds: 1), (timer) => update());
|
||||||
_delay = settings.bellDelayEnabled
|
_delay = settings.bellDelayEnabled
|
||||||
? Duration(seconds: settings.bellDelay)
|
? Duration(seconds: settings.bellDelay)
|
||||||
@@ -58,13 +74,21 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_timer.cancel();
|
_timer.cancel();
|
||||||
if (_latestActivityId != null && Platform.isIOS)
|
if (Platform.isIOS) {
|
||||||
_liveActivitiesPlugin.endActivity(_latestActivityId!);
|
_liveActivitiesPlugin.areActivitiesEnabled().then((value) {
|
||||||
|
if (value) {
|
||||||
|
if (_latestActivityId != null) {
|
||||||
|
_liveActivitiesPlugin.endActivity(_latestActivityId!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
static DateTime _now() {
|
static DateTime _now() {
|
||||||
|
// return DateTime(2023, 9, 27, 9, 30);
|
||||||
return DateTime.now();
|
return DateTime.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,13 +112,15 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
switch (currentState) {
|
switch (currentState) {
|
||||||
case LiveCardState.duringLesson:
|
case LiveCardState.duringLesson:
|
||||||
return {
|
return {
|
||||||
|
"color":
|
||||||
|
'#${_settings.liveActivityColor.toString().substring(10, 16)}',
|
||||||
"icon": currentLesson != null
|
"icon": currentLesson != null
|
||||||
? SubjectIcon.resolveName(subject: currentLesson?.subject)
|
? SubjectIcon.resolveName(subject: currentLesson?.subject)
|
||||||
: "book",
|
: "book",
|
||||||
"index":
|
"index":
|
||||||
currentLesson != null ? '${currentLesson!.lessonIndex}. ' : "",
|
currentLesson != null ? '${currentLesson!.lessonIndex}. ' : "",
|
||||||
"title": currentLesson != null
|
"title": currentLesson != null
|
||||||
? ShortSubject.resolve(subject: currentLesson?.subject).capital()
|
? currentLesson?.subject.renamedTo ?? ShortSubject.resolve(subject: currentLesson?.subject).capital()
|
||||||
: "",
|
: "",
|
||||||
"subtitle": currentLesson?.room.replaceAll("_", " ") ?? "",
|
"subtitle": currentLesson?.room.replaceAll("_", " ") ?? "",
|
||||||
"description": currentLesson?.description ?? "",
|
"description": currentLesson?.description ?? "",
|
||||||
@@ -105,7 +131,7 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
_delay.inMilliseconds)
|
_delay.inMilliseconds)
|
||||||
.toString(),
|
.toString(),
|
||||||
"nextSubject": nextLesson != null
|
"nextSubject": nextLesson != null
|
||||||
? ShortSubject.resolve(subject: nextLesson?.subject).capital()
|
? nextLesson?.subject.renamedTo ?? ShortSubject.resolve(subject: nextLesson?.subject).capital()
|
||||||
: "",
|
: "",
|
||||||
"nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
|
"nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
|
||||||
};
|
};
|
||||||
@@ -120,6 +146,8 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
final diff = getFloorDifference();
|
final diff = getFloorDifference();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
"color":
|
||||||
|
'#${_settings.liveActivityColor.toString().substring(10, 16)}',
|
||||||
"icon": iconFloorMap[diff] ?? "cup.and.saucer",
|
"icon": iconFloorMap[diff] ?? "cup.and.saucer",
|
||||||
"title": "Szünet",
|
"title": "Szünet",
|
||||||
"description": "go $diff".i18n.fill([
|
"description": "go $diff".i18n.fill([
|
||||||
@@ -132,7 +160,7 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
_delay.inMilliseconds)
|
_delay.inMilliseconds)
|
||||||
.toString(),
|
.toString(),
|
||||||
"nextSubject": (nextLesson != null
|
"nextSubject": (nextLesson != null
|
||||||
? ShortSubject.resolve(subject: nextLesson?.subject)
|
? nextLesson?.subject.renamedTo ?? ShortSubject.resolve(subject: nextLesson?.subject).capital()
|
||||||
: "")
|
: "")
|
||||||
.capital(),
|
.capital(),
|
||||||
"nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
|
"nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
|
||||||
@@ -146,35 +174,40 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
|
|
||||||
void update() async {
|
void update() async {
|
||||||
if (Platform.isIOS) {
|
if (Platform.isIOS) {
|
||||||
final cmap = toMap();
|
_liveActivitiesPlugin.areActivitiesEnabled().then((value) {
|
||||||
if (!mapEquals(cmap, _lastActivity)) {
|
if (value) {
|
||||||
_lastActivity = cmap;
|
final cmap = toMap();
|
||||||
try {
|
if (!mapEquals(cmap, _lastActivity)) {
|
||||||
if (_lastActivity.isNotEmpty) {
|
_lastActivity = cmap;
|
||||||
if (_latestActivityId == null) {
|
try {
|
||||||
_liveActivitiesPlugin
|
if (_lastActivity.isNotEmpty) {
|
||||||
.createActivity(_lastActivity)
|
if (_latestActivityId == null) {
|
||||||
.then((value) => _latestActivityId = value);
|
_liveActivitiesPlugin
|
||||||
} else {
|
.createActivity(_lastActivity)
|
||||||
_liveActivitiesPlugin.updateActivity(
|
.then((value) => _latestActivityId = value);
|
||||||
_latestActivityId!, _lastActivity);
|
} else {
|
||||||
|
_liveActivitiesPlugin.updateActivity(
|
||||||
|
_latestActivityId!, _lastActivity);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (_latestActivityId != null) {
|
||||||
|
_liveActivitiesPlugin.endActivity(_latestActivityId!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (kDebugMode) {
|
||||||
|
print('ERROR: Unable to create or update iOS LiveActivity!');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (_latestActivityId != null) {
|
|
||||||
_liveActivitiesPlugin.endActivity(_latestActivityId!);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
if (kDebugMode) {
|
|
||||||
print('ERROR: Unable to create or update iOS LiveCard!');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Lesson> today = _today(_timetable);
|
List<Lesson> today = _today(_timetable);
|
||||||
|
|
||||||
if (today.isEmpty) {
|
if (today.isEmpty && !_hasCheckedTimetable) {
|
||||||
|
_hasCheckedTimetable = true;
|
||||||
await _timetable.fetch(week: Week.current());
|
await _timetable.fetch(week: Week.current());
|
||||||
today = _today(_timetable);
|
today = _today(_timetable);
|
||||||
}
|
}
|
||||||
@@ -228,7 +261,10 @@ class LiveCardProvider extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentLesson != null) {
|
if (now.isBefore(DateTime(now.year, DateTime.august, 31)) &&
|
||||||
|
now.isAfter(DateTime(now.year, DateTime.june, 14))) {
|
||||||
|
currentState = LiveCardState.summary;
|
||||||
|
} else if (currentLesson != null) {
|
||||||
currentState = LiveCardState.duringLesson;
|
currentState = LiveCardState.duringLesson;
|
||||||
} else if (nextLesson != null && prevLesson != null) {
|
} else if (nextLesson != null && prevLesson != null) {
|
||||||
currentState = LiveCardState.duringBreak;
|
currentState = LiveCardState.duringBreak;
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
// ignore_for_file: use_build_context_synchronously
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'dart:math';
|
|
||||||
|
|
||||||
import 'package:filcnaplo/api/client.dart';
|
import 'package:filcnaplo/api/client.dart';
|
||||||
import 'package:filcnaplo/models/news.dart';
|
import 'package:filcnaplo/models/news.dart';
|
||||||
import 'package:filcnaplo/models/settings.dart';
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
@@ -11,7 +8,7 @@ import 'package:provider/provider.dart';
|
|||||||
class NewsProvider extends ChangeNotifier {
|
class NewsProvider extends ChangeNotifier {
|
||||||
// Private
|
// Private
|
||||||
late List<News> _news;
|
late List<News> _news;
|
||||||
late int _state;
|
//late int _state;
|
||||||
late int _fresh;
|
late int _fresh;
|
||||||
bool show = false;
|
bool show = false;
|
||||||
late BuildContext _context;
|
late BuildContext _context;
|
||||||
@@ -30,56 +27,83 @@ class NewsProvider extends ChangeNotifier {
|
|||||||
|
|
||||||
Future<void> restore() async {
|
Future<void> restore() async {
|
||||||
// Load news state from the database
|
// Load news state from the database
|
||||||
var state_ = Provider.of<SettingsProvider>(_context, listen: false).newsState;
|
var seen_ = Provider.of<SettingsProvider>(_context, listen: false).seenNews;
|
||||||
|
|
||||||
if (state_ == -1) {
|
if (seen_.isEmpty) {
|
||||||
var news_ = await FilcAPI.getNews();
|
var news_ = await FilcAPI.getNews();
|
||||||
if (news_ != null) {
|
if (news_ != null) {
|
||||||
state_ = news_.length;
|
|
||||||
_news = news_;
|
_news = news_;
|
||||||
|
show = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_state = state_;
|
//_state = seen_;
|
||||||
Provider.of<SettingsProvider>(_context, listen: false).update(newsState: _state);
|
// Provider.of<SettingsProvider>(_context, listen: false)
|
||||||
|
// .update(seenNewsId: news_.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetch() async {
|
Future<void> fetch() async {
|
||||||
var news_ = await FilcAPI.getNews();
|
var news_ = await FilcAPI.getNews();
|
||||||
if (news_ == null) return;
|
if (news_ == null) return;
|
||||||
|
|
||||||
|
show = false;
|
||||||
|
|
||||||
_news = news_;
|
_news = news_;
|
||||||
_fresh = news_.length - _state;
|
|
||||||
|
|
||||||
if (_fresh < 0) {
|
for (var news in news_) {
|
||||||
_state = news_.length;
|
if (news.expireDate.isAfter(DateTime.now()) &&
|
||||||
Provider.of<SettingsProvider>(_context, listen: false).update(newsState: _state);
|
Provider.of<SettingsProvider>(_context, listen: false)
|
||||||
|
.seenNews
|
||||||
|
.contains(news.id) ==
|
||||||
|
false) {
|
||||||
|
show = true;
|
||||||
|
Provider.of<SettingsProvider>(_context, listen: false)
|
||||||
|
.update(seenNewsId: news.id);
|
||||||
|
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// print(news_.length);
|
||||||
|
// print(_state);
|
||||||
|
|
||||||
_fresh = max(_fresh, 0);
|
// _news = news_;
|
||||||
|
// _fresh = news_.length - _state;
|
||||||
|
|
||||||
if (_fresh > 0) {
|
// if (_fresh < 0) {
|
||||||
show = true;
|
// _state = news_.length;
|
||||||
notifyListeners();
|
// Provider.of<SettingsProvider>(_context, listen: false)
|
||||||
}
|
// .update(newsState: _state);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// _fresh = max(_fresh, 0);
|
||||||
|
|
||||||
|
// if (_fresh > 0) {
|
||||||
|
// show = true;
|
||||||
|
// notifyListeners();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// print(_fresh);
|
||||||
|
// print(_state);
|
||||||
|
// print(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lock() => show = false;
|
void lock() => show = false;
|
||||||
|
|
||||||
void release() {
|
void release() {
|
||||||
if (_fresh == 0) return;
|
// if (_fresh == 0) return;
|
||||||
|
|
||||||
_fresh--;
|
// _fresh--;
|
||||||
_state++;
|
// //_state++;
|
||||||
|
|
||||||
Provider.of<SettingsProvider>(_context, listen: false).update(newsState: _state);
|
// // Provider.of<SettingsProvider>(_context, listen: false)
|
||||||
|
// // .update(seenNewsId: _state);
|
||||||
|
|
||||||
if (_fresh > 0) {
|
// if (_fresh > 0) {
|
||||||
show = true;
|
// show = true;
|
||||||
} else {
|
// } else {
|
||||||
show = false;
|
// show = false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
notifyListeners();
|
// notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
enum Status { network, maintenance, syncing }
|
enum Status { network, maintenance, syncing, apiError }
|
||||||
|
|
||||||
class StatusProvider extends ChangeNotifier {
|
class StatusProvider extends ChangeNotifier {
|
||||||
final List<Status> _stack = [];
|
final List<Status> _stack = [];
|
||||||
@@ -12,6 +14,7 @@ class StatusProvider extends ChangeNotifier {
|
|||||||
|
|
||||||
StatusProvider() {
|
StatusProvider() {
|
||||||
_handleNetworkChanges();
|
_handleNetworkChanges();
|
||||||
|
_handleDNSFailure();
|
||||||
Connectivity().checkConnectivity().then((value) => _networkType = value);
|
Connectivity().checkConnectivity().then((value) => _networkType = value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,6 +27,7 @@ class StatusProvider extends ChangeNotifier {
|
|||||||
_networkType = event;
|
_networkType = event;
|
||||||
if (event == ConnectivityResult.none) {
|
if (event == ConnectivityResult.none) {
|
||||||
if (!_stack.contains(Status.network)) {
|
if (!_stack.contains(Status.network)) {
|
||||||
|
_stack.remove(Status.apiError);
|
||||||
_stack.insert(0, Status.network);
|
_stack.insert(0, Status.network);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
@@ -36,8 +40,34 @@ class StatusProvider extends ChangeNotifier {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _handleDNSFailure() {
|
||||||
|
try {
|
||||||
|
InternetAddress.lookup('api.refilc.hu').then((status) {
|
||||||
|
if (status.isEmpty) {
|
||||||
|
if (!_stack.contains(Status.network)) {
|
||||||
|
_stack.remove(Status.apiError);
|
||||||
|
_stack.insert(0, Status.network);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (_stack.contains(Status.network)) {
|
||||||
|
_stack.remove(Status.network);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} on SocketException catch (_) {
|
||||||
|
if (!_stack.contains(Status.network)) {
|
||||||
|
_stack.remove(Status.apiError);
|
||||||
|
_stack.insert(0, Status.network);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void triggerRequest(http.Response res) {
|
void triggerRequest(http.Response res) {
|
||||||
if (res.headers.containsKey("x-maintenance-mode") || res.statusCode == 503) {
|
if (res.headers.containsKey("x-maintenance-mode") ||
|
||||||
|
res.statusCode == 503) {
|
||||||
if (!_stack.contains(Status.maintenance)) {
|
if (!_stack.contains(Status.maintenance)) {
|
||||||
_stack.insert(0, Status.maintenance);
|
_stack.insert(0, Status.maintenance);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
@@ -48,6 +78,23 @@ class StatusProvider extends ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res.body == 'invalid_grant' ||
|
||||||
|
res.body.replaceAll(' ', '') == '' ||
|
||||||
|
res.statusCode == 400) {
|
||||||
|
if (!_stack.contains(Status.apiError) &&
|
||||||
|
!_stack.contains(Status.network)) {
|
||||||
|
if (res.statusCode == 401) return;
|
||||||
|
_stack.insert(0, Status.apiError);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (_stack.contains(Status.apiError) &&
|
||||||
|
res.request?.url.path != '/nonce') {
|
||||||
|
_stack.remove(Status.apiError);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggerSync({required int current, required int max}) {
|
void triggerSync({required int current, required int max}) {
|
||||||
|
|||||||
@@ -33,9 +33,12 @@ class UpdateProvider extends ChangeNotifier {
|
|||||||
|
|
||||||
// Check for new releases
|
// Check for new releases
|
||||||
if (_releases.isNotEmpty) {
|
if (_releases.isNotEmpty) {
|
||||||
_available = _releases.first.version
|
if (!_releases.first.prerelease) {
|
||||||
.compareTo(Version.fromString(currentVersion)) ==
|
_available = _releases.first.version
|
||||||
1;
|
.compareTo(Version.fromString(currentVersion)) ==
|
||||||
|
1;
|
||||||
|
}
|
||||||
|
|
||||||
// ignore: avoid_print
|
// ignore: avoid_print
|
||||||
if (_available) print("INFO: New update: ${releases.first.version}");
|
if (_available) print("INFO: New update: ${releases.first.version}");
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'dart:math';
|
|||||||
|
|
||||||
import 'package:dynamic_color/dynamic_color.dart';
|
import 'package:dynamic_color/dynamic_color.dart';
|
||||||
import 'package:filcnaplo/api/client.dart';
|
import 'package:filcnaplo/api/client.dart';
|
||||||
|
import 'package:filcnaplo/api/providers/ad_provider.dart';
|
||||||
import 'package:filcnaplo/api/providers/live_card_provider.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';
|
||||||
@@ -12,7 +13,10 @@ import 'package:filcnaplo/theme/observer.dart';
|
|||||||
import 'package:filcnaplo/theme/theme.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_kreta_api/providers/grade_provider.dart';
|
import 'package:filcnaplo_kreta_api/providers/grade_provider.dart';
|
||||||
|
import 'package:filcnaplo_premium/providers/goal_provider.dart';
|
||||||
|
import 'package:filcnaplo_premium/providers/share_provider.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/foundation.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';
|
||||||
@@ -88,6 +92,7 @@ class App extends StatelessWidget {
|
|||||||
|
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
providers: [
|
providers: [
|
||||||
|
// refilc providers
|
||||||
ChangeNotifierProvider<PremiumProvider>(create: (_) => premium),
|
ChangeNotifierProvider<PremiumProvider>(create: (_) => premium),
|
||||||
ChangeNotifierProvider<SettingsProvider>(create: (_) => settings),
|
ChangeNotifierProvider<SettingsProvider>(create: (_) => settings),
|
||||||
ChangeNotifierProvider<UserProvider>(create: (_) => user),
|
ChangeNotifierProvider<UserProvider>(create: (_) => user),
|
||||||
@@ -95,43 +100,79 @@ class App extends StatelessWidget {
|
|||||||
Provider<KretaClient>(create: (_) => kreta),
|
Provider<KretaClient>(create: (_) => kreta),
|
||||||
Provider<DatabaseProvider>(create: (context) => database),
|
Provider<DatabaseProvider>(create: (context) => database),
|
||||||
ChangeNotifierProvider<ThemeModeObserver>(
|
ChangeNotifierProvider<ThemeModeObserver>(
|
||||||
create: (context) =>
|
create: (context) => ThemeModeObserver(
|
||||||
ThemeModeObserver(initialTheme: settings.theme)),
|
initialTheme: settings.theme,
|
||||||
|
),
|
||||||
|
),
|
||||||
ChangeNotifierProvider<NewsProvider>(
|
ChangeNotifierProvider<NewsProvider>(
|
||||||
create: (context) => NewsProvider(context: context)),
|
create: (context) => NewsProvider(context: context),
|
||||||
|
),
|
||||||
ChangeNotifierProvider<UpdateProvider>(
|
ChangeNotifierProvider<UpdateProvider>(
|
||||||
create: (context) => UpdateProvider(context: context)),
|
create: (context) => UpdateProvider(context: context),
|
||||||
|
),
|
||||||
|
ChangeNotifierProvider<AdProvider>(
|
||||||
|
create: (context) => AdProvider(context: context),
|
||||||
|
),
|
||||||
|
|
||||||
// User data providers
|
// user data (kreten) providers
|
||||||
ChangeNotifierProvider<GradeProvider>(
|
ChangeNotifierProvider<GradeProvider>(
|
||||||
create: (_) => GradeProvider(
|
create: (_) => GradeProvider(
|
||||||
settings: settings,
|
settings: settings,
|
||||||
user: user,
|
user: user,
|
||||||
database: database,
|
database: database,
|
||||||
kreta: kreta)),
|
kreta: kreta,
|
||||||
|
),
|
||||||
|
),
|
||||||
ChangeNotifierProvider<TimetableProvider>(create: (_) => timetable),
|
ChangeNotifierProvider<TimetableProvider>(create: (_) => timetable),
|
||||||
ChangeNotifierProvider<ExamProvider>(
|
ChangeNotifierProvider<ExamProvider>(
|
||||||
create: (context) => ExamProvider(context: context)),
|
create: (context) => ExamProvider(context: context),
|
||||||
|
),
|
||||||
ChangeNotifierProvider<HomeworkProvider>(
|
ChangeNotifierProvider<HomeworkProvider>(
|
||||||
create: (context) => HomeworkProvider(context: context)),
|
create: (context) => HomeworkProvider(
|
||||||
|
context: context,
|
||||||
|
database: database,
|
||||||
|
user: user,
|
||||||
|
),
|
||||||
|
),
|
||||||
ChangeNotifierProvider<MessageProvider>(
|
ChangeNotifierProvider<MessageProvider>(
|
||||||
create: (context) => MessageProvider(context: context)),
|
create: (context) => MessageProvider(context: context),
|
||||||
|
),
|
||||||
ChangeNotifierProvider<NoteProvider>(
|
ChangeNotifierProvider<NoteProvider>(
|
||||||
create: (context) => NoteProvider(context: context)),
|
create: (context) => NoteProvider(context: context),
|
||||||
|
),
|
||||||
ChangeNotifierProvider<EventProvider>(
|
ChangeNotifierProvider<EventProvider>(
|
||||||
create: (context) => EventProvider(context: context)),
|
create: (context) => EventProvider(context: context),
|
||||||
|
),
|
||||||
ChangeNotifierProvider<AbsenceProvider>(
|
ChangeNotifierProvider<AbsenceProvider>(
|
||||||
create: (context) => AbsenceProvider(context: context)),
|
create: (context) => AbsenceProvider(context: context),
|
||||||
|
),
|
||||||
|
|
||||||
|
// other providers
|
||||||
ChangeNotifierProvider<GradeCalculatorProvider>(
|
ChangeNotifierProvider<GradeCalculatorProvider>(
|
||||||
create: (_) => GradeCalculatorProvider(
|
create: (_) => GradeCalculatorProvider(
|
||||||
settings: settings,
|
settings: settings,
|
||||||
user: user,
|
user: user,
|
||||||
database: database,
|
database: database,
|
||||||
kreta: kreta)),
|
kreta: kreta,
|
||||||
|
),
|
||||||
|
),
|
||||||
ChangeNotifierProvider<LiveCardProvider>(
|
ChangeNotifierProvider<LiveCardProvider>(
|
||||||
create: (context) =>
|
create: (context) => LiveCardProvider(
|
||||||
LiveCardProvider(timetable: timetable, settings: settings))
|
timetable: timetable,
|
||||||
|
settings: settings,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ChangeNotifierProvider<GoalProvider>(
|
||||||
|
create: (context) => GoalProvider(
|
||||||
|
database: database,
|
||||||
|
user: user,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ChangeNotifierProvider<ShareProvider>(
|
||||||
|
create: (context) => ShareProvider(
|
||||||
|
user: user,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: Consumer<ThemeModeObserver>(
|
child: Consumer<ThemeModeObserver>(
|
||||||
builder: (context, themeMode, child) {
|
builder: (context, themeMode, child) {
|
||||||
@@ -194,8 +235,19 @@ class App extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Route? rootNavigator(RouteSettings route) {
|
Route? rootNavigator(RouteSettings route) {
|
||||||
// if platform == android || platform == ios
|
if (kIsWeb) {
|
||||||
if (Platform.isAndroid || Platform.isIOS) {
|
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.isAndroid || Platform.isIOS) {
|
||||||
switch (route.name) {
|
switch (route.name) {
|
||||||
case "login_back":
|
case "login_back":
|
||||||
return CupertinoPageRoute(
|
return CupertinoPageRoute(
|
||||||
|
|||||||
@@ -5,41 +5,69 @@ import 'dart:io';
|
|||||||
import 'package:filcnaplo/api/providers/database_provider.dart';
|
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:flutter/foundation.dart';
|
||||||
// ignore: depend_on_referenced_packages
|
// ignore: depend_on_referenced_packages
|
||||||
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
||||||
|
import 'package:sqflite_common_ffi_web/sqflite_ffi_web.dart';
|
||||||
|
|
||||||
const settingsDB = DatabaseStruct("settings", {
|
const settingsDB = DatabaseStruct("settings", {
|
||||||
"language": String, "start_page": int, "rounding": int, "theme": int, "accent_color": int, "news": int, "news_state": int, "developer_mode": int,
|
"language": String, "start_page": int, "rounding": int, "theme": int,
|
||||||
"update_channel": int, "config": String, "custom_accent_color": int, "custom_background_color": int, "custom_highlight_color": int, // general
|
"accent_color": int, "news": int, "seen_news": String,
|
||||||
"grade_color1": int, "grade_color2": int, "grade_color3": int, "grade_color4": int, "grade_color5": int, // grade colors
|
"developer_mode": int,
|
||||||
|
"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,
|
"vibration_strength": int, "ab_weeks": int, "swap_ab_weeks": int,
|
||||||
"notifications": int, "notifications_bitfield": int, "notification_poll_interval": int, // notifications
|
"notifications": int, "notifications_bitfield": int,
|
||||||
"x_filc_id": String, "graph_class_avg": int, "presentation_mode": int, "bell_delay": int, "bell_delay_enabled": int,
|
"notification_poll_interval": int,
|
||||||
"grade_opening_fun": int, "icon_pack": String, "premium_scopes": String, "premium_token": String, "premium_login": String,
|
"notifications_grades": int,
|
||||||
|
"notifications_absences": int,
|
||||||
|
"notifications_messages": int,
|
||||||
|
"notifications_lessons": 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, "premium_login": String,
|
||||||
"last_account_id": String, "renamed_subjects_enabled": int,
|
"last_account_id": String, "renamed_subjects_enabled": int,
|
||||||
|
"renamed_subjects_italics": int, "renamed_teachers_enabled": int,
|
||||||
|
"renamed_teachers_italics": int,
|
||||||
|
"live_activity_color": String,
|
||||||
|
"welcome_message": String,
|
||||||
});
|
});
|
||||||
// DON'T FORGET TO UPDATE DEFAULT VALUES IN `initDB` MIGRATION OR ELSE PARENTS WILL COMPLAIN ABOUT THEIR CHILDREN MISSING
|
// DON'T FORGET TO UPDATE DEFAULT VALUES IN `initDB` MIGRATION OR ELSE PARENTS WILL COMPLAIN ABOUT THEIR CHILDREN MISSING
|
||||||
// YOU'VE BEEN WARNED!!!
|
// YOU'VE BEEN WARNED!!!
|
||||||
const usersDB = DatabaseStruct("users", {
|
const usersDB = DatabaseStruct("users", {
|
||||||
"id": String, "name": String, "username": String, "password": String, "institute_code": String, "student": String, "role": int,
|
"id": String, "name": String, "username": String, "password": String,
|
||||||
|
"institute_code": String, "student": String, "role": int,
|
||||||
"nickname": String, "picture": String // premium only
|
"nickname": String, "picture": String // premium only
|
||||||
});
|
});
|
||||||
const userDataDB = DatabaseStruct("user_data", {
|
const userDataDB = DatabaseStruct("user_data", {
|
||||||
"id": String, "grades": String, "timetable": String, "exams": String, "homework": String, "messages": String, "notes": String,
|
"id": String, "grades": String, "timetable": String, "exams": String,
|
||||||
|
"homework": String, "messages": String, "notes": String,
|
||||||
"events": String, "absences": String, "group_averages": String,
|
"events": String, "absences": String, "group_averages": String,
|
||||||
// renamed subjects // non kreta data
|
// renamed subjects // non kreta data
|
||||||
"renamed_subjects": String,
|
"renamed_subjects": String,
|
||||||
|
// renamed teachers // non kreta data
|
||||||
|
"renamed_teachers": String,
|
||||||
// "subject_lesson_count": String, // non kreta data
|
// "subject_lesson_count": String, // non kreta data
|
||||||
"last_seen_grade": int,
|
"last_seen_grade": int,
|
||||||
|
// goal planning // non kreta data
|
||||||
|
"goal_plans": String,
|
||||||
|
"goal_averages": String,
|
||||||
|
"goal_befores": String,
|
||||||
|
"goal_pin_dates": String,
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<void> createTable(Database db, DatabaseStruct struct) => db.execute("CREATE TABLE IF NOT EXISTS ${struct.table} ($struct)");
|
Future<void> createTable(Database db, DatabaseStruct struct) =>
|
||||||
|
db.execute("CREATE TABLE IF NOT EXISTS ${struct.table} ($struct)");
|
||||||
|
|
||||||
Future<Database> initDB(DatabaseProvider database) async {
|
Future<Database> initDB(DatabaseProvider database) async {
|
||||||
Database db;
|
Database db;
|
||||||
|
|
||||||
if (Platform.isLinux || Platform.isWindows) {
|
if (kIsWeb) {
|
||||||
|
db = await databaseFactoryFfiWeb.openDatabase("app.db");
|
||||||
|
} else if (Platform.isLinux || Platform.isWindows) {
|
||||||
sqfliteFfiInit();
|
sqfliteFfiInit();
|
||||||
db = await databaseFactoryFfi.openDatabase("app.db");
|
db = await databaseFactoryFfi.openDatabase("app.db");
|
||||||
} else {
|
} else {
|
||||||
@@ -50,9 +78,11 @@ Future<Database> initDB(DatabaseProvider database) async {
|
|||||||
await createTable(db, usersDB);
|
await createTable(db, usersDB);
|
||||||
await createTable(db, userDataDB);
|
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(database: database).toMap());
|
await db.insert("settings",
|
||||||
|
SettingsProvider.defaultSettings(database: database).toMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate Databases
|
// Migrate Databases
|
||||||
@@ -60,7 +90,8 @@ Future<Database> initDB(DatabaseProvider database) async {
|
|||||||
await migrateDB(
|
await migrateDB(
|
||||||
db,
|
db,
|
||||||
struct: settingsDB,
|
struct: settingsDB,
|
||||||
defaultValues: SettingsProvider.defaultSettings(database: database).toMap(),
|
defaultValues:
|
||||||
|
SettingsProvider.defaultSettings(database: database).toMap(),
|
||||||
);
|
);
|
||||||
await migrateDB(
|
await migrateDB(
|
||||||
db,
|
db,
|
||||||
@@ -68,12 +99,20 @@ Future<Database> initDB(DatabaseProvider database) async {
|
|||||||
defaultValues: {"role": 0, "nickname": "", "picture": ""},
|
defaultValues: {"role": 0, "nickname": "", "picture": ""},
|
||||||
);
|
);
|
||||||
await migrateDB(db, struct: userDataDB, defaultValues: {
|
await migrateDB(db, struct: userDataDB, defaultValues: {
|
||||||
"grades": "[]", "timetable": "[]", "exams": "[]", "homework": "[]", "messages": "[]", "notes": "[]", "events": "[]", "absences": "[]",
|
"grades": "[]", "timetable": "[]", "exams": "[]", "homework": "[]",
|
||||||
|
"messages": "[]", "notes": "[]", "events": "[]", "absences": "[]",
|
||||||
"group_averages": "[]",
|
"group_averages": "[]",
|
||||||
// renamed subjects // non kreta data
|
// renamed subjects // non kreta data
|
||||||
"renamed_subjects": "{}",
|
"renamed_subjects": "{}",
|
||||||
|
// renamed teachers // non kreta data
|
||||||
|
"renamed_teachers": "{}",
|
||||||
// "subject_lesson_count": "{}", // non kreta data
|
// "subject_lesson_count": "{}", // non kreta data
|
||||||
"last_seen_grade": 0,
|
"last_seen_grade": 0,
|
||||||
|
// goal planning // non kreta data
|
||||||
|
"goal_plans": "{}",
|
||||||
|
"goal_averages": "{}",
|
||||||
|
"goal_befores": "{}",
|
||||||
|
"goal_pin_dates": "{}",
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
print("ERROR: migrateDB: $error");
|
print("ERROR: migrateDB: $error");
|
||||||
@@ -99,7 +138,8 @@ Future<void> migrateDB(
|
|||||||
|
|
||||||
// go through each row and add missing keys or delete non existing keys
|
// go through each row and add missing keys or delete non existing keys
|
||||||
await Future.forEach<Map<String, Object?>>(originalRows, (original) async {
|
await Future.forEach<Map<String, Object?>>(originalRows, (original) async {
|
||||||
bool migrationRequired = struct.struct.keys.any((key) => !original.containsKey(key) || original[key] == null) ||
|
bool migrationRequired = struct.struct.keys.any(
|
||||||
|
(key) => !original.containsKey(key) || original[key] == null) ||
|
||||||
original.keys.any((key) => !struct.struct.containsKey(key));
|
original.keys.any((key) => !struct.struct.containsKey(key));
|
||||||
|
|
||||||
if (migrationRequired) {
|
if (migrationRequired) {
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ class DatabaseQuery {
|
|||||||
|
|
||||||
Future<SettingsProvider> getSettings(DatabaseProvider database) 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, database: database);
|
SettingsProvider settings =
|
||||||
|
SettingsProvider.fromMap(settingsMap, database: database);
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +37,10 @@ class DatabaseQuery {
|
|||||||
for (var user in usersMap) {
|
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)) {
|
if (userProvider
|
||||||
|
.getUsers()
|
||||||
|
.map((e) => e.id)
|
||||||
|
.contains(settings.lastAccountId)) {
|
||||||
userProvider.setUser(settings.lastAccountId);
|
userProvider.setUser(settings.lastAccountId);
|
||||||
} else {
|
} else {
|
||||||
if (usersMap.isNotEmpty) {
|
if (usersMap.isNotEmpty) {
|
||||||
@@ -54,100 +58,133 @@ class UserDatabaseQuery {
|
|||||||
final Database db;
|
final Database db;
|
||||||
|
|
||||||
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.isEmpty) 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();
|
||||||
return grades;
|
return grades;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<Week, List<Lesson>>> getLessons({required String userId}) async {
|
Future<Map<Week, 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.isEmpty) 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 {};
|
||||||
if (jsonDecode(lessonsJson) is List) return {};
|
if (jsonDecode(lessonsJson) is List) return {};
|
||||||
Map<Week, List<Lesson>> lessons = (jsonDecode(lessonsJson) as Map).cast<String, List>().map((key, value) {
|
Map<Week, List<Lesson>> lessons =
|
||||||
return MapEntry(Week.fromId(int.parse(key)), value.cast<Map<String, Object?>>().map((e) => Lesson.fromJson(e)).toList());
|
(jsonDecode(lessonsJson) as Map).cast<String, List>().map((key, value) {
|
||||||
|
return MapEntry(
|
||||||
|
Week.fromId(int.parse(key)),
|
||||||
|
value
|
||||||
|
.cast<Map<String, Object?>>()
|
||||||
|
.map((e) => Lesson.fromJson(e))
|
||||||
|
.toList());
|
||||||
}).cast();
|
}).cast();
|
||||||
return lessons;
|
return lessons;
|
||||||
}
|
}
|
||||||
|
|
||||||
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.isEmpty) 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();
|
||||||
return exams;
|
return exams;
|
||||||
}
|
}
|
||||||
|
|
||||||
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.isEmpty) 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();
|
||||||
return homework;
|
return homework;
|
||||||
}
|
}
|
||||||
|
|
||||||
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.isEmpty) 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();
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
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.isEmpty) 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();
|
||||||
return notes;
|
return notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
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.isEmpty) 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();
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
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.isEmpty) return [];
|
if (userData.isEmpty) return [];
|
||||||
String? absencesJson = userData.elementAt(0)["absences"] as String?;
|
String? absencesJson = userData.elementAt(0)["absences"] as String?;
|
||||||
if (absencesJson == null) return [];
|
if (absencesJson == null) return [];
|
||||||
List<Absence> absences = (jsonDecode(absencesJson) as List).map((e) => Absence.fromJson(e)).toList();
|
List<Absence> absences = (jsonDecode(absencesJson) as List)
|
||||||
|
.map((e) => Absence.fromJson(e))
|
||||||
|
.toList();
|
||||||
return absences;
|
return absences;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<GroupAverage>> getGroupAverages({required String userId}) async {
|
Future<List<GroupAverage>> getGroupAverages({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.isEmpty) return [];
|
if (userData.isEmpty) return [];
|
||||||
String? groupAveragesJson = userData.elementAt(0)["group_averages"] as String?;
|
String? groupAveragesJson =
|
||||||
|
userData.elementAt(0)["group_averages"] as String?;
|
||||||
if (groupAveragesJson == null) return [];
|
if (groupAveragesJson == null) return [];
|
||||||
List<GroupAverage> groupAverages = (jsonDecode(groupAveragesJson) as List).map((e) => GroupAverage.fromJson(e)).toList();
|
List<GroupAverage> groupAverages = (jsonDecode(groupAveragesJson) as List)
|
||||||
|
.map((e) => GroupAverage.fromJson(e))
|
||||||
|
.toList();
|
||||||
return groupAverages;
|
return groupAverages;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<SubjectLessonCount> getSubjectLessonCount({required String userId}) async {
|
Future<SubjectLessonCount> getSubjectLessonCount(
|
||||||
List<Map> userData = await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
{required String userId}) async {
|
||||||
|
List<Map> userData =
|
||||||
|
await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
if (userData.isEmpty) return SubjectLessonCount.fromMap({});
|
if (userData.isEmpty) return SubjectLessonCount.fromMap({});
|
||||||
String? lessonCountJson = userData.elementAt(0)["subject_lesson_count"] as String?;
|
String? lessonCountJson =
|
||||||
|
userData.elementAt(0)["subject_lesson_count"] as String?;
|
||||||
if (lessonCountJson == null) return SubjectLessonCount.fromMap({});
|
if (lessonCountJson == null) return SubjectLessonCount.fromMap({});
|
||||||
SubjectLessonCount lessonCount = SubjectLessonCount.fromMap(jsonDecode(lessonCountJson) as Map);
|
SubjectLessonCount lessonCount =
|
||||||
|
SubjectLessonCount.fromMap(jsonDecode(lessonCountJson) as Map);
|
||||||
return lessonCount;
|
return lessonCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<DateTime> lastSeenGrade({required String userId}) async {
|
Future<DateTime> lastSeenGrade({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.isEmpty) return DateTime(0);
|
if (userData.isEmpty) return DateTime(0);
|
||||||
int? lastSeenDate = userData.elementAt(0)["last_seen_grade"] as int?;
|
int? lastSeenDate = userData.elementAt(0)["last_seen_grade"] as int?;
|
||||||
if (lastSeenDate == null) return DateTime(0);
|
if (lastSeenDate == null) return DateTime(0);
|
||||||
@@ -155,11 +192,71 @@ class UserDatabaseQuery {
|
|||||||
return lastSeen;
|
return lastSeen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// renamed things
|
||||||
Future<Map<String, String>> renamedSubjects({required String userId}) async {
|
Future<Map<String, String>> renamedSubjects({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.isEmpty) return {};
|
if (userData.isEmpty) return {};
|
||||||
String? renamedSubjectsJson = userData.elementAt(0)["renamed_subjects"] as String?;
|
String? renamedSubjectsJson =
|
||||||
|
userData.elementAt(0)["renamed_subjects"] as String?;
|
||||||
if (renamedSubjectsJson == null) return {};
|
if (renamedSubjectsJson == null) return {};
|
||||||
return (jsonDecode(renamedSubjectsJson) as Map).map((key, value) => MapEntry(key.toString(), value.toString()));
|
return (jsonDecode(renamedSubjectsJson) as Map)
|
||||||
|
.map((key, value) => MapEntry(key.toString(), value.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Map<String, String>> renamedTeachers({required String userId}) async {
|
||||||
|
List<Map> userData =
|
||||||
|
await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
|
if (userData.isEmpty) return {};
|
||||||
|
String? renamedTeachersJson =
|
||||||
|
userData.elementAt(0)["renamed_teachers"] as String?;
|
||||||
|
if (renamedTeachersJson == null) return {};
|
||||||
|
return (jsonDecode(renamedTeachersJson) as Map)
|
||||||
|
.map((key, value) => MapEntry(key.toString(), value.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// goal planner
|
||||||
|
Future<Map<String, String>> subjectGoalPlans({required String userId}) async {
|
||||||
|
List<Map> userData =
|
||||||
|
await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
|
if (userData.isEmpty) return {};
|
||||||
|
String? goalPlansJson = userData.elementAt(0)["goal_plans"] as String?;
|
||||||
|
if (goalPlansJson == null) return {};
|
||||||
|
return (jsonDecode(goalPlansJson) as Map)
|
||||||
|
.map((key, value) => MapEntry(key.toString(), value.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Map<String, String>> subjectGoalAverages(
|
||||||
|
{required String userId}) async {
|
||||||
|
List<Map> userData =
|
||||||
|
await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
|
if (userData.isEmpty) return {};
|
||||||
|
String? goalAvgsJson = userData.elementAt(0)["goal_averages"] as String?;
|
||||||
|
if (goalAvgsJson == null) return {};
|
||||||
|
return (jsonDecode(goalAvgsJson) as Map)
|
||||||
|
.map((key, value) => MapEntry(key.toString(), value.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Map<String, String>> subjectGoalBefores(
|
||||||
|
{required String userId}) async {
|
||||||
|
List<Map> userData =
|
||||||
|
await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
|
if (userData.isEmpty) return {};
|
||||||
|
String? goalBeforesJson = userData.elementAt(0)["goal_befores"] as String?;
|
||||||
|
if (goalBeforesJson == null) return {};
|
||||||
|
return (jsonDecode(goalBeforesJson) as Map)
|
||||||
|
.map((key, value) => MapEntry(key.toString(), value.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Map<String, String>> subjectGoalPinDates(
|
||||||
|
{required String userId}) async {
|
||||||
|
List<Map> userData =
|
||||||
|
await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||||
|
if (userData.isEmpty) return {};
|
||||||
|
String? goalPinDatesJson =
|
||||||
|
userData.elementAt(0)["goal_pin_dates"] as String?;
|
||||||
|
if (goalPinDatesJson == null) return {};
|
||||||
|
return (jsonDecode(goalPinDatesJson) as Map)
|
||||||
|
.map((key, value) => MapEntry(key.toString(), value.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ 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.isNotEmpty) {
|
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());
|
||||||
await db.insert("user_data", {"id": user.id});
|
await db.insert("user_data", {"id": user.id});
|
||||||
@@ -49,64 +51,123 @@ class UserDatabaseStore {
|
|||||||
|
|
||||||
Future<void> 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<void> storeLessons(Map<Week, List<Lesson>?> lessons, {required String userId}) async {
|
Future<void> storeLessons(Map<Week, List<Lesson>?> lessons,
|
||||||
|
{required String userId}) async {
|
||||||
final map = lessons.map<String, List<Map<String, Object?>>>(
|
final map = lessons.map<String, List<Map<String, Object?>>>(
|
||||||
(k, v) => MapEntry(k.id.toString(), v!.where((e) => e.json != null).map((e) => e.json!).toList().cast()),
|
(k, v) => MapEntry(k.id.toString(),
|
||||||
|
v!.where((e) => e.json != null).map((e) => e.json!).toList().cast()),
|
||||||
);
|
);
|
||||||
String lessonsJson = jsonEncode(map);
|
String lessonsJson = jsonEncode(map);
|
||||||
await db.update("user_data", {"timetable": lessonsJson}, where: "id = ?", whereArgs: [userId]);
|
await db.update("user_data", {"timetable": lessonsJson},
|
||||||
|
where: "id = ?", whereArgs: [userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> 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<void> 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<void> 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<void> 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<void> 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<void> 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 {
|
Future<void> storeGroupAverages(List<GroupAverage> groupAverages,
|
||||||
String groupAveragesJson = jsonEncode(groupAverages.map((e) => e.json).toList());
|
{required String userId}) async {
|
||||||
await db.update("user_data", {"group_averages": groupAveragesJson}, where: "id = ?", whereArgs: [userId]);
|
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 {
|
Future<void> storeSubjectLessonCount(SubjectLessonCount lessonCount,
|
||||||
|
{required String userId}) async {
|
||||||
String lessonCountJson = jsonEncode(lessonCount.toMap());
|
String lessonCountJson = jsonEncode(lessonCount.toMap());
|
||||||
await db.update("user_data", {"subject_lesson_count": lessonCountJson}, where: "id = ?", whereArgs: [userId]);
|
await db.update("user_data", {"subject_lesson_count": lessonCountJson},
|
||||||
|
where: "id = ?", whereArgs: [userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> storeLastSeenGrade(DateTime date, {required String userId}) async {
|
Future<void> storeLastSeenGrade(DateTime date,
|
||||||
|
{required String userId}) async {
|
||||||
int lastSeenDate = date.millisecondsSinceEpoch;
|
int lastSeenDate = date.millisecondsSinceEpoch;
|
||||||
await db.update("user_data", {"last_seen_grade": lastSeenDate}, where: "id = ?", whereArgs: [userId]);
|
await db.update("user_data", {"last_seen_grade": lastSeenDate},
|
||||||
|
where: "id = ?", whereArgs: [userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> storeRenamedSubjects(Map<String, String> subjects, {required String userId}) async {
|
// renamed things
|
||||||
|
Future<void> storeRenamedSubjects(Map<String, String> subjects,
|
||||||
|
{required String userId}) async {
|
||||||
String renamedSubjectsJson = jsonEncode(subjects);
|
String renamedSubjectsJson = jsonEncode(subjects);
|
||||||
await db.update("user_data", {"renamed_subjects": renamedSubjectsJson}, where: "id = ?", whereArgs: [userId]);
|
await db.update("user_data", {"renamed_subjects": renamedSubjectsJson},
|
||||||
|
where: "id = ?", whereArgs: [userId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> storeRenamedTeachers(Map<String, String> teachers,
|
||||||
|
{required String userId}) async {
|
||||||
|
String renamedTeachersJson = jsonEncode(teachers);
|
||||||
|
await db.update("user_data", {"renamed_teachers": renamedTeachersJson},
|
||||||
|
where: "id = ?", whereArgs: [userId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// goal planner
|
||||||
|
Future<void> storeSubjectGoalPlans(Map<String, String> plans,
|
||||||
|
{required String userId}) async {
|
||||||
|
String goalPlansJson = jsonEncode(plans);
|
||||||
|
await db.update("user_data", {"goal_plans": goalPlansJson},
|
||||||
|
where: "id = ?", whereArgs: [userId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> storeSubjectGoalAverages(Map<String, String> avgs,
|
||||||
|
{required String userId}) async {
|
||||||
|
String goalAvgsJson = jsonEncode(avgs);
|
||||||
|
await db.update("user_data", {"goal_averages": goalAvgsJson},
|
||||||
|
where: "id = ?", whereArgs: [userId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> storeSubjectGoalBefores(Map<String, String> befores,
|
||||||
|
{required String userId}) async {
|
||||||
|
String goalBeforesJson = jsonEncode(befores);
|
||||||
|
await db.update("user_data", {"goal_befores": goalBeforesJson},
|
||||||
|
where: "id = ?", whereArgs: [userId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> storeSubjectGoalPinDates(Map<String, String> dates,
|
||||||
|
{required String userId}) async {
|
||||||
|
String goalPinDatesJson = jsonEncode(dates);
|
||||||
|
await db.update("user_data", {"goal_pin_dates": goalPinDatesJson},
|
||||||
|
where: "id = ?", whereArgs: [userId]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
601
filcnaplo/lib/helpers/notification_helper.dart
Normal file
@@ -0,0 +1,601 @@
|
|||||||
|
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/models/settings.dart';
|
||||||
|
import 'package:filcnaplo/helpers/notification_helper.i18n.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/client/api.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/client/client.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/absence.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/grade.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/lesson.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/week.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/providers/grade_provider.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/providers/timetable_provider.dart';
|
||||||
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart'
|
||||||
|
hide Message;
|
||||||
|
import 'package:i18n_extension/i18n_widget.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/message.dart';
|
||||||
|
|
||||||
|
class NotificationsHelper {
|
||||||
|
late DatabaseProvider database;
|
||||||
|
late SettingsProvider settingsProvider;
|
||||||
|
late UserProvider userProvider;
|
||||||
|
late KretaClient kretaClient;
|
||||||
|
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||||
|
FlutterLocalNotificationsPlugin();
|
||||||
|
|
||||||
|
List<T> combineLists<T, K>(
|
||||||
|
List<T> list1,
|
||||||
|
List<T> list2,
|
||||||
|
K Function(T) keyExtractor,
|
||||||
|
) {
|
||||||
|
Set<K> uniqueKeys = <K>{};
|
||||||
|
List<T> combinedList = [];
|
||||||
|
|
||||||
|
for (T item in list1) {
|
||||||
|
K key = keyExtractor(item);
|
||||||
|
if (!uniqueKeys.contains(key)) {
|
||||||
|
uniqueKeys.add(key);
|
||||||
|
combinedList.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (T item in list2) {
|
||||||
|
K key = keyExtractor(item);
|
||||||
|
if (!uniqueKeys.contains(key)) {
|
||||||
|
uniqueKeys.add(key);
|
||||||
|
combinedList.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return combinedList;
|
||||||
|
}
|
||||||
|
|
||||||
|
String dayTitle(DateTime date) {
|
||||||
|
try {
|
||||||
|
return DateFormat("EEEE", I18n.locale.languageCode).format(date);
|
||||||
|
} catch (e) {
|
||||||
|
return "Unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@pragma('vm:entry-point')
|
||||||
|
void backgroundJob() async {
|
||||||
|
// initialize providers
|
||||||
|
database = DatabaseProvider();
|
||||||
|
await database.init();
|
||||||
|
settingsProvider = await database.query.getSettings(database);
|
||||||
|
userProvider = await database.query.getUsers(settingsProvider);
|
||||||
|
|
||||||
|
if (userProvider.id != null && settingsProvider.notificationsEnabled) {
|
||||||
|
// refresh kreta login
|
||||||
|
final status = StatusProvider();
|
||||||
|
kretaClient = KretaClient(
|
||||||
|
user: userProvider, settings: settingsProvider, status: status);
|
||||||
|
kretaClient.refreshLogin();
|
||||||
|
if (settingsProvider.notificationsGradesEnabled) gradeNotification();
|
||||||
|
if (settingsProvider.notificationsAbsencesEnabled) absenceNotification();
|
||||||
|
if (settingsProvider.notificationsMessagesEnabled) messageNotification();
|
||||||
|
if (settingsProvider.notificationsLessonsEnabled) lessonNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gradeNotification() async {
|
||||||
|
// fetch grades
|
||||||
|
GradeProvider gradeProvider = GradeProvider(
|
||||||
|
settings: settingsProvider,
|
||||||
|
user: userProvider,
|
||||||
|
database: database,
|
||||||
|
kreta: kretaClient);
|
||||||
|
gradeProvider.fetch();
|
||||||
|
List<Grade> grades =
|
||||||
|
await database.userQuery.getGrades(userId: userProvider.id ?? "");
|
||||||
|
DateTime lastSeenGrade =
|
||||||
|
await database.userQuery.lastSeenGrade(userId: userProvider.id ?? "");
|
||||||
|
|
||||||
|
// loop through grades and see which hasn't been seen yet
|
||||||
|
for (Grade grade in grades) {
|
||||||
|
// if grade is not a normal grade (1-5), don't show it
|
||||||
|
if ([1, 2, 3, 4, 5].contains(grade.value.value)) {
|
||||||
|
// if the grade was added over a week ago, don't show it to avoid notification spam
|
||||||
|
if (grade.seenDate.isAfter(lastSeenGrade) &&
|
||||||
|
grade.date.difference(DateTime.now()).inDays * -1 < 7) {
|
||||||
|
// send notificiation about new grade
|
||||||
|
AndroidNotificationDetails androidNotificationDetails =
|
||||||
|
AndroidNotificationDetails(
|
||||||
|
'GRADES',
|
||||||
|
'Jegyek',
|
||||||
|
channelDescription: 'Értesítés jegyek beírásakor',
|
||||||
|
importance: Importance.max,
|
||||||
|
priority: Priority.max,
|
||||||
|
color: settingsProvider.customAccentColor,
|
||||||
|
ticker: 'Jegyek',
|
||||||
|
);
|
||||||
|
NotificationDetails notificationDetails =
|
||||||
|
NotificationDetails(android: androidNotificationDetails);
|
||||||
|
if (userProvider.getUsers().length == 1) {
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
grade.id.hashCode,
|
||||||
|
"title_grade".i18n,
|
||||||
|
"body_grade".i18n.fill(
|
||||||
|
[
|
||||||
|
grade.value.value.toString(),
|
||||||
|
grade.subject.isRenamed &&
|
||||||
|
settingsProvider.renamedSubjectsEnabled
|
||||||
|
? grade.subject.renamedTo!
|
||||||
|
: grade.subject.name
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// multiple users are added, also display student name
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
grade.id.hashCode,
|
||||||
|
"title_grade".i18n,
|
||||||
|
"body_grade_multiuser".i18n.fill(
|
||||||
|
[
|
||||||
|
userProvider.displayName!,
|
||||||
|
grade.value.value.toString(),
|
||||||
|
grade.subject.isRenamed &&
|
||||||
|
settingsProvider.renamedSubjectsEnabled
|
||||||
|
? grade.subject.renamedTo!
|
||||||
|
: grade.subject.name
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// set grade seen status
|
||||||
|
gradeProvider.seenAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
void absenceNotification() async {
|
||||||
|
// get absences from api
|
||||||
|
List? absenceJson = await kretaClient
|
||||||
|
.getAPI(KretaAPI.absences(userProvider.instituteCode ?? ""));
|
||||||
|
List<Absence> storedAbsences =
|
||||||
|
await database.userQuery.getAbsences(userId: userProvider.id!);
|
||||||
|
if (absenceJson == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// format api absences to correct format while preserving isSeen value
|
||||||
|
List<Absence> absences = absenceJson.map((e) {
|
||||||
|
Absence apiAbsence = Absence.fromJson(e);
|
||||||
|
Absence storedAbsence = storedAbsences.firstWhere(
|
||||||
|
(stored) => stored.id == apiAbsence.id,
|
||||||
|
orElse: () => apiAbsence);
|
||||||
|
apiAbsence.isSeen = storedAbsence.isSeen;
|
||||||
|
return apiAbsence;
|
||||||
|
}).toList();
|
||||||
|
List<Absence> modifiedAbsences = [];
|
||||||
|
if (absences != storedAbsences) {
|
||||||
|
// remove absences that are not new
|
||||||
|
absences.removeWhere((element) => storedAbsences.contains(element));
|
||||||
|
for (Absence absence in absences) {
|
||||||
|
if (!absence.isSeen) {
|
||||||
|
absence.isSeen = true;
|
||||||
|
modifiedAbsences.add(absence);
|
||||||
|
AndroidNotificationDetails androidNotificationDetails =
|
||||||
|
AndroidNotificationDetails(
|
||||||
|
'ABSENCES',
|
||||||
|
'Hiányzások',
|
||||||
|
channelDescription: 'Értesítés hiányzások beírásakor',
|
||||||
|
importance: Importance.max,
|
||||||
|
priority: Priority.max,
|
||||||
|
color: settingsProvider.customAccentColor,
|
||||||
|
ticker: 'Hiányzások',
|
||||||
|
);
|
||||||
|
NotificationDetails notificationDetails =
|
||||||
|
NotificationDetails(android: androidNotificationDetails);
|
||||||
|
if (userProvider.getUsers().length == 1) {
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
absence.id.hashCode,
|
||||||
|
"title_absence".i18n, // https://discord.com/channels/1111649116020285532/1153273625206591528
|
||||||
|
"body_absence".i18n.fill(
|
||||||
|
[
|
||||||
|
DateFormat("yyyy-MM-dd").format(absence.date),
|
||||||
|
absence.subject.isRenamed &&
|
||||||
|
settingsProvider.renamedSubjectsEnabled
|
||||||
|
? absence.subject.renamedTo!
|
||||||
|
: absence.subject.name
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
absence.id.hashCode,
|
||||||
|
"title_absence".i18n, // https://discord.com/channels/1111649116020285532/1153273625206591528
|
||||||
|
"body_absence_multiuser".i18n.fill(
|
||||||
|
[
|
||||||
|
userProvider.displayName!,
|
||||||
|
DateFormat("yyyy-MM-dd").format(absence.date),
|
||||||
|
absence.subject.isRenamed &&
|
||||||
|
settingsProvider.renamedSubjectsEnabled
|
||||||
|
? absence.subject.renamedTo!
|
||||||
|
: absence.subject.name
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// combine modified absences and storedabsences list and save them to the database
|
||||||
|
List<Absence> combinedAbsences = combineLists(
|
||||||
|
modifiedAbsences,
|
||||||
|
storedAbsences,
|
||||||
|
(Absence absence) => absence.id,
|
||||||
|
);
|
||||||
|
await database.userStore
|
||||||
|
.storeAbsences(combinedAbsences, userId: userProvider.id!);
|
||||||
|
}
|
||||||
|
|
||||||
|
void messageNotification() async {
|
||||||
|
// get messages from api
|
||||||
|
List? messageJson =
|
||||||
|
await kretaClient.getAPI(KretaAPI.messages("beerkezett"));
|
||||||
|
List<Message> storedmessages =
|
||||||
|
await database.userQuery.getMessages(userId: userProvider.id!);
|
||||||
|
if (messageJson == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// format api messages to correct format while preserving isSeen value
|
||||||
|
// Parse messages
|
||||||
|
List<Message> messages = [];
|
||||||
|
await Future.wait(List.generate(messageJson.length, (index) {
|
||||||
|
return () async {
|
||||||
|
Map message = messageJson.cast<Map>()[index];
|
||||||
|
Map? innerMessageJson = await kretaClient
|
||||||
|
.getAPI(KretaAPI.message(message["azonosito"].toString()));
|
||||||
|
if (innerMessageJson != null) {
|
||||||
|
messages.add(
|
||||||
|
Message.fromJson(innerMessageJson, forceType: MessageType.inbox));
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
}));
|
||||||
|
|
||||||
|
for (Message message in messages) {
|
||||||
|
for (Message storedMessage in storedmessages) {
|
||||||
|
if (message.id == storedMessage.id) {
|
||||||
|
message.isSeen = storedMessage.isSeen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<Message> modifiedmessages = [];
|
||||||
|
if (messages != storedmessages) {
|
||||||
|
// remove messages that are not new
|
||||||
|
messages.removeWhere((element) => storedmessages.contains(element));
|
||||||
|
for (Message message in messages) {
|
||||||
|
if (!message.isSeen) {
|
||||||
|
message.isSeen = true;
|
||||||
|
modifiedmessages.add(message);
|
||||||
|
AndroidNotificationDetails androidNotificationDetails =
|
||||||
|
AndroidNotificationDetails(
|
||||||
|
'MESSAGES',
|
||||||
|
'Üzenetek',
|
||||||
|
channelDescription: 'Értesítés kapott üzenetekkor',
|
||||||
|
importance: Importance.max,
|
||||||
|
priority: Priority.max,
|
||||||
|
color: settingsProvider.customAccentColor,
|
||||||
|
ticker: 'Üzenetek',
|
||||||
|
);
|
||||||
|
NotificationDetails notificationDetails =
|
||||||
|
NotificationDetails(android: androidNotificationDetails);
|
||||||
|
if (userProvider.getUsers().length == 1) {
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
message.id.hashCode,
|
||||||
|
message.author,
|
||||||
|
message.content.replaceAll(RegExp(r'<[^>]*>'), ''),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
message.id.hashCode,
|
||||||
|
"(${userProvider.displayName!}) ${message.author}",
|
||||||
|
message.content.replaceAll(RegExp(r'<[^>]*>'), ''),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// combine modified messages and storedmessages list and save them to the database
|
||||||
|
List<Message> combinedmessages = combineLists(
|
||||||
|
modifiedmessages,
|
||||||
|
storedmessages,
|
||||||
|
(Message message) => message.id,
|
||||||
|
);
|
||||||
|
await database.userStore
|
||||||
|
.storeMessages(combinedmessages, userId: userProvider.id!);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lessonNotification() async {
|
||||||
|
// get lesson from api
|
||||||
|
TimetableProvider timetableProvider = TimetableProvider(
|
||||||
|
user: userProvider, database: database, kreta: kretaClient);
|
||||||
|
List<Lesson> storedlessons =
|
||||||
|
timetableProvider.lessons[Week.current()] ?? [];
|
||||||
|
List? apilessons = timetableProvider.getWeek(Week.current()) ?? [];
|
||||||
|
for (Lesson lesson in apilessons) {
|
||||||
|
for (Lesson storedLesson in storedlessons) {
|
||||||
|
if (lesson.id == storedLesson.id) {
|
||||||
|
lesson.isSeen = storedLesson.isSeen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<Lesson> modifiedlessons = [];
|
||||||
|
if (apilessons != storedlessons) {
|
||||||
|
// remove lessons that are not new
|
||||||
|
apilessons.removeWhere((element) => storedlessons.contains(element));
|
||||||
|
for (Lesson lesson in apilessons) {
|
||||||
|
if (!lesson.isSeen && lesson.isChanged) {
|
||||||
|
lesson.isSeen = true;
|
||||||
|
modifiedlessons.add(lesson);
|
||||||
|
AndroidNotificationDetails androidNotificationDetails =
|
||||||
|
AndroidNotificationDetails(
|
||||||
|
'LESSONS',
|
||||||
|
'Órák',
|
||||||
|
channelDescription:
|
||||||
|
'Értesítés órák elmaradásáról, helyettesítésről',
|
||||||
|
importance: Importance.max,
|
||||||
|
priority: Priority.max,
|
||||||
|
color: settingsProvider.customAccentColor,
|
||||||
|
ticker: 'Órák',
|
||||||
|
);
|
||||||
|
NotificationDetails notificationDetails =
|
||||||
|
NotificationDetails(android: androidNotificationDetails);
|
||||||
|
if (userProvider.getUsers().length == 1) {
|
||||||
|
if (lesson.status?.name == "Elmaradt") {
|
||||||
|
switch (I18n.localeStr) {
|
||||||
|
case "en_en":
|
||||||
|
{
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
lesson.id.hashCode,
|
||||||
|
"title_lesson".i18n,
|
||||||
|
"body_lesson_canceled".i18n.fill(
|
||||||
|
[
|
||||||
|
lesson.lessonIndex,
|
||||||
|
lesson.name,
|
||||||
|
dayTitle(lesson.date)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "hu_hu":
|
||||||
|
{
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
lesson.id.hashCode,
|
||||||
|
"title_lesson".i18n,
|
||||||
|
"body_lesson_canceled".i18n.fill(
|
||||||
|
[
|
||||||
|
dayTitle(lesson.date),
|
||||||
|
lesson.lessonIndex,
|
||||||
|
lesson.name
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
lesson.id.hashCode,
|
||||||
|
"title_lesson".i18n,
|
||||||
|
"body_lesson_canceled".i18n.fill(
|
||||||
|
[
|
||||||
|
lesson.lessonIndex,
|
||||||
|
lesson.name,
|
||||||
|
dayTitle(lesson.date)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (lesson.substituteTeacher?.name != "") {
|
||||||
|
switch (I18n.localeStr) {
|
||||||
|
case "en_en":
|
||||||
|
{
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
lesson.id.hashCode,
|
||||||
|
"title_lesson".i18n,
|
||||||
|
"body_lesson_substituted".i18n.fill(
|
||||||
|
[
|
||||||
|
lesson.lessonIndex,
|
||||||
|
lesson.name,
|
||||||
|
dayTitle(lesson.date),
|
||||||
|
lesson.substituteTeacher!.isRenamed
|
||||||
|
? lesson.substituteTeacher!.renamedTo!
|
||||||
|
: lesson.substituteTeacher!.name
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "hu_hu":
|
||||||
|
{
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
lesson.id.hashCode,
|
||||||
|
"title_lesson".i18n,
|
||||||
|
"body_lesson_substituted".i18n.fill(
|
||||||
|
[
|
||||||
|
dayTitle(lesson.date),
|
||||||
|
lesson.lessonIndex,
|
||||||
|
lesson.name,
|
||||||
|
lesson.substituteTeacher!.isRenamed
|
||||||
|
? lesson.substituteTeacher!.renamedTo!
|
||||||
|
: lesson.substituteTeacher!.name
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
lesson.id.hashCode,
|
||||||
|
"title_lesson".i18n,
|
||||||
|
"body_lesson_substituted".i18n.fill(
|
||||||
|
[
|
||||||
|
lesson.lessonIndex,
|
||||||
|
lesson.name,
|
||||||
|
dayTitle(lesson.date),
|
||||||
|
lesson.substituteTeacher!.isRenamed
|
||||||
|
? lesson.substituteTeacher!.renamedTo!
|
||||||
|
: lesson.substituteTeacher!.name
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (lesson.status?.name == "Elmaradt") {
|
||||||
|
switch (I18n.localeStr) {
|
||||||
|
case "en_en":
|
||||||
|
{
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
lesson.id.hashCode,
|
||||||
|
"title_lesson".i18n,
|
||||||
|
"body_lesson_canceled".i18n.fill(
|
||||||
|
[
|
||||||
|
userProvider.displayName!,
|
||||||
|
lesson.lessonIndex,
|
||||||
|
lesson.name,
|
||||||
|
dayTitle(lesson.date)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "hu_hu":
|
||||||
|
{
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
lesson.id.hashCode,
|
||||||
|
"title_lesson".i18n,
|
||||||
|
"body_lesson_canceled".i18n.fill(
|
||||||
|
[
|
||||||
|
userProvider.displayName!,
|
||||||
|
dayTitle(lesson.date),
|
||||||
|
lesson.lessonIndex,
|
||||||
|
lesson.name
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
lesson.id.hashCode,
|
||||||
|
"title_lesson".i18n,
|
||||||
|
"body_lesson_canceled".i18n.fill(
|
||||||
|
[
|
||||||
|
userProvider.displayName!,
|
||||||
|
lesson.lessonIndex,
|
||||||
|
lesson.name,
|
||||||
|
dayTitle(lesson.date)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (lesson.substituteTeacher?.name != "") {
|
||||||
|
switch (I18n.localeStr) {
|
||||||
|
case "en_en":
|
||||||
|
{
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
lesson.id.hashCode,
|
||||||
|
"title_lesson".i18n,
|
||||||
|
"body_lesson_substituted".i18n.fill(
|
||||||
|
[
|
||||||
|
userProvider.displayName!,
|
||||||
|
lesson.lessonIndex,
|
||||||
|
lesson.name,
|
||||||
|
dayTitle(lesson.date),
|
||||||
|
lesson.substituteTeacher!.isRenamed
|
||||||
|
? lesson.substituteTeacher!.renamedTo!
|
||||||
|
: lesson.substituteTeacher!.name
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "hu_hu":
|
||||||
|
{
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
lesson.id.hashCode,
|
||||||
|
"title_lesson".i18n,
|
||||||
|
"body_lesson_substituted".i18n.fill(
|
||||||
|
[
|
||||||
|
userProvider.displayName!,
|
||||||
|
dayTitle(lesson.date),
|
||||||
|
lesson.lessonIndex,
|
||||||
|
lesson.name,
|
||||||
|
lesson.substituteTeacher!.isRenamed
|
||||||
|
? lesson.substituteTeacher!.renamedTo!
|
||||||
|
: lesson.substituteTeacher!.name
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
lesson.id.hashCode,
|
||||||
|
"title_lesson".i18n,
|
||||||
|
"body_lesson_substituted".i18n.fill(
|
||||||
|
[
|
||||||
|
userProvider.displayName!,
|
||||||
|
lesson.lessonIndex,
|
||||||
|
lesson.name,
|
||||||
|
dayTitle(lesson.date),
|
||||||
|
lesson.substituteTeacher!.isRenamed
|
||||||
|
? lesson.substituteTeacher!.renamedTo!
|
||||||
|
: lesson.substituteTeacher!.name
|
||||||
|
],
|
||||||
|
),
|
||||||
|
notificationDetails,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// combine modified lesson and storedlesson list and save them to the database
|
||||||
|
List<Lesson> combinedlessons = combineLists(
|
||||||
|
modifiedlessons,
|
||||||
|
storedlessons,
|
||||||
|
(Lesson message) => message.id,
|
||||||
|
);
|
||||||
|
Map<Week, List<Lesson>> timetableLessons = timetableProvider.lessons;
|
||||||
|
timetableLessons[Week.current()] = combinedlessons;
|
||||||
|
await database.userStore
|
||||||
|
.storeLessons(timetableLessons, userId: userProvider.id!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
51
filcnaplo/lib/helpers/notification_helper.i18n.dart
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import 'package:i18n_extension/i18n_extension.dart';
|
||||||
|
|
||||||
|
extension Localization on String {
|
||||||
|
static final _t = Translations.byLocale("hu_hu") +
|
||||||
|
{
|
||||||
|
"en_en": {
|
||||||
|
"title_grade": "New grade",
|
||||||
|
"body_grade": "You got a %s in %s",
|
||||||
|
"body_grade_multiuser": "%s got a %s in %s",
|
||||||
|
"title_absence": "Absence recorded",
|
||||||
|
"body_absence": "An absence was recorded on %s for %s",
|
||||||
|
"body_absence_multiuser": "An absence was recorded for %s on %s for the subject %s",
|
||||||
|
"title_lesson": "Timetable modified",
|
||||||
|
"body_lesson_canceled": "Lesson #%s (%s) has been canceled on %s",
|
||||||
|
"body_lesson_canceled_multiuser": "(%s) Lesson #%s (%s) has been canceled on %s",
|
||||||
|
"body_lesson_substituted": "Lesson #%s (%s) on %s will be substituted by %s",
|
||||||
|
"body_lesson_substituted_multiuser": "(%s) Lesson #%s (%s) on %s will be substituted by %s"
|
||||||
|
},
|
||||||
|
"hu_hu": {
|
||||||
|
"title_grade": "Új jegy",
|
||||||
|
"body_grade": "%s-st kaptál %s tantárgyból",
|
||||||
|
"body_grade_multiuser": "%s tanuló %s-st kapott %s tantárgyból",
|
||||||
|
"title_absence": "Új hiányzás",
|
||||||
|
"body_absence": "Új hiányzást kaptál %s napon %s tantárgyból",
|
||||||
|
"body_absence_multiuser": "%s tanuló új hiányzást kapott %s napon %s tantárgyból",
|
||||||
|
"title_lesson": "Órarend szerkesztve",
|
||||||
|
"body_lesson_canceled": "%s-i %s. óra (%s) elmarad",
|
||||||
|
"body_lesson_canceled_multiuser": "(%s) %s-i %s. óra (%s) elmarad",
|
||||||
|
"body_lesson_substituted": "%s-i %s. (%s) órát %s helyettesíti",
|
||||||
|
"body_lesson_substituted_multiuser": "(%s) %s-i %s. (%s) órát %s helyettesíti"
|
||||||
|
},
|
||||||
|
"de_de": {
|
||||||
|
"title_grade": "Neue Note",
|
||||||
|
"body_grade": "Du hast eine %s in %s",
|
||||||
|
"body_grade_multiuser": "%s hast eine %s in %s",
|
||||||
|
"title_absence": "Abwesenheit aufgezeichnet",
|
||||||
|
"body_absence": "Auf %s für %s wurde eine Abwesenheit aufgezeichnet",
|
||||||
|
"body_absence_multiuser": "Für %s wurde am %s für das Thema Mathematik eine Abwesenheit aufgezeichnet",
|
||||||
|
"title_lesson": "Fahrplan geändert",
|
||||||
|
"body_lesson_canceled": "Lektion Nr. %s (%s) wurde am %s abgesagt",
|
||||||
|
"body_lesson_canceled_multiuser": "(%s) Lektion Nr. %s (%s) wurde am %s abgesagt",
|
||||||
|
"body_lesson_substituted": "Lektion Nr. %s (%s) wird am %s durch %s ersetzt",
|
||||||
|
"body_lesson_substituted_multiuser": "(%s) Lektion Nr. %s (%s) wird am %s durch %s ersetzt"
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
String get i18n => localize(this, _t);
|
||||||
|
String fill(List<Object> params) => localizeFill(this, params);
|
||||||
|
String plural(int value) => localizePlural(value, this, _t);
|
||||||
|
String version(Object modifier) => localizeVersion(modifier, this, _t);
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ import 'package:permission_handler/permission_handler.dart';
|
|||||||
class StorageHelper {
|
class StorageHelper {
|
||||||
static Future<bool> write(String path, Uint8List data) async {
|
static Future<bool> write(String path, Uint8List data) async {
|
||||||
try {
|
try {
|
||||||
if (await Permission.storage.request().isGranted) {
|
if (await Permission.manageExternalStorage.request().isGranted) {
|
||||||
await File(path).writeAsBytes(data);
|
await File(path).writeAsBytes(data);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -34,5 +34,6 @@ class StorageHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return downloads;
|
return downloads;
|
||||||
|
// return (await getTemporaryDirectory()).path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,12 @@ class SubjectIcon {
|
|||||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.globe, material: Icons.translate_outlined), name: "globe");
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.globe, material: Icons.translate_outlined), name: "globe");
|
||||||
} else if (RegExp("linux").hasMatch(name)) {
|
} else if (RegExp("linux").hasMatch(name)) {
|
||||||
return SubjectIconData(data: createIcon(material: FilcIcons.linux, cupertino: FilcIcons.linux));
|
return SubjectIconData(data: createIcon(material: FilcIcons.linux, cupertino: FilcIcons.linux));
|
||||||
|
} else if (RegExp("adatbazis").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.table_badge_more, material: Icons.table_chart), name: "table.badge.more");
|
||||||
|
} else if (RegExp("asztali alkalmazasok").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.macwindow, material: Icons.desktop_windows_outlined), name: "macwindow");
|
||||||
|
} else if (RegExp("projekt").hasMatch(name)) {
|
||||||
|
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.person_3_fill, material: Icons.groups_3), name: "person.3.fill");
|
||||||
}
|
}
|
||||||
|
|
||||||
return SubjectIconData();
|
return SubjectIconData();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:filcnaplo/api/client.dart';
|
|||||||
import 'package:filcnaplo/helpers/storage_helper.dart';
|
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';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
enum UpdateState { none, preparing, downloading, installing }
|
enum UpdateState { none, preparing, downloading, installing }
|
||||||
|
|
||||||
@@ -19,23 +20,30 @@ extension UpdateHelper on Release {
|
|||||||
updateCallback!(-1, UpdateState.preparing);
|
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/refilc-v$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 installPerms =
|
||||||
|
(await Permission.manageExternalStorage.request().isGranted &&
|
||||||
|
await Permission.requestInstallPackages.request().isGranted);
|
||||||
|
if (installPerms) {
|
||||||
|
var result = await OpenFile.open(apk.path);
|
||||||
|
|
||||||
if (result.type != ResultType.done) {
|
if (result.type != ResultType.done) {
|
||||||
// ignore: avoid_print
|
// ignore: avoid_print
|
||||||
print("ERROR: installUpdate.openFile: ${result.message}");
|
print("ERROR: installUpdate.openFile: ${result.message}");
|
||||||
throw result.message;
|
throw result.message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCallback(-1, UpdateState.none);
|
updateCallback(-1, UpdateState.none);
|
||||||
@@ -50,7 +58,8 @@ extension UpdateHelper on Release {
|
|||||||
var completer = Completer<Uint8List>();
|
var completer = Completer<Uint8List>();
|
||||||
|
|
||||||
response?.stream.listen((List<int> chunk) {
|
response?.stream.listen((List<int> chunk) {
|
||||||
updateCallback!(downloaded / (response.contentLength ?? 0), UpdateState.downloading);
|
updateCallback!(
|
||||||
|
downloaded / (response.contentLength ?? 0), UpdateState.downloading);
|
||||||
|
|
||||||
chunks.add(chunk);
|
chunks.add(chunk);
|
||||||
downloaded += chunk.length;
|
downloaded += chunk.length;
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:background_fetch/background_fetch.dart';
|
import 'package:background_fetch/background_fetch.dart';
|
||||||
import 'package:filcnaplo/api/providers/user_provider.dart';
|
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/helpers/notification_helper.dart';
|
||||||
import 'package:filcnaplo/models/settings.dart';
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -9,6 +12,7 @@ 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';
|
import 'package:filcnaplo_mobile_ui/screens/error_report_screen.dart';
|
||||||
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
// Initalize
|
// Initalize
|
||||||
@@ -26,9 +30,10 @@ void main() async {
|
|||||||
|
|
||||||
// Run App
|
// Run App
|
||||||
runApp(App(
|
runApp(App(
|
||||||
database: startup.database,
|
database: startup.database,
|
||||||
settings: startup.settings,
|
settings: startup.settings,
|
||||||
user: startup.user));
|
user: startup.user,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
class Startup {
|
class Startup {
|
||||||
@@ -43,6 +48,69 @@ class Startup {
|
|||||||
await database.init();
|
await database.init();
|
||||||
settings = await database.query.getSettings(database);
|
settings = await database.query.getSettings(database);
|
||||||
user = await database.query.getUsers(settings);
|
user = await database.query.getUsers(settings);
|
||||||
|
|
||||||
|
late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
|
||||||
|
// Notifications setup
|
||||||
|
if (!kIsWeb) {
|
||||||
|
initPlatformState();
|
||||||
|
flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get permission to show notifications
|
||||||
|
if (kIsWeb) {
|
||||||
|
// do nothing
|
||||||
|
} else if (Platform.isAndroid) {
|
||||||
|
await flutterLocalNotificationsPlugin
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
AndroidFlutterLocalNotificationsPlugin>()!
|
||||||
|
.requestPermission();
|
||||||
|
} else if (Platform.isIOS) {
|
||||||
|
await flutterLocalNotificationsPlugin
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
IOSFlutterLocalNotificationsPlugin>()
|
||||||
|
?.requestPermissions(
|
||||||
|
alert: false,
|
||||||
|
badge: true,
|
||||||
|
sound: true,
|
||||||
|
);
|
||||||
|
} else if (Platform.isMacOS) {
|
||||||
|
await flutterLocalNotificationsPlugin
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
MacOSFlutterLocalNotificationsPlugin>()
|
||||||
|
?.requestPermissions(
|
||||||
|
alert: false,
|
||||||
|
badge: true,
|
||||||
|
sound: true,
|
||||||
|
);
|
||||||
|
} else if (Platform.isLinux) {
|
||||||
|
// no permissions are needed on linux
|
||||||
|
}
|
||||||
|
|
||||||
|
// Platform specific settings
|
||||||
|
if (!kIsWeb) {
|
||||||
|
const DarwinInitializationSettings initializationSettingsDarwin =
|
||||||
|
DarwinInitializationSettings(
|
||||||
|
requestSoundPermission: true,
|
||||||
|
requestBadgePermission: true,
|
||||||
|
requestAlertPermission: false,
|
||||||
|
);
|
||||||
|
const AndroidInitializationSettings initializationSettingsAndroid =
|
||||||
|
AndroidInitializationSettings('ic_notification');
|
||||||
|
const LinuxInitializationSettings initializationSettingsLinux =
|
||||||
|
LinuxInitializationSettings(defaultActionName: 'Open notification');
|
||||||
|
const InitializationSettings initializationSettings =
|
||||||
|
InitializationSettings(
|
||||||
|
android: initializationSettingsAndroid,
|
||||||
|
iOS: initializationSettingsDarwin,
|
||||||
|
macOS: initializationSettingsDarwin,
|
||||||
|
linux: initializationSettingsLinux,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Initialize notifications
|
||||||
|
await flutterLocalNotificationsPlugin.initialize(
|
||||||
|
initializationSettings,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,8 +140,58 @@ Widget errorBuilder(FlutterErrorDetails details) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> initPlatformState() async {
|
||||||
|
// Configure BackgroundFetch.
|
||||||
|
int status = await BackgroundFetch.configure(
|
||||||
|
BackgroundFetchConfig(
|
||||||
|
minimumFetchInterval: 15,
|
||||||
|
stopOnTerminate: false,
|
||||||
|
enableHeadless: true,
|
||||||
|
requiresBatteryNotLow: false,
|
||||||
|
requiresCharging: false,
|
||||||
|
requiresStorageNotLow: false,
|
||||||
|
requiresDeviceIdle: false,
|
||||||
|
requiredNetworkType: NetworkType.ANY,
|
||||||
|
startOnBoot: true), (String taskId) async {
|
||||||
|
// <-- Event handler
|
||||||
|
if (kDebugMode) {
|
||||||
|
print("[BackgroundFetch] Event received $taskId");
|
||||||
|
}
|
||||||
|
NotificationsHelper().backgroundJob();
|
||||||
|
BackgroundFetch.finish(taskId);
|
||||||
|
}, (String taskId) async {
|
||||||
|
// <-- Task timeout handler.
|
||||||
|
if (kDebugMode) {
|
||||||
|
print("[BackgroundFetch] TASK TIMEOUT taskId: $taskId");
|
||||||
|
}
|
||||||
|
BackgroundFetch.finish(taskId);
|
||||||
|
});
|
||||||
|
if (kDebugMode) {
|
||||||
|
print('[BackgroundFetch] configure success: $status');
|
||||||
|
}
|
||||||
|
BackgroundFetch.scheduleTask(TaskConfig(
|
||||||
|
taskId: "com.transistorsoft.refilcnotification",
|
||||||
|
delay: 900000, // 15 minutes
|
||||||
|
periodic: true,
|
||||||
|
forceAlarmManager: true,
|
||||||
|
stopOnTerminate: false,
|
||||||
|
enableHeadless: true));
|
||||||
|
}
|
||||||
|
|
||||||
@pragma('vm:entry-point')
|
@pragma('vm:entry-point')
|
||||||
void backgroundHeadlessTask(HeadlessTask task) {
|
void backgroundHeadlessTask(HeadlessTask task) {
|
||||||
print('[BackgroundFetch] Headless event received.');
|
String taskId = task.taskId;
|
||||||
|
bool isTimeout = task.timeout;
|
||||||
|
if (isTimeout) {
|
||||||
|
if (kDebugMode) {
|
||||||
|
print("[BackgroundFetch] Headless task timed-out: $taskId");
|
||||||
|
}
|
||||||
|
BackgroundFetch.finish(taskId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (kDebugMode) {
|
||||||
|
print('[BackgroundFetch] Headless event received.');
|
||||||
|
}
|
||||||
|
NotificationsHelper().backgroundJob();
|
||||||
BackgroundFetch.finish(task.taskId);
|
BackgroundFetch.finish(task.taskId);
|
||||||
}
|
}
|
||||||
|
|||||||
37
filcnaplo/lib/models/ad.dart
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
class Ad {
|
||||||
|
String title;
|
||||||
|
String description;
|
||||||
|
String author;
|
||||||
|
Uri? logoUrl;
|
||||||
|
bool overridePremium;
|
||||||
|
DateTime date;
|
||||||
|
DateTime expireDate;
|
||||||
|
Uri launchUrl;
|
||||||
|
|
||||||
|
Ad({
|
||||||
|
required this.title,
|
||||||
|
required this.description,
|
||||||
|
required this.author,
|
||||||
|
this.logoUrl,
|
||||||
|
this.overridePremium = false,
|
||||||
|
required this.date,
|
||||||
|
required this.expireDate,
|
||||||
|
required this.launchUrl,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Ad.fromJson(Map json) {
|
||||||
|
return Ad(
|
||||||
|
title: json['title'] ?? 'Ad',
|
||||||
|
description: json['description'] ?? '',
|
||||||
|
author: json['author'] ?? 'reFilc',
|
||||||
|
logoUrl: json['logo_url'] != null ? Uri.parse(json['logo_url']) : null,
|
||||||
|
overridePremium: json['override_premium'] ?? false,
|
||||||
|
date:
|
||||||
|
json['date'] != null ? DateTime.parse(json['date']) : DateTime.now(),
|
||||||
|
expireDate: json['expire_date'] != null
|
||||||
|
? DateTime.parse(json['expire_date'])
|
||||||
|
: DateTime.now(),
|
||||||
|
launchUrl: Uri.parse(json['launch_url'] ?? 'https://refilc.hu'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,18 +3,22 @@ import 'dart:io';
|
|||||||
class Config {
|
class Config {
|
||||||
String _userAgent;
|
String _userAgent;
|
||||||
Map? json;
|
Map? json;
|
||||||
static const String _version = String.fromEnvironment("APPVER", defaultValue: "2.2.0");
|
static const String _version =
|
||||||
|
String.fromEnvironment("APPVER", defaultValue: "3.0.4");
|
||||||
|
|
||||||
Config({required String userAgent, this.json}) : _userAgent = userAgent;
|
Config({required String userAgent, this.json}) : _userAgent = userAgent;
|
||||||
|
|
||||||
factory Config.fromJson(Map json) {
|
factory Config.fromJson(Map json) {
|
||||||
return Config(
|
return Config(
|
||||||
userAgent: json["user_agent"] ?? "hu.refilc.naplo/\$0/\$1/\$2",
|
userAgent: json["user_agent"] ?? "hu.ekreta.student/\$0/\$1/\$2",
|
||||||
json: json,
|
json: json,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String get userAgent => _userAgent.replaceAll("\$0", _version).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,30 +1,36 @@
|
|||||||
class News {
|
class News {
|
||||||
|
String id;
|
||||||
String title;
|
String title;
|
||||||
String content;
|
String content;
|
||||||
String link;
|
String link;
|
||||||
String openLabel;
|
String openLabel;
|
||||||
String platform;
|
String platform;
|
||||||
bool emergency;
|
bool emergency;
|
||||||
|
DateTime expireDate;
|
||||||
Map? json;
|
Map? json;
|
||||||
|
|
||||||
News({
|
News({
|
||||||
|
required this.id,
|
||||||
required this.title,
|
required this.title,
|
||||||
required this.content,
|
required this.content,
|
||||||
required this.link,
|
required this.link,
|
||||||
required this.openLabel,
|
required this.openLabel,
|
||||||
required this.platform,
|
required this.platform,
|
||||||
required this.emergency,
|
required this.emergency,
|
||||||
|
required this.expireDate,
|
||||||
this.json,
|
this.json,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory News.fromJson(Map json) {
|
factory News.fromJson(Map json) {
|
||||||
return News(
|
return News(
|
||||||
|
id: json["id"] ?? "",
|
||||||
title: json["title"] ?? "",
|
title: json["title"] ?? "",
|
||||||
content: json["content"] ?? "",
|
content: json["content"] ?? "",
|
||||||
link: json["link"] ?? "",
|
link: json["link"] ?? "",
|
||||||
openLabel: json["open_label"] ?? "",
|
openLabel: json["open_label"] ?? "",
|
||||||
platform: json["platform"] ?? "",
|
platform: json["platform"] ?? "",
|
||||||
emergency: json["emergency"] ?? false,
|
emergency: json["emergency"] ?? false,
|
||||||
|
expireDate: DateTime.parse(json["expire_date"] ?? ''),
|
||||||
json: json,
|
json: json,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
21
filcnaplo/lib/models/personality.dart
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
class Personality {
|
||||||
|
PersonalityType type;
|
||||||
|
|
||||||
|
Personality({
|
||||||
|
this.type = PersonalityType.npc,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
enum PersonalityType {
|
||||||
|
geek,
|
||||||
|
sick,
|
||||||
|
late,
|
||||||
|
quitter,
|
||||||
|
healthy,
|
||||||
|
acceptable,
|
||||||
|
fallible,
|
||||||
|
average,
|
||||||
|
diligent,
|
||||||
|
cheater,
|
||||||
|
npc
|
||||||
|
}
|
||||||
@@ -29,8 +29,12 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
// zero is one, ...
|
// zero is one, ...
|
||||||
List<Color> _gradeColors;
|
List<Color> _gradeColors;
|
||||||
bool _newsEnabled;
|
bool _newsEnabled;
|
||||||
int _newsState;
|
String _seenNews;
|
||||||
bool _notificationsEnabled;
|
bool _notificationsEnabled;
|
||||||
|
bool _notificationsGradesEnabled;
|
||||||
|
bool _notificationsAbsencesEnabled;
|
||||||
|
bool _notificationsMessagesEnabled;
|
||||||
|
bool _notificationsLessonsEnabled;
|
||||||
/*
|
/*
|
||||||
notificationsBitfield values:
|
notificationsBitfield values:
|
||||||
|
|
||||||
@@ -68,6 +72,11 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
String _premiumLogin;
|
String _premiumLogin;
|
||||||
String _lastAccountId;
|
String _lastAccountId;
|
||||||
bool _renamedSubjectsEnabled;
|
bool _renamedSubjectsEnabled;
|
||||||
|
bool _renamedSubjectsItalics;
|
||||||
|
bool _renamedTeachersEnabled;
|
||||||
|
bool _renamedTeachersItalics;
|
||||||
|
Color _liveActivityColor;
|
||||||
|
String _welcomeMessage;
|
||||||
|
|
||||||
SettingsProvider({
|
SettingsProvider({
|
||||||
DatabaseProvider? database,
|
DatabaseProvider? database,
|
||||||
@@ -78,8 +87,12 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
required AccentColor accentColor,
|
required AccentColor accentColor,
|
||||||
required List<Color> gradeColors,
|
required List<Color> gradeColors,
|
||||||
required bool newsEnabled,
|
required bool newsEnabled,
|
||||||
required int newsState,
|
required String seenNews,
|
||||||
required bool notificationsEnabled,
|
required bool notificationsEnabled,
|
||||||
|
required bool notificationsGradesEnabled,
|
||||||
|
required bool notificationsAbsencesEnabled,
|
||||||
|
required bool notificationsMessagesEnabled,
|
||||||
|
required bool notificationsLessonsEnabled,
|
||||||
required int notificationsBitfield,
|
required int notificationsBitfield,
|
||||||
required bool developerMode,
|
required bool developerMode,
|
||||||
required int notificationPollInterval,
|
required int notificationPollInterval,
|
||||||
@@ -104,6 +117,11 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
required String premiumLogin,
|
required String premiumLogin,
|
||||||
required String lastAccountId,
|
required String lastAccountId,
|
||||||
required bool renameSubjectsEnabled,
|
required bool renameSubjectsEnabled,
|
||||||
|
required bool renameSubjectsItalics,
|
||||||
|
required bool renameTeachersEnabled,
|
||||||
|
required bool renameTeachersItalics,
|
||||||
|
required Color liveActivityColor,
|
||||||
|
required String welcomeMessage,
|
||||||
}) : _database = database,
|
}) : _database = database,
|
||||||
_language = language,
|
_language = language,
|
||||||
_startPage = startPage,
|
_startPage = startPage,
|
||||||
@@ -112,8 +130,12 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
_accentColor = accentColor,
|
_accentColor = accentColor,
|
||||||
_gradeColors = gradeColors,
|
_gradeColors = gradeColors,
|
||||||
_newsEnabled = newsEnabled,
|
_newsEnabled = newsEnabled,
|
||||||
_newsState = newsState,
|
_seenNews = seenNews,
|
||||||
_notificationsEnabled = notificationsEnabled,
|
_notificationsEnabled = notificationsEnabled,
|
||||||
|
_notificationsGradesEnabled = notificationsGradesEnabled,
|
||||||
|
_notificationsAbsencesEnabled = notificationsAbsencesEnabled,
|
||||||
|
_notificationsMessagesEnabled = notificationsMessagesEnabled,
|
||||||
|
_notificationsLessonsEnabled = notificationsLessonsEnabled,
|
||||||
_notificationsBitfield = notificationsBitfield,
|
_notificationsBitfield = notificationsBitfield,
|
||||||
_developerMode = developerMode,
|
_developerMode = developerMode,
|
||||||
_notificationPollInterval = notificationPollInterval,
|
_notificationPollInterval = notificationPollInterval,
|
||||||
@@ -137,7 +159,12 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
_premiumAccessToken = premiumAccessToken,
|
_premiumAccessToken = premiumAccessToken,
|
||||||
_premiumLogin = premiumLogin,
|
_premiumLogin = premiumLogin,
|
||||||
_lastAccountId = lastAccountId,
|
_lastAccountId = lastAccountId,
|
||||||
_renamedSubjectsEnabled = renameSubjectsEnabled;
|
_renamedSubjectsEnabled = renameSubjectsEnabled,
|
||||||
|
_renamedSubjectsItalics = renameSubjectsItalics,
|
||||||
|
_renamedTeachersEnabled = renameTeachersEnabled,
|
||||||
|
_renamedTeachersItalics = renameTeachersItalics,
|
||||||
|
_liveActivityColor = liveActivityColor,
|
||||||
|
_welcomeMessage = welcomeMessage;
|
||||||
|
|
||||||
factory SettingsProvider.fromMap(Map map,
|
factory SettingsProvider.fromMap(Map map,
|
||||||
{required DatabaseProvider database}) {
|
{required DatabaseProvider database}) {
|
||||||
@@ -164,8 +191,12 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
Color(map["grade_color5"]),
|
Color(map["grade_color5"]),
|
||||||
],
|
],
|
||||||
newsEnabled: map["news"] == 1,
|
newsEnabled: map["news"] == 1,
|
||||||
newsState: map["news_state"],
|
seenNews: map["seen_news"],
|
||||||
notificationsEnabled: map["notifications"] == 1,
|
notificationsEnabled: map["notifications"] == 1,
|
||||||
|
notificationsGradesEnabled: map["notifications_grades"] == 1,
|
||||||
|
notificationsAbsencesEnabled: map["notifications_absences"] == 1,
|
||||||
|
notificationsMessagesEnabled: map["notifications_messages"] == 1,
|
||||||
|
notificationsLessonsEnabled: map["notifications_lessons"] == 1,
|
||||||
notificationsBitfield: map["notifications_bitfield"],
|
notificationsBitfield: map["notifications_bitfield"],
|
||||||
notificationPollInterval: map["notification_poll_interval"],
|
notificationPollInterval: map["notification_poll_interval"],
|
||||||
developerMode: map["developer_mode"] == 1,
|
developerMode: map["developer_mode"] == 1,
|
||||||
@@ -191,6 +222,11 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
premiumLogin: map["premium_login"],
|
premiumLogin: map["premium_login"],
|
||||||
lastAccountId: map["last_account_id"],
|
lastAccountId: map["last_account_id"],
|
||||||
renameSubjectsEnabled: map["renamed_subjects_enabled"] == 1,
|
renameSubjectsEnabled: map["renamed_subjects_enabled"] == 1,
|
||||||
|
renameSubjectsItalics: map["renamed_subjects_italics"] == 1,
|
||||||
|
renameTeachersEnabled: map["renamed_teachers_enabled"] == 1,
|
||||||
|
renameTeachersItalics: map["renamed_teachers_italics"] == 1,
|
||||||
|
liveActivityColor: Color(map["live_activity_color"]),
|
||||||
|
welcomeMessage: map["welcome_message"],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,8 +238,12 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
"theme": _theme.index,
|
"theme": _theme.index,
|
||||||
"accent_color": _accentColor.index,
|
"accent_color": _accentColor.index,
|
||||||
"news": _newsEnabled ? 1 : 0,
|
"news": _newsEnabled ? 1 : 0,
|
||||||
"news_state": _newsState,
|
"seen_news": _seenNews,
|
||||||
"notifications": _notificationsEnabled ? 1 : 0,
|
"notifications": _notificationsEnabled ? 1 : 0,
|
||||||
|
"notifications_grades": _notificationsGradesEnabled ? 1 : 0,
|
||||||
|
"notifications_absences": _notificationsAbsencesEnabled ? 1 : 0,
|
||||||
|
"notifications_messages": _notificationsMessagesEnabled ? 1 : 0,
|
||||||
|
"notifications_lessons": _notificationsLessonsEnabled ? 1 : 0,
|
||||||
"notifications_bitfield": _notificationsBitfield,
|
"notifications_bitfield": _notificationsBitfield,
|
||||||
"developer_mode": _developerMode ? 1 : 0,
|
"developer_mode": _developerMode ? 1 : 0,
|
||||||
"grade_color1": _gradeColors[0].value,
|
"grade_color1": _gradeColors[0].value,
|
||||||
@@ -231,7 +271,12 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
"premium_token": _premiumAccessToken,
|
"premium_token": _premiumAccessToken,
|
||||||
"premium_login": _premiumLogin,
|
"premium_login": _premiumLogin,
|
||||||
"last_account_id": _lastAccountId,
|
"last_account_id": _lastAccountId,
|
||||||
"renamed_subjects_enabled": _renamedSubjectsEnabled ? 1 : 0
|
"renamed_subjects_enabled": _renamedSubjectsEnabled ? 1 : 0,
|
||||||
|
"renamed_subjects_italics": _renamedSubjectsItalics ? 1 : 0,
|
||||||
|
"renamed_teachers_enabled": _renamedTeachersEnabled ? 1 : 0,
|
||||||
|
"renamed_teachers_italics": _renamedTeachersItalics ? 1 : 0,
|
||||||
|
"live_activity_color": _liveActivityColor.value,
|
||||||
|
"welcome_message": _welcomeMessage,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,8 +296,12 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
DarkMobileAppColors().gradeFive,
|
DarkMobileAppColors().gradeFive,
|
||||||
],
|
],
|
||||||
newsEnabled: true,
|
newsEnabled: true,
|
||||||
newsState: -1,
|
seenNews: '',
|
||||||
notificationsEnabled: true,
|
notificationsEnabled: true,
|
||||||
|
notificationsGradesEnabled: true,
|
||||||
|
notificationsAbsencesEnabled: true,
|
||||||
|
notificationsMessagesEnabled: true,
|
||||||
|
notificationsLessonsEnabled: true,
|
||||||
notificationsBitfield: 255,
|
notificationsBitfield: 255,
|
||||||
developerMode: false,
|
developerMode: false,
|
||||||
notificationPollInterval: 1,
|
notificationPollInterval: 1,
|
||||||
@@ -269,7 +318,7 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
bellDelay: 0,
|
bellDelay: 0,
|
||||||
gradeOpeningFun: true,
|
gradeOpeningFun: true,
|
||||||
iconPack: IconPack.cupertino,
|
iconPack: IconPack.cupertino,
|
||||||
customAccentColor: const Color(0xff20AC9B),
|
customAccentColor: const Color(0xff3D7BF4),
|
||||||
customBackgroundColor: const Color(0xff000000),
|
customBackgroundColor: const Color(0xff000000),
|
||||||
customHighlightColor: const Color(0xff222222),
|
customHighlightColor: const Color(0xff222222),
|
||||||
premiumScopes: [PremiumScopes.all],
|
premiumScopes: [PremiumScopes.all],
|
||||||
@@ -277,6 +326,11 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
premiumLogin: "igen",
|
premiumLogin: "igen",
|
||||||
lastAccountId: "",
|
lastAccountId: "",
|
||||||
renameSubjectsEnabled: false,
|
renameSubjectsEnabled: false,
|
||||||
|
renameSubjectsItalics: false,
|
||||||
|
renameTeachersEnabled: false,
|
||||||
|
renameTeachersItalics: false,
|
||||||
|
liveActivityColor: const Color(0xFF676767),
|
||||||
|
welcomeMessage: '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,8 +342,12 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
AccentColor get accentColor => _accentColor;
|
AccentColor get accentColor => _accentColor;
|
||||||
List<Color> get gradeColors => _gradeColors;
|
List<Color> get gradeColors => _gradeColors;
|
||||||
bool get newsEnabled => _newsEnabled;
|
bool get newsEnabled => _newsEnabled;
|
||||||
int get newsState => _newsState;
|
List<String> get seenNews => _seenNews.split(',');
|
||||||
bool get notificationsEnabled => _notificationsEnabled;
|
bool get notificationsEnabled => _notificationsEnabled;
|
||||||
|
bool get notificationsGradesEnabled => _notificationsGradesEnabled;
|
||||||
|
bool get notificationsAbsencesEnabled => _notificationsAbsencesEnabled;
|
||||||
|
bool get notificationsMessagesEnabled => _notificationsMessagesEnabled;
|
||||||
|
bool get notificationsLessonsEnabled => _notificationsLessonsEnabled;
|
||||||
int get notificationsBitfield => _notificationsBitfield;
|
int get notificationsBitfield => _notificationsBitfield;
|
||||||
bool get developerMode => _developerMode;
|
bool get developerMode => _developerMode;
|
||||||
int get notificationPollInterval => _notificationPollInterval;
|
int get notificationPollInterval => _notificationPollInterval;
|
||||||
@@ -317,6 +375,11 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
String get premiumLogin => _premiumLogin;
|
String get premiumLogin => _premiumLogin;
|
||||||
String get lastAccountId => _lastAccountId;
|
String get lastAccountId => _lastAccountId;
|
||||||
bool get renamedSubjectsEnabled => _renamedSubjectsEnabled;
|
bool get renamedSubjectsEnabled => _renamedSubjectsEnabled;
|
||||||
|
bool get renamedSubjectsItalics => _renamedSubjectsItalics;
|
||||||
|
bool get renamedTeachersEnabled => _renamedTeachersEnabled;
|
||||||
|
bool get renamedTeachersItalics => _renamedTeachersItalics;
|
||||||
|
Color get liveActivityColor => _liveActivityColor;
|
||||||
|
String get welcomeMessage => _welcomeMessage;
|
||||||
|
|
||||||
Future<void> update({
|
Future<void> update({
|
||||||
bool store = true,
|
bool store = true,
|
||||||
@@ -327,8 +390,12 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
AccentColor? accentColor,
|
AccentColor? accentColor,
|
||||||
List<Color>? gradeColors,
|
List<Color>? gradeColors,
|
||||||
bool? newsEnabled,
|
bool? newsEnabled,
|
||||||
int? newsState,
|
String? seenNewsId,
|
||||||
bool? notificationsEnabled,
|
bool? notificationsEnabled,
|
||||||
|
bool? notificationsGradesEnabled,
|
||||||
|
bool? notificationsAbsencesEnabled,
|
||||||
|
bool? notificationsMessagesEnabled,
|
||||||
|
bool? notificationsLessonsEnabled,
|
||||||
int? notificationsBitfield,
|
int? notificationsBitfield,
|
||||||
bool? developerMode,
|
bool? developerMode,
|
||||||
int? notificationPollInterval,
|
int? notificationPollInterval,
|
||||||
@@ -353,69 +420,132 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
String? premiumLogin,
|
String? premiumLogin,
|
||||||
String? lastAccountId,
|
String? lastAccountId,
|
||||||
bool? renamedSubjectsEnabled,
|
bool? renamedSubjectsEnabled,
|
||||||
|
bool? renamedSubjectsItalics,
|
||||||
|
bool? renamedTeachersEnabled,
|
||||||
|
bool? renamedTeachersItalics,
|
||||||
|
Color? liveActivityColor,
|
||||||
|
String? welcomeMessage,
|
||||||
}) 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;
|
||||||
if (rounding != null && rounding != _rounding) _rounding = rounding;
|
if (rounding != null && rounding != _rounding) _rounding = rounding;
|
||||||
if (theme != null && theme != _theme) _theme = theme;
|
if (theme != null && theme != _theme) _theme = theme;
|
||||||
if (accentColor != null && accentColor != _accentColor)
|
if (accentColor != null && accentColor != _accentColor) {
|
||||||
_accentColor = accentColor;
|
_accentColor = accentColor;
|
||||||
if (gradeColors != null && gradeColors != _gradeColors)
|
}
|
||||||
|
if (gradeColors != null && gradeColors != _gradeColors) {
|
||||||
_gradeColors = gradeColors;
|
_gradeColors = gradeColors;
|
||||||
if (newsEnabled != null && newsEnabled != _newsEnabled)
|
}
|
||||||
|
if (newsEnabled != null && newsEnabled != _newsEnabled) {
|
||||||
_newsEnabled = newsEnabled;
|
_newsEnabled = newsEnabled;
|
||||||
if (newsState != null && newsState != _newsState) _newsState = newsState;
|
}
|
||||||
|
if (seenNewsId != null && !_seenNews.split(',').contains(seenNewsId)) {
|
||||||
|
var tempList = _seenNews.split(',');
|
||||||
|
tempList.add(seenNewsId);
|
||||||
|
_seenNews = tempList.join(',');
|
||||||
|
}
|
||||||
if (notificationsEnabled != null &&
|
if (notificationsEnabled != null &&
|
||||||
notificationsEnabled != _notificationsEnabled)
|
notificationsEnabled != _notificationsEnabled) {
|
||||||
_notificationsEnabled = notificationsEnabled;
|
_notificationsEnabled = notificationsEnabled;
|
||||||
|
}
|
||||||
|
if (notificationsGradesEnabled != null &&
|
||||||
|
notificationsGradesEnabled != _notificationsGradesEnabled) {
|
||||||
|
_notificationsGradesEnabled = notificationsGradesEnabled;
|
||||||
|
}
|
||||||
|
if (notificationsAbsencesEnabled != null &&
|
||||||
|
notificationsAbsencesEnabled != _notificationsAbsencesEnabled) {
|
||||||
|
_notificationsAbsencesEnabled = notificationsAbsencesEnabled;
|
||||||
|
}
|
||||||
|
if (notificationsMessagesEnabled != null &&
|
||||||
|
notificationsMessagesEnabled != _notificationsMessagesEnabled) {
|
||||||
|
_notificationsMessagesEnabled = notificationsMessagesEnabled;
|
||||||
|
}
|
||||||
|
if (notificationsLessonsEnabled != null &&
|
||||||
|
notificationsLessonsEnabled != _notificationsLessonsEnabled) {
|
||||||
|
_notificationsLessonsEnabled = notificationsLessonsEnabled;
|
||||||
|
}
|
||||||
if (notificationsBitfield != null &&
|
if (notificationsBitfield != null &&
|
||||||
notificationsBitfield != _notificationsBitfield)
|
notificationsBitfield != _notificationsBitfield) {
|
||||||
_notificationsBitfield = notificationsBitfield;
|
_notificationsBitfield = notificationsBitfield;
|
||||||
if (developerMode != null && developerMode != _developerMode)
|
}
|
||||||
|
if (developerMode != null && developerMode != _developerMode) {
|
||||||
_developerMode = developerMode;
|
_developerMode = developerMode;
|
||||||
|
}
|
||||||
if (notificationPollInterval != null &&
|
if (notificationPollInterval != null &&
|
||||||
notificationPollInterval != _notificationPollInterval) {
|
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)
|
if (swapABweeks != null && swapABweeks != _swapABweeks) {
|
||||||
_swapABweeks = swapABweeks;
|
_swapABweeks = swapABweeks;
|
||||||
if (updateChannel != null && updateChannel != _updateChannel)
|
}
|
||||||
|
if (updateChannel != null && updateChannel != _updateChannel) {
|
||||||
_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 (xFilcId != null && xFilcId != _xFilcId) _xFilcId = xFilcId;
|
||||||
if (graphClassAvg != null && graphClassAvg != _graphClassAvg)
|
if (graphClassAvg != null && graphClassAvg != _graphClassAvg) {
|
||||||
_graphClassAvg = graphClassAvg;
|
_graphClassAvg = graphClassAvg;
|
||||||
|
}
|
||||||
if (goodStudent != null) _goodStudent = goodStudent;
|
if (goodStudent != null) _goodStudent = goodStudent;
|
||||||
if (presentationMode != null && presentationMode != _presentationMode)
|
if (presentationMode != null && presentationMode != _presentationMode) {
|
||||||
_presentationMode = presentationMode;
|
_presentationMode = presentationMode;
|
||||||
|
}
|
||||||
if (bellDelay != null && bellDelay != _bellDelay) _bellDelay = bellDelay;
|
if (bellDelay != null && bellDelay != _bellDelay) _bellDelay = bellDelay;
|
||||||
if (bellDelayEnabled != null && bellDelayEnabled != _bellDelayEnabled)
|
if (bellDelayEnabled != null && bellDelayEnabled != _bellDelayEnabled) {
|
||||||
_bellDelayEnabled = bellDelayEnabled;
|
_bellDelayEnabled = bellDelayEnabled;
|
||||||
if (gradeOpeningFun != null && gradeOpeningFun != _gradeOpeningFun)
|
}
|
||||||
|
if (gradeOpeningFun != null && gradeOpeningFun != _gradeOpeningFun) {
|
||||||
_gradeOpeningFun = gradeOpeningFun;
|
_gradeOpeningFun = gradeOpeningFun;
|
||||||
|
}
|
||||||
if (iconPack != null && iconPack != _iconPack) _iconPack = iconPack;
|
if (iconPack != null && iconPack != _iconPack) _iconPack = iconPack;
|
||||||
if (customAccentColor != null && customAccentColor != _customAccentColor)
|
if (customAccentColor != null && customAccentColor != _customAccentColor) {
|
||||||
_customAccentColor = customAccentColor;
|
_customAccentColor = customAccentColor;
|
||||||
|
}
|
||||||
if (customBackgroundColor != null &&
|
if (customBackgroundColor != null &&
|
||||||
customBackgroundColor != _customBackgroundColor)
|
customBackgroundColor != _customBackgroundColor) {
|
||||||
_customBackgroundColor = customBackgroundColor;
|
_customBackgroundColor = customBackgroundColor;
|
||||||
|
}
|
||||||
if (customHighlightColor != null &&
|
if (customHighlightColor != null &&
|
||||||
customHighlightColor != _customHighlightColor)
|
customHighlightColor != _customHighlightColor) {
|
||||||
_customHighlightColor = customHighlightColor;
|
_customHighlightColor = customHighlightColor;
|
||||||
if (premiumScopes != null && premiumScopes != _premiumScopes)
|
}
|
||||||
|
if (premiumScopes != null && premiumScopes != _premiumScopes) {
|
||||||
_premiumScopes = premiumScopes;
|
_premiumScopes = premiumScopes;
|
||||||
if (premiumAccessToken != null && premiumAccessToken != _premiumAccessToken)
|
}
|
||||||
|
if (premiumAccessToken != null &&
|
||||||
|
premiumAccessToken != _premiumAccessToken) {
|
||||||
_premiumAccessToken = premiumAccessToken;
|
_premiumAccessToken = premiumAccessToken;
|
||||||
if (premiumLogin != null && premiumLogin != _premiumLogin)
|
}
|
||||||
|
if (premiumLogin != null && premiumLogin != _premiumLogin) {
|
||||||
_premiumLogin = premiumLogin;
|
_premiumLogin = premiumLogin;
|
||||||
if (lastAccountId != null && lastAccountId != _lastAccountId)
|
}
|
||||||
|
if (lastAccountId != null && lastAccountId != _lastAccountId) {
|
||||||
_lastAccountId = lastAccountId;
|
_lastAccountId = lastAccountId;
|
||||||
|
}
|
||||||
if (renamedSubjectsEnabled != null &&
|
if (renamedSubjectsEnabled != null &&
|
||||||
renamedSubjectsEnabled != _renamedSubjectsEnabled)
|
renamedSubjectsEnabled != _renamedSubjectsEnabled) {
|
||||||
_renamedSubjectsEnabled = renamedSubjectsEnabled;
|
_renamedSubjectsEnabled = renamedSubjectsEnabled;
|
||||||
|
}
|
||||||
|
if (renamedSubjectsItalics != null &&
|
||||||
|
renamedSubjectsItalics != _renamedSubjectsItalics) {
|
||||||
|
_renamedSubjectsItalics = renamedSubjectsItalics;
|
||||||
|
}
|
||||||
|
if (renamedTeachersEnabled != null &&
|
||||||
|
renamedTeachersEnabled != _renamedTeachersEnabled) {
|
||||||
|
_renamedTeachersEnabled = renamedTeachersEnabled;
|
||||||
|
}
|
||||||
|
if (renamedTeachersItalics != null &&
|
||||||
|
renamedTeachersItalics != _renamedTeachersItalics) {
|
||||||
|
_renamedTeachersItalics = renamedTeachersItalics;
|
||||||
|
}
|
||||||
|
if (liveActivityColor != null && liveActivityColor != _liveActivityColor) {
|
||||||
|
_liveActivityColor = liveActivityColor;
|
||||||
|
}
|
||||||
|
if (welcomeMessage != null && welcomeMessage != _welcomeMessage) {
|
||||||
|
_welcomeMessage = welcomeMessage;
|
||||||
|
}
|
||||||
if (store) await _database?.store.storeSettings(this);
|
if (store) await _database?.store.storeSettings(this);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|||||||
74
filcnaplo/lib/models/shared_theme.dart
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
|
class SharedTheme {
|
||||||
|
Map json;
|
||||||
|
String id;
|
||||||
|
bool isPublic;
|
||||||
|
String nickname;
|
||||||
|
Color backgroundColor;
|
||||||
|
Color panelsColor;
|
||||||
|
Color accentColor;
|
||||||
|
SharedGradeColors gradeColors;
|
||||||
|
|
||||||
|
SharedTheme({
|
||||||
|
required this.json,
|
||||||
|
required this.id,
|
||||||
|
this.isPublic = false,
|
||||||
|
this.nickname = 'Anonymous',
|
||||||
|
required this.backgroundColor,
|
||||||
|
required this.panelsColor,
|
||||||
|
required this.accentColor,
|
||||||
|
required this.gradeColors,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory SharedTheme.fromJson(Map json, SharedGradeColors gradeColors) {
|
||||||
|
return SharedTheme(
|
||||||
|
json: json,
|
||||||
|
id: json['public_id'],
|
||||||
|
isPublic: json['is_public'] ?? false,
|
||||||
|
nickname: json['nickname'] ?? 'Anonymous',
|
||||||
|
backgroundColor: Color(json['background_color']),
|
||||||
|
panelsColor: Color(json['panels_color']),
|
||||||
|
accentColor: Color(json['accent_color']),
|
||||||
|
gradeColors: gradeColors,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SharedGradeColors {
|
||||||
|
Map json;
|
||||||
|
String id;
|
||||||
|
bool isPublic;
|
||||||
|
String nickname;
|
||||||
|
Color fiveColor;
|
||||||
|
Color fourColor;
|
||||||
|
Color threeColor;
|
||||||
|
Color twoColor;
|
||||||
|
Color oneColor;
|
||||||
|
|
||||||
|
SharedGradeColors({
|
||||||
|
required this.json,
|
||||||
|
required this.id,
|
||||||
|
this.isPublic = false,
|
||||||
|
this.nickname = 'Anonymous',
|
||||||
|
required this.fiveColor,
|
||||||
|
required this.fourColor,
|
||||||
|
required this.threeColor,
|
||||||
|
required this.twoColor,
|
||||||
|
required this.oneColor,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory SharedGradeColors.fromJson(Map json) {
|
||||||
|
return SharedGradeColors(
|
||||||
|
json: json,
|
||||||
|
id: json['public_id'],
|
||||||
|
isPublic: json['is_public'] ?? false,
|
||||||
|
nickname: json['nickname'] ?? 'Anonymous',
|
||||||
|
fiveColor: Color(json['five_color']),
|
||||||
|
fourColor: Color(json['four_color']),
|
||||||
|
threeColor: Color(json['three_color']),
|
||||||
|
twoColor: Color(json['two_color']),
|
||||||
|
oneColor: Color(json['one_color']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:filcnaplo_kreta_api/client/api.dart';
|
import 'package:filcnaplo_kreta_api/client/api.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/school.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';
|
||||||
|
|
||||||
@@ -43,7 +44,16 @@ class User {
|
|||||||
username: map["username"],
|
username: map["username"],
|
||||||
password: map["password"],
|
password: map["password"],
|
||||||
name: map["name"].trim(),
|
name: map["name"].trim(),
|
||||||
student: Student.fromJson(jsonDecode(map["student"])),
|
student: map["student"] != 'null'
|
||||||
|
? Student.fromJson(jsonDecode(map["student"]))
|
||||||
|
: Student(
|
||||||
|
id: const Uuid().v4(),
|
||||||
|
name: 'Ismeretlen Diák',
|
||||||
|
school: School(instituteCode: '', name: '', city: ''),
|
||||||
|
birth: DateTime.now(),
|
||||||
|
yearId: '1',
|
||||||
|
parents: [],
|
||||||
|
),
|
||||||
role: Role.values[map["role"] ?? 0],
|
role: Role.values[map["role"] ?? 0],
|
||||||
nickname: map["nickname"] ?? "",
|
nickname: map["nickname"] ?? "",
|
||||||
picture: map["picture"] ?? "",
|
picture: map["picture"] ?? "",
|
||||||
@@ -93,4 +103,13 @@ class User {
|
|||||||
"refresh_user_data": "false",
|
"refresh_user_data": "false",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Map<String, Object?> logoutBody({
|
||||||
|
required String refreshToken,
|
||||||
|
}) {
|
||||||
|
return {
|
||||||
|
"refresh_token": refreshToken,
|
||||||
|
"client_id": KretaAPI.clientId,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class DarkMobileAppColors implements ThemeAppColors {
|
|||||||
final gradeTwo = const Color(0xFFAE3DF4);
|
final gradeTwo = const Color(0xFFAE3DF4);
|
||||||
@override
|
@override
|
||||||
final gradeOne = const Color(0xFFF43DAB);
|
final gradeOne = const Color(0xFFF43DAB);
|
||||||
|
@override
|
||||||
final purple = const Color(0xffBF5AF2);
|
final purple = const Color(0xffBF5AF2);
|
||||||
@override
|
@override
|
||||||
final pink = const Color(0xffFF375F);
|
final pink = const Color(0xffFF375F);
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ import 'package:filcnaplo_mobile_ui/common/widgets/lesson/changed_lesson_tile.da
|
|||||||
import 'package:filcnaplo/utils/format.dart';
|
import 'package:filcnaplo/utils/format.dart';
|
||||||
|
|
||||||
// difference.inDays is not reliable
|
// difference.inDays is not reliable
|
||||||
bool _sameDate(DateTime a, DateTime b) => (a.year == b.year && a.month == b.month && a.day == b.day);
|
bool _sameDate(DateTime a, DateTime b) =>
|
||||||
|
(a.year == b.year && a.month == b.month && a.day == b.day);
|
||||||
|
|
||||||
List<Widget> sortDateWidgets(
|
List<Widget> sortDateWidgets(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
@@ -35,13 +36,16 @@ List<Widget> sortDateWidgets(
|
|||||||
if (message.conversationId != null) {
|
if (message.conversationId != null) {
|
||||||
convMessages.add(w);
|
convMessages.add(w);
|
||||||
|
|
||||||
Conversation conv = conversations.firstWhere((e) => e.id == message.conversationId, orElse: () => Conversation(id: message.conversationId!));
|
Conversation conv = conversations.firstWhere(
|
||||||
|
(e) => e.id == message.conversationId,
|
||||||
|
orElse: () => Conversation(id: message.conversationId!));
|
||||||
conv.add(message);
|
conv.add(message);
|
||||||
if (conv.messages.length == 1) conversations.add(conv);
|
if (conv.messages.length == 1) conversations.add(conv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conversations.any((c) => c.id == message.messageId)) {
|
if (conversations.any((c) => c.id == message.messageId)) {
|
||||||
Conversation conv = conversations.firstWhere((e) => e.id == message.messageId);
|
Conversation conv =
|
||||||
|
conversations.firstWhere((e) => e.id == message.messageId);
|
||||||
convMessages.add(w);
|
convMessages.add(w);
|
||||||
conv.add(message);
|
conv.add(message);
|
||||||
}
|
}
|
||||||
@@ -87,26 +91,41 @@ List<Widget> sortDateWidgets(
|
|||||||
|
|
||||||
// Group Absence Tiles
|
// Group Absence Tiles
|
||||||
List<DateWidget> absenceTileWidgets = elements.where((element) {
|
List<DateWidget> absenceTileWidgets = elements.where((element) {
|
||||||
return element.widget is AbsenceViewable && (element.widget as AbsenceViewable).absence.delay == 0;
|
return element.widget is AbsenceViewable &&
|
||||||
|
(element.widget as AbsenceViewable).absence.delay == 0;
|
||||||
}).toList();
|
}).toList();
|
||||||
List<AbsenceViewable> absenceTiles = absenceTileWidgets.map((e) => e.widget as AbsenceViewable).toList();
|
List<AbsenceViewable> absenceTiles =
|
||||||
|
absenceTileWidgets.map((e) => e.widget as AbsenceViewable).toList();
|
||||||
if (absenceTiles.length > 1) {
|
if (absenceTiles.length > 1) {
|
||||||
elements.removeWhere((element) => element.widget.runtimeType == AbsenceViewable && (element.widget as AbsenceViewable).absence.delay == 0);
|
elements.removeWhere((element) =>
|
||||||
|
element.widget.runtimeType == AbsenceViewable &&
|
||||||
|
(element.widget as AbsenceViewable).absence.delay == 0);
|
||||||
if (elements.isEmpty) {
|
if (elements.isEmpty) {
|
||||||
cst = false;
|
cst = false;
|
||||||
}
|
}
|
||||||
elements.add(DateWidget(
|
elements.add(
|
||||||
widget: AbsenceGroupTile(absenceTiles, showDate: !cst),
|
DateWidget(
|
||||||
date: absenceTileWidgets.first.date,
|
widget: AbsenceGroupTile(
|
||||||
key: "${absenceTileWidgets.first.date.millisecondsSinceEpoch}-absence-group"));
|
absenceTiles,
|
||||||
|
showDate: !cst,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 6.0),
|
||||||
|
),
|
||||||
|
date: absenceTileWidgets.first.date,
|
||||||
|
key:
|
||||||
|
"${absenceTileWidgets.first.date.millisecondsSinceEpoch}-absence-group"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bring Lesson Tiles to front & sort by index asc
|
// Bring Lesson Tiles to front & sort by index asc
|
||||||
List<DateWidget> lessonTiles = elements.where((element) {
|
List<DateWidget> lessonTiles = elements.where((element) {
|
||||||
return element.widget.runtimeType == ChangedLessonTile;
|
return element.widget.runtimeType == ChangedLessonTile;
|
||||||
}).toList();
|
}).toList();
|
||||||
lessonTiles.sort((a, b) => (a.widget as ChangedLessonTile).lesson.lessonIndex.compareTo((b.widget as ChangedLessonTile).lesson.lessonIndex));
|
lessonTiles.sort((a, b) => (a.widget as ChangedLessonTile)
|
||||||
elements.removeWhere((element) => element.widget.runtimeType == ChangedLessonTile);
|
.lesson
|
||||||
|
.lessonIndex
|
||||||
|
.compareTo((b.widget as ChangedLessonTile).lesson.lessonIndex));
|
||||||
|
elements.removeWhere(
|
||||||
|
(element) => element.widget.runtimeType == ChangedLessonTile);
|
||||||
elements.insertAll(0, lessonTiles);
|
elements.insertAll(0, lessonTiles);
|
||||||
|
|
||||||
final date = (elements + absenceTileWidgets).first.date;
|
final date = (elements + absenceTileWidgets).first.date;
|
||||||
@@ -122,7 +141,8 @@ List<Widget> sortDateWidgets(
|
|||||||
spawnIsolate: false,
|
spawnIsolate: false,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemBuilder: (context, animation, item, index) => filterItemBuilder(context, animation, item.widget, index),
|
itemBuilder: (context, animation, item, index) =>
|
||||||
|
filterItemBuilder(context, animation, item.widget, index),
|
||||||
items: elements,
|
items: elements,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -131,9 +151,12 @@ List<Widget> sortDateWidgets(
|
|||||||
}
|
}
|
||||||
|
|
||||||
final nh = DateTime.now();
|
final nh = DateTime.now();
|
||||||
final now = DateTime(nh.year, nh.month, nh.day).subtract(const Duration(seconds: 1));
|
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))) {
|
if (showDivider &&
|
||||||
|
items.any((i) => i.date.isBefore(now)) &&
|
||||||
|
items.any((i) => i.date.isAfter(now))) {
|
||||||
items.add(
|
items.add(
|
||||||
DateWidget(
|
DateWidget(
|
||||||
date: now,
|
date: now,
|
||||||
@@ -153,7 +176,9 @@ List<Widget> sortDateWidgets(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sort future dates asc, past dates desc
|
// 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));
|
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();
|
return items.map((e) => e.widget).toList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:filcnaplo/api/providers/ad_provider.dart';
|
||||||
import 'package:filcnaplo/api/providers/update_provider.dart';
|
import 'package:filcnaplo/api/providers/update_provider.dart';
|
||||||
import 'package:filcnaplo/models/settings.dart';
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
import 'package:filcnaplo/ui/date_widget.dart';
|
import 'package:filcnaplo/ui/date_widget.dart';
|
||||||
@@ -14,6 +15,7 @@ import 'package:filcnaplo/ui/filter/widgets/lessons.dart' as lesson_filter;
|
|||||||
import 'package:filcnaplo/ui/filter/widgets/update.dart' as update_filter;
|
import 'package:filcnaplo/ui/filter/widgets/update.dart' as update_filter;
|
||||||
import 'package:filcnaplo/ui/filter/widgets/missed_exams.dart'
|
import 'package:filcnaplo/ui/filter/widgets/missed_exams.dart'
|
||||||
as missed_exam_filter;
|
as missed_exam_filter;
|
||||||
|
import 'package:filcnaplo/ui/filter/widgets/ads.dart' as ad_filter;
|
||||||
import 'package:filcnaplo_kreta_api/models/week.dart';
|
import 'package:filcnaplo_kreta_api/models/week.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';
|
||||||
@@ -50,7 +52,8 @@ enum FilterType {
|
|||||||
lessons,
|
lessons,
|
||||||
updates,
|
updates,
|
||||||
certifications,
|
certifications,
|
||||||
missedExams
|
missedExams,
|
||||||
|
ads,
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<DateWidget>> getFilterWidgets(FilterType activeData,
|
Future<List<DateWidget>> getFilterWidgets(FilterType activeData,
|
||||||
@@ -65,6 +68,7 @@ Future<List<DateWidget>> getFilterWidgets(FilterType activeData,
|
|||||||
final eventProvider = Provider.of<EventProvider>(context);
|
final eventProvider = Provider.of<EventProvider>(context);
|
||||||
final updateProvider = Provider.of<UpdateProvider>(context);
|
final updateProvider = Provider.of<UpdateProvider>(context);
|
||||||
final settingsProvider = Provider.of<SettingsProvider>(context);
|
final settingsProvider = Provider.of<SettingsProvider>(context);
|
||||||
|
final adProvider = Provider.of<AdProvider>(context);
|
||||||
|
|
||||||
List<DateWidget> items = [];
|
List<DateWidget> items = [];
|
||||||
|
|
||||||
@@ -82,6 +86,7 @@ Future<List<DateWidget>> getFilterWidgets(FilterType activeData,
|
|||||||
getFilterWidgets(FilterType.updates, context: context),
|
getFilterWidgets(FilterType.updates, context: context),
|
||||||
getFilterWidgets(FilterType.certifications, context: context),
|
getFilterWidgets(FilterType.certifications, context: context),
|
||||||
getFilterWidgets(FilterType.missedExams, context: context),
|
getFilterWidgets(FilterType.missedExams, context: context),
|
||||||
|
getFilterWidgets(FilterType.ads, context: context),
|
||||||
]);
|
]);
|
||||||
items = all.expand((x) => x).toList();
|
items = all.expand((x) => x).toList();
|
||||||
|
|
||||||
@@ -89,10 +94,14 @@ Future<List<DateWidget>> getFilterWidgets(FilterType activeData,
|
|||||||
|
|
||||||
// Grades
|
// Grades
|
||||||
case FilterType.grades:
|
case FilterType.grades:
|
||||||
|
if (!settingsProvider.gradeOpeningFun) {
|
||||||
|
gradeProvider.seenAll();
|
||||||
|
}
|
||||||
items = grade_filter.getWidgets(
|
items = grade_filter.getWidgets(
|
||||||
gradeProvider.grades, gradeProvider.lastSeenDate);
|
gradeProvider.grades, gradeProvider.lastSeenDate);
|
||||||
if (settingsProvider.gradeOpeningFun) {
|
if (settingsProvider.gradeOpeningFun) {
|
||||||
items.addAll(
|
items.addAll(
|
||||||
|
// ignore: use_build_context_synchronously
|
||||||
await getFilterWidgets(FilterType.newGrades, context: context));
|
await getFilterWidgets(FilterType.newGrades, context: context));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -161,6 +170,13 @@ Future<List<DateWidget>> getFilterWidgets(FilterType activeData,
|
|||||||
items = missed_exam_filter
|
items = missed_exam_filter
|
||||||
.getWidgets(timetableProvider.getWeek(Week.current()) ?? []);
|
.getWidgets(timetableProvider.getWeek(Week.current()) ?? []);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Ads
|
||||||
|
case FilterType.ads:
|
||||||
|
if (adProvider.available) {
|
||||||
|
items = ad_filter.getWidgets(adProvider.ads);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|||||||
25
filcnaplo/lib/ui/filter/widgets/ads.dart
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import 'package:filcnaplo/models/ad.dart';
|
||||||
|
import 'package:filcnaplo/ui/date_widget.dart';
|
||||||
|
import 'package:filcnaplo_mobile_ui/common/widgets/ad/ad_viewable.dart'
|
||||||
|
as mobile;
|
||||||
|
|
||||||
|
List<DateWidget> getWidgets(List<Ad> providerAds) {
|
||||||
|
List<DateWidget> items = [];
|
||||||
|
|
||||||
|
if (providerAds.isNotEmpty) {
|
||||||
|
for (var ad in providerAds) {
|
||||||
|
if (ad.date.isBefore(DateTime.now()) &&
|
||||||
|
ad.expireDate.isAfter(DateTime.now())) {
|
||||||
|
providerAds.sort((a, b) => -a.date.compareTo(b.date));
|
||||||
|
|
||||||
|
items.add(DateWidget(
|
||||||
|
key: ad.description,
|
||||||
|
date: ad.date,
|
||||||
|
widget: mobile.AdViewable(ad),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
@@ -23,6 +23,8 @@ class GradeTile extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String title;
|
String title;
|
||||||
String subtitle;
|
String subtitle;
|
||||||
|
bool isTitleItalic = false;
|
||||||
|
bool isSubtitleItalic = false;
|
||||||
EdgeInsets leadingPadding = EdgeInsets.zero;
|
EdgeInsets leadingPadding = EdgeInsets.zero;
|
||||||
bool isSubjectView = SubjectGradesContainer.of(context) != null;
|
bool isSubjectView = SubjectGradesContainer.of(context) != null;
|
||||||
String subjectName =
|
String subjectName =
|
||||||
@@ -32,7 +34,8 @@ class GradeTile extends StatelessWidget {
|
|||||||
|
|
||||||
GradeCalculatorProvider calculatorProvider =
|
GradeCalculatorProvider calculatorProvider =
|
||||||
Provider.of<GradeCalculatorProvider>(context, listen: false);
|
Provider.of<GradeCalculatorProvider>(context, listen: false);
|
||||||
|
SettingsProvider settingsProvider =
|
||||||
|
Provider.of<SettingsProvider>(context);
|
||||||
// Test order:
|
// Test order:
|
||||||
// description
|
// description
|
||||||
// mode
|
// mode
|
||||||
@@ -47,6 +50,7 @@ class GradeTile extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
title = subjectName;
|
title = subjectName;
|
||||||
|
isTitleItalic = grade.subject.isRenamed && settingsProvider.renamedSubjectsItalics;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test order:
|
// Test order:
|
||||||
@@ -58,6 +62,7 @@ class GradeTile extends StatelessWidget {
|
|||||||
? modeDescription
|
? modeDescription
|
||||||
: ""
|
: ""
|
||||||
: subjectName;
|
: subjectName;
|
||||||
|
isSubtitleItalic = isSubjectView ? false : grade.subject.isRenamed && settingsProvider.renamedSubjectsItalics;
|
||||||
} else {
|
} else {
|
||||||
subtitle = grade.value.valueName.split("(")[0];
|
subtitle = grade.value.valueName.split("(")[0];
|
||||||
}
|
}
|
||||||
@@ -122,7 +127,7 @@ class GradeTile extends StatelessWidget {
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
fontStyle: grade.subject.isRenamed && title == subjectName
|
fontStyle: isTitleItalic
|
||||||
? FontStyle.italic
|
? FontStyle.italic
|
||||||
: null),
|
: null),
|
||||||
),
|
),
|
||||||
@@ -144,7 +149,7 @@ class GradeTile extends StatelessWidget {
|
|||||||
subtitle,
|
subtitle,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
style: TextStyle(fontWeight: FontWeight.w500, fontStyle: isSubtitleItalic ? FontStyle.italic : null),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
trailing: isSubjectView
|
trailing: isSubjectView
|
||||||
@@ -187,6 +192,7 @@ class GradeValueWidget extends StatelessWidget {
|
|||||||
this.outline = false,
|
this.outline = false,
|
||||||
this.complemented = false,
|
this.complemented = false,
|
||||||
this.nocolor = false,
|
this.nocolor = false,
|
||||||
|
this.color,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final GradeValue value;
|
final GradeValue value;
|
||||||
@@ -197,6 +203,7 @@ class GradeValueWidget extends StatelessWidget {
|
|||||||
final bool outline;
|
final bool outline;
|
||||||
final bool complemented;
|
final bool complemented;
|
||||||
final bool nocolor;
|
final bool nocolor;
|
||||||
|
final Color? color;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -204,7 +211,7 @@ class GradeValueWidget extends StatelessWidget {
|
|||||||
bool isSubjectView = SubjectGradesContainer.of(context) != null;
|
bool isSubjectView = SubjectGradesContainer.of(context) != null;
|
||||||
|
|
||||||
Color color =
|
Color color =
|
||||||
gradeColor(context: context, value: value.value, nocolor: nocolor);
|
this.color ?? gradeColor(context: context, value: value.value, nocolor: nocolor);
|
||||||
Widget valueText;
|
Widget valueText;
|
||||||
final percentage = value.percentage;
|
final percentage = value.percentage;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
import 'package:filcnaplo_kreta_api/providers/exam_provider.dart';
|
import 'package:filcnaplo_kreta_api/providers/exam_provider.dart';
|
||||||
import 'package:filcnaplo_kreta_api/providers/homework_provider.dart';
|
import 'package:filcnaplo_kreta_api/providers/homework_provider.dart';
|
||||||
import 'package:filcnaplo/theme/colors/colors.dart';
|
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||||
@@ -31,6 +32,8 @@ class LessonTile extends StatelessWidget {
|
|||||||
bool fillLeading = false;
|
bool fillLeading = false;
|
||||||
String lessonIndexTrailing = "";
|
String lessonIndexTrailing = "";
|
||||||
|
|
||||||
|
SettingsProvider settingsProvider = Provider.of<SettingsProvider>(context);
|
||||||
|
|
||||||
// Only put a trailing . if its a digit
|
// Only put a trailing . if its a digit
|
||||||
if (RegExp(r'\d').hasMatch(lesson.lessonIndex)) lessonIndexTrailing = ".";
|
if (RegExp(r'\d').hasMatch(lesson.lessonIndex)) lessonIndexTrailing = ".";
|
||||||
|
|
||||||
@@ -41,7 +44,8 @@ class LessonTile extends StatelessWidget {
|
|||||||
fillLeading = true;
|
fillLeading = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lesson.substituteTeacher != "") {
|
if (lesson.substituteTeacher != null &&
|
||||||
|
lesson.substituteTeacher?.name != "") {
|
||||||
fill = true;
|
fill = true;
|
||||||
accent = AppColors.of(context).yellow;
|
accent = AppColors.of(context).yellow;
|
||||||
}
|
}
|
||||||
@@ -110,7 +114,7 @@ class LessonTile extends StatelessWidget {
|
|||||||
if (lesson.isChanged) {
|
if (lesson.isChanged) {
|
||||||
if (lesson.status?.name == "Elmaradt") {
|
if (lesson.status?.name == "Elmaradt") {
|
||||||
description = 'cancelled'.i18n;
|
description = 'cancelled'.i18n;
|
||||||
} else if (lesson.substituteTeacher != "") {
|
} else if (lesson.substituteTeacher?.name != "") {
|
||||||
description = 'substitution'.i18n;
|
description = 'substitution'.i18n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -158,8 +162,10 @@ class LessonTile extends StatelessWidget {
|
|||||||
color: AppColors.of(context)
|
color: AppColors.of(context)
|
||||||
.text
|
.text
|
||||||
.withOpacity(!lesson.isEmpty ? 1.0 : 0.5),
|
.withOpacity(!lesson.isEmpty ? 1.0 : 0.5),
|
||||||
fontStyle:
|
fontStyle: lesson.subject.isRenamed &&
|
||||||
lesson.subject.isRenamed ? FontStyle.italic : null),
|
settingsProvider.renamedSubjectsItalics
|
||||||
|
? FontStyle.italic
|
||||||
|
: null),
|
||||||
),
|
),
|
||||||
subtitle: description != ""
|
subtitle: description != ""
|
||||||
? Text(
|
? Text(
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
//
|
|
||||||
// Generated file. Do not edit.
|
|
||||||
//
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
|
||||||
|
|
||||||
#include <dynamic_color/dynamic_color_plugin.h>
|
|
||||||
#include <flutter_acrylic/flutter_acrylic_plugin.h>
|
|
||||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
|
||||||
|
|
||||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
|
||||||
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
|
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
|
|
||||||
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
|
|
||||||
g_autoptr(FlPluginRegistrar) flutter_acrylic_registrar =
|
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterAcrylicPlugin");
|
|
||||||
flutter_acrylic_plugin_register_with_registrar(flutter_acrylic_registrar);
|
|
||||||
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
|
||||||
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
//
|
|
||||||
// Generated file. Do not edit.
|
|
||||||
//
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
|
|
||||||
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
|
||||||
#define GENERATED_PLUGIN_REGISTRANT_
|
|
||||||
|
|
||||||
#include <flutter_linux/flutter_linux.h>
|
|
||||||
|
|
||||||
// Registers Flutter plugins.
|
|
||||||
void fl_register_plugins(FlPluginRegistry* registry);
|
|
||||||
|
|
||||||
#endif // GENERATED_PLUGIN_REGISTRANT_
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#
|
|
||||||
# Generated file, do not edit.
|
|
||||||
#
|
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
|
||||||
dynamic_color
|
|
||||||
flutter_acrylic
|
|
||||||
url_launcher_linux
|
|
||||||
)
|
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
|
||||||
)
|
|
||||||
|
|
||||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
|
||||||
|
|
||||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
|
||||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
|
|
||||||
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
|
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
|
||||||
endforeach(plugin)
|
|
||||||
|
|
||||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
|
||||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
|
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
|
||||||
endforeach(ffi_plugin)
|
|
||||||
@@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) {
|
|||||||
if (use_header_bar) {
|
if (use_header_bar) {
|
||||||
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
||||||
gtk_widget_show(GTK_WIDGET(header_bar));
|
gtk_widget_show(GTK_WIDGET(header_bar));
|
||||||
gtk_header_bar_set_title(header_bar, "Filc Napló");
|
gtk_header_bar_set_title(header_bar, "reFilc");
|
||||||
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
||||||
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
|
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
|
||||||
} else {
|
} else {
|
||||||
gtk_window_set_title(window, "Filc Napló");
|
gtk_window_set_title(window, "reFilc");
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_window_set_default_size(window, 1280, 720);
|
gtk_window_set_default_size(window, 1280, 720);
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
//
|
|
||||||
// Generated file. Do not edit.
|
|
||||||
//
|
|
||||||
|
|
||||||
import FlutterMacOS
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
import connectivity_plus
|
|
||||||
import dynamic_color
|
|
||||||
import flutter_acrylic
|
|
||||||
import flutter_local_notifications
|
|
||||||
import package_info_plus
|
|
||||||
import path_provider_foundation
|
|
||||||
import share_plus_macos
|
|
||||||
import sqflite
|
|
||||||
import url_launcher_macos
|
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|
||||||
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
|
|
||||||
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
|
|
||||||
FlutterAcrylicPlugin.register(with: registry.registrar(forPlugin: "FlutterAcrylicPlugin"))
|
|
||||||
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
|
|
||||||
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
|
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
|
||||||
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
|
|
||||||
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
|
||||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
PODS:
|
|
||||||
- connectivity_plus (0.0.1):
|
|
||||||
- FlutterMacOS
|
|
||||||
- ReachabilitySwift
|
|
||||||
- dynamic_color (0.0.2):
|
|
||||||
- FlutterMacOS
|
|
||||||
- flutter_acrylic (0.1.0):
|
|
||||||
- FlutterMacOS
|
|
||||||
- flutter_local_notifications (0.0.1):
|
|
||||||
- FlutterMacOS
|
|
||||||
- FlutterMacOS (1.0.0)
|
|
||||||
- FMDB (2.7.5):
|
|
||||||
- FMDB/standard (= 2.7.5)
|
|
||||||
- FMDB/standard (2.7.5)
|
|
||||||
- path_provider_foundation (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- FlutterMacOS
|
|
||||||
- ReachabilitySwift (5.0.0)
|
|
||||||
- share_plus_macos (0.0.1):
|
|
||||||
- FlutterMacOS
|
|
||||||
- sqflite (0.0.2):
|
|
||||||
- FlutterMacOS
|
|
||||||
- FMDB (>= 2.7.5)
|
|
||||||
- url_launcher_macos (0.0.1):
|
|
||||||
- FlutterMacOS
|
|
||||||
|
|
||||||
DEPENDENCIES:
|
|
||||||
- connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos`)
|
|
||||||
- dynamic_color (from `Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos`)
|
|
||||||
- flutter_acrylic (from `Flutter/ephemeral/.symlinks/plugins/flutter_acrylic/macos`)
|
|
||||||
- flutter_local_notifications (from `Flutter/ephemeral/.symlinks/plugins/flutter_local_notifications/macos`)
|
|
||||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
|
||||||
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
|
|
||||||
- share_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos`)
|
|
||||||
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`)
|
|
||||||
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
|
|
||||||
|
|
||||||
SPEC REPOS:
|
|
||||||
trunk:
|
|
||||||
- FMDB
|
|
||||||
- ReachabilitySwift
|
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
|
||||||
connectivity_plus:
|
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos
|
|
||||||
dynamic_color:
|
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos
|
|
||||||
flutter_acrylic:
|
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/flutter_acrylic/macos
|
|
||||||
flutter_local_notifications:
|
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/flutter_local_notifications/macos
|
|
||||||
FlutterMacOS:
|
|
||||||
:path: Flutter/ephemeral
|
|
||||||
path_provider_foundation:
|
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
|
|
||||||
share_plus_macos:
|
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos
|
|
||||||
sqflite:
|
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos
|
|
||||||
url_launcher_macos:
|
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
|
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
|
||||||
connectivity_plus: 18d3c32514c886e046de60e9c13895109866c747
|
|
||||||
dynamic_color: 2eaa27267de1ca20d879fbd6e01259773fb1670f
|
|
||||||
flutter_acrylic: c3df24ae52ab6597197837ce59ef2a8542640c17
|
|
||||||
flutter_local_notifications: 3805ca215b2fb7f397d78b66db91f6a747af52e4
|
|
||||||
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
|
|
||||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
|
||||||
path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8
|
|
||||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
|
||||||
share_plus_macos: 853ee48e7dce06b633998ca0735d482dd671ade4
|
|
||||||
sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea
|
|
||||||
url_launcher_macos: 5335912b679c073563f29d89d33d10d459f95451
|
|
||||||
|
|
||||||
PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7
|
|
||||||
|
|
||||||
COCOAPODS: 1.12.1
|
|
||||||
@@ -3,7 +3,7 @@ description: "Nem hivatalos e-napló alkalmazás az e-Kréta rendszerhez"
|
|||||||
homepage: https://refilc.hu
|
homepage: https://refilc.hu
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
|
|
||||||
version: 4.0.3+210
|
version: 4.3.1+230
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.17.0 <3.0.0"
|
sdk: ">=2.17.0 <3.0.0"
|
||||||
@@ -38,27 +38,24 @@ dependencies:
|
|||||||
ref: master
|
ref: master
|
||||||
path_provider: ^2.0.2
|
path_provider: ^2.0.2
|
||||||
permission_handler: ^10.2.0
|
permission_handler: ^10.2.0
|
||||||
share_plus: ^5.0.0
|
share_plus: ^7.0.2
|
||||||
connectivity_plus: ^4.0.1
|
connectivity_plus: ^4.0.1
|
||||||
flutter_displaymode: ^0.6.0
|
flutter_displaymode: ^0.6.0
|
||||||
quick_actions: ^1.0.1
|
quick_actions: ^1.0.1
|
||||||
animated_list_plus: ^0.5.0
|
animated_list_plus: ^0.5.0
|
||||||
dynamic_color: ^1.2.2
|
dynamic_color: ^1.2.2
|
||||||
material_color_utilities: ^0.2.0
|
material_color_utilities: ^0.5.0
|
||||||
crypto: ^3.0.2
|
crypto: ^3.0.2
|
||||||
elegant_notification: ^1.6.1
|
elegant_notification: ^1.6.1
|
||||||
flutter_feather_icons: ^2.0.0+1
|
flutter_feather_icons: ^2.0.0+1
|
||||||
live_activities: ^1.0.0
|
live_activities: ^1.7.4
|
||||||
animated_flip_counter: ^0.2.5
|
animated_flip_counter: ^0.2.5
|
||||||
lottie: ^1.4.3
|
lottie: ^1.4.3
|
||||||
rive: ^0.9.1
|
rive: ^0.9.1
|
||||||
animated_background: ^2.0.0
|
animated_background: ^2.0.0
|
||||||
dropdown_button2: ^1.8.9
|
dropdown_button2: ^1.8.9
|
||||||
home_widget: ^0.1.6
|
home_widget: ^0.1.6
|
||||||
flutter_expandable_fab:
|
flutter_expandable_fab: ^1.8.1
|
||||||
git:
|
|
||||||
url: https://github.com/filc/flutter_expandable_fab
|
|
||||||
ref: master
|
|
||||||
uni_links: ^0.5.1
|
uni_links: ^0.5.1
|
||||||
url_launcher: ^6.1.6
|
url_launcher: ^6.1.6
|
||||||
workmanager: ^0.5.1
|
workmanager: ^0.5.1
|
||||||
@@ -67,7 +64,13 @@ dependencies:
|
|||||||
animations: ^2.0.1
|
animations: ^2.0.1
|
||||||
background_fetch: ^1.1.5
|
background_fetch: ^1.1.5
|
||||||
flutter_local_notifications: ^14.1.0
|
flutter_local_notifications: ^14.1.0
|
||||||
package_info_plus: ^3.1.2
|
package_info_plus: ^4.0.2
|
||||||
|
screenshot: ^2.1.0
|
||||||
|
flutter_staggered_grid_view: ^0.7.0
|
||||||
|
sqflite_common_ffi_web: ^0.4.0
|
||||||
|
image_crop:
|
||||||
|
git:
|
||||||
|
url: https://github.com/kimaah/image_crop.git
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_lints: ^2.0.1
|
flutter_lints: ^2.0.1
|
||||||
@@ -83,6 +86,7 @@ flutter:
|
|||||||
- assets/icons/ic_splash.png
|
- assets/icons/ic_splash.png
|
||||||
- assets/animations/
|
- assets/animations/
|
||||||
- assets/images/
|
- assets/images/
|
||||||
|
- assets/images/subject_covers/
|
||||||
|
|
||||||
fonts:
|
fonts:
|
||||||
- family: FilcIcons
|
- family: FilcIcons
|
||||||
|
|||||||
30
filcnaplo/test/widget_test.dart
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
// // This is a basic Flutter widget test.
|
||||||
|
// //
|
||||||
|
// // To perform an interaction with a widget in your test, use the WidgetTester
|
||||||
|
// // utility in the flutter_test package. For example, you can send tap and scroll
|
||||||
|
// // gestures. You can also use WidgetTester to find child widgets in the widget
|
||||||
|
// // tree, read text, and verify that the values of widget properties are correct.
|
||||||
|
|
||||||
|
// import 'package:flutter/material.dart';
|
||||||
|
// import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
// import 'package:filcnaplo/main.dart';
|
||||||
|
|
||||||
|
// void main() {
|
||||||
|
// testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||||
|
// // Build our app and trigger a frame.
|
||||||
|
// await tester.pumpWidget(const MyApp());
|
||||||
|
|
||||||
|
// // Verify that our counter starts at 0.
|
||||||
|
// expect(find.text('0'), findsOneWidget);
|
||||||
|
// expect(find.text('1'), findsNothing);
|
||||||
|
|
||||||
|
// // Tap the '+' icon and trigger a frame.
|
||||||
|
// await tester.tap(find.byIcon(Icons.add));
|
||||||
|
// await tester.pump();
|
||||||
|
|
||||||
|
// // Verify that our counter has incremented.
|
||||||
|
// expect(find.text('0'), findsNothing);
|
||||||
|
// expect(find.text('1'), findsOneWidget);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
BIN
filcnaplo/web/favicon.png
Normal file
|
After Width: | Height: | Size: 917 B |
BIN
filcnaplo/web/icons/Icon-192.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
filcnaplo/web/icons/Icon-512.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
filcnaplo/web/icons/Icon-maskable-192.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
filcnaplo/web/icons/Icon-maskable-512.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
59
filcnaplo/web/index.html
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<!--
|
||||||
|
If you are serving your web app in a path other than the root, change the
|
||||||
|
href value below to reflect the base path you are serving from.
|
||||||
|
|
||||||
|
The path provided below has to start and end with a slash "/" in order for
|
||||||
|
it to work correctly.
|
||||||
|
|
||||||
|
For more details:
|
||||||
|
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
||||||
|
|
||||||
|
This is a placeholder for base href that will be replaced by the value of
|
||||||
|
the `--base-href` argument provided to `flutter build`.
|
||||||
|
-->
|
||||||
|
<base href="$FLUTTER_BASE_HREF">
|
||||||
|
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||||
|
<meta name="description" content="A new Flutter project.">
|
||||||
|
|
||||||
|
<!-- iOS meta tags & icons -->
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||||
|
<meta name="apple-mobile-web-app-title" content="filcnaplo">
|
||||||
|
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||||
|
|
||||||
|
<!-- Favicon -->
|
||||||
|
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||||
|
|
||||||
|
<title>filcnaplo</title>
|
||||||
|
<link rel="manifest" href="manifest.json">
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// The value below is injected by flutter build, do not touch.
|
||||||
|
var serviceWorkerVersion = null;
|
||||||
|
</script>
|
||||||
|
<!-- This script adds the flutter initialization JS code -->
|
||||||
|
<script src="flutter.js" defer></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
window.addEventListener('load', function(ev) {
|
||||||
|
// Download main.dart.js
|
||||||
|
_flutter.loader.loadEntrypoint({
|
||||||
|
serviceWorker: {
|
||||||
|
serviceWorkerVersion: serviceWorkerVersion,
|
||||||
|
},
|
||||||
|
onEntrypointLoaded: function(engineInitializer) {
|
||||||
|
engineInitializer.initializeEngine().then(function(appRunner) {
|
||||||
|
appRunner.runApp();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
35
filcnaplo/web/manifest.json
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"name": "filcnaplo",
|
||||||
|
"short_name": "filcnaplo",
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"background_color": "#0175C2",
|
||||||
|
"theme_color": "#0175C2",
|
||||||
|
"description": "A new Flutter project.",
|
||||||
|
"orientation": "portrait-primary",
|
||||||
|
"prefer_related_applications": false,
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "icons/Icon-192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "icons/Icon-512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "icons/Icon-maskable-192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "icons/Icon-maskable-512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
17
filcnaplo/windows/.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
flutter/ephemeral/
|
||||||
|
|
||||||
|
# Visual Studio user-specific files.
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# Visual Studio build-related files.
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!*.[Cc]ache/
|
||||||
121
filcnaplo/windows/runner/Runner.rc
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
#pragma code_page(65001)
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "winres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (United States) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"#include ""winres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Icon
|
||||||
|
//
|
||||||
|
|
||||||
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
|
// remains consistent on all systems.
|
||||||
|
IDI_APP_ICON ICON "resources\\app_icon.ico"
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
|
||||||
|
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
|
||||||
|
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
|
||||||
|
#else
|
||||||
|
#define VERSION_AS_NUMBER 1,0,0,0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(FLUTTER_VERSION)
|
||||||
|
#define VERSION_AS_STRING FLUTTER_VERSION
|
||||||
|
#else
|
||||||
|
#define VERSION_AS_STRING "1.0.0"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION VERSION_AS_NUMBER
|
||||||
|
PRODUCTVERSION VERSION_AS_NUMBER
|
||||||
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS VS_FF_DEBUG
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS VOS__WINDOWS32
|
||||||
|
FILETYPE VFT_APP
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904e4"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", "hu.refilc" "\0"
|
||||||
|
VALUE "FileDescription", "filcnaplo" "\0"
|
||||||
|
VALUE "FileVersion", VERSION_AS_STRING "\0"
|
||||||
|
VALUE "InternalName", "filcnaplo" "\0"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2023 hu.refilc. All rights reserved." "\0"
|
||||||
|
VALUE "OriginalFilename", "filcnaplo.exe" "\0"
|
||||||
|
VALUE "ProductName", "filcnaplo" "\0"
|
||||||
|
VALUE "ProductVersion", VERSION_AS_STRING "\0"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1252
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // English (United States) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
66
filcnaplo/windows/runner/flutter_window.cpp
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#include "flutter_window.h"
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
|
#include "flutter/generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
FlutterWindow::FlutterWindow(const flutter::DartProject& project)
|
||||||
|
: project_(project) {}
|
||||||
|
|
||||||
|
FlutterWindow::~FlutterWindow() {}
|
||||||
|
|
||||||
|
bool FlutterWindow::OnCreate() {
|
||||||
|
if (!Win32Window::OnCreate()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
RECT frame = GetClientArea();
|
||||||
|
|
||||||
|
// The size here must match the window dimensions to avoid unnecessary surface
|
||||||
|
// creation / destruction in the startup path.
|
||||||
|
flutter_controller_ = std::make_unique<flutter::FlutterViewController>(
|
||||||
|
frame.right - frame.left, frame.bottom - frame.top, project_);
|
||||||
|
// Ensure that basic setup of the controller was successful.
|
||||||
|
if (!flutter_controller_->engine() || !flutter_controller_->view()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
RegisterPlugins(flutter_controller_->engine());
|
||||||
|
SetChildContent(flutter_controller_->view()->GetNativeWindow());
|
||||||
|
|
||||||
|
flutter_controller_->engine()->SetNextFrameCallback([&]() {
|
||||||
|
this->Show();
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FlutterWindow::OnDestroy() {
|
||||||
|
if (flutter_controller_) {
|
||||||
|
flutter_controller_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Win32Window::OnDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT
|
||||||
|
FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
|
||||||
|
WPARAM const wparam,
|
||||||
|
LPARAM const lparam) noexcept {
|
||||||
|
// Give Flutter, including plugins, an opportunity to handle window messages.
|
||||||
|
if (flutter_controller_) {
|
||||||
|
std::optional<LRESULT> result =
|
||||||
|
flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
|
||||||
|
lparam);
|
||||||
|
if (result) {
|
||||||
|
return *result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (message) {
|
||||||
|
case WM_FONTCHANGE:
|
||||||
|
flutter_controller_->engine()->ReloadSystemFonts();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
|
||||||
|
}
|
||||||