Merge pull request #36 from refilc/dev

dev minden is master-be
This commit is contained in:
Márton Kiss 2023-09-04 18:37:18 +02:00 committed by GitHub
commit d65c722ef0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 229 additions and 140 deletions

1
.gitignore vendored
View File

@ -48,3 +48,4 @@ filcnaplo/ios/Podfile.lock
key.properties
.flutter-plugins*
filcnaplo/ios/Flutter/flutter_export_environment 4.sh

View File

@ -0,0 +1,15 @@
// 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

View File

@ -0,0 +1,14 @@
// 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

View File

@ -0,0 +1,13 @@
#!/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"

View File

@ -0,0 +1,13 @@
#!/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"

View File

@ -27,7 +27,7 @@ enum LoginState {
failed,
normal,
inProgress,
success
success,
}
Nonce getNonce(String nonce, String username, String instituteCode) {
@ -39,7 +39,7 @@ Nonce getNonce(String nonce, String username, String instituteCode) {
return nonceEncoder;
}
Future loginApi({
Future loginAPI({
required String username,
required String password,
required String instituteCode,
@ -101,7 +101,7 @@ Future loginApi({
Provider.of<UserProvider>(context, listen: false).setUser(user.id);
// Get user data
try {
// try {
await Future.wait([
Provider.of<GradeProvider>(context, listen: false).fetch(),
Provider.of<TimetableProvider>(context, listen: false)
@ -113,15 +113,15 @@ Future loginApi({
Provider.of<EventProvider>(context, listen: false).fetch(),
Provider.of<AbsenceProvider>(context, listen: false).fetch(),
]);
} catch (error) {
print("WARNING: failed to fetch user data: $error");
}
// } catch (error) {
// print("WARNING: failed to fetch user data: $error");
// }
if (onSuccess != null) onSuccess();
return LoginState.success;
} catch (error) {
print("ERROR: loginApi: $error");
print("ERROR: loginAPI: $error");
// maybe check debug mode
// ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("ERROR: $error")));
return LoginState.failed;

View File

@ -44,7 +44,8 @@ class LessonTile extends StatelessWidget {
fillLeading = true;
}
if (lesson.substituteTeacher?.name != "") {
if (lesson.substituteTeacher != null &&
lesson.substituteTeacher?.name != "") {
fill = true;
accent = AppColors.of(context).yellow;
}

View File

@ -3,7 +3,7 @@ description: "Nem hivatalos e-napló alkalmazás az e-Kréta rendszerhez"
homepage: https://refilc.hu
publish_to: "none"
version: 4.2.0+220
version: 4.2.1+221
environment:
sdk: ">=2.17.0 <3.0.0"

View File

@ -235,7 +235,7 @@ class _LoginScreenState extends State<LoginScreen> {
fontWeight: FontWeight.w600,
fontSize: 15.0,
)),
onPressed: () => _loginApi(context: context),
onPressed: () => _loginAPI(context: context),
),
visible: _loginState != LoginState.inProgress,
replacement: const Padding(
@ -279,7 +279,7 @@ class _LoginScreenState extends State<LoginScreen> {
);
}
void _loginApi({required BuildContext context}) {
void _loginAPI({required BuildContext context}) {
String username = usernameController.text;
String password = passwordController.text;
@ -289,7 +289,7 @@ class _LoginScreenState extends State<LoginScreen> {
setState(() => _loginState = LoginState.inProgress);
loginApi(
loginAPI(
username: username,
password: password,
instituteCode: schoolController.selectedSchool!.instituteCode,

View File

@ -61,6 +61,8 @@ class Lesson {
int get hashCode => id.hashCode;
factory Lesson.fromJson(Map json) {
print(json['Allapot']);
print(json['TanarNeve']);
return Lesson(
id: json["Uid"] ?? "",
status:
@ -71,8 +73,9 @@ class Lesson {
subject: Subject.fromJson(json["Tantargy"] ?? {}),
lessonIndex: json["Oraszam"] != null ? json["Oraszam"].toString() : "+",
lessonYearIndex: json["OraEvesSorszama"],
substituteTeacher:
Teacher.fromString((json["HelyettesTanarNeve"] ?? "").trim()),
substituteTeacher: json["HelyettesTanarNeve"] != null
? Teacher.fromString((json["HelyettesTanarNeve"]).trim())
: null,
teacher: Teacher.fromString((json["TanarNeve"] ?? "").trim()),
homeworkEnabled: json["IsTanuloHaziFeladatEnabled"] ?? false,
start: json["KezdetIdopont"] != null
@ -99,8 +102,7 @@ class Lesson {
online: json["IsDigitalisOra"] ?? false,
isEmpty: json['isEmpty'] ?? false,
json: json,
isSeen: false
);
isSeen: false);
}
int? getFloor() {

View File

@ -22,7 +22,8 @@ class LessonView extends StatelessWidget {
if (RegExp(r'\d').hasMatch(lesson.lessonIndex)) lessonIndexTrailing = ".";
if (lesson.substituteTeacher?.name != "") {
if (lesson.substituteTeacher != null &&
lesson.substituteTeacher?.name != "") {
accent = AppColors.of(context).yellow;
}

View File

@ -1,3 +1,4 @@
// import 'dart:async';
import 'dart:ui';
import 'package:filcnaplo/api/client.dart';
@ -42,6 +43,8 @@ class _LoginScreenState extends State<LoginScreen> {
stops: [-1.0, 0.0, 1.0],
);
late String tempUsername = '';
@override
void initState() {
super.initState();
@ -250,7 +253,7 @@ class _LoginScreenState extends State<LoginScreen> {
fontWeight: FontWeight.w600,
fontSize: 15.0,
)),
onPressed: () => _loginApi(context: context),
onPressed: () => _loginAPI(context: context),
),
visible: _loginState != LoginState.inProgress,
replacement: const Padding(
@ -275,7 +278,10 @@ class _LoginScreenState extends State<LoginScreen> {
][_loginState.index]
.i18n,
style: const TextStyle(
color: Colors.red, fontWeight: FontWeight.w500),
color: Colors.red,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
),
const Spacer()
@ -288,19 +294,20 @@ class _LoginScreenState extends State<LoginScreen> {
);
}
void _loginApi({required BuildContext context}) {
void _loginAPI({required BuildContext context}) {
String username = usernameController.text;
String password = passwordController.text;
tempUsername = username;
if (username == "" ||
password == "" ||
schoolController.selectedSchool == null) {
return setState(() => _loginState = LoginState.missingFields);
}
setState(() => _loginState = LoginState.inProgress);
loginApi(
void _callAPI() {
loginAPI(
username: username,
password: password,
instituteCode: schoolController.selectedSchool!.instituteCode,
@ -317,6 +324,24 @@ class _LoginScreenState extends State<LoginScreen> {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
setSystemChrome(context);
Navigator.of(context).pushReplacementNamed("login_to_navigation");
}).then((res) => setState(() => _loginState = res));
}).then(
(res) => setState(() {
// if (res == LoginState.invalidGrant &&
// tempUsername.replaceAll(username, '').length <= 3) {
// tempUsername = username + ' ';
// Timer(
// const Duration(milliseconds: 500),
// () => _loginAPI(context: context),
// );
// // _loginAPI(context: context);
// } else {
_loginState = res;
// }
}),
);
}
setState(() => _loginState = LoginState.inProgress);
_callAPI();
}
}

View File

@ -12,7 +12,8 @@ extension Localization on String {
"login": "Log in",
"welcome": "Welcome, %s!",
"missing_fields": "Missing Fields!",
"invalid_grant": "Invalid Username/Password!",
"invalid_grant":
"Invalid Username/Password! (Try adding spaces after Username)",
"error": "Failed to log in.",
"schools_error": "Failed to get schools."
},
@ -25,7 +26,8 @@ extension Localization on String {
"login": "Belépés",
"welcome": "Üdv, %s!",
"missing_fields": "Hiányzó adatok!",
"invalid_grant": "Helytelen Felhasználónév/Jelszó!",
"invalid_grant":
"Helytelen Felhasználónév/Jelszó! (Próbálj szóközöket írni a Felhasználónév után)",
"error": "Sikertelen bejelentkezés.",
"schools_error": "Nem sikerült lekérni az iskolákat."
},

View File

@ -12,12 +12,10 @@ class SchoolInputTile extends StatelessWidget {
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(4.0),
child: GestureDetector(
onPanDown: (e) {
child: InkWell(
onTap: () {
onTap!();
},
child: InkWell(
onTapDown: (e) {},
borderRadius: BorderRadius.circular(6.0),
child: Padding(
padding: const EdgeInsets.all(6.0),
@ -59,7 +57,6 @@ class SchoolInputTile extends StatelessWidget {
),
),
),
),
);
}
}

View File

@ -1,5 +1,6 @@
import 'package:filcnaplo/api/providers/database_provider.dart';
import 'package:filcnaplo/api/providers/user_provider.dart';
import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo_kreta_api/models/subject.dart';
import 'package:filcnaplo_mobile_ui/common/average_display.dart';
import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_state_screen.i18n.dart';
@ -33,7 +34,7 @@ class GoalCompleteModal extends StatelessWidget {
child: Container(
padding: const EdgeInsets.all(16.0),
decoration: BoxDecoration(
color: Colors.white,
color: Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.circular(20.0),
),
child: Column(
@ -79,19 +80,21 @@ class GoalCompleteModal extends StatelessWidget {
Text(
'congrats_title'.i18n,
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontSize: 27.0,
fontWeight: FontWeight.w700,
height: 1.1,
height: 1.2,
color: AppColors.of(context).text,
),
),
Text(
'goal_reached'.i18n.fill(['20']),
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.w500,
height: 1.1,
color: AppColors.of(context).text,
),
),
const SizedBox(height: 18.0),
@ -103,9 +106,10 @@ class GoalCompleteModal extends StatelessWidget {
Text(
'started_at'.i18n,
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontSize: 17.0,
fontWeight: FontWeight.w500,
color: AppColors.of(context).text,
),
),
const SizedBox(width: 5.0),
@ -119,9 +123,10 @@ class GoalCompleteModal extends StatelessWidget {
averageDifference.toStringAsFixed(2) + '%',
]),
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontSize: 17.0,
fontWeight: FontWeight.w500,
color: AppColors.of(context).text,
),
),
],
@ -173,17 +178,17 @@ class GoalCompleteModal extends StatelessWidget {
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: const Color(0xFFF5FAF9),
color: const Color.fromARGB(38, 131, 131, 131),
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Text(
'later'.i18n,
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.w700,
color: Color(0xFF01342D),
color: AppColors.of(context).text,
),
),
),