forked from firka/student-legacy
commit
da356bb212
29
.vscode/launch.json
vendored
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"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -26,6 +26,11 @@ 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 java.util.HashMap;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import hu.refilc.naplo.database.DBManager;
|
import hu.refilc.naplo.database.DBManager;
|
||||||
import hu.refilc.naplo.MainActivity;
|
import hu.refilc.naplo.MainActivity;
|
||||||
@ -247,71 +252,61 @@ public class WidgetTimetable extends HomeWidgetProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<JSONArray> genJsonDays(Context context) {
|
public static List<JSONArray> genJsonDays(Context context) {
|
||||||
List<JSONArray> gen_days = new ArrayList<>();
|
List<JSONArray> genDays = new ArrayList<>();
|
||||||
|
Map<String, JSONArray> dayMap = new HashMap<>();
|
||||||
|
|
||||||
DBManager dbManager = new DBManager(context.getApplicationContext());
|
DBManager dbManager = new DBManager(context.getApplicationContext());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dbManager.open();
|
dbManager.open();
|
||||||
Cursor ct = dbManager.fetchTimetable();
|
Cursor ct = dbManager.fetchTimetable();
|
||||||
dbManager.close();
|
|
||||||
|
|
||||||
if(ct.getCount() == 0) {
|
if (ct.getCount() == 0) {
|
||||||
return gen_days;
|
return genDays;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject fecthtt = new JSONObject(ct.getString(0));
|
JSONObject fetchedTimetable = new JSONObject(ct.getString(0));
|
||||||
|
String currentWeek = String.valueOf(Week.current().id());
|
||||||
|
JSONArray week = fetchedTimetable.getJSONArray(currentWeek);
|
||||||
|
|
||||||
JSONArray dayArray = new JSONArray();
|
// Organize lessons into dates
|
||||||
String currday = "";
|
for (int i = 0; i < week.length(); i++) {
|
||||||
|
|
||||||
String currweek = String.valueOf(Week.current().id());
|
|
||||||
|
|
||||||
JSONArray week = fecthtt.getJSONArray(currweek);
|
|
||||||
|
|
||||||
for (int i=0; i < week.length(); i++)
|
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
if(i == 0) currday = week.getJSONObject(0).getString("Datum");
|
JSONObject entry = week.getJSONObject(i);
|
||||||
JSONObject oraObj = week.getJSONObject(i);
|
String date = entry.getString("Datum");
|
||||||
|
dayMap.computeIfAbsent(date, k -> new JSONArray()).put(entry);
|
||||||
if(!currday.equals(oraObj.getString("Datum"))) {
|
} catch (JSONException e) {
|
||||||
gen_days.add(dayArray);
|
|
||||||
currday = week.getJSONObject(i).getString("Datum");
|
|
||||||
dayArray = new JSONArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
dayArray.put(oraObj);
|
|
||||||
if(i == week.length() - 1) {
|
|
||||||
gen_days.add(dayArray);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.sort(gen_days, new Comparator<JSONArray>() {
|
genDays.addAll(dayMap.values());
|
||||||
|
|
||||||
public int compare(JSONArray a, JSONArray b) {
|
|
||||||
long valA = 0;
|
|
||||||
long valB = 0;
|
|
||||||
|
|
||||||
|
// Sort the 'genDays' list of JSON based on the start time of the first entry
|
||||||
|
genDays.sort((day1, day2) -> {
|
||||||
try {
|
try {
|
||||||
valA = (long) new DateTime( a.getJSONObject(0).getString("Datum")).getMillis();
|
// Extract the start time of the first entry in each day's JSON
|
||||||
valB = (long) new DateTime( b.getJSONObject(0).getString("Datum")).getMillis();
|
String startTime1 = day1.getJSONObject(0).getString("KezdetIdopont");
|
||||||
}
|
String startTime2 = day2.getJSONObject(0).getString("KezdetIdopont");
|
||||||
catch (JSONException ignored) {
|
// Compare the start times and return the result for sorting
|
||||||
}
|
return startTime1.compareTo(startTime2);
|
||||||
|
} catch (JSONException e) {
|
||||||
return (int) (valA - valB);
|
e.printStackTrace();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return gen_days;
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
dbManager.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return genDays;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String zeroPad(int value, int padding){
|
public static String zeroPad(int value, int padding){
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append(value);
|
b.append(value);
|
||||||
|
@ -335,10 +335,12 @@ public class WidgetTimetableDataProvider implements RemoteViewsService.RemoteVie
|
|||||||
|
|
||||||
public Lesson jsonToLesson(JSONObject json) {
|
public Lesson jsonToLesson(JSONObject json) {
|
||||||
try {
|
try {
|
||||||
|
String name = json.getString("Nev");
|
||||||
|
name = name.substring(0, 1).toUpperCase() + name.substring(1); // Capitalize name
|
||||||
return new Lesson(
|
return new Lesson(
|
||||||
json.getJSONObject("Allapot").getString("Nev"),
|
json.getJSONObject("Allapot").getString("Nev"),
|
||||||
!json.getString("Oraszam").equals("null") ? json.getString("Oraszam") : "+",
|
!json.getString("Oraszam").equals("null") ? json.getString("Oraszam") : "+",
|
||||||
json.getString("Nev"),
|
name,
|
||||||
json.getString("Tema"),
|
json.getString("Tema"),
|
||||||
json.getString("TeremNeve"),
|
json.getString("TeremNeve"),
|
||||||
new DateTime(json.getString("KezdetIdopont")).getMillis(),
|
new DateTime(json.getString("KezdetIdopont")).getMillis(),
|
||||||
|
@ -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,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=4.1.0
|
|
||||||
FLUTTER_BUILD_NUMBER=213
|
|
||||||
EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386
|
|
||||||
EXCLUDED_ARCHS[sdk=iphoneos*]=armv7
|
|
||||||
DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC8yYTM0MDFjOWJiYjVhOWE5YWVjNzRkNGY3MzVkMThhOWRkM2ViZjJkLw==
|
|
||||||
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,15 +0,0 @@
|
|||||||
// This is a generated file; do not edit or check into version control.
|
|
||||||
FLUTTER_ROOT=/Users/kima/src/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=4.1.1
|
|
||||||
FLUTTER_BUILD_NUMBER=216
|
|
||||||
EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386
|
|
||||||
EXCLUDED_ARCHS[sdk=iphoneos*]=armv7
|
|
||||||
DART_DEFINES=QVBQVkVSPTQuMS4x,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9jZGJlZGE3ODhhMjkzZmEyOTY2NWRjM2ZhM2Q2ZTYzYmQyMjFjYjBkLw==
|
|
||||||
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,14 +0,0 @@
|
|||||||
// This is a generated file; do not edit or check into version control.
|
|
||||||
FLUTTER_ROOT=/Users/kima/src/flutter
|
|
||||||
FLUTTER_APPLICATION_PATH=/Users/kima/Documents/refilc/app/naplo/filcnaplo
|
|
||||||
COCOAPODS_PARALLEL_CODE_SIGN=true
|
|
||||||
FLUTTER_TARGET=lib/main.dart
|
|
||||||
FLUTTER_BUILD_DIR=build
|
|
||||||
FLUTTER_BUILD_NAME=4.2.0
|
|
||||||
FLUTTER_BUILD_NUMBER=220
|
|
||||||
EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386
|
|
||||||
EXCLUDED_ARCHS[sdk=iphoneos*]=armv7
|
|
||||||
DART_OBFUSCATION=false
|
|
||||||
TRACK_WIDGET_CREATION=true
|
|
||||||
TREE_SHAKE_ICONS=false
|
|
||||||
PACKAGE_CONFIG=.dart_tool/package_config.json
|
|
@ -1,14 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# This is a generated file; do not edit or check into version control.
|
# This is a generated file; do not edit or check into version control.
|
||||||
export "FLUTTER_ROOT=/Users/kima/development/flutter"
|
export "FLUTTER_ROOT=/Users/kima/src/flutter"
|
||||||
export "FLUTTER_APPLICATION_PATH=/Users/kima/Documents/refilc/app/naplo/filcnaplo"
|
export "FLUTTER_APPLICATION_PATH=/Users/kima/Documents/refilc/app/naplo/filcnaplo"
|
||||||
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
||||||
export "FLUTTER_TARGET=/Users/kima/Documents/refilc/app/naplo/filcnaplo/lib/main.dart"
|
export "FLUTTER_TARGET=lib/main.dart"
|
||||||
export "FLUTTER_BUILD_DIR=build"
|
export "FLUTTER_BUILD_DIR=build"
|
||||||
export "FLUTTER_BUILD_NAME=4.1.0"
|
export "FLUTTER_BUILD_NAME=4.2.0"
|
||||||
export "FLUTTER_BUILD_NUMBER=213"
|
export "FLUTTER_BUILD_NUMBER=220"
|
||||||
export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC8yYTM0MDFjOWJiYjVhOWE5YWVjNzRkNGY3MzVkMThhOWRkM2ViZjJkLw=="
|
|
||||||
export "DART_OBFUSCATION=false"
|
export "DART_OBFUSCATION=false"
|
||||||
export "TRACK_WIDGET_CREATION=true"
|
export "TRACK_WIDGET_CREATION=true"
|
||||||
export "TREE_SHAKE_ICONS=false"
|
export "TREE_SHAKE_ICONS=false"
|
||||||
export "PACKAGE_CONFIG=/Users/kima/Documents/refilc/app/naplo/filcnaplo/.dart_tool/package_config.json"
|
export "PACKAGE_CONFIG=.dart_tool/package_config.json"
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# This is a generated file; do not edit or check into version control.
|
|
||||||
export "FLUTTER_ROOT=/Users/kima/src/flutter"
|
|
||||||
export "FLUTTER_APPLICATION_PATH=/Users/kima/Documents/refilc/app/naplo/filcnaplo"
|
|
||||||
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
|
||||||
export "FLUTTER_TARGET=lib/main.dart"
|
|
||||||
export "FLUTTER_BUILD_DIR=build"
|
|
||||||
export "FLUTTER_BUILD_NAME=4.2.0"
|
|
||||||
export "FLUTTER_BUILD_NUMBER=220"
|
|
||||||
export "DART_OBFUSCATION=false"
|
|
||||||
export "TRACK_WIDGET_CREATION=true"
|
|
||||||
export "TREE_SHAKE_ICONS=false"
|
|
||||||
export "PACKAGE_CONFIG=.dart_tool/package_config.json"
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# This is a generated file; do not edit or check into version control.
|
|
||||||
export "FLUTTER_ROOT=/Users/kima/src/flutter"
|
|
||||||
export "FLUTTER_APPLICATION_PATH=/Users/kima/Documents/refilc/app/naplo/filcnaplo"
|
|
||||||
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
|
||||||
export "FLUTTER_TARGET=lib/main.dart"
|
|
||||||
export "FLUTTER_BUILD_DIR=build"
|
|
||||||
export "FLUTTER_BUILD_NAME=4.2.0"
|
|
||||||
export "FLUTTER_BUILD_NUMBER=220"
|
|
||||||
export "DART_OBFUSCATION=false"
|
|
||||||
export "TRACK_WIDGET_CREATION=true"
|
|
||||||
export "TREE_SHAKE_ICONS=false"
|
|
||||||
export "PACKAGE_CONFIG=.dart_tool/package_config.json"
|
|
@ -101,7 +101,7 @@ Future loginAPI({
|
|||||||
Provider.of<UserProvider>(context, listen: false).setUser(user.id);
|
Provider.of<UserProvider>(context, listen: false).setUser(user.id);
|
||||||
|
|
||||||
// Get user data
|
// Get user data
|
||||||
// try {
|
try {
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
Provider.of<GradeProvider>(context, listen: false).fetch(),
|
Provider.of<GradeProvider>(context, listen: false).fetch(),
|
||||||
Provider.of<TimetableProvider>(context, listen: false)
|
Provider.of<TimetableProvider>(context, listen: false)
|
||||||
@ -113,9 +113,9 @@ Future loginAPI({
|
|||||||
Provider.of<EventProvider>(context, listen: false).fetch(),
|
Provider.of<EventProvider>(context, listen: false).fetch(),
|
||||||
Provider.of<AbsenceProvider>(context, listen: false).fetch(),
|
Provider.of<AbsenceProvider>(context, listen: false).fetch(),
|
||||||
]);
|
]);
|
||||||
// } catch (error) {
|
} catch (error) {
|
||||||
// print("WARNING: failed to fetch user data: $error");
|
print("WARNING: failed to fetch user data: $error");
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (onSuccess != null) onSuccess();
|
if (onSuccess != null) onSuccess();
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,10 @@ extension UpdateHelper on Release {
|
|||||||
|
|
||||||
updateCallback(-1, UpdateState.installing);
|
updateCallback(-1, UpdateState.installing);
|
||||||
|
|
||||||
var permStatus =
|
var installPerms =
|
||||||
(await Permission.manageExternalStorage.request().isGranted &&
|
(await Permission.manageExternalStorage.request().isGranted &&
|
||||||
await Permission.requestInstallPackages.request().isGranted);
|
await Permission.requestInstallPackages.request().isGranted);
|
||||||
if (permStatus) {
|
if (installPerms) {
|
||||||
var result = await OpenFile.open(apk.path);
|
var result = await OpenFile.open(apk.path);
|
||||||
|
|
||||||
if (result.type != ResultType.done) {
|
if (result.type != ResultType.done) {
|
||||||
|
@ -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.2.1+221
|
version: 4.2.0+220
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.17.0 <3.0.0"
|
sdk: ">=2.17.0 <3.0.0"
|
||||||
|
@ -24,6 +24,11 @@ class KretaAPI {
|
|||||||
KretaApiEndpoints.groupAverages +
|
KretaApiEndpoints.groupAverages +
|
||||||
"?oktatasiNevelesiFeladatUid=" +
|
"?oktatasiNevelesiFeladatUid=" +
|
||||||
uid;
|
uid;
|
||||||
|
static String averages(String iss, String uid) =>
|
||||||
|
BaseKreta.kreta(iss) +
|
||||||
|
KretaApiEndpoints.averages +
|
||||||
|
"?oktatasiNevelesiFeladatUid=" +
|
||||||
|
uid;
|
||||||
static String timetable(String iss, {DateTime? start, DateTime? end}) =>
|
static String timetable(String iss, {DateTime? start, DateTime? end}) =>
|
||||||
BaseKreta.kreta(iss) +
|
BaseKreta.kreta(iss) +
|
||||||
KretaApiEndpoints.timetable +
|
KretaApiEndpoints.timetable +
|
||||||
@ -90,6 +95,8 @@ class KretaApiEndpoints {
|
|||||||
static const groups = "/ellenorzo/V3/Sajat/OsztalyCsoportok";
|
static const groups = "/ellenorzo/V3/Sajat/OsztalyCsoportok";
|
||||||
static const groupAverages =
|
static const groupAverages =
|
||||||
"/ellenorzo/V3/Sajat/Ertekelesek/Atlagok/OsztalyAtlagok";
|
"/ellenorzo/V3/Sajat/Ertekelesek/Atlagok/OsztalyAtlagok";
|
||||||
|
static const averages =
|
||||||
|
"/ellenorzo/V3/Sajat/Ertekelesek/Atlagok/TantargyiAtlagok";
|
||||||
static const timetable = "/ellenorzo/V3/Sajat/OrarendElemek";
|
static const timetable = "/ellenorzo/V3/Sajat/OrarendElemek";
|
||||||
static const exams = "/ellenorzo/V3/Sajat/BejelentettSzamonkeresek";
|
static const exams = "/ellenorzo/V3/Sajat/BejelentettSzamonkeresek";
|
||||||
static const homework = "/ellenorzo/V3/Sajat/HaziFeladatok";
|
static const homework = "/ellenorzo/V3/Sajat/HaziFeladatok";
|
||||||
|
@ -73,8 +73,16 @@ class HomeworkProvider with ChangeNotifier {
|
|||||||
if (user == null) throw "Cannot fetch Homework for User null";
|
if (user == null) throw "Cannot fetch Homework for User null";
|
||||||
|
|
||||||
String iss = user.instituteCode;
|
String iss = user.instituteCode;
|
||||||
List? homeworkJson = await Provider.of<KretaClient>(_context, listen: false)
|
|
||||||
|
List? homeworkJson = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
homeworkJson = await Provider.of<KretaClient>(_context, listen: false)
|
||||||
.getAPI(KretaAPI.homework(iss, start: from));
|
.getAPI(KretaAPI.homework(iss, start: from));
|
||||||
|
} catch (e) {
|
||||||
|
// error fetcing homework (unknown error)
|
||||||
|
}
|
||||||
|
|
||||||
if (homeworkJson == null) throw "Cannot fetch Homework for User ${user.id}";
|
if (homeworkJson == null) throw "Cannot fetch Homework for User ${user.id}";
|
||||||
|
|
||||||
List<Homework> homework = [];
|
List<Homework> homework = [];
|
||||||
|
@ -18,7 +18,8 @@ class UpdateView extends StatefulWidget {
|
|||||||
|
|
||||||
final Release release;
|
final Release release;
|
||||||
|
|
||||||
static void show(Release release, {required BuildContext context}) => showBottomCard(context: context, child: UpdateView(release));
|
static void show(Release release, {required BuildContext context}) =>
|
||||||
|
showBottomCard(context: context, child: UpdateView(release));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_UpdateViewState createState() => _UpdateViewState();
|
_UpdateViewState createState() => _UpdateViewState();
|
||||||
@ -45,7 +46,8 @@ class _UpdateViewState extends State<UpdateView> {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"new_update".i18n,
|
"new_update".i18n,
|
||||||
style: const TextStyle(fontWeight: FontWeight.w700, fontSize: 18.0),
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w700, fontSize: 18.0),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"${widget.release.version}",
|
"${widget.release.version}",
|
||||||
@ -75,7 +77,7 @@ class _UpdateViewState extends State<UpdateView> {
|
|||||||
borderRadius: BorderRadius.circular(12.0),
|
borderRadius: BorderRadius.circular(12.0),
|
||||||
),
|
),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 125.0,
|
height: 200.0,
|
||||||
child: Markdown(
|
child: Markdown(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
@ -91,21 +93,30 @@ class _UpdateViewState extends State<UpdateView> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
if (state == UpdateState.downloading || state == UpdateState.preparing)
|
if (state == UpdateState.downloading ||
|
||||||
|
state == UpdateState.preparing)
|
||||||
Container(
|
Container(
|
||||||
height: 18.0,
|
height: 18.0,
|
||||||
width: 18.0,
|
width: 18.0,
|
||||||
margin: const EdgeInsets.only(right: 8.0),
|
margin: const EdgeInsets.only(right: 8.0),
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
value: progress > 0.05 ? progress : null,
|
value: progress > 0.05 ? progress : null,
|
||||||
color: ColorUtils.foregroundColor(AppColors.of(context).filc),
|
color: ColorUtils.foregroundColor(
|
||||||
|
AppColors.of(context).filc),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(["download".i18n, "downloading".i18n, "downloading".i18n, "installing".i18n][state.index].toUpperCase()),
|
Text([
|
||||||
|
"download".i18n,
|
||||||
|
"downloading".i18n,
|
||||||
|
"downloading".i18n,
|
||||||
|
"installing".i18n
|
||||||
|
][state.index]
|
||||||
|
.toUpperCase()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
backgroundColor: AppColors.of(context).filc,
|
backgroundColor: AppColors.of(context).filc,
|
||||||
onPressed: state == UpdateState.none ? () => downloadPrecheck() : null,
|
onPressed:
|
||||||
|
state == UpdateState.none ? () => downloadPrecheck() : null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -113,7 +124,8 @@ class _UpdateViewState extends State<UpdateView> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String fmtSize() => "${(widget.release.downloads.first.size / 1024 / 1024).toStringAsFixed(1)} MB";
|
String fmtSize() =>
|
||||||
|
"${(widget.release.downloads.first.size / 1024 / 1024).toStringAsFixed(1)} MB";
|
||||||
|
|
||||||
void downloadPrecheck() {
|
void downloadPrecheck() {
|
||||||
final status = Provider.of<StatusProvider>(context, listen: false);
|
final status = Provider.of<StatusProvider>(context, listen: false);
|
||||||
@ -157,6 +169,7 @@ class _UpdateViewState extends State<UpdateView> {
|
|||||||
.then((_) => Navigator.of(context).maybePop())
|
.then((_) => Navigator.of(context).maybePop())
|
||||||
.catchError((error, stackTrace) {
|
.catchError((error, stackTrace) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
|
Navigator.of(context).maybePop();
|
||||||
ScaffoldMessenger.of(context).showSnackBar(CustomSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(CustomSnackBar(
|
||||||
context: context,
|
context: context,
|
||||||
content: Text("error".i18n),
|
content: Text("error".i18n),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user