Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not able to getting debug into onConsoleMessage and not get value in that. #2366

Closed
1 of 2 tasks
Kevin9597 opened this issue Oct 22, 2024 · 5 comments
Closed
1 of 2 tasks
Labels
bug Something isn't working

Comments

@Kevin9597
Copy link

Kevin9597 commented Oct 22, 2024

@pichillilorenzo

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

not able to get the console

Expected Behavior

I need console log when any operation hit into inAppwebview

Steps with code example to reproduce

when i enter details in webview but not return any console before 10days ago i'm getting

Stacktrace/Logs

[IOSInAppWebViewController] (iOS) WebView ID 1 calling "onReceivedServerTrustAuthRequest" using {protectionSpace: {proxyType: null, sslError: {code: 4, message: Indicates the evaluation succeeded and the certificate is implicitly trusted, but user intent was not explicitly specified.}, protocol: https, authenticationMethod: NSURLAuthenticationMethodServerTrust, host: api.sandbox.getfwd.com, realm: null, distinguishedNames: null, sslCertificate: {validNotBeforeDate: null, issuedTo: null, issuedBy: null, x509Certificate: [48, 130, 5, 213, 48, 130, 4, 189, 160, 3, 2, 1, 2, 2, 16, 6, 26, 60, 243, 50, 219, 180, 170, 135, 42, 164, 237, 232, 120, 27, 218, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 48, 60, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 85, 83, 49, 15, 48, 13, 6, 3, 85, 4, 10, 19, 6, 65, 109, 97, 122, 111, 110, 49, 28, 48, 26, 6, 3, 85, 4, 3, 19, 19, 65, 109, 97, 122, 111, 110, 32, 82, 83, 65, 32, 50, 48, 52, 56, 32, 77, 48, 51, 48, 30, 23, 13, 50, 52, 48, 55, 48, 51, 48, 48, 48, 48, 48, 48, 90, 23, ...
[IOSInAppWebViewController] (iOS) WebView ID 1 calling "onReceivedServerTrustAuthRequest" using {protectionSpace: {receivesCredentialSecurely: true, port: 443, host: api.sandbox.getfwd.com, proxyType: null, distinguishedNames: null, realm: null, authenticationMethod: NSURLAuthenticationMethodServerTrust, protocol: https, sslError: {code: 4, message: Indicates the evaluation succeeded and the certificate is implicitly trusted, but user intent was not explicitly specified.}, sslCertificate: {validNotBeforeDate: null, issuedTo: null, validNotAfterDate: null, issuedBy: null, x509Certificate: [48, 130, 5, 213, 48, 130, 4, 189, 160, 3, 2, 1, 2, 2, 16, 6, 26, 60, 243, 50, 219, 180, 170, 135, 42, 164, 237, 232, 120, 27, 218, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 48, 60, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 85, 83, 49, 15, 48, 13, 6, 3, 85, 4, 10, 19, 6, 65, 109, 97, 122, 111, 110, 49, 28, 48, 26, 6, 3, 85, 4, 3, 19, 19, 65, 109, 97, 122, 111, 110, 32, 82, 83, 65, 32, 50, 48, 52, 56, 32, 77, 48, 51, 48...
[IOSInAppWebViewController] (iOS) WebView ID 1 calling "onReceivedServerTrustAuthRequest" using {protectionSpace: {distinguishedNames: null, proxyType: null, receivesCredentialSecurely: true, realm: null, protocol: https, sslCertificate: {validNotBeforeDate: null, x509Certificate: [48, 130, 5, 233, 48, 130, 4, 209, 160, 3, 2, 1, 2, 2, 16, 10, 38, 147, 66, 70, 220, 176, 66, 245, 194, 171, 162, 186, 116, 163, 35, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 48, 60, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 85, 83, 49, 15, 48, 13, 6, 3, 85, 4, 10, 19, 6, 65, 109, 97, 122, 111, 110, 49, 28, 48, 26, 6, 3, 85, 4, 3, 19, 19, 65, 109, 97, 122, 111, 110, 32, 82, 83, 65, 32, 50, 48, 52, 56, 32, 77, 48, 50, 48, 30, 23, 13, 50, 52, 48, 51, 48, 55, 48, 48, 48, 48, 48, 48, 90, 23, 13, 50, 53, 48, 52, 48, 53, 50, 51, 53, 57, 53, 57, 90, 48, 42, 49, 40, 48, 38, 6, 3, 85, 4, 3, 19, 31, 115, 97, 110, 100, 98, 111, 120, 45, 101, 108, 101, 109, 101, 110, 116, 115, 46, 112, 99, 105, 46, 103, 101, 116, 102, 119, 100, 46, 99, 1...

Flutter version

3.24.3

Operating System, Device-specific and/or Tool

macOS 14.2.1

Plugin version

6.1.5

Additional information

Na

Self grab

  • I'm ready to work on this issue!
@Kevin9597 Kevin9597 added the bug Something isn't working label Oct 22, 2024
@pichillilorenzo
Copy link
Owner

Please, post a code example to reproduce the issue

@Kevin9597
Copy link
Author

@pichillilorenzo
InAppWebView(
initialUrlRequest: URLRequest(
url: WebUri.uri(
Uri.parse(
'$paymentUrl?client_secret=${Settings.clientSecret}',
),
),
),
onWebViewCreated: (InAppWebViewController controller) {
webViewController = controller;

                  webViewController.addJavaScriptHandler(
                    handlerName: 'handleTokenFromWeb',
                    callback: (token) {
                      if (kDebugMode) {
                        print('Received token from web: $token');
                      }
                    },
                  );
                },
                onConsoleMessage: (controller, consoleMessage) async {
                  if (kDebugMode) {
                    print('Console Message : $consoleMessage');
                  }
                  Settings.fiservPaymentId = consoleMessage.message;

                  if (Settings.fiservPaymentId!.contains('false') ||
                      (Settings.fiservPaymentId!.contains('LOG') || (Settings.fiservPaymentId!.contains('jQuery'))) ||
                      (Settings.fiservPaymentId!.contains('Uncaught')) ||
                      (Settings.fiservPaymentId!.contains('error TypeError:')) ||
                      (Settings.fiservPaymentId!.contains('Enabling apple pay')) ||
                      (Settings.fiservPaymentId!.contains("You cann't submit yet"))) {
                    if (kDebugMode) {
                      print(Settings.fiservPaymentId);
                    }
                  } else {
                    await ref.read(paymentProvider.notifier).bookingSlot();
                  }
                },
              ),

In that my card UI load and i'm able to enter card details but when i click on pay button that time not call onConsoleMessage method in ios and android both.
Some days ago it's working fine.

@Kevin9597
Copy link
Author

@pichillilorenzo

Uri.parse(
'$paymentUrl?client_secret=${Settings.clientSecret}',
),

                    This Url I open into web browser like crome or other in that I'm able to achive output into onConsoleMessage.

@Kevin9597 Kevin9597 reopened this Nov 4, 2024
@pichillilorenzo
Copy link
Owner

pichillilorenzo commented Nov 5, 2024

iOS and macOS don't have an official native API to get console messages and the current implementation is using javascript, which overrides the default console window object, so you shouldn't rely on it.
By the way, you shouldn't rely on it for any platform, not only iOS or macOS!
Console messages should be used only for debugging purposes.

You should use javascript communication to achieve what are you doing.
Check https://inappwebview.dev/docs/webview/javascript/communication for more info.

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants