Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf8ca49f98 | ||
|
|
0fca636311 | ||
|
|
8673a9e42a | ||
|
|
0390d0df39 | ||
|
|
4ec2f74fee | ||
|
|
e2078db34b | ||
|
|
1f39bdc301 | ||
|
|
029e841d7b | ||
|
|
6a16f93884 | ||
|
|
cfc0229f09 | ||
|
|
a68dd759d8 | ||
|
|
e7d0e3805d | ||
|
|
d617d9ef47 | ||
|
|
2564224a6e | ||
|
|
5c2b690bc8 |
4
.vscode/launch.json
vendored
@@ -7,8 +7,8 @@
|
||||
{
|
||||
"name": "filcnaplo",
|
||||
"cwd": "filcnaplo",
|
||||
"request": "launch",
|
||||
"type": "dart"
|
||||
"request": "attach",
|
||||
"type": "dart",
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
- Félévi, évvégi értesítő
|
||||
- Esztétikai újítások
|
||||
- Hibajavítások
|
||||
- Órarendben dolgozatok javítása
|
||||
- Kilógó félév jelző javítása a grafikonon
|
||||
- Dicséretes jegyek jelzése
|
||||
- Üzenet & Szellem jegy animációk
|
||||
- Design javítások
|
||||
- Kisebb hibajavítások
|
||||
|
||||
1
filcnaplo/.gitignore
vendored
@@ -8,7 +8,6 @@
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
build.sh
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
|
||||
BIN
filcnaplo/android/app/src/main/res/drawable/ic_absences.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
filcnaplo/android/app/src/main/res/drawable/ic_grades.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
filcnaplo/android/app/src/main/res/drawable/ic_home.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
filcnaplo/android/app/src/main/res/drawable/ic_messages.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
filcnaplo/android/app/src/main/res/drawable/ic_timetable.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
19
filcnaplo/build.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/fish
|
||||
|
||||
# With build number
|
||||
function get_version_bn
|
||||
cat pubspec.yaml | grep version: | cut -d' ' -f2
|
||||
end
|
||||
|
||||
function get_version
|
||||
cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1
|
||||
end
|
||||
|
||||
if test -e /mnt/enc/keys/filc3.properties
|
||||
set -x ANDROID_SIGNING /mnt/enc/keys/filc3.properties
|
||||
end
|
||||
|
||||
flutter build apk --release --dart-define=APPVER=(get_version)
|
||||
cp -v "build/app/outputs/flutter-apk/app-release.apk" ~/"Desktop/hu.filc.naplo_"(get_version_bn).apk
|
||||
|
||||
notify-send "Flutter" "Apk build done."
|
||||
6
filcnaplo/ios/Runner/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
21
filcnaplo/ios/Runner/Assets.xcassets/ic_absences.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "icon.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
filcnaplo/ios/Runner/Assets.xcassets/ic_absences.imageset/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 570 B |
21
filcnaplo/ios/Runner/Assets.xcassets/ic_grades.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "icon.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
filcnaplo/ios/Runner/Assets.xcassets/ic_grades.imageset/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 404 B |
21
filcnaplo/ios/Runner/Assets.xcassets/ic_messages.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "icon.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
filcnaplo/ios/Runner/Assets.xcassets/ic_messages.imageset/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 347 B |
21
filcnaplo/ios/Runner/Assets.xcassets/ic_timetable.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "icon.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
filcnaplo/ios/Runner/Assets.xcassets/ic_timetable.imageset/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 422 B |
@@ -1,6 +1,7 @@
|
||||
// ignore_for_file: avoid_print
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:filcnaplo/models/config.dart';
|
||||
import 'package:filcnaplo/models/news.dart';
|
||||
@@ -45,14 +46,20 @@ class FilcAPI {
|
||||
} catch (error) {
|
||||
print("ERROR: FilcAPI.getSchools: $error");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static Future<Config?> getConfig(SettingsProvider settings) async {
|
||||
final userAgent = SettingsProvider.defaultSettings().config.userAgent;
|
||||
|
||||
Map<String, String> headers = {
|
||||
"x-filc-id": settings.xFilcId,
|
||||
"user-agent": SettingsProvider.defaultSettings().config.userAgent,
|
||||
"user-agent": userAgent,
|
||||
};
|
||||
|
||||
log("[CONFIG] x-filc-id: \"${settings.xFilcId}\"");
|
||||
log("[CONFIG] user-agent: \"$userAgent\"");
|
||||
|
||||
try {
|
||||
http.Response res = await http.get(Uri.parse(config), headers: headers);
|
||||
|
||||
@@ -66,6 +73,7 @@ class FilcAPI {
|
||||
} catch (error) {
|
||||
print("ERROR: FilcAPI.getConfig: $error");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static Future<List<News>?> getNews() async {
|
||||
@@ -80,6 +88,7 @@ class FilcAPI {
|
||||
} catch (error) {
|
||||
print("ERROR: FilcAPI.getNews: $error");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static Future<Supporters?> getSupporters() async {
|
||||
@@ -94,6 +103,7 @@ class FilcAPI {
|
||||
} catch (error) {
|
||||
print("ERROR: FilcAPI.getSupporters: $error");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static Future<List<Release>?> getReleases() async {
|
||||
@@ -108,6 +118,7 @@ class FilcAPI {
|
||||
} catch (error) {
|
||||
print("ERROR: FilcAPI.getReleases: $error");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static Future<http.StreamedResponse?> downloadRelease(Release release) {
|
||||
|
||||
@@ -3,14 +3,12 @@ import 'dart:io';
|
||||
import 'package:filcnaplo/api/client.dart';
|
||||
import 'package:filcnaplo/models/release.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
class UpdateProvider extends ChangeNotifier {
|
||||
// Private
|
||||
late List<Release> _releases;
|
||||
bool _available = false;
|
||||
bool get available => _available && _releases.isNotEmpty;
|
||||
PackageInfo? _packageInfo;
|
||||
|
||||
// Public
|
||||
List<Release> get releases => _releases;
|
||||
@@ -20,10 +18,9 @@ class UpdateProvider extends ChangeNotifier {
|
||||
required BuildContext context,
|
||||
}) {
|
||||
_releases = List.castFrom(initialReleases);
|
||||
PackageInfo.fromPlatform().then((value) => _packageInfo = value);
|
||||
}
|
||||
|
||||
String get currentVersion => _packageInfo?.version ?? "";
|
||||
static const currentVersion = String.fromEnvironment("APPVER", defaultValue: "1.0");
|
||||
|
||||
Future<void> fetch() async {
|
||||
if (!Platform.isAndroid) return;
|
||||
@@ -33,7 +30,7 @@ class UpdateProvider extends ChangeNotifier {
|
||||
|
||||
// Check for new releases
|
||||
if (_releases.isNotEmpty) {
|
||||
_available = _packageInfo != null && _releases.first.version.compareTo(Version.fromString(currentVersion)) == 1;
|
||||
_available = _releases.first.version.compareTo(Version.fromString(currentVersion)) == 1;
|
||||
// ignore: avoid_print
|
||||
if (_available) print("INFO: New update: ${releases.first.version}");
|
||||
notifyListeners();
|
||||
|
||||
@@ -143,6 +143,7 @@ class App extends StatelessWidget {
|
||||
case "settings":
|
||||
return settingsRoute(const SettingsScreen());
|
||||
}
|
||||
return null;
|
||||
// else if platform == windows || ...
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:filcnaplo/api/providers/user_provider.dart';
|
||||
import 'package:filcnaplo/helpers/storage_helper.dart';
|
||||
import 'package:filcnaplo_kreta_api/client/client.dart';
|
||||
import 'package:filcnaplo_kreta_api/models/attachment.dart';
|
||||
import 'package:filcnaplo_kreta_api/models/homework.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:open_file/open_file.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -22,7 +24,29 @@ extension AttachmentHelper on Attachment {
|
||||
|
||||
Future<bool> open(BuildContext context) async {
|
||||
String downloads = await StorageHelper.downloadsPath();
|
||||
|
||||
|
||||
if (!await File("$downloads/$name").exists()) await download(context);
|
||||
var result = await OpenFile.open("$downloads/$name");
|
||||
return result.type == ResultType.done;
|
||||
}
|
||||
}
|
||||
|
||||
extension HomeworkAttachmentHelper on HomeworkAttachment {
|
||||
Future<String> download(BuildContext context, {bool overwrite = false}) async {
|
||||
String downloads = await StorageHelper.downloadsPath();
|
||||
|
||||
if (!overwrite && await File("$downloads/$name").exists()) return "$downloads/$name";
|
||||
|
||||
String url = downloadUrl(Provider.of<UserProvider>(context, listen: false).instituteCode ?? "");
|
||||
Uint8List data = await Provider.of<KretaClient>(context, listen: false).getAPI(url, rawResponse: true);
|
||||
if (!await StorageHelper.write("$downloads/$name", data)) return "";
|
||||
|
||||
return "$downloads/$name";
|
||||
}
|
||||
|
||||
Future<bool> open(BuildContext context) async {
|
||||
String downloads = await StorageHelper.downloadsPath();
|
||||
|
||||
if (!await File("$downloads/$name").exists()) await download(context);
|
||||
var result = await OpenFile.open("$downloads/$name");
|
||||
return result.type == ResultType.done;
|
||||
|
||||
36
filcnaplo/lib/helpers/quick_actions.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:quick_actions/quick_actions.dart';
|
||||
import 'package:filcnaplo_mobile_ui/common/screens.i18n.dart';
|
||||
|
||||
const QuickActions quickActions = QuickActions();
|
||||
|
||||
void setupQuickActions() {
|
||||
quickActions.setShortcutItems(<ShortcutItem>[
|
||||
ShortcutItem(type: 'action_grades', localizedTitle: 'grades'.i18n, icon: 'ic_grades'),
|
||||
ShortcutItem(type: 'action_timetable', localizedTitle: 'timetable'.i18n, icon: 'ic_timetable'),
|
||||
ShortcutItem(type: 'action_messages', localizedTitle: 'messages'.i18n, icon: 'ic_messages'),
|
||||
ShortcutItem(type: 'action_absences', localizedTitle: 'absences'.i18n, icon: 'ic_absences')
|
||||
]);
|
||||
}
|
||||
|
||||
void handleQuickActions(BuildContext context, void Function(String) callback) {
|
||||
quickActions.initialize((shortcutType) {
|
||||
switch (shortcutType) {
|
||||
case 'action_home':
|
||||
callback("home");
|
||||
break;
|
||||
case 'action_grades':
|
||||
callback("grades");
|
||||
break;
|
||||
case 'action_timetable':
|
||||
callback("timetable");
|
||||
break;
|
||||
case 'action_messages':
|
||||
callback("messages");
|
||||
break;
|
||||
case 'action_absences':
|
||||
callback("absences");
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
class Config {
|
||||
String _userAgent;
|
||||
String? _version;
|
||||
Map? json;
|
||||
static const String _version = String.fromEnvironment("APPVER", defaultValue: "2.2.0");
|
||||
|
||||
Config({required String userAgent, this.json}) : _userAgent = userAgent {
|
||||
PackageInfo.fromPlatform().then((value) => _version = value.version);
|
||||
}
|
||||
Config({required String userAgent, this.json}) : _userAgent = userAgent;
|
||||
|
||||
factory Config.fromJson(Map json) {
|
||||
return Config(
|
||||
@@ -18,7 +14,7 @@ class Config {
|
||||
);
|
||||
}
|
||||
|
||||
String get userAgent => _userAgent.replaceAll("\$0", _version ?? "0").replaceAll("\$1", platform).replaceAll("\$2", "0");
|
||||
String get userAgent => _userAgent.replaceAll("\$0", _version).replaceAll("\$1", platform).replaceAll("\$2", "0");
|
||||
|
||||
static String get platform {
|
||||
if (Platform.isAndroid) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:filcnaplo/api/providers/database_provider.dart';
|
||||
import 'package:filcnaplo/models/config.dart';
|
||||
import 'package:filcnaplo/theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
@@ -13,8 +12,6 @@ enum UpdateChannel { stable, beta, dev }
|
||||
enum VibrationStrength { off, light, medium, strong }
|
||||
|
||||
class SettingsProvider extends ChangeNotifier {
|
||||
PackageInfo? _packageInfo;
|
||||
|
||||
// en_en, hu_hu, de_de
|
||||
String _language;
|
||||
Pages _startPage;
|
||||
@@ -86,11 +83,7 @@ class SettingsProvider extends ChangeNotifier {
|
||||
_swapABweeks = swapABweeks,
|
||||
_updateChannel = updateChannel,
|
||||
_config = config,
|
||||
_xFilcId = xFilcId {
|
||||
PackageInfo.fromPlatform().then((PackageInfo packageInfo) {
|
||||
_packageInfo = packageInfo;
|
||||
});
|
||||
}
|
||||
_xFilcId = xFilcId;
|
||||
|
||||
factory SettingsProvider.fromMap(Map map) {
|
||||
return SettingsProvider(
|
||||
@@ -194,7 +187,6 @@ class SettingsProvider extends ChangeNotifier {
|
||||
bool get abWeeks => _abWeeks;
|
||||
bool get swapABweeks => _swapABweeks;
|
||||
UpdateChannel get updateChannel => _updateChannel;
|
||||
PackageInfo? get packageInfo => _packageInfo;
|
||||
Config get config => _config;
|
||||
String get xFilcId => _xFilcId;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ class JwtUtils {
|
||||
// ignore: avoid_print
|
||||
print("ERROR: JwtUtils.decodeJwt: $error");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static String? getNameFromJWT(String jwt) {
|
||||
@@ -36,5 +37,6 @@ class JwtUtils {
|
||||
case "Gondviselo":
|
||||
return Role.parent;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ description: "Nem hivatalos e-napló alkalmazás az e-Kréta rendszerhez"
|
||||
homepage: https://filcnaplo.hu
|
||||
publish_to: "none"
|
||||
|
||||
version: 3.2.1+143
|
||||
version: 3.2.3+148
|
||||
|
||||
environment:
|
||||
sdk: ">=2.16.0-80.1.beta <3.0.0"
|
||||
@@ -34,9 +34,10 @@ dependencies:
|
||||
path_provider: ^2.0.2
|
||||
permission_handler: ^8.3.0
|
||||
share_plus: ^3.0.4
|
||||
package_info_plus: ^1.0.6
|
||||
connectivity_plus: ^2.0.2
|
||||
flutter_displaymode: ^0.3.2
|
||||
quick_actions: ^0.6.0
|
||||
implicitly_animated_reorderable_list: ^0.4.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
12
filcnaplo/run.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/fish
|
||||
|
||||
function get_version
|
||||
cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1
|
||||
end
|
||||
|
||||
|
||||
if test -e /mnt/enc/keys/filc3.properties
|
||||
set -x ANDROID_SIGNING /mnt/enc/keys/filc3.properties
|
||||
end
|
||||
|
||||
flutter run --debug --dart-define=APPVER=(get_version)
|
||||