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

fix(ios): invoke onBrowserCreated when viewDidLoad is called with win… #1344

Merged
merged 1 commit into from
Oct 13, 2022
Merged

fix(ios): invoke onBrowserCreated when viewDidLoad is called with win… #1344

merged 1 commit into from
Oct 13, 2022

Conversation

perffecto
Copy link
Contributor

When an InAppBrowser is created with the past windowId, the onBrowserCreated method is not called and the isOpened flag does not become true.
In this case, when you try to call InAppBrowser.close, an InAppBrowserNotOpenedException is thrown.

Example:

import 'package:flutter_inappwebview/flutter_inappwebview.dart';

class CrossSiteBrowser extends InAppBrowser {
  CrossSiteBrowser({
    required int windowId,
    required Uri url,
  }) : super(windowId: windowId) {
    openUrlRequest(urlRequest: URLRequest(url: url));
  }

  @override
  Future onLoadStart(url) async {
    await Future.delayed(const Duration(seconds: 10), close);
  }
}

@perffecto
Copy link
Contributor Author

On android there is no such problem and everything works correctly.

@pichillilorenzo pichillilorenzo merged commit 5a65dd4 into pichillilorenzo:master Oct 13, 2022
@pichillilorenzo
Copy link
Owner

Thanks! @all-contributors please add @perffecto for code

@allcontributors
Copy link
Contributor

@pichillilorenzo

I've put up a pull request to add @perffecto! 🎉

@perffecto
Copy link
Contributor Author

@pichillilorenzo Thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants