From 4474562538219cdc2536f1c92ffc3ddd168185ab Mon Sep 17 00:00:00 2001 From: Kima Date: Thu, 22 Aug 2024 22:04:05 +0200 Subject: [PATCH 1/2] login fix --- .../lib/screens/login/kreten_login.dart | 88 +++++++++++++------ 1 file changed, 62 insertions(+), 26 deletions(-) diff --git a/refilc_mobile_ui/lib/screens/login/kreten_login.dart b/refilc_mobile_ui/lib/screens/login/kreten_login.dart index 93a73b7..c203a75 100644 --- a/refilc_mobile_ui/lib/screens/login/kreten_login.dart +++ b/refilc_mobile_ui/lib/screens/login/kreten_login.dart @@ -33,35 +33,71 @@ class _KretenLoginWidgetState extends State controller = WebViewController() ..setJavaScriptMode(JavaScriptMode.unrestricted) ..setNavigationDelegate(NavigationDelegate( - onPageStarted: (url) async { - setState(() { - loadingPercentage = 0; - currentUrl = url; - }); + onNavigationRequest: (n) async { + if (n.url.startsWith('https://mobil.e-kreta.hu')) { + setState(() { + loadingPercentage = 0; + currentUrl = n.url; + }); - // final String instituteCode = widget.selectedSchool; - if (!url.startsWith( - 'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=')) { - return; + // final String instituteCode = widget.selectedSchool; + // if (!n.url.startsWith( + // 'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=')) { + // return; + // } + + List requiredThings = n.url + .replaceAll( + 'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=', + '') + .replaceAll( + '&scope=openid%20email%20offline_access%20kreta-ellenorzo-webapi.public%20kreta-eugyintezes-webapi.public%20kreta-fileservice-webapi.public%20kreta-mobile-global-webapi.public%20kreta-dkt-webapi.public%20kreta-ier-webapi.public&state=refilc_student_mobile&session_state=', + ':') + .split(':'); + + String code = requiredThings[0]; + // String sessionState = requiredThings[1]; + + widget.onLogin(code); + // Future.delayed(const Duration(milliseconds: 500), () { + // Navigator.of(context).pop(); + // }); + // Navigator.of(context).pop(); + + return NavigationDecision.prevent; + } else { + return NavigationDecision.navigate; } - - List requiredThings = url - .replaceAll( - 'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=', - '') - .replaceAll( - '&scope=openid%20email%20offline_access%20kreta-ellenorzo-webapi.public%20kreta-eugyintezes-webapi.public%20kreta-fileservice-webapi.public%20kreta-mobile-global-webapi.public%20kreta-dkt-webapi.public%20kreta-ier-webapi.public&state=refilc_student_mobile&session_state=', - ':') - .split(':'); - - String code = requiredThings[0]; - // String sessionState = requiredThings[1]; - - widget.onLogin(code); - // Future.delayed(const Duration(milliseconds: 500), () { - // Navigator.of(context).pop(); + }, + onPageStarted: (url) async { + // setState(() { + // loadingPercentage = 0; + // currentUrl = url; // }); - // Navigator.of(context).pop(); + + // // final String instituteCode = widget.selectedSchool; + // if (!url.startsWith( + // 'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=')) { + // return; + // } + + // List requiredThings = url + // .replaceAll( + // 'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=', + // '') + // .replaceAll( + // '&scope=openid%20email%20offline_access%20kreta-ellenorzo-webapi.public%20kreta-eugyintezes-webapi.public%20kreta-fileservice-webapi.public%20kreta-mobile-global-webapi.public%20kreta-dkt-webapi.public%20kreta-ier-webapi.public&state=refilc_student_mobile&session_state=', + // ':') + // .split(':'); + + // String code = requiredThings[0]; + // // String sessionState = requiredThings[1]; + + // widget.onLogin(code); + // // Future.delayed(const Duration(milliseconds: 500), () { + // // Navigator.of(context).pop(); + // // }); + // // Navigator.of(context).pop(); }, onProgress: (progress) { setState(() { From 51b25395c1007490891369ff5c728d0896cb425f Mon Sep 17 00:00:00 2001 From: Kima Date: Thu, 22 Aug 2024 22:08:11 +0200 Subject: [PATCH 2/2] version change --- refilc/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refilc/pubspec.yaml b/refilc/pubspec.yaml index fa73090..a7fa3f0 100644 --- a/refilc/pubspec.yaml +++ b/refilc/pubspec.yaml @@ -3,7 +3,7 @@ description: "Egy nem hivatalos e-KRÉTA kliens, diákoktól diákoknak." homepage: https://refilc.hu publish_to: "none" -version: 5.0.4+272 +version: 5.0.4+274 environment: sdk: ">=3.3.2 <=3.4.3"