diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 055a6a0..96d47d3 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,33 +1,33 @@ PODS: - app_settings (5.1.1): - Flutter - - Firebase/CoreOnly (10.15.0): - - FirebaseCore (= 10.15.0) - - Firebase/Messaging (10.15.0): + - Firebase/CoreOnly (10.20.0): + - FirebaseCore (= 10.20.0) + - Firebase/Messaging (10.20.0): - Firebase/CoreOnly - - FirebaseMessaging (~> 10.15.0) - - firebase_core (2.16.0): - - Firebase/CoreOnly (= 10.15.0) + - FirebaseMessaging (~> 10.20.0) + - firebase_core (2.25.4): + - Firebase/CoreOnly (= 10.20.0) - Flutter - - firebase_messaging (14.6.8): - - Firebase/Messaging (= 10.15.0) + - firebase_messaging (14.7.16): + - Firebase/Messaging (= 10.20.0) - firebase_core - Flutter - - FirebaseCore (10.15.0): + - FirebaseCore (10.20.0): - FirebaseCoreInternal (~> 10.0) - - GoogleUtilities/Environment (~> 7.8) - - GoogleUtilities/Logger (~> 7.8) - - FirebaseCoreInternal (10.15.0): + - GoogleUtilities/Environment (~> 7.12) + - GoogleUtilities/Logger (~> 7.12) + - FirebaseCoreInternal (10.22.0): - "GoogleUtilities/NSData+zlib (~> 7.8)" - - FirebaseInstallations (10.15.0): + - FirebaseInstallations (10.22.0): - FirebaseCore (~> 10.0) - GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/UserDefaults (~> 7.8) - PromisesObjC (~> 2.1) - - FirebaseMessaging (10.15.0): + - FirebaseMessaging (10.20.0): - FirebaseCore (~> 10.0) - FirebaseInstallations (~> 10.0) - - GoogleDataTransport (~> 9.2) + - GoogleDataTransport (~> 9.3) - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/Reachability (~> 7.8) @@ -49,74 +49,83 @@ PODS: - Flutter - flutter_secure_storage (6.0.0): - Flutter - - FMDB (2.7.5): - - FMDB/standard (= 2.7.5) - - FMDB/standard (2.7.5) - - Google-Mobile-Ads-SDK (10.4.0): + - FMDB (2.7.9): + - FMDB/standard (= 2.7.9) + - FMDB/standard (2.7.9) + - Google-Mobile-Ads-SDK (10.9.0): - GoogleAppMeasurement (< 11.0, >= 7.0) - GoogleUserMessagingPlatform (>= 1.1) - google_mobile_ads (1.0.0): - Flutter - - Google-Mobile-Ads-SDK (~> 10.4.0) + - Google-Mobile-Ads-SDK (~> 10.9.0) - webview_flutter_wkwebview - - GoogleAppMeasurement (10.15.0): - - GoogleAppMeasurement/AdIdSupport (= 10.15.0) + - GoogleAppMeasurement (10.22.0): + - GoogleAppMeasurement/AdIdSupport (= 10.22.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - - nanopb (< 2.30910.0, >= 2.30908.0) - - GoogleAppMeasurement/AdIdSupport (10.15.0): - - GoogleAppMeasurement/WithoutAdIdSupport (= 10.15.0) + - nanopb (< 2.30911.0, >= 2.30908.0) + - GoogleAppMeasurement/AdIdSupport (10.22.0): + - GoogleAppMeasurement/WithoutAdIdSupport (= 10.22.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - - nanopb (< 2.30910.0, >= 2.30908.0) - - GoogleAppMeasurement/WithoutAdIdSupport (10.15.0): + - nanopb (< 2.30911.0, >= 2.30908.0) + - GoogleAppMeasurement/WithoutAdIdSupport (10.22.0): - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - - nanopb (< 2.30910.0, >= 2.30908.0) - - GoogleDataTransport (9.2.5): + - nanopb (< 2.30911.0, >= 2.30908.0) + - GoogleDataTransport (9.4.0): - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) - - GoogleUserMessagingPlatform (2.1.0) - - GoogleUtilities/AppDelegateSwizzler (7.11.5): + - GoogleUserMessagingPlatform (2.2.0) + - GoogleUtilities/AppDelegateSwizzler (7.13.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (7.11.5): + - GoogleUtilities/Privacy + - GoogleUtilities/Environment (7.13.0): + - GoogleUtilities/Privacy - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/Logger (7.11.5): + - GoogleUtilities/Logger (7.13.0): - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (7.11.5): + - GoogleUtilities/Privacy + - GoogleUtilities/MethodSwizzler (7.13.0): - GoogleUtilities/Logger - - GoogleUtilities/Network (7.11.5): + - GoogleUtilities/Privacy + - GoogleUtilities/Network (7.13.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" + - GoogleUtilities/Privacy - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (7.11.5)" - - GoogleUtilities/Reachability (7.11.5): + - "GoogleUtilities/NSData+zlib (7.13.0)": + - GoogleUtilities/Privacy + - GoogleUtilities/Privacy (7.13.0) + - GoogleUtilities/Reachability (7.13.0): - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (7.11.5): + - GoogleUtilities/Privacy + - GoogleUtilities/UserDefaults (7.13.0): - GoogleUtilities/Logger + - GoogleUtilities/Privacy - in_app_review (0.2.0): - Flutter - - nanopb (2.30909.0): - - nanopb/decode (= 2.30909.0) - - nanopb/encode (= 2.30909.0) - - nanopb/decode (2.30909.0) - - nanopb/encode (2.30909.0) + - nanopb (2.30909.1): + - nanopb/decode (= 2.30909.1) + - nanopb/encode (= 2.30909.1) + - nanopb/decode (2.30909.1) + - nanopb/encode (2.30909.1) - OrderedSet (5.0.0) - package_info_plus (0.4.5): - Flutter - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS - - PromisesObjC (2.3.1) + - PromisesObjC (2.4.0) - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS @@ -207,36 +216,36 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: app_settings: 017320c6a680cdc94c799949d95b84cb69389ebc - Firebase: 66043bd4579e5b73811f96829c694c7af8d67435 - firebase_core: 77172d0a9d8d19d07606e24406e4c2fc14d3265b - firebase_messaging: 6aff54d420b7ce7080c26dd131b08bc632666852 - FirebaseCore: 2cec518b43635f96afe7ac3a9c513e47558abd2e - FirebaseCoreInternal: 2f4bee5ed00301b5e56da0849268797a2dd31fb4 - FirebaseInstallations: cae95cab0f965ce05b805189de1d4c70b11c76fb - FirebaseMessaging: 0c0ae1eb722ef0c07f7801e5ded8dccd1357d6d4 + Firebase: 10c8cb12fb7ad2ae0c09ffc86cd9c1ab392a0031 + firebase_core: a46c312d8bae4defa3d009b2aa7b5b413aeb394e + firebase_messaging: e7062cef946e12f93b42abea96937004f8d914d6 + FirebaseCore: 28045c1560a2600d284b9c45a904fe322dc890b6 + FirebaseCoreInternal: bca337352024b18424a61e478460547d46c4c753 + FirebaseInstallations: 763814908793c0da14c18b3dcffdec71e29ed55e + FirebaseMessaging: 06c414a21b122396a26847c523d5c370f8325df5 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_dynamic_icon: fb0cd2f84c817c1a0ddbbc383fbebec3cd5e88d8 flutter_inappwebview: 3d32228f1304635e7c028b0d4252937730bbc6cf flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743 flutter_platform_alert: 6a241c90f3cc350d0286deeefee9f52bee957019 flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be - FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a - Google-Mobile-Ads-SDK: 32fe7836431a06a29f7734ae092b600137c8108d - google_mobile_ads: 53b1f0d74445963e5810e34ac38dfb27aabe278e - GoogleAppMeasurement: 722db6550d1e6d552b08398b69a975ac61039338 - GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2 - GoogleUserMessagingPlatform: dce302b8f1b84d6e945812ee7a15c3f65a102cbf - GoogleUtilities: 13e2c67ede716b8741c7989e26893d151b2b2084 + FMDB: aa44149f6fb634b1ac54f64f47064bb0d0c5a032 + Google-Mobile-Ads-SDK: e81e8b009a182dc8dd14951782efdbb30a5e4510 + google_mobile_ads: 035df0d095e1a196b52e3c91534d0718d3dacf98 + GoogleAppMeasurement: ccefe3eac9b0aa27f96066809fb1a7fe4b462626 + GoogleDataTransport: bed3a36c04c8552479fbb9b76326e0fc69bddcb2 + GoogleUserMessagingPlatform: d31dbfb40ec02c5d9683029815c5d5a7f46389ee + GoogleUtilities: d053d902a8edaa9904e1bd00c37535385b8ed152 in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d - nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431 + nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5 OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c - package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7 + package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85 path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 - PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4 + PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a store_redirect: 2977747cf81689a39bd62c248c2deacb7a0d131e - url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 + url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a PODFILE CHECKSUM: cd13f7939ef96b7b2bc5022f3b5fe97092150907 diff --git a/lib/main.dart b/lib/main.dart index 27b00be..52584b7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -49,8 +49,8 @@ Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async { 'login': username, 'passwort': password, 'response_type': 'token', - 'client_id': 'cj79FSz1JQvZKpJY', - 'state': 'mipeZwvnUtB4bJWCsoXhGi7d8AyQT5698jSa9ixl', + 'client_id': 'ppyybShnMerHdtBQ', + 'state': 'Y2p5M2NJUUh1YV9-Nmh1TXc4NHZYVy1sYUdTNzB5a3pWa3cwWFVIS0UzWkNi', }); if (response.statusCode == 302) { String locationHeader = response.headers['location'].toString().replaceAll( @@ -212,8 +212,8 @@ Future login() async { 'login': username, 'passwort': password, 'response_type': 'token', - 'client_id': 'cj79FSz1JQvZKpJY', - 'state': 'mipeZwvnUtB4bJWCsoXhGi7d8AyQT5698jSa9ixl', + 'client_id': 'ppyybShnMerHdtBQ', + 'state': 'Y2p5M2NJUUh1YV9-Nmh1TXc4NHZYVy1sYUdTNzB5a3pWa3cwWFVIS0UzWkNi', }); if (response.statusCode == 302 && response.headers['location'] != null) { String locationHeader = response.headers['location'].toString().replaceAll( diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index ae62f9c..5a83ab7 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -13,7 +13,8 @@ import 'package:notely/widgets/auth_text_field.dart'; import 'package:page_transition/page_transition.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:http/http.dart' as http; - +import 'package:html/parser.dart' as parser; +import 'package:html/dom.dart' as dom; import '../config/style.dart'; import '../view_container.dart'; @@ -37,7 +38,7 @@ class _LoginPageState extends State { if (!kIsWeb) { headlessWebView = HeadlessInAppWebView( initialUrlRequest: - URLRequest(url: Uri.parse("https://www.schul-netz.com/mobile/")), + URLRequest(url: Uri.parse("https://schulnetz.web.app/")), onWebViewCreated: (controller) { debugPrint('HeadlessInAppWebView created!'); }, @@ -51,11 +52,21 @@ class _LoginPageState extends State { debugPrint("onLoadStop $url"); if (url .toString() - .contains("https://www.schul-netz.com/mobile/login?mandant")) { + .contains("https://schulnetz.web.app/login?mandant")) { debugPrint("gotologin"); - await headlessWebView!.webViewController.evaluateJavascript( - source: - """document.querySelector('.mat-raised-button').click();"""); + + await headlessWebView!.webViewController + .evaluateJavascript(source: """ + document.querySelectorAll('button').forEach(button => { + if (button.textContent.trim() === 'Log in') { + button.click(); + console.log('clicked'); + } +}); + + + + """); } if (url.toString().contains("authorize.php")) { debugPrint("authorize"); @@ -71,9 +82,7 @@ class _LoginPageState extends State { }, onUpdateVisitedHistory: (controller, url, androidIsReload) async { debugPrint("onUpdateVisitedHistory $url"); - if (url - .toString() - .contains("https://www.schul-netz.com/mobile/start")) { + if (url.toString().contains("/login")) { debugPrint("sucessfully authenticated for the first time"); await headlessWebView?.dispose(); setState(() { @@ -93,7 +102,7 @@ class _LoginPageState extends State { final String username = _usernameController.text; final String password = _passwordController.text; final url = Globals.buildUrl( - "${dropdownValue.toLowerCase()}/authorize.php?response_type=token&client_id=cj79FSz1JQvZKpJY&state=mipeZwvnUtB4bJWCsoXhGi7d8AyQT5698jSa9ixl"); + "${dropdownValue.toLowerCase()}/authorize.php?response_type=token&client_id=ppyybShnMerHdtBQ&state=Y2p5M2NJUUh1YV9-Nmh1TXc4NHZYVy1sYUdTNzB5a3pWa3cwWFVIS0UzWkNi/authorize.php&response_type=code&client_id=ppyybShnMerHdtBQ&state=TkhFWHlaOVNLeDQ1TGZSOExaUS1QY1NVelY0cnVGZkhUR1BZNnpYNE1QU1lX&redirect_uri=&scope=openid%20&code_challenge=o7GBGEkRSfRgfuTzL5XAoRU6JDy0B-t3kk84Vp8K9dE&code_challenge_method=S256&nonce=TkhFWHlaOVNLeDQ1TGZSOExaUS1QY1NVelY0cnVGZkhUR1BZNnpYNE1QU1lX"); if (username == "demo" && password == "demo") { apiClient.fakeData = true; @@ -127,8 +136,12 @@ class _LoginPageState extends State { 'access-control-expose-headers': '*' }).then((response) async { debugPrint(response.statusCode.toString()); + debugPrint(response.body.toString()); + debugPrint(response.headers.toString()); + if (response.statusCode == 302 && response.headers['location'] != null) { String locationHeader = response.headers['location'].toString(); + debugPrint(locationHeader); var trimmedString = locationHeader.substring(0, locationHeader.indexOf('&')); trimmedString = trimmedString @@ -183,7 +196,7 @@ class _LoginPageState extends State { headlessWebView!.webViewController.loadUrl( urlRequest: URLRequest( url: Uri.parse( - "https://www.schul-netz.com/mobile/login?mandant=https:%2F%2Fkaschuso.so.ch%2Fpublic%2F${dropdownValue.toLowerCase()}"))); + "https://kaschuso.so.ch/public/${dropdownValue.toLowerCase()}/authorize.php?response_type=token&client_id=ppyybShnMerHdtBQ&state=M0w1SDU3NTVRdkJwamUxWnd5UHhPWlJXYXBaelBHUVFmY3VQQ2JiRUF5b1pz&redirect_uri=&scope=openid%20&code_challenge=HZfCQIX-u5DwZhXXBGxOtPD3VzlN0kXGMmZAlS4p0Y4&code_challenge_method=S256&nonce=M0w1SDU3NTVRdkJwamUxWnd5UHhPWlJXYXBaelBHUVFmY3VQQ2JiRUF5b1pz"))); } else { showToast( alignment: Alignment.bottomCenter, diff --git a/lib/view_container.dart b/lib/view_container.dart index b0b8a9d..c863399 100644 --- a/lib/view_container.dart +++ b/lib/view_container.dart @@ -85,8 +85,8 @@ class _ViewContainerWidgetState extends State 'login': username, 'passwort': password, 'response_type': 'token', - 'client_id': 'cj79FSz1JQvZKpJY', - 'state': 'mipeZwvnUtB4bJWCsoXhGi7d8AyQT5698jSa9ixl', + 'client_id': 'ppyybShnMerHdtBQ', + 'state': 'Y2p5M2NJUUh1YV9-Nmh1TXc4NHZYVy1sYUdTNzB5a3pWa3cwWFVIS0UzWkNi', }).then((response) { if (response.statusCode == 302) { String locationHeader = response.headers['location'].toString(); diff --git a/pubspec.yaml b/pubspec.yaml index 9bd179f..0f989f4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: notely description: A new Flutter project. publish_to: 'none' -version: 1.1.5+16 +version: 1.1.6+17 environment: sdk: ">=2.18.5 <3.0.0" @@ -52,6 +52,7 @@ dependencies: store_redirect: ^2.0.1 flutter_localizations: sdk: flutter + html: ^0.15.4 dev_dependencies: flutter_launcher_icons: "^0.12.0" flutter_lints: ^2.0.1