maybe finally fixed ios login problem (i hope so)

This commit is contained in:
Kima 2024-08-17 23:34:39 +02:00
parent 52b9b4f5db
commit 9adfe636d6

View File

@ -25,42 +25,70 @@ class _KretenLoginScreenState extends State<KretenLoginScreen> {
..setJavaScriptMode(JavaScriptMode.unrestricted) ..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(NavigationDelegate( ..setNavigationDelegate(NavigationDelegate(
onNavigationRequest: (n) async { onNavigationRequest: (n) async {
if (n.url.startsWith('https://mobil.e-kreta.hu') || if (n.url.startsWith('https://mobil.e-kreta.hu')) {
n.url.startsWith('https://idp.e-kreta.hu')) { setState(() {
return NavigationDecision.navigate; loadingPercentage = 0;
} else { currentUrl = n.url;
});
// final String instituteCode = widget.selectedSchool;
// if (!n.url.startsWith(
// 'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=')) {
// return;
// }
List<String> 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; return NavigationDecision.prevent;
} else {
return NavigationDecision.navigate;
} }
}, },
onPageStarted: (url) async { onPageStarted: (url) async {
setState(() { // setState(() {
loadingPercentage = 0; // loadingPercentage = 0;
currentUrl = url; // currentUrl = url;
});
// final String instituteCode = widget.selectedSchool;
if (!url.startsWith(
'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=')) {
return;
}
List<String> 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();
// // final String instituteCode = widget.selectedSchool;
// if (!url.startsWith(
// 'https://mobil.e-kreta.hu/ellenorzo-student/prod/oauthredirect?code=')) {
// return;
// }
// List<String> 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) { onProgress: (progress) {
setState(() { setState(() {