updated chrome_safari_browser implementation, updated WebMessage.ports interface, updated WebViewAssetLoader implementation, force InAppWebViewController type for webview controller events
This commit is contained in:
parent
d37de77f36
commit
9cb8b3af26
@ -214,12 +214,12 @@ void customTabs() {
|
||||
});
|
||||
|
||||
skippableTest('getMaxToolbarItems', () async {
|
||||
expect(await PlatformChromeSafariBrowser.getMaxToolbarItems(),
|
||||
expect(await ChromeSafariBrowser.getMaxToolbarItems(),
|
||||
greaterThanOrEqualTo(0));
|
||||
});
|
||||
|
||||
skippableTest('getPackageName', () async {
|
||||
expect(await PlatformChromeSafariBrowser.getPackageName(), isNotNull);
|
||||
expect(await ChromeSafariBrowser.getPackageName(), isNotNull);
|
||||
});
|
||||
}, skip: shouldSkip);
|
||||
}
|
||||
|
@ -32,10 +32,10 @@ void sfSafariViewController() {
|
||||
|
||||
skippableTest('create and invalidate Prewarming Token', () async {
|
||||
final prewarmingToken =
|
||||
await PlatformChromeSafariBrowser.prewarmConnections([TEST_URL_1]);
|
||||
await ChromeSafariBrowser.prewarmConnections([TEST_URL_1]);
|
||||
expect(prewarmingToken, isNotNull);
|
||||
await expectLater(
|
||||
PlatformChromeSafariBrowser.invalidatePrewarmingToken(prewarmingToken!),
|
||||
ChromeSafariBrowser.invalidatePrewarmingToken(prewarmingToken!),
|
||||
completes);
|
||||
});
|
||||
}, skip: shouldSkip);
|
||||
|
@ -11,8 +11,8 @@ void setGetDelete() {
|
||||
|
||||
skippableTestWidgets('set, get, delete', (WidgetTester tester) async {
|
||||
CookieManager cookieManager = CookieManager.instance();
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> pageLoaded = Completer<String>();
|
||||
|
||||
var headlessWebView = new HeadlessInAppWebView(
|
||||
|
@ -9,8 +9,8 @@ void convertToInAppWebView() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('convert to InAppWebView', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
var headlessWebView = new HeadlessInAppWebView(
|
||||
@ -26,14 +26,14 @@ void convertToInAppWebView() {
|
||||
await headlessWebView.run();
|
||||
expect(headlessWebView.isRunning(), true);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
final String? url = (await controller.getUrl())?.toString();
|
||||
expect(url, TEST_CROSS_PLATFORM_URL_1.toString());
|
||||
|
||||
final Completer<PlatformInAppWebViewController> widgetControllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> widgetControllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> loadedUrl = Completer<String>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -54,7 +54,7 @@ void convertToInAppWebView() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController widgetController =
|
||||
final InAppWebViewController widgetController =
|
||||
await widgetControllerCompleter.future;
|
||||
|
||||
expect(headlessWebView.isRunning(), false);
|
||||
|
@ -10,8 +10,8 @@ void customSize() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTest('set and get custom size', () async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
||||
var headlessWebView = new HeadlessInAppWebView(
|
||||
initialUrlRequest: URLRequest(url: TEST_CROSS_PLATFORM_URL_1),
|
||||
|
@ -10,8 +10,8 @@ void runAndDispose() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTest('run and dispose', () async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
var headlessWebView = new HeadlessInAppWebView(
|
||||
@ -27,7 +27,7 @@ void runAndDispose() {
|
||||
await headlessWebView.run();
|
||||
expect(headlessWebView.isRunning(), true);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
final String? url = (await controller.getUrl())?.toString();
|
||||
|
@ -10,8 +10,8 @@ void setGetSettings() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTest('set/get settings', () async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
var headlessWebView = new HeadlessInAppWebView(
|
||||
@ -26,7 +26,7 @@ void setGetSettings() {
|
||||
);
|
||||
|
||||
await headlessWebView.run();
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
var settings = await controller.getSettings();
|
||||
|
@ -9,8 +9,8 @@ void takeScreenshot() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTest('take screenshot', () async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
var headlessWebView = new HeadlessInAppWebView(
|
||||
@ -27,7 +27,7 @@ void takeScreenshot() {
|
||||
await headlessWebView.run();
|
||||
expect(headlessWebView.isRunning(), true);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
final String? url = (await controller.getUrl())?.toString();
|
||||
|
@ -12,8 +12,8 @@ void loadAssetFile(InAppLocalhostServer localhostServer) {
|
||||
skippableTestWidgets('load asset file', (WidgetTester tester) async {
|
||||
expect(localhostServer.isRunning(), true);
|
||||
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
||||
var headlessWebView = new HeadlessInAppWebView(
|
||||
initialUrlRequest: URLRequest(
|
||||
@ -40,7 +40,7 @@ void loadAssetFile(InAppLocalhostServer localhostServer) {
|
||||
),
|
||||
);
|
||||
}
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
final String? currentUrl = (await controller.getUrl())?.toString();
|
||||
expect(currentUrl, 'http://localhost:8080/test_assets/index.html');
|
||||
|
||||
|
@ -41,8 +41,8 @@ void audioPlaybackPolicy() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('Auto media playback', (WidgetTester tester) async {
|
||||
Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
Completer<void> pageStarted = Completer<void>();
|
||||
Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
@ -69,7 +69,7 @@ void audioPlaybackPolicy() {
|
||||
),
|
||||
),
|
||||
);
|
||||
PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageStarted.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
@ -77,7 +77,7 @@ void audioPlaybackPolicy() {
|
||||
await controller.evaluateJavascript(source: 'isPaused();');
|
||||
expect(isPaused, false);
|
||||
|
||||
controllerCompleter = Completer<PlatformInAppWebViewController>();
|
||||
controllerCompleter = Completer<InAppWebViewController>();
|
||||
pageStarted = Completer<void>();
|
||||
pageLoaded = Completer<void>();
|
||||
|
||||
|
@ -10,8 +10,8 @@ void clearCache() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('clearCache', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -30,7 +30,7 @@ void clearCache() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
await expectLater(controller.clearCache(), completes);
|
||||
}, skip: shouldSkip);
|
||||
|
@ -10,8 +10,8 @@ void clearFocus() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('clearFocus', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -30,7 +30,7 @@ void clearFocus() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
await expectLater(controller.clearFocus(), completes);
|
||||
|
@ -8,8 +8,8 @@ void clearSslPreferences() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('clearSslPreferences', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -28,7 +28,7 @@ void clearSslPreferences() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
await expectLater(controller.clearSslPreferences(), completes);
|
||||
}, skip: shouldSkip);
|
||||
|
@ -10,8 +10,8 @@ void contentBlocker() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('Content Blocker', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
|
@ -9,8 +9,8 @@ void createPdf() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('createPdf', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -29,7 +29,7 @@ void createPdf() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
var pdfConfiguration = PDFConfiguration(
|
||||
|
@ -10,8 +10,8 @@ void getCertificate() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('getCertificate', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -30,7 +30,7 @@ void getCertificate() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
var sslCertificate = await controller.getCertificate();
|
||||
|
@ -12,8 +12,8 @@ void getContentHeight() {
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('getContentHeight', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -32,7 +32,7 @@ void getContentHeight() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
await tester.pump();
|
||||
|
@ -12,8 +12,8 @@ void getFavicons() {
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('getFavicons', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -32,7 +32,7 @@ void getFavicons() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
final List<Favicon>? favicons = await controller.getFavicons();
|
||||
|
@ -12,8 +12,8 @@ void getHtml() {
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('getHtml', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -32,7 +32,7 @@ void getHtml() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
final String? html = await controller.getHtml();
|
||||
|
@ -12,8 +12,8 @@ void getMetaTags() {
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('getMetaTags', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -32,7 +32,7 @@ void getMetaTags() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
List<MetaTag> metaTags = await controller.getMetaTags();
|
||||
|
@ -12,8 +12,8 @@ void getMetaThemeColor() {
|
||||
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('getMetaThemeColor', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -32,7 +32,7 @@ void getMetaThemeColor() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
expect(await controller.getMetaThemeColor(), isNotNull);
|
||||
|
@ -12,8 +12,8 @@ void getOriginalUrl() {
|
||||
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('getOriginalUrl', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -32,7 +32,7 @@ void getOriginalUrl() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
var originUrl = (await controller.getOriginalUrl())?.toString();
|
||||
expect(originUrl, url.toString());
|
||||
|
@ -10,8 +10,8 @@ void getProgress() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('getProgress', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -30,7 +30,7 @@ void getProgress() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
final int? progress = await controller.getProgress();
|
||||
|
@ -28,8 +28,8 @@ void getTitle() {
|
||||
skippableTestWidgets('getTitle', (WidgetTester tester) async {
|
||||
final Completer<void> pageStarted = Completer<void>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
@ -49,7 +49,7 @@ void getTitle() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageStarted.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
|
@ -13,8 +13,8 @@ void httpAuthCredentialDatabase() {
|
||||
skippableTestWidgets('use saved credentials', (WidgetTester tester) async {
|
||||
HttpAuthCredentialDatabase httpAuthCredentialDatabase =
|
||||
HttpAuthCredentialDatabase.instance();
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
httpAuthCredentialDatabase.setHttpAuthCredential(
|
||||
@ -50,7 +50,7 @@ void httpAuthCredentialDatabase() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
@ -77,8 +77,8 @@ void httpAuthCredentialDatabase() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('save credentials', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -107,7 +107,7 @@ void httpAuthCredentialDatabase() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
|
@ -21,8 +21,8 @@ void initialUrlRequest() {
|
||||
'launches with allowsBackForwardNavigationGestures true',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
@ -46,7 +46,7 @@ void initialUrlRequest() {
|
||||
),
|
||||
);
|
||||
await pageLoaded.future;
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
final String? currentUrl = (await controller.getUrl())?.toString();
|
||||
expect(currentUrl, TEST_URL_1.toString());
|
||||
@ -62,8 +62,8 @@ void initialUrlRequest() {
|
||||
|
||||
skippableTestWidgets('basic', (WidgetTester tester) async {
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
@ -82,7 +82,7 @@ void initialUrlRequest() {
|
||||
);
|
||||
|
||||
await pageLoaded.future;
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
final String? currentUrl = (await controller.getUrl())?.toString();
|
||||
|
||||
|
@ -13,8 +13,8 @@ void injectCSS() {
|
||||
|
||||
skippableGroup('inject CSS', () {
|
||||
skippableTestWidgets('code', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -33,7 +33,7 @@ void injectCSS() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
@ -52,8 +52,8 @@ void injectCSS() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('file from url', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -72,7 +72,7 @@ void injectCSS() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
@ -88,8 +88,8 @@ void injectCSS() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('file from asset', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -108,7 +108,7 @@ void injectCSS() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
|
@ -13,8 +13,8 @@ void injectJavascriptFile() {
|
||||
|
||||
skippableGroup('inject javascript file', () {
|
||||
skippableTestWidgets('from url', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<void> jQueryLoaded = Completer<void>();
|
||||
final Completer<void> jQueryLoadError = Completer<void>();
|
||||
@ -35,7 +35,7 @@ void injectJavascriptFile() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
@ -75,8 +75,8 @@ void injectJavascriptFile() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('from asset', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -95,7 +95,7 @@ void injectJavascriptFile() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
|
@ -11,8 +11,8 @@ void interceptAjaxRequest() {
|
||||
|
||||
skippableGroup('intercept ajax request', () {
|
||||
skippableTestWidgets('send string data', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer shouldInterceptAjaxPostRequestCompleter =
|
||||
Completer<void>();
|
||||
final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter =
|
||||
@ -93,8 +93,8 @@ void interceptAjaxRequest() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('send json data', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer shouldInterceptAjaxPostRequestCompleter =
|
||||
Completer<void>();
|
||||
final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter =
|
||||
@ -182,8 +182,8 @@ void interceptAjaxRequest() {
|
||||
|
||||
skippableTestWidgets('send URLSearchParams data',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer shouldInterceptAjaxPostRequestCompleter =
|
||||
Completer<void>();
|
||||
final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter =
|
||||
@ -266,8 +266,8 @@ void interceptAjaxRequest() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('send FormData', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer shouldInterceptAjaxPostRequestCompleter =
|
||||
Completer<void>();
|
||||
final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter =
|
||||
|
@ -11,8 +11,8 @@ void interceptFetchRequest() {
|
||||
|
||||
skippableGroup('intercept fetch request', () {
|
||||
skippableTestWidgets('send string data', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<Map<String, dynamic>> fetchPostCompleter =
|
||||
Completer<Map<String, dynamic>>();
|
||||
final Completer<void> shouldInterceptFetchPostRequestCompleter =
|
||||
@ -86,8 +86,8 @@ void interceptFetchRequest() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('send json data', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<Map<String, dynamic>> fetchPostCompleter =
|
||||
Completer<Map<String, dynamic>>();
|
||||
final Completer<void> shouldInterceptFetchPostRequestCompleter =
|
||||
@ -168,8 +168,8 @@ void interceptFetchRequest() {
|
||||
|
||||
skippableTestWidgets('send URLSearchParams data',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<Map<String, dynamic>> fetchPostCompleter =
|
||||
Completer<Map<String, dynamic>>();
|
||||
final Completer<void> shouldInterceptFetchPostRequestCompleter =
|
||||
@ -245,8 +245,8 @@ void interceptFetchRequest() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('send FormData', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<Map<String, dynamic>> fetchPostCompleter =
|
||||
Completer<Map<String, dynamic>>();
|
||||
final Completer<void> shouldInterceptFetchPostRequestCompleter =
|
||||
|
@ -10,8 +10,8 @@ void isLoading() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('isLoading', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageStarted = Completer<void>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
@ -35,7 +35,7 @@ void isLoading() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageStarted.future;
|
||||
expect(await controller.isLoading(), true);
|
||||
|
||||
|
@ -12,8 +12,8 @@ void isSecureContext() {
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('isSecureContext', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
|
||||
@ -33,7 +33,7 @@ void isSecureContext() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoads.stream.first;
|
||||
expect(await controller.isSecureContext(), true);
|
||||
|
||||
|
@ -19,8 +19,8 @@ void javascriptCodeEvaluation() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('evaluateJavascript', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -38,7 +38,7 @@ void javascriptCodeEvaluation() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
@ -63,8 +63,8 @@ void javascriptCodeEvaluation() {
|
||||
|
||||
skippableTestWidgets('evaluateJavascript with content world',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -82,7 +82,7 @@ void javascriptCodeEvaluation() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
@ -107,8 +107,8 @@ void javascriptCodeEvaluation() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('callAsyncJavaScript', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -126,7 +126,7 @@ void javascriptCodeEvaluation() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
@ -169,8 +169,8 @@ void javascriptCodeEvaluation() {
|
||||
|
||||
skippableTestWidgets('callAsyncJavaScript with content world',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -188,7 +188,7 @@ void javascriptCodeEvaluation() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
|
@ -10,8 +10,8 @@ void javascriptDialogs() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('javascript dialogs', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<JsAlertRequest> alertCompleter =
|
||||
Completer<JsAlertRequest>();
|
||||
|
@ -10,8 +10,8 @@ void javascriptHandler() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('JavaScript Handler', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageStarted = Completer<void>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<void> handlerFoo = Completer<void>();
|
||||
|
@ -15,10 +15,10 @@ void keepAlive() {
|
||||
skippableTestWidgets('Keep Alive', (WidgetTester tester) async {
|
||||
final keepAlive = InAppWebViewKeepAlive();
|
||||
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter2 =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter2 =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<void> pageLoaded2 = Completer<void>();
|
||||
|
||||
@ -46,7 +46,7 @@ void keepAlive() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
await controller.loadUrl(
|
||||
@ -64,7 +64,7 @@ void keepAlive() {
|
||||
},
|
||||
)),
|
||||
);
|
||||
final PlatformInAppWebViewController controller2 =
|
||||
final InAppWebViewController controller2 =
|
||||
await controllerCompleter2.future;
|
||||
|
||||
final String? currentUrl = (await controller2.getUrl())?.toString();
|
||||
|
@ -10,8 +10,8 @@ void loadData() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('loadData', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
|
||||
@ -31,7 +31,7 @@ void loadData() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoads.stream.first;
|
||||
|
||||
final data = """
|
||||
|
@ -10,8 +10,8 @@ void loadFile() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('loadFile', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
|
||||
@ -31,7 +31,7 @@ void loadFile() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoads.stream.first;
|
||||
|
||||
await controller.loadFile(
|
||||
|
@ -12,8 +12,8 @@ void loadUrl() {
|
||||
var initialUrl = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('loadUrl', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> firstUrlLoad = Completer<String>();
|
||||
final Completer<String> loadedUrl = Completer<String>();
|
||||
|
||||
@ -38,7 +38,7 @@ void loadUrl() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
expect(await firstUrlLoad.future, initialUrl.toString());
|
||||
|
||||
await controller.loadUrl(
|
||||
@ -54,8 +54,8 @@ void loadUrl() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('loadSimulatedRequest', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> firstUrlLoad = Completer<String>();
|
||||
final Completer<String> loadedUrl = Completer<String>();
|
||||
|
||||
@ -80,7 +80,7 @@ void loadUrl() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
expect(await firstUrlLoad.future, initialUrl.toString());
|
||||
|
||||
final htmlCode = "<h1>Hello</h1>";
|
||||
|
@ -10,8 +10,8 @@ void onConsoleMessage() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('onConsoleMessage', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<ConsoleMessage> onConsoleMessageCompleter =
|
||||
Completer<ConsoleMessage>();
|
||||
await tester.pumpWidget(
|
||||
|
@ -10,8 +10,8 @@ void onDownloadStartRequest() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('onDownloadStartRequest', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> onDownloadStartCompleter = Completer<String>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
|
@ -9,8 +9,8 @@ void onJsBeforeUnload() {
|
||||
final shouldSkip = true;
|
||||
// on Android, for some reason, it works on an example app but not in this test
|
||||
skippableTestWidgets('onJsBeforeUnload', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> onJsBeforeUnloadCompleter = Completer<String>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
|
@ -11,8 +11,8 @@ void onLoadResourceWithCustomScheme() {
|
||||
|
||||
skippableTestWidgets('onLoadResourceWithCustomScheme',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> imageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
|
@ -10,8 +10,8 @@ void onNavigationResponse() {
|
||||
|
||||
skippableGroup('onNavigationResponse', () {
|
||||
skippableTestWidgets('allow navigation', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<String> onNavigationResponseCompleter =
|
||||
Completer<String>();
|
||||
@ -43,8 +43,8 @@ void onNavigationResponse() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('cancel navigation', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<String> onNavigationResponseCompleter =
|
||||
Completer<String>();
|
||||
|
@ -10,8 +10,8 @@ void onPageCommitVisible() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('onPageCommitVisible', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> onPageCommitVisibleCompleter = Completer<String>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
|
@ -12,8 +12,8 @@ void onPermissionRequest() {
|
||||
final expectedValue = [PermissionResourceType.CAMERA];
|
||||
|
||||
skippableTestWidgets('onPermissionRequest', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<List<PermissionResourceType>> onPermissionRequestCompleter =
|
||||
Completer<List<PermissionResourceType>>();
|
||||
@ -40,7 +40,7 @@ void onPermissionRequest() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
await controller.evaluateJavascript(
|
||||
source: "document.querySelector('#camera').click();");
|
||||
@ -61,8 +61,8 @@ void onPermissionRequest() {
|
||||
|
||||
skippableTestWidgets('onPermissionRequestCanceled',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<List<PermissionResourceType>> onPermissionRequestCompleter =
|
||||
Completer<List<PermissionResourceType>>();
|
||||
@ -99,7 +99,7 @@ void onPermissionRequest() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
await controller.evaluateJavascript(
|
||||
source: "document.querySelector('#camera').click();");
|
||||
|
@ -8,8 +8,8 @@ void onReceivedIcon() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('onReceivedIcon', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<Uint8List> onReceivedIconCompleter = Completer<Uint8List>();
|
||||
|
||||
|
@ -8,8 +8,8 @@ void onReceivedTouchIconUrl() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('onReceivedTouchIconUrl', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> onReceivedTouchIconUrlCompleter =
|
||||
Completer<String>();
|
||||
|
||||
|
@ -12,8 +12,8 @@ void onScrollChanged() {
|
||||
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('onScrollChanged', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<void> onScrollChangedCompleter = Completer<void>();
|
||||
await tester.pumpWidget(
|
||||
@ -37,7 +37,7 @@ void onScrollChanged() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
await tester.pump();
|
||||
|
@ -12,8 +12,8 @@ void onTitleChanged() {
|
||||
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('onTitleChanged', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<void> onTitleChangedCompleter = Completer<void>();
|
||||
|
||||
@ -40,7 +40,7 @@ void onTitleChanged() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
await tester.pump();
|
||||
await controller.evaluateJavascript(
|
||||
|
@ -12,8 +12,8 @@ void onUpdateVisitedHistory() {
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('onUpdateVisitedHistory', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> firstPushCompleter = Completer<String>();
|
||||
final Completer<String> secondPushCompleter = Completer<String>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
@ -42,7 +42,7 @@ void onUpdateVisitedHistory() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
await controller.evaluateJavascript(source: """
|
||||
|
@ -8,8 +8,8 @@ void pageDownUp() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('pageDown/pageUp', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -28,7 +28,7 @@ void pageDownUp() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
await tester.pump();
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
|
@ -8,8 +8,8 @@ void pauseResume() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('pause/resume', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -28,7 +28,7 @@ void pauseResume() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
await expectLater(controller.pause(), completes);
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
|
@ -10,8 +10,8 @@ void pauseResumeTimers() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('pause/resume timers', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -30,7 +30,7 @@ void pauseResumeTimers() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
await controller.evaluateJavascript(source: """
|
||||
|
@ -11,8 +11,8 @@ void postRequests() {
|
||||
|
||||
skippableGroup('POST requests', () {
|
||||
skippableTestWidgets('initialUrlRequest', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> postPageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -36,7 +36,7 @@ void postRequests() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await postPageLoaded.future;
|
||||
|
||||
@ -50,8 +50,8 @@ void postRequests() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('loadUrl', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> postPageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -72,7 +72,7 @@ void postRequests() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
|
||||
var postData = Uint8List.fromList(utf8.encode("name=FooBar"));
|
||||
@ -96,8 +96,8 @@ void postRequests() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('postUrl', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> postPageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -118,7 +118,7 @@ void postRequests() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
|
||||
var postData = Uint8List.fromList(utf8.encode("name=FooBar"));
|
||||
|
@ -12,8 +12,8 @@ void printCurrentPage() {
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('printCurrentPage', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -32,7 +32,7 @@ void printCurrentPage() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
await tester.pump();
|
||||
await expectLater(controller.printCurrentPage(), completes);
|
||||
|
@ -49,8 +49,8 @@ void programmaticScroll() {
|
||||
: TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
@ -67,7 +67,7 @@ void programmaticScroll() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
@ -127,8 +127,8 @@ void programmaticScroll() {
|
||||
base64Encode(const Utf8Encoder().convert(scrollTestPage));
|
||||
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
@ -148,7 +148,7 @@ void programmaticScroll() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
await controller.scrollTo(x: 0, y: 0);
|
||||
|
@ -17,8 +17,8 @@ void programmaticZoomScale() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('zoomIn/zoomOut', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -37,7 +37,7 @@ void programmaticZoomScale() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
expect(await controller.zoomIn(), true);
|
||||
@ -46,8 +46,8 @@ void programmaticZoomScale() {
|
||||
}, skip: shouldSkipTest1);
|
||||
|
||||
skippableTestWidgets('onZoomScaleChanged', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<void> onZoomScaleChangedCompleter = Completer<void>();
|
||||
|
||||
@ -76,7 +76,7 @@ void programmaticZoomScale() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
listenForScaleChange = true;
|
||||
@ -87,8 +87,8 @@ void programmaticZoomScale() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('zoomBy', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -107,7 +107,7 @@ void programmaticZoomScale() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
@ -116,8 +116,8 @@ void programmaticZoomScale() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('getZoomScale', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -136,7 +136,7 @@ void programmaticZoomScale() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
|
@ -11,8 +11,8 @@ void pullToRefresh() {
|
||||
|
||||
skippableTestWidgets('launches with pull-to-refresh feature',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final pullToRefreshController = PullToRefreshController(
|
||||
settings: PullToRefreshSettings(
|
||||
color: Colors.blue,
|
||||
@ -38,7 +38,7 @@ void pullToRefresh() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
final String? currentUrl = (await controller.getUrl())?.toString();
|
||||
expect(currentUrl, TEST_URL_1.toString());
|
||||
}, skip: shouldSkip);
|
||||
|
@ -20,8 +20,8 @@ void reload() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('from origin', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -42,15 +42,15 @@ void reload() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
await expectLater(controller.reloadFromOrigin(), completes);
|
||||
}, skip: shouldSkipTest1);
|
||||
|
||||
skippableTestWidgets('basic', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
|
||||
@ -69,7 +69,7 @@ void reload() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
String? reloadUrl = await pageLoads.stream.first;
|
||||
expect(reloadUrl, url.toString());
|
||||
|
@ -10,8 +10,8 @@ void requestFocusNodeHref() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('requestFocusNodeHref', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -30,7 +30,7 @@ void requestFocusNodeHref() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
await expectLater(controller.requestFocusNodeHref(), completes);
|
||||
|
@ -10,8 +10,8 @@ void requestImageRef() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('requestImageRef', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -30,7 +30,7 @@ void requestImageRef() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
await expectLater(controller.requestImageRef(), completes);
|
||||
|
@ -31,8 +31,8 @@ void resizeWebView() {
|
||||
final Completer<void> resizeCompleter = Completer<void>();
|
||||
final Completer<void> pageStarted = Completer<void>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final GlobalKey key = GlobalKey();
|
||||
|
||||
final InAppWebView webView = InAppWebView(
|
||||
|
@ -10,7 +10,7 @@ void setCustomUserAgent() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('set custom userAgent', (WidgetTester tester) async {
|
||||
final Completer controllerCompleter1 = Completer<PlatformInAppWebViewController>();
|
||||
final Completer controllerCompleter1 = Completer<InAppWebViewController>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
|
@ -12,8 +12,8 @@ void setGetSettings() {
|
||||
final url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('set/get settings', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -32,7 +32,7 @@ void setGetSettings() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
InAppWebViewSettings? settings = await controller.getSettings();
|
||||
|
@ -15,8 +15,8 @@ void shouldInterceptRequest() {
|
||||
];
|
||||
List<String> resourceLoaded = [];
|
||||
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<void> loadedResourceCompleter = Completer<void>();
|
||||
|
||||
|
@ -16,8 +16,8 @@ void shouldOverrideUrlLoading() {
|
||||
base64Encode(const Utf8Encoder().convert(page));
|
||||
|
||||
skippableTestWidgets('can allow requests', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
await tester.pumpWidget(
|
||||
@ -43,7 +43,7 @@ void shouldOverrideUrlLoading() {
|
||||
);
|
||||
|
||||
await pageLoads.stream.first; // Wait for initial page load.
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await controller.evaluateJavascript(
|
||||
source: 'location.href = "$TEST_URL_2"');
|
||||
@ -65,8 +65,8 @@ void shouldOverrideUrlLoading() {
|
||||
testWidgets(
|
||||
'allow requests on iOS only if navigationType == NavigationType.LINK_ACTIVATED',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
await tester.pumpWidget(
|
||||
@ -94,7 +94,7 @@ void shouldOverrideUrlLoading() {
|
||||
);
|
||||
|
||||
await pageLoads.stream.first; // Wait for initial page load.
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await controller.evaluateJavascript(
|
||||
source: 'location.href = "$TEST_URL_2"');
|
||||
@ -120,8 +120,8 @@ void shouldOverrideUrlLoading() {
|
||||
}, skip: shouldSkipTest2);
|
||||
|
||||
skippableTestWidgets('can block requests', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
await tester.pumpWidget(
|
||||
@ -147,7 +147,7 @@ void shouldOverrideUrlLoading() {
|
||||
);
|
||||
|
||||
await pageLoads.stream.first; // Wait for initial page load.
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await controller.evaluateJavascript(
|
||||
source: 'location.href = "$TEST_URL_4"');
|
||||
@ -169,8 +169,8 @@ void shouldOverrideUrlLoading() {
|
||||
|
||||
skippableTestWidgets('supports asynchronous decisions',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
await tester.pumpWidget(
|
||||
@ -197,7 +197,7 @@ void shouldOverrideUrlLoading() {
|
||||
);
|
||||
|
||||
await pageLoads.stream.first; // Wait for initial page load.
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await controller.evaluateJavascript(
|
||||
source: 'location.href = "$TEST_URL_2"');
|
||||
|
@ -10,8 +10,8 @@ void sslRequest() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('SSL request', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
@ -40,7 +40,7 @@ void sslRequest() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
final String h1Content = await controller.evaluateJavascript(
|
||||
|
@ -10,8 +10,8 @@ void stopLoading() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('stopLoading', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -34,7 +34,7 @@ void stopLoading() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
|
||||
if (defaultTargetPlatform == TargetPlatform.android) {
|
||||
await pageLoaded.future;
|
||||
|
@ -10,8 +10,8 @@ void tRexRunnerGame() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('T-Rex Runner game', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
|
@ -10,8 +10,8 @@ void takeScreenshot() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('takeScreenshot', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -30,7 +30,7 @@ void takeScreenshot() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
|
@ -11,8 +11,8 @@ void userScripts() {
|
||||
|
||||
skippableGroup('user scripts', () {
|
||||
skippableTestWidgets('initialUserScripts', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -47,7 +47,7 @@ void userScripts() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
@ -71,8 +71,8 @@ void userScripts() {
|
||||
|
||||
skippableTestWidgets('add/remove user scripts',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
|
||||
@ -92,7 +92,7 @@ void userScripts() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoads.stream.first;
|
||||
|
||||
|
@ -50,8 +50,8 @@ void videoPlaybackPolicy() {
|
||||
});
|
||||
|
||||
skippableTestWidgets('Auto media playback', (WidgetTester tester) async {
|
||||
Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -74,14 +74,14 @@ void videoPlaybackPolicy() {
|
||||
),
|
||||
),
|
||||
);
|
||||
PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
bool isPaused =
|
||||
await controller.evaluateJavascript(source: 'isPaused();');
|
||||
expect(isPaused, false);
|
||||
|
||||
controllerCompleter = Completer<PlatformInAppWebViewController>();
|
||||
controllerCompleter = Completer<InAppWebViewController>();
|
||||
pageLoaded = Completer<void>();
|
||||
|
||||
// We change the key to re-create a new webview as we change the mediaPlaybackRequiresUserGesture
|
||||
@ -123,8 +123,8 @@ void videoPlaybackPolicy() {
|
||||
skippableTestWidgets(
|
||||
'Video plays inline when allowsInlineMediaPlayback is true',
|
||||
(WidgetTester tester) async {
|
||||
Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
Completer<void> pageLoaded = Completer<void>();
|
||||
Completer<void> onEnterFullscreenCompleter = Completer<void>();
|
||||
|
||||
@ -167,8 +167,8 @@ void videoPlaybackPolicy() {
|
||||
testWidgets(
|
||||
'Video plays fullscreen when allowsInlineMediaPlayback is false',
|
||||
(WidgetTester tester) async {
|
||||
Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
Completer<void> pageLoaded = Completer<void>();
|
||||
Completer<void> onEnterFullscreenCompleter = Completer<void>();
|
||||
|
||||
@ -212,8 +212,8 @@ void videoPlaybackPolicy() {
|
||||
].contains(defaultTargetPlatform);
|
||||
// on Android, entering fullscreen requires user interaction
|
||||
skippableTestWidgets('exit fullscreen event', (WidgetTester tester) async {
|
||||
Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
Completer<void> pageLoaded = Completer<void>();
|
||||
Completer<void> onExitFullscreenCompleter = Completer<void>();
|
||||
|
||||
@ -242,7 +242,7 @@ void videoPlaybackPolicy() {
|
||||
),
|
||||
);
|
||||
|
||||
PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
await Future.delayed(Duration(seconds: 2));
|
||||
|
@ -18,8 +18,8 @@ void webArchive() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('create data', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -38,7 +38,7 @@ void webArchive() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
@ -46,8 +46,8 @@ void webArchive() {
|
||||
}, skip: shouldSkipTest1);
|
||||
|
||||
skippableTestWidgets('save', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -66,7 +66,7 @@ void webArchive() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
|
@ -20,8 +20,8 @@ void webHistory() {
|
||||
|
||||
skippableTestWidgets('get history list and go back/forward',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
@ -39,7 +39,7 @@ void webHistory() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
@ -119,8 +119,8 @@ void webHistory() {
|
||||
|
||||
skippableTestWidgets('go back/forward on web platform',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
|
||||
@ -140,7 +140,7 @@ void webHistory() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
|
||||
await tester.pump();
|
||||
@ -178,8 +178,8 @@ void webHistory() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('clearHistory', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
|
||||
@ -199,7 +199,7 @@ void webHistory() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoads.stream.first;
|
||||
await controller.loadUrl(urlRequest: URLRequest(url: TEST_URL_1));
|
||||
|
@ -12,8 +12,8 @@ void webMessage() {
|
||||
skippableGroup('WebMessage', () {
|
||||
skippableTestWidgets('WebMessageChannel post String',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer webMessageCompleter = Completer<String>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
@ -81,8 +81,8 @@ void webMessage() {
|
||||
|
||||
skippableTestWidgets('WebMessageChannel post ArrayBuffer',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer webMessageCompleter = Completer<String>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
@ -167,8 +167,8 @@ void webMessage() {
|
||||
|
||||
skippableTestWidgets('WebMessageListener post String',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer webMessageCompleter = Completer<String>();
|
||||
await tester.pumpWidget(
|
||||
@ -177,7 +177,7 @@ void webMessage() {
|
||||
child: InAppWebView(
|
||||
key: GlobalKey(),
|
||||
onWebViewCreated: (controller) async {
|
||||
await InAppWebViewController.fromPlatform(platform: controller).addWebMessageListener(WebMessageListener(
|
||||
await controller.addWebMessageListener(WebMessageListener(
|
||||
jsObjectName: "myTestObj",
|
||||
allowedOriginRules: Set.from(["https://*.example.com"]),
|
||||
onPostMessage:
|
||||
@ -222,8 +222,8 @@ void webMessage() {
|
||||
|
||||
skippableTestWidgets('WebMessageListener post ArrayBuffer',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer webMessageCompleter = Completer<String>();
|
||||
await tester.pumpWidget(
|
||||
@ -232,7 +232,7 @@ void webMessage() {
|
||||
child: InAppWebView(
|
||||
key: GlobalKey(),
|
||||
onWebViewCreated: (controller) async {
|
||||
await InAppWebViewController.fromPlatform(platform: controller).addWebMessageListener(WebMessageListener(
|
||||
await controller.addWebMessageListener(WebMessageListener(
|
||||
jsObjectName: "myTestObj",
|
||||
allowedOriginRules: Set.from(["https://*.example.com"]),
|
||||
onPostMessage:
|
||||
|
@ -8,8 +8,8 @@ void webViewAssetLoader() {
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTestWidgets('WebViewAssetLoader', (WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> pageLoaded = Completer<String>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -25,7 +25,7 @@ void webViewAssetLoader() {
|
||||
allowContentAccess: false,
|
||||
webViewAssetLoader: WebViewAssetLoader(
|
||||
domain: TEST_WEBVIEW_ASSET_LOADER_DOMAIN,
|
||||
pathHandlers: [AssetsPathHandler(path: '/assets/')]).platform),
|
||||
pathHandlers: [AssetsPathHandler(path: '/assets/')])),
|
||||
onWebViewCreated: (controller) {
|
||||
controllerCompleter.complete(controller);
|
||||
},
|
||||
@ -36,7 +36,7 @@ void webViewAssetLoader() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
final url = await pageLoaded.future;
|
||||
|
||||
expect(url, TEST_WEBVIEW_ASSET_LOADER_URL.toString());
|
||||
|
@ -20,8 +20,8 @@ void webViewWindows() {
|
||||
|
||||
skippableTestWidgets('onCreateWindow return false',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
@ -63,8 +63,8 @@ void webViewWindows() {
|
||||
|
||||
skippableTestWidgets('onCreateWindow return true',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<int> onCreateWindowCompleter = Completer<int>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
@ -91,7 +91,7 @@ void webViewWindows() {
|
||||
var windowId = await onCreateWindowCompleter.future;
|
||||
|
||||
final Completer windowControllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> windowPageLoaded = Completer<String>();
|
||||
final Completer<void> onCloseWindowCompleter = Completer<void>();
|
||||
|
||||
@ -137,8 +137,8 @@ void webViewWindows() {
|
||||
skippableTestWidgets(
|
||||
'window.open() with target _blank opens in same window',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
await tester.pumpWidget(
|
||||
@ -160,7 +160,7 @@ void webViewWindows() {
|
||||
),
|
||||
);
|
||||
await pageLoads.stream.first;
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
|
||||
await controller.evaluateJavascript(
|
||||
@ -181,8 +181,8 @@ void webViewWindows() {
|
||||
// on Android, for some reason, it works on an example app but not in this test
|
||||
skippableTestWidgets('can open new window and go back',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
StreamController<String>.broadcast();
|
||||
await tester.pumpWidget(
|
||||
@ -205,7 +205,7 @@ void webViewWindows() {
|
||||
),
|
||||
);
|
||||
await pageLoads.stream.first;
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
|
||||
await tester.pump();
|
||||
@ -264,8 +264,8 @@ void webViewWindows() {
|
||||
''';
|
||||
final String openWindowTestBase64 =
|
||||
base64Encode(const Utf8Encoder().convert(openWindowTest));
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoadCompleter = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -290,7 +290,7 @@ void webViewWindows() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await pageLoadCompleter.future;
|
||||
|
||||
@ -309,8 +309,8 @@ void webViewWindows() {
|
||||
// on Web, opening a new window during tests makes crash
|
||||
skippableTestWidgets('onCreateWindow called on Web',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> onCreateWindowCalled = Completer<String>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
@ -334,7 +334,7 @@ void webViewWindows() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller =
|
||||
final InAppWebViewController controller =
|
||||
await controllerCompleter.future;
|
||||
await controller.evaluateJavascript(
|
||||
source: "window.open('$TEST_CROSS_PLATFORM_URL_1');");
|
||||
|
@ -9,8 +9,8 @@ void clearAndSetProxyOverride() {
|
||||
|
||||
skippableTestWidgets('clear and set proxy override',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<PlatformInAppWebViewController> controllerCompleter =
|
||||
Completer<PlatformInAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> pageLoaded = Completer<String>();
|
||||
|
||||
var proxyAvailable =
|
||||
@ -42,7 +42,7 @@ void clearAndSetProxyOverride() {
|
||||
),
|
||||
);
|
||||
|
||||
final PlatformInAppWebViewController controller = await controllerCompleter.future;
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
|
||||
final String url = await pageLoaded.future;
|
||||
expect(url, TEST_URL_HTTP_EXAMPLE.toString());
|
||||
|
@ -111,7 +111,7 @@ class MyInAppBrowser extends InAppBrowser {
|
||||
}
|
||||
}
|
||||
|
||||
class MyChromeSafariBrowser extends PlatformChromeSafariBrowser {
|
||||
class MyChromeSafariBrowser extends ChromeSafariBrowser {
|
||||
final Completer<void> serviceConnected = Completer<void>();
|
||||
final Completer<void> opened = Completer<void>();
|
||||
final Completer<bool?> firstPageLoaded = Completer<bool?>();
|
||||
|
@ -20,16 +20,16 @@ void main() {
|
||||
|
||||
PlatformInAppWebViewController.debugLoggingSettings.usePrint = true;
|
||||
PlatformInAppWebViewController.debugLoggingSettings.maxLogMessageLength = 7000;
|
||||
InAppBrowser.debugLoggingSettings.usePrint = true;
|
||||
InAppBrowser.debugLoggingSettings.maxLogMessageLength = 7000;
|
||||
PlatformInAppBrowser.debugLoggingSettings.usePrint = true;
|
||||
PlatformInAppBrowser.debugLoggingSettings.maxLogMessageLength = 7000;
|
||||
PlatformChromeSafariBrowser.debugLoggingSettings.usePrint = true;
|
||||
PlatformChromeSafariBrowser.debugLoggingSettings.maxLogMessageLength = 7000;
|
||||
WebAuthenticationSession.debugLoggingSettings.usePrint = true;
|
||||
WebAuthenticationSession.debugLoggingSettings.maxLogMessageLength = 7000;
|
||||
PullToRefreshController.debugLoggingSettings.usePrint = true;
|
||||
PullToRefreshController.debugLoggingSettings.maxLogMessageLength = 7000;
|
||||
FindInteractionController.debugLoggingSettings.usePrint = true;
|
||||
FindInteractionController.debugLoggingSettings.maxLogMessageLength = 7000;
|
||||
PlatformWebAuthenticationSession.debugLoggingSettings.usePrint = true;
|
||||
PlatformWebAuthenticationSession.debugLoggingSettings.maxLogMessageLength = 7000;
|
||||
PlatformPullToRefreshController.debugLoggingSettings.usePrint = true;
|
||||
PlatformPullToRefreshController.debugLoggingSettings.maxLogMessageLength = 7000;
|
||||
PlatformFindInteractionController.debugLoggingSettings.usePrint = true;
|
||||
PlatformFindInteractionController.debugLoggingSettings.maxLogMessageLength = 7000;
|
||||
|
||||
process_global_config_tests.main();
|
||||
in_app_webview_tests.main();
|
||||
|
@ -4,7 +4,7 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
|
||||
import 'main.dart';
|
||||
|
||||
class MyChromeSafariBrowser extends PlatformChromeSafariBrowser {
|
||||
class MyChromeSafariBrowser extends ChromeSafariBrowser {
|
||||
@override
|
||||
void onOpened() {
|
||||
print("ChromeSafari browser opened");
|
||||
@ -22,7 +22,7 @@ class MyChromeSafariBrowser extends PlatformChromeSafariBrowser {
|
||||
}
|
||||
|
||||
class ChromeSafariBrowserExampleScreen extends StatefulWidget {
|
||||
final PlatformChromeSafariBrowser browser = MyChromeSafariBrowser();
|
||||
final ChromeSafariBrowser browser = MyChromeSafariBrowser();
|
||||
|
||||
@override
|
||||
_ChromeSafariBrowserExampleScreenState createState() =>
|
||||
|
@ -15,7 +15,7 @@ class InAppWebViewExampleScreen extends StatefulWidget {
|
||||
class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
|
||||
final GlobalKey webViewKey = GlobalKey();
|
||||
|
||||
PlatformInAppWebViewController? webViewController;
|
||||
InAppWebViewController? webViewController;
|
||||
InAppWebViewSettings settings = InAppWebViewSettings(
|
||||
isInspectable: kDebugMode,
|
||||
mediaPlaybackRequiresUserGesture: false,
|
||||
|
@ -0,0 +1,600 @@
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
|
||||
|
||||
/// Object specifying creation parameters for creating a [AndroidChromeSafariBrowser].
|
||||
///
|
||||
/// When adding additional fields make sure they can be null or have a default
|
||||
/// value to avoid breaking changes. See [PlatformChromeSafariBrowserCreationParams] for
|
||||
/// more information.
|
||||
@immutable
|
||||
class AndroidChromeSafariBrowserCreationParams
|
||||
extends PlatformChromeSafariBrowserCreationParams {
|
||||
/// Creates a new [AndroidChromeSafariBrowserCreationParams] instance.
|
||||
const AndroidChromeSafariBrowserCreationParams();
|
||||
|
||||
/// Creates a [AndroidChromeSafariBrowserCreationParams] instance based on [PlatformChromeSafariBrowserCreationParams].
|
||||
factory AndroidChromeSafariBrowserCreationParams.fromPlatformChromeSafariBrowserCreationParams(
|
||||
// Recommended placeholder to prevent being broken by platform interface.
|
||||
// ignore: avoid_unused_constructor_parameters
|
||||
PlatformChromeSafariBrowserCreationParams params) {
|
||||
return AndroidChromeSafariBrowserCreationParams();
|
||||
}
|
||||
}
|
||||
|
||||
///This class uses native [Chrome Custom Tabs](https://developer.android.com/reference/android/support/customtabs/package-summary) on Android
|
||||
///and [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) on iOS.
|
||||
///
|
||||
///**NOTE**: If you want to use the `ChromeSafariBrowser` class on Android 11+ you need to specify your app querying for
|
||||
///`android.support.customtabs.action.CustomTabsService` in your `AndroidManifest.xml`
|
||||
///(you can read more about it here: https://developers.google.com/web/android/custom-tabs/best-practices#applications_targeting_android_11_api_level_30_or_above).
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser with ChannelController {
|
||||
///Debug settings.
|
||||
static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings();
|
||||
|
||||
///View ID used internally.
|
||||
final String id = IdGenerator.generate();
|
||||
|
||||
/// Constructs a [AndroidChromeSafariBrowser].
|
||||
AndroidChromeSafariBrowser(PlatformChromeSafariBrowserCreationParams params)
|
||||
: super.implementation(
|
||||
params is AndroidChromeSafariBrowserCreationParams
|
||||
? params
|
||||
: AndroidChromeSafariBrowserCreationParams
|
||||
.fromPlatformChromeSafariBrowserCreationParams(params),
|
||||
);
|
||||
|
||||
static final AndroidChromeSafariBrowser _staticValue =
|
||||
AndroidChromeSafariBrowser(AndroidChromeSafariBrowserCreationParams());
|
||||
|
||||
factory AndroidChromeSafariBrowser.static() {
|
||||
return _staticValue;
|
||||
}
|
||||
|
||||
ChromeSafariBrowserActionButton? _actionButton;
|
||||
Map<int, ChromeSafariBrowserMenuItem> _menuItems = new HashMap();
|
||||
ChromeSafariBrowserSecondaryToolbar? _secondaryToolbar;
|
||||
bool _isOpened = false;
|
||||
static const MethodChannel _staticChannel =
|
||||
const MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser');
|
||||
|
||||
_init() {
|
||||
channel =
|
||||
MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser_$id');
|
||||
handler = _handleMethod;
|
||||
initMethodCallHandler();
|
||||
}
|
||||
|
||||
_debugLog(String method, dynamic args) {
|
||||
debugLog(
|
||||
className: this.runtimeType.toString(),
|
||||
id: id,
|
||||
debugLoggingSettings: AndroidChromeSafariBrowser.debugLoggingSettings,
|
||||
method: method,
|
||||
args: args);
|
||||
}
|
||||
|
||||
Future<dynamic> _handleMethod(MethodCall call) async {
|
||||
_debugLog(call.method, call.arguments);
|
||||
|
||||
switch (call.method) {
|
||||
case "onServiceConnected":
|
||||
eventHandler?.onServiceConnected();
|
||||
break;
|
||||
case "onOpened":
|
||||
eventHandler?.onOpened();
|
||||
break;
|
||||
case "onCompletedInitialLoad":
|
||||
final bool? didLoadSuccessfully = call.arguments["didLoadSuccessfully"];
|
||||
eventHandler?.onCompletedInitialLoad(didLoadSuccessfully);
|
||||
break;
|
||||
case "onInitialLoadDidRedirect":
|
||||
final String? url = call.arguments["url"];
|
||||
final WebUri? uri = url != null ? WebUri(url) : null;
|
||||
eventHandler?.onInitialLoadDidRedirect(uri);
|
||||
break;
|
||||
case "onNavigationEvent":
|
||||
final navigationEvent = CustomTabsNavigationEventType.fromNativeValue(
|
||||
call.arguments["navigationEvent"]);
|
||||
eventHandler?.onNavigationEvent(navigationEvent);
|
||||
break;
|
||||
case "onRelationshipValidationResult":
|
||||
final relation =
|
||||
CustomTabsRelationType.fromNativeValue(call.arguments["relation"]);
|
||||
final requestedOrigin = call.arguments["requestedOrigin"] != null
|
||||
? WebUri(call.arguments["requestedOrigin"])
|
||||
: null;
|
||||
final bool result = call.arguments["result"];
|
||||
eventHandler?.onRelationshipValidationResult(relation, requestedOrigin, result);
|
||||
break;
|
||||
case "onWillOpenInBrowser":
|
||||
eventHandler?.onWillOpenInBrowser();
|
||||
break;
|
||||
case "onClosed":
|
||||
_isOpened = false;
|
||||
dispose();
|
||||
eventHandler?.onClosed();
|
||||
break;
|
||||
case "onItemActionPerform":
|
||||
String url = call.arguments["url"];
|
||||
String title = call.arguments["title"];
|
||||
int id = call.arguments["id"].toInt();
|
||||
if (this._actionButton?.id == id) {
|
||||
if (this._actionButton?.action != null) {
|
||||
this._actionButton?.action!(url, title);
|
||||
}
|
||||
if (this._actionButton?.onClick != null) {
|
||||
this._actionButton?.onClick!(WebUri(url), title);
|
||||
}
|
||||
} else if (this._menuItems[id] != null) {
|
||||
if (this._menuItems[id]?.action != null) {
|
||||
this._menuItems[id]?.action!(url, title);
|
||||
}
|
||||
if (this._menuItems[id]?.onClick != null) {
|
||||
this._menuItems[id]?.onClick!(WebUri(url), title);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "onSecondaryItemActionPerform":
|
||||
final clickableIDs = this._secondaryToolbar?.clickableIDs;
|
||||
if (clickableIDs != null) {
|
||||
WebUri? url = call.arguments["url"] != null
|
||||
? WebUri(call.arguments["url"])
|
||||
: null;
|
||||
String name = call.arguments["name"];
|
||||
for (final clickable in clickableIDs) {
|
||||
var clickableFullname = clickable.id.name;
|
||||
if (clickable.id.defType != null &&
|
||||
!clickableFullname.contains("/")) {
|
||||
clickableFullname = "${clickable.id.defType}/$clickableFullname";
|
||||
}
|
||||
if (clickable.id.defPackage != null &&
|
||||
!clickableFullname.contains(":")) {
|
||||
clickableFullname =
|
||||
"${clickable.id.defPackage}:$clickableFullname";
|
||||
}
|
||||
if (clickableFullname == name) {
|
||||
if (clickable.onClick != null) {
|
||||
clickable.onClick!(url);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "onMessageChannelReady":
|
||||
eventHandler?.onMessageChannelReady();
|
||||
break;
|
||||
case "onPostMessage":
|
||||
final String message = call.arguments["message"];
|
||||
eventHandler?.onPostMessage(message);
|
||||
break;
|
||||
case "onVerticalScrollEvent":
|
||||
final bool isDirectionUp = call.arguments["isDirectionUp"];
|
||||
eventHandler?.onVerticalScrollEvent(isDirectionUp);
|
||||
break;
|
||||
case "onGreatestScrollPercentageIncreased":
|
||||
final int scrollPercentage = call.arguments["scrollPercentage"];
|
||||
eventHandler?.onGreatestScrollPercentageIncreased(scrollPercentage);
|
||||
break;
|
||||
case "onSessionEnded":
|
||||
final bool didUserInteract = call.arguments["didUserInteract"];
|
||||
eventHandler?.onSessionEnded(didUserInteract);
|
||||
break;
|
||||
default:
|
||||
throw UnimplementedError("Unimplemented ${call.method} method");
|
||||
}
|
||||
}
|
||||
|
||||
///Opens the [AndroidChromeSafariBrowser] instance with an [url].
|
||||
///
|
||||
///[url] - The [url] to load. On iOS, the [url] is required and must use the `http` or `https` scheme.
|
||||
///
|
||||
///[headers] (Supported only on Android) - [whitelisted](https://fetch.spec.whatwg.org/#cors-safelisted-request-header) cross-origin request headers.
|
||||
///It is possible to attach non-whitelisted headers to cross-origin requests, when the server and client are related using a
|
||||
///[digital asset link](https://developers.google.com/digital-asset-links/v1/getting-started).
|
||||
///
|
||||
///[otherLikelyURLs] - Other likely destinations, sorted in decreasing likelihood order. Supported only on Android.
|
||||
///
|
||||
///[referrer] - referrer header. Supported only on Android.
|
||||
///
|
||||
///[options] - Deprecated. Use `settings` instead.
|
||||
///
|
||||
///[settings] - Settings for the [AndroidChromeSafariBrowser].
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
Future<void> open(
|
||||
{WebUri? url,
|
||||
Map<String, String>? headers,
|
||||
List<WebUri>? otherLikelyURLs,
|
||||
WebUri? referrer,
|
||||
@Deprecated('Use settings instead')
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
ChromeSafariBrowserClassOptions? options,
|
||||
ChromeSafariBrowserSettings? settings}) async {
|
||||
assert(!_isOpened, 'The browser is already opened.');
|
||||
_isOpened = true;
|
||||
|
||||
if (Util.isIOS) {
|
||||
assert(url != null, 'The specified URL must not be null on iOS.');
|
||||
assert(['http', 'https'].contains(url!.scheme),
|
||||
'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported on iOS.');
|
||||
}
|
||||
if (url != null) {
|
||||
assert(url.toString().isNotEmpty, 'The specified URL must not be empty.');
|
||||
}
|
||||
|
||||
_init();
|
||||
|
||||
List<Map<String, dynamic>> menuItemList = [];
|
||||
_menuItems.forEach((key, value) {
|
||||
menuItemList.add(value.toMap());
|
||||
});
|
||||
|
||||
var initialSettings = settings?.toMap() ??
|
||||
options?.toMap() ??
|
||||
ChromeSafariBrowserSettings().toMap();
|
||||
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('id', () => id);
|
||||
args.putIfAbsent('url', () => url?.toString());
|
||||
args.putIfAbsent('headers', () => headers);
|
||||
args.putIfAbsent('otherLikelyURLs',
|
||||
() => otherLikelyURLs?.map((e) => e.toString()).toList());
|
||||
args.putIfAbsent('referrer', () => referrer?.toString());
|
||||
args.putIfAbsent('settings', () => initialSettings);
|
||||
args.putIfAbsent('actionButton', () => _actionButton?.toMap());
|
||||
args.putIfAbsent('secondaryToolbar', () => _secondaryToolbar?.toMap());
|
||||
args.putIfAbsent('menuItemList', () => menuItemList);
|
||||
await _staticChannel.invokeMethod('open', args);
|
||||
}
|
||||
|
||||
///Tells the browser to launch with [url].
|
||||
///
|
||||
///[url] - initial url.
|
||||
///
|
||||
///[headers] (Supported only on Android) - [whitelisted](https://fetch.spec.whatwg.org/#cors-safelisted-request-header) cross-origin request headers.
|
||||
///It is possible to attach non-whitelisted headers to cross-origin requests, when the server and client are related using a
|
||||
///[digital asset link](https://developers.google.com/digital-asset-links/v1/getting-started).
|
||||
///
|
||||
///[otherLikelyURLs] - Other likely destinations, sorted in decreasing likelihood order.
|
||||
///
|
||||
///[referrer] - referrer header. Supported only on Android.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
Future<void> launchUrl({
|
||||
required WebUri url,
|
||||
Map<String, String>? headers,
|
||||
List<WebUri>? otherLikelyURLs,
|
||||
WebUri? referrer,
|
||||
}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('url', () => url.toString());
|
||||
args.putIfAbsent('headers', () => headers);
|
||||
args.putIfAbsent('otherLikelyURLs',
|
||||
() => otherLikelyURLs?.map((e) => e.toString()).toList());
|
||||
args.putIfAbsent('referrer', () => referrer?.toString());
|
||||
await channel?.invokeMethod("launchUrl", args);
|
||||
}
|
||||
|
||||
///Tells the browser of a likely future navigation to a URL.
|
||||
///The most likely URL has to be specified first.
|
||||
///Optionally, a list of other likely URLs can be provided.
|
||||
///They are treated as less likely than the first one, and have to be sorted in decreasing priority order.
|
||||
///These additional URLs may be ignored. All previous calls to this method will be deprioritized.
|
||||
///
|
||||
///[url] - Most likely URL, may be null if otherLikelyBundles is provided.
|
||||
///
|
||||
///[otherLikelyURLs] - Other likely destinations, sorted in decreasing likelihood order.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.mayLaunchUrl](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#mayLaunchUrl(android.net.Uri,android.os.Bundle,java.util.List%3Candroid.os.Bundle%3E)))
|
||||
Future<bool> mayLaunchUrl(
|
||||
{WebUri? url, List<WebUri>? otherLikelyURLs}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('url', () => url?.toString());
|
||||
args.putIfAbsent('otherLikelyURLs',
|
||||
() => otherLikelyURLs?.map((e) => e.toString()).toList());
|
||||
return await channel?.invokeMethod<bool>("mayLaunchUrl", args) ?? false;
|
||||
}
|
||||
|
||||
///Requests to validate a relationship between the application and an origin.
|
||||
///
|
||||
///See [here](https://developers.google.com/digital-asset-links/v1/getting-started) for documentation about Digital Asset Links.
|
||||
///This methods requests the browser to verify a relation with the calling application, to grant the associated rights.
|
||||
///
|
||||
///If this method returns `true`, the validation result will be provided through [onRelationshipValidationResult].
|
||||
///Otherwise the request didn't succeed.
|
||||
///
|
||||
///[relation] – Relation to check, must be one of the [CustomTabsRelationType] constants.
|
||||
///
|
||||
///[origin] – Origin.
|
||||
///
|
||||
///[extras] – Reserved for future use.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.validateRelationship](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#validateRelationship(int,android.net.Uri,android.os.Bundle)))
|
||||
Future<bool> validateRelationship(
|
||||
{required CustomTabsRelationType relation,
|
||||
required WebUri origin}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('relation', () => relation.toNativeValue());
|
||||
args.putIfAbsent('origin', () => origin.toString());
|
||||
return await channel?.invokeMethod<bool>("validateRelationship", args) ??
|
||||
false;
|
||||
}
|
||||
|
||||
///Closes the [AndroidChromeSafariBrowser] instance.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
Future<void> close() async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
await channel?.invokeMethod("close", args);
|
||||
}
|
||||
|
||||
///Set a custom action button.
|
||||
///
|
||||
///**NOTE**: Not available in a Trusted Web Activity.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsIntent.Builder.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setActionButton(android.graphics.Bitmap,%20java.lang.String,%20android.app.PendingIntent,%20boolean)))
|
||||
void setActionButton(ChromeSafariBrowserActionButton actionButton) {
|
||||
this._actionButton = actionButton;
|
||||
}
|
||||
|
||||
///Updates the [ChromeSafariBrowserActionButton.icon] and [ChromeSafariBrowserActionButton.description].
|
||||
///
|
||||
///**NOTE**: Not available in a Trusted Web Activity.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setActionButton(android.graphics.Bitmap,java.lang.String)))
|
||||
Future<void> updateActionButton(
|
||||
{required Uint8List icon, required String description}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('icon', () => icon);
|
||||
args.putIfAbsent('description', () => description);
|
||||
await channel?.invokeMethod("updateActionButton", args);
|
||||
_actionButton?.icon = icon;
|
||||
_actionButton?.description = description;
|
||||
}
|
||||
|
||||
///Sets the remote views displayed in the secondary toolbar in a custom tab.
|
||||
///
|
||||
///**NOTE**: Not available in a Trusted Web Activity.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsIntent.Builder.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent)))
|
||||
void setSecondaryToolbar(
|
||||
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) {
|
||||
this._secondaryToolbar = secondaryToolbar;
|
||||
}
|
||||
|
||||
///Sets or updates (if already present) the Remote Views of the secondary toolbar in an existing custom tab session.
|
||||
///
|
||||
///**NOTE**: Not available in a Trusted Web Activity.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent)))
|
||||
Future<void> updateSecondaryToolbar(
|
||||
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('secondaryToolbar', () => secondaryToolbar.toMap());
|
||||
await channel?.invokeMethod("updateSecondaryToolbar", args);
|
||||
this._secondaryToolbar = secondaryToolbar;
|
||||
}
|
||||
|
||||
///Adds a [ChromeSafariBrowserMenuItem] to the menu.
|
||||
///
|
||||
///**NOTE**: Not available in an Android Trusted Web Activity.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
void addMenuItem(ChromeSafariBrowserMenuItem menuItem) {
|
||||
this._menuItems[menuItem.id] = menuItem;
|
||||
}
|
||||
|
||||
///Adds a list of [ChromeSafariBrowserMenuItem] to the menu.
|
||||
///
|
||||
///**NOTE**: Not available in an Android Trusted Web Activity.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
void addMenuItems(List<ChromeSafariBrowserMenuItem> menuItems) {
|
||||
menuItems.forEach((menuItem) {
|
||||
this._menuItems[menuItem.id] = menuItem;
|
||||
});
|
||||
}
|
||||
|
||||
///Sends a request to create a two way postMessage channel between the client
|
||||
///and the browser.
|
||||
///If you want to specifying the target origin to communicate with, set the [targetOrigin].
|
||||
///
|
||||
///[sourceOrigin] - A origin that the client is requesting to be
|
||||
///identified as during the postMessage communication.
|
||||
///It has to either start with http or https.
|
||||
///
|
||||
///[targetOrigin] - The target Origin to establish the postMessage communication with.
|
||||
///This can be the app's package name, it has to either start with http or https.
|
||||
///
|
||||
///Returns whether the implementation accepted the request.
|
||||
///Note that returning true here doesn't mean an origin has already been
|
||||
///assigned as the validation is asynchronous.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.requestPostMessageChannel](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#requestPostMessageChannel(android.net.Uri,android.net.Uri,android.os.Bundle)))
|
||||
Future<bool> requestPostMessageChannel(
|
||||
{required WebUri sourceOrigin, WebUri? targetOrigin}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent("sourceOrigin", () => sourceOrigin.toString());
|
||||
args.putIfAbsent("targetOrigin", () => targetOrigin.toString());
|
||||
return await channel?.invokeMethod<bool>(
|
||||
"requestPostMessageChannel", args) ??
|
||||
false;
|
||||
}
|
||||
|
||||
///Sends a postMessage request using the origin communicated via [requestPostMessageChannel].
|
||||
///Fails when called before [onMessageChannelReady] event.
|
||||
///
|
||||
///[message] – The message that is being sent.
|
||||
///
|
||||
///Returns an integer constant about the postMessage request result.
|
||||
///Will return CustomTabsService.RESULT_SUCCESS if successful.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.postMessage](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#postMessage(java.lang.String,android.os.Bundle)))
|
||||
Future<CustomTabsPostMessageResultType> postMessage(String message) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent("message", () => message);
|
||||
return CustomTabsPostMessageResultType.fromNativeValue(
|
||||
await channel?.invokeMethod<int>("postMessage", args)) ??
|
||||
CustomTabsPostMessageResultType.FAILURE_MESSAGING_ERROR;
|
||||
}
|
||||
|
||||
///Returns whether the Engagement Signals API is available.
|
||||
///The availability of the Engagement Signals API may change at runtime.
|
||||
///If an EngagementSignalsCallback has been set, an [onSessionEnded]
|
||||
///signal will be sent if the API becomes unavailable later.
|
||||
///
|
||||
///Returns whether the Engagement Signals API is available.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.isEngagementSignalsApiAvailable](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#isEngagementSignalsApiAvailable(android.os.Bundle)))
|
||||
Future<bool> isEngagementSignalsApiAvailable() async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
return await channel?.invokeMethod<bool>(
|
||||
"isEngagementSignalsApiAvailable", args) ??
|
||||
false;
|
||||
}
|
||||
|
||||
///On Android, returns `true` if Chrome Custom Tabs is available.
|
||||
///On iOS, returns `true` if SFSafariViewController is available.
|
||||
///Otherwise returns `false`.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
Future<bool> isAvailable() async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
return await _staticChannel.invokeMethod<bool>("isAvailable", args) ??
|
||||
false;
|
||||
}
|
||||
|
||||
///The maximum number of allowed secondary toolbar items.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
Future<int> getMaxToolbarItems() async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
return await _staticChannel.invokeMethod<int>("getMaxToolbarItems", args) ??
|
||||
0;
|
||||
}
|
||||
|
||||
///Returns the preferred package to use for Custom Tabs.
|
||||
///The preferred package name is the default VIEW intent handler as long as it supports Custom Tabs.
|
||||
///To modify this preferred behavior, set [ignoreDefault] to `true` and give a
|
||||
///non empty list of package names in packages.
|
||||
///This method queries the `PackageManager` to determine which packages support the Custom Tabs API.
|
||||
///On apps that target Android 11 and above, this requires adding the following
|
||||
///package visibility elements to your manifest.
|
||||
///
|
||||
///[packages] – Ordered list of packages to test for Custom Tabs support, in decreasing order of priority.
|
||||
///
|
||||
///[ignoreDefault] – If set, the default VIEW handler won't get priority over other browsers.
|
||||
///
|
||||
///Returns the preferred package name for handling Custom Tabs, or null.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsClient.getPackageName](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#getPackageName(android.content.Context,java.util.List%3Cjava.lang.String%3E,boolean))))
|
||||
Future<String?> getPackageName(
|
||||
{List<String>? packages, bool ignoreDefault = false}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent("packages", () => packages);
|
||||
args.putIfAbsent("ignoreDefault", () => ignoreDefault);
|
||||
return await _staticChannel.invokeMethod<String?>("getPackageName", args);
|
||||
}
|
||||
|
||||
///Clear associated website data accrued from browsing activity within your app.
|
||||
///This includes all local storage, cached resources, and cookies.
|
||||
///
|
||||
///**NOTE for iOS**: available on iOS 16.0+.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- iOS ([Official API - SFSafariViewController.DataStore.clearWebsiteData](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/datastore/3981117-clearwebsitedata))
|
||||
Future<void> clearWebsiteData() async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
await _staticChannel.invokeMethod("clearWebsiteData", args);
|
||||
}
|
||||
|
||||
///Prewarms a connection to each URL. SFSafariViewController will automatically use a
|
||||
///prewarmed connection if possible when loading its initial URL.
|
||||
///
|
||||
///Returns a token object that corresponds to the requested URLs. You must keep a strong
|
||||
///reference to this token as long as you expect the prewarmed connections to remain open. If the same
|
||||
///server is requested in multiple calls to this method, all of the corresponding tokens must be
|
||||
///invalidated or released to end the prewarmed connection to that server.
|
||||
///
|
||||
///This method uses a best-effort approach to prewarming connections, but may delay
|
||||
///or drop requests based on the volume of requests made by your app. Use this method when you expect
|
||||
///to present the browser soon. Many HTTP servers time out connections after a few minutes.
|
||||
///After a timeout, prewarming delivers less performance benefit.
|
||||
///
|
||||
///[URLs] - the URLs of servers that the browser should prewarm connections to.
|
||||
///Only supports URLs with `http://` or `https://` schemes.
|
||||
///
|
||||
///**NOTE for iOS**: available on iOS 15.0+.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections))
|
||||
Future<PrewarmingToken?> prewarmConnections(List<WebUri> URLs) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('URLs', () => URLs.map((e) => e.toString()).toList());
|
||||
Map<String, dynamic>? result =
|
||||
(await _staticChannel.invokeMethod("prewarmConnections", args))
|
||||
?.cast<String, dynamic>();
|
||||
return PrewarmingToken.fromMap(result);
|
||||
}
|
||||
|
||||
///Ends all prewarmed connections associated with the token, except for connections that are also kept alive by other tokens.
|
||||
///
|
||||
///**NOTE for iOS**: available on iOS 15.0+.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections))
|
||||
Future<void> invalidatePrewarmingToken(
|
||||
PrewarmingToken prewarmingToken) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('prewarmingToken', () => prewarmingToken.toMap());
|
||||
await _staticChannel.invokeMethod("invalidatePrewarmingToken", args);
|
||||
}
|
||||
|
||||
///Returns `true` if the [AndroidChromeSafariBrowser] instance is opened, otherwise `false`.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
bool isOpened() {
|
||||
return _isOpened;
|
||||
}
|
||||
|
||||
///Disposes the channel.
|
||||
@override
|
||||
@mustCallSuper
|
||||
void dispose() {
|
||||
disposeChannel();
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
export 'chrome_safari_browser.dart';
|
@ -194,7 +194,7 @@ class AndroidCookieManager extends PlatformCookieManager
|
||||
await controller.evaluateJavascript(
|
||||
source: 'document.cookie="$cookieValue"');
|
||||
setCookieCompleter.complete();
|
||||
},
|
||||
}
|
||||
));
|
||||
await headlessWebView.run();
|
||||
await setCookieCompleter.future;
|
||||
|
@ -17,7 +17,8 @@ class AndroidHeadlessInAppWebViewCreationParams
|
||||
extends PlatformHeadlessInAppWebViewCreationParams {
|
||||
/// Creates a new [AndroidHeadlessInAppWebViewCreationParams] instance.
|
||||
AndroidHeadlessInAppWebViewCreationParams(
|
||||
{super.initialSize,
|
||||
{super.controllerFromPlatform,
|
||||
super.initialSize,
|
||||
super.windowId,
|
||||
super.onWebViewCreated,
|
||||
super.onLoadStart,
|
||||
@ -132,6 +133,7 @@ class AndroidHeadlessInAppWebViewCreationParams
|
||||
AndroidHeadlessInAppWebViewCreationParams.fromPlatformHeadlessInAppWebViewCreationParams(
|
||||
PlatformHeadlessInAppWebViewCreationParams params)
|
||||
: this(
|
||||
controllerFromPlatform: params.controllerFromPlatform,
|
||||
initialSize: params.initialSize,
|
||||
windowId: params.windowId,
|
||||
onWebViewCreated: params.onWebViewCreated,
|
||||
@ -288,6 +290,8 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView
|
||||
@override
|
||||
AndroidInAppWebViewController? get webViewController => _webViewController;
|
||||
|
||||
dynamic _controllerFromPlatform;
|
||||
|
||||
AndroidHeadlessInAppWebViewCreationParams get _androidParams =>
|
||||
params as AndroidHeadlessInAppWebViewCreationParams;
|
||||
|
||||
@ -296,6 +300,9 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView
|
||||
AndroidInAppWebViewControllerCreationParams(
|
||||
id: id, webviewParams: params),
|
||||
);
|
||||
_controllerFromPlatform =
|
||||
params.controllerFromPlatform?.call(_webViewController!) ??
|
||||
_webViewController!;
|
||||
_androidParams.pullToRefreshController?.init(id);
|
||||
_androidParams.findInteractionController?.init(id);
|
||||
channel =
|
||||
@ -308,7 +315,7 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView
|
||||
switch (call.method) {
|
||||
case "onWebViewCreated":
|
||||
if (params.onWebViewCreated != null && _webViewController != null) {
|
||||
params.onWebViewCreated!(_webViewController!);
|
||||
params.onWebViewCreated!(_controllerFromPlatform);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -478,6 +485,7 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView
|
||||
_running = false;
|
||||
_webViewController?.dispose();
|
||||
_webViewController = null;
|
||||
_controllerFromPlatform = null;
|
||||
_androidParams.pullToRefreshController?.dispose();
|
||||
_androidParams.findInteractionController?.dispose();
|
||||
}
|
||||
|
@ -19,7 +19,8 @@ import '../pull_to_refresh/pull_to_refresh_controller.dart';
|
||||
class AndroidInAppWebViewWidgetCreationParams
|
||||
extends PlatformInAppWebViewWidgetCreationParams {
|
||||
AndroidInAppWebViewWidgetCreationParams(
|
||||
{super.key,
|
||||
{super.controllerFromPlatform,
|
||||
super.key,
|
||||
super.layoutDirection,
|
||||
super.gestureRecognizers,
|
||||
super.headlessWebView,
|
||||
@ -140,6 +141,7 @@ class AndroidInAppWebViewWidgetCreationParams
|
||||
AndroidInAppWebViewWidgetCreationParams.fromPlatformInAppWebViewWidgetCreationParams(
|
||||
PlatformInAppWebViewWidgetCreationParams params)
|
||||
: this(
|
||||
controllerFromPlatform: params.controllerFromPlatform,
|
||||
key: params.key,
|
||||
layoutDirection: params.layoutDirection,
|
||||
gestureRecognizers: params.gestureRecognizers,
|
||||
@ -320,8 +322,6 @@ class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget {
|
||||
true;
|
||||
|
||||
return PlatformViewLink(
|
||||
// Setting a default key using `params` ensures the `PlatformViewLink`
|
||||
// recreates the PlatformView when changes are made.
|
||||
key: _androidParams.key,
|
||||
viewType: 'com.pichillilorenzo/flutter_inappwebview',
|
||||
surfaceFactory: (
|
||||
@ -369,22 +369,6 @@ class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget {
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
dynamic viewId = _controller?.getViewId();
|
||||
debugLog(
|
||||
className: runtimeType.toString(),
|
||||
id: viewId?.toString(),
|
||||
debugLoggingSettings: PlatformInAppWebViewController.debugLoggingSettings,
|
||||
method: "dispose",
|
||||
args: []);
|
||||
final isKeepAlive = _androidParams.keepAlive != null;
|
||||
_controller?.dispose(isKeepAlive: isKeepAlive);
|
||||
_controller = null;
|
||||
_androidParams.pullToRefreshController?.dispose(isKeepAlive: isKeepAlive);
|
||||
_androidParams.findInteractionController?.dispose(isKeepAlive: isKeepAlive);
|
||||
}
|
||||
|
||||
AndroidViewController _createAndroidViewController({
|
||||
required bool hybridComposition,
|
||||
required int id,
|
||||
@ -427,11 +411,12 @@ class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget {
|
||||
debugLog(
|
||||
className: runtimeType.toString(),
|
||||
id: viewId?.toString(),
|
||||
debugLoggingSettings: PlatformInAppWebViewController.debugLoggingSettings,
|
||||
debugLoggingSettings:
|
||||
PlatformInAppWebViewController.debugLoggingSettings,
|
||||
method: "onWebViewCreated",
|
||||
args: []);
|
||||
if (_androidParams.onWebViewCreated != null) {
|
||||
_androidParams.onWebViewCreated!(_controller!);
|
||||
_androidParams.onWebViewCreated!(params.controllerFromPlatform?.call(_controller!) ?? _controller!);
|
||||
}
|
||||
}
|
||||
|
||||
@ -469,4 +454,27 @@ class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget {
|
||||
settings.useOnNavigationResponse = true;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
dynamic viewId = _controller?.getViewId();
|
||||
debugLog(
|
||||
className: runtimeType.toString(),
|
||||
id: viewId?.toString(),
|
||||
debugLoggingSettings:
|
||||
PlatformInAppWebViewController.debugLoggingSettings,
|
||||
method: "dispose",
|
||||
args: []);
|
||||
final isKeepAlive = _androidParams.keepAlive != null;
|
||||
_controller?.dispose(isKeepAlive: isKeepAlive);
|
||||
_controller = null;
|
||||
_androidParams.pullToRefreshController?.dispose(isKeepAlive: isKeepAlive);
|
||||
_androidParams.findInteractionController?.dispose(isKeepAlive: isKeepAlive);
|
||||
}
|
||||
|
||||
@override
|
||||
T controllerFromPlatform<T>(PlatformInAppWebViewController controller) {
|
||||
// TODO: implement controllerFromPlatform
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
import 'package:flutter_inappwebview_android/src/print_job/main.dart';
|
||||
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
|
||||
|
||||
import 'chrome_safari_browser/chrome_safari_browser.dart';
|
||||
import 'cookie_manager.dart';
|
||||
import 'http_auth_credentials_database.dart';
|
||||
import 'find_interaction/main.dart';
|
||||
@ -265,24 +266,6 @@ class AndroidInAppWebViewPlatform extends InAppWebViewPlatform {
|
||||
return AndroidTracingController(params);
|
||||
}
|
||||
|
||||
/// Creates a new [AndroidWebViewAssetLoader].
|
||||
///
|
||||
/// This function should only be called by the app-facing package.
|
||||
/// Look at using [WebViewAssetLoader] in `flutter_inappwebview` instead.
|
||||
AndroidWebViewAssetLoader createPlatformWebViewAssetLoader(
|
||||
PlatformWebViewAssetLoaderCreationParams params,
|
||||
) {
|
||||
return AndroidWebViewAssetLoader(params);
|
||||
}
|
||||
|
||||
/// Creates a new empty [AndroidWebViewAssetLoader] to access static methods.
|
||||
///
|
||||
/// This function should only be called by the app-facing package.
|
||||
/// Look at using [WebViewAssetLoader] in `flutter_inappwebview` instead.
|
||||
AndroidWebViewAssetLoader createAndroidWebViewAssetLoaderStatic() {
|
||||
return AndroidWebViewAssetLoader.static();
|
||||
}
|
||||
|
||||
/// Creates a new [AndroidPathHandler].
|
||||
///
|
||||
/// This function should only be called by the app-facing package.
|
||||
@ -340,4 +323,31 @@ class AndroidInAppWebViewPlatform extends InAppWebViewPlatform {
|
||||
wv.AndroidWebViewFeature createPlatformWebViewFeatureStatic() {
|
||||
return wv.AndroidWebViewFeature.static();
|
||||
}
|
||||
|
||||
/// Creates a new [AndroidChromeSafariBrowser].
|
||||
///
|
||||
/// This function should only be called by the app-facing package.
|
||||
/// Look at using [ChromeSafariBrowser] in `flutter_inappwebview` instead.
|
||||
AndroidChromeSafariBrowser createPlatformChromeSafariBrowser(
|
||||
PlatformChromeSafariBrowserCreationParams params,
|
||||
) {
|
||||
return AndroidChromeSafariBrowser(params);
|
||||
}
|
||||
|
||||
/// Creates a new empty [AndroidChromeSafariBrowser] to access static methods.
|
||||
///
|
||||
/// This function should only be called by the app-facing package.
|
||||
/// Look at using [ChromeSafariBrowser] in `flutter_inappwebview` instead.
|
||||
AndroidChromeSafariBrowser createPlatformChromeSafariBrowserStatic() {
|
||||
return AndroidChromeSafariBrowser.static();
|
||||
}
|
||||
|
||||
/// Creates a new empty [AndroidWebStorageManager] to access static methods.
|
||||
///
|
||||
/// This function should only be called by the app-facing package.
|
||||
/// Look at using [WebStorageManager] in `flutter_inappwebview` instead.
|
||||
AndroidWebStorageManager createPlatformWebStorageManager(
|
||||
PlatformWebStorageManagerCreationParams params) {
|
||||
return AndroidWebStorageManager(params);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
export 'inappwebview_platform.dart';
|
||||
export 'in_app_webview/main.dart';
|
||||
export 'in_app_browser/main.dart';
|
||||
// export 'chrome_safari_browser/main.dart';
|
||||
export 'chrome_safari_browser/main.dart';
|
||||
export 'web_storage/main.dart';
|
||||
export 'cookie_manager.dart' hide InternalCookieManager;
|
||||
export 'http_auth_credentials_database.dart' hide InternalHttpAuthCredentialDatabase;
|
||||
@ -13,9 +13,6 @@ export 'service_worker_controller.dart';
|
||||
export 'webview_feature.dart'
|
||||
hide InternalWebViewFeature;
|
||||
export 'proxy_controller.dart' hide InternalProxyController;
|
||||
export 'webview_asset_loader.dart'
|
||||
hide
|
||||
InteranlWebViewAssetLoader,
|
||||
InteranlPathHandler;
|
||||
export 'webview_asset_loader.dart';
|
||||
export 'tracing_controller.dart' hide InternalTracingController;
|
||||
export 'process_global_config.dart' hide InternalProcessGlobalConfig;
|
@ -2,125 +2,6 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
|
||||
|
||||
/// Object specifying creation parameters for creating a [AndroidWebViewAssetLoader].
|
||||
///
|
||||
/// When adding additional fields make sure they can be null or have a default
|
||||
/// value to avoid breaking changes. See [PlatformWebViewAssetLoaderCreationParams] for
|
||||
/// more information.
|
||||
@immutable
|
||||
class AndroidWebViewAssetLoaderCreationParams
|
||||
extends PlatformWebViewAssetLoaderCreationParams {
|
||||
/// Creates a new [AndroidWebViewAssetLoaderCreationParams] instance.
|
||||
const AndroidWebViewAssetLoaderCreationParams(
|
||||
// This parameter prevents breaking changes later.
|
||||
// ignore: avoid_unused_constructor_parameters
|
||||
PlatformWebViewAssetLoaderCreationParams params,
|
||||
) : super();
|
||||
|
||||
/// Creates a [AndroidWebViewAssetLoaderCreationParams] instance based on [PlatformWebViewAssetLoaderCreationParams].
|
||||
factory AndroidWebViewAssetLoaderCreationParams.fromPlatformWebViewAssetLoaderCreationParams(
|
||||
PlatformWebViewAssetLoaderCreationParams params) {
|
||||
return AndroidWebViewAssetLoaderCreationParams(params);
|
||||
}
|
||||
}
|
||||
|
||||
///Helper class to load local files including application's static assets and resources using http(s):// URLs inside a [WebView] class.
|
||||
///Loading local files using web-like URLs instead of `file://` is desirable as it is compatible with the Same-Origin policy.
|
||||
///
|
||||
///For more context about application's assets and resources and how to normally access them please refer to
|
||||
///[Android Developer Docs: App resources overview](https://developer.android.com/guide/topics/resources/providing-resources).
|
||||
///
|
||||
///Using http(s):// URLs to access local resources may conflict with a real website.
|
||||
///This means that local files should only be hosted on domains your organization owns
|
||||
///(at paths reserved for this purpose) or the default domain reserved for this: `appassets.androidplatform.net`.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android native WebView
|
||||
class AndroidWebViewAssetLoader extends PlatformWebViewAssetLoader {
|
||||
/// Creates a new [AndroidWebViewAssetLoader].
|
||||
AndroidWebViewAssetLoader(PlatformWebViewAssetLoaderCreationParams params)
|
||||
: super.implementation(
|
||||
params is AndroidWebViewAssetLoaderCreationParams
|
||||
? params
|
||||
: AndroidWebViewAssetLoaderCreationParams
|
||||
.fromPlatformWebViewAssetLoaderCreationParams(params),
|
||||
);
|
||||
|
||||
factory AndroidWebViewAssetLoader.static() {
|
||||
return instance();
|
||||
}
|
||||
|
||||
static AndroidWebViewAssetLoader? _instance;
|
||||
|
||||
///Gets the [AndroidWebViewAssetLoader] shared instance.
|
||||
static AndroidWebViewAssetLoader instance() {
|
||||
return (_instance != null) ? _instance! : _init();
|
||||
}
|
||||
|
||||
static AndroidWebViewAssetLoader _init() {
|
||||
_instance = AndroidWebViewAssetLoader(
|
||||
AndroidWebViewAssetLoaderCreationParams(
|
||||
const PlatformWebViewAssetLoaderCreationParams()));
|
||||
return _instance!;
|
||||
}
|
||||
|
||||
///Set the domain under which app assets can be accessed. The default domain is `appassets.androidplatform.net`.
|
||||
String? get domain => params.domain;
|
||||
|
||||
///Allow using the HTTP scheme in addition to HTTPS. The default is to not allow HTTP.
|
||||
bool? get httpAllowed => params.httpAllowed;
|
||||
|
||||
///List of registered path handlers.
|
||||
///
|
||||
///[WebViewAssetLoader] will try Path Handlers in the order they're registered,
|
||||
///and will use whichever is the first to return a non-null.
|
||||
List<AndroidPathHandler>? get pathHandlers =>
|
||||
params.pathHandlers as List<AndroidPathHandler>?;
|
||||
|
||||
///Gets a possible [AndroidWebViewAssetLoader] instance from a [Map] value.
|
||||
AndroidWebViewAssetLoader? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
final instance = AndroidWebViewAssetLoader(
|
||||
AndroidWebViewAssetLoaderCreationParams(
|
||||
PlatformWebViewAssetLoaderCreationParams(
|
||||
domain: map['domain'],
|
||||
httpAllowed: map['httpAllowed'],
|
||||
pathHandlers: map['pathHandlers'] != null
|
||||
? List<AndroidPathHandler>.from(map['pathHandlers'].map((e) => e))
|
||||
: null,
|
||||
)));
|
||||
return instance;
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"domain": domain,
|
||||
"httpAllowed": httpAllowed,
|
||||
"pathHandlers": pathHandlers?.map((e) => e.toMap()).toList(),
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return toMap();
|
||||
}
|
||||
|
||||
///Returns a copy of WebViewAssetLoader.
|
||||
AndroidWebViewAssetLoader copy() {
|
||||
return fromMap(toMap()) ??
|
||||
AndroidWebViewAssetLoader(AndroidWebViewAssetLoaderCreationParams(
|
||||
const PlatformWebViewAssetLoaderCreationParams()));
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AndroidWebViewAssetLoader{domain: $domain, httpAllowed: $httpAllowed, pathHandlers: $pathHandlers}';
|
||||
}
|
||||
}
|
||||
|
||||
/// Object specifying creation parameters for creating a [AndroidPathHandler].
|
||||
///
|
||||
/// When adding additional fields make sure they can be null or have a default
|
||||
@ -346,4 +227,12 @@ class AndroidInternalStoragePathHandler extends AndroidPathHandler implements Pl
|
||||
|
||||
@override
|
||||
String get directory => _internalParams.directory;
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
...toMap(),
|
||||
'directory': directory
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,18 @@
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../types/custom_tabs_navigation_event_type.dart';
|
||||
import '../types/custom_tabs_post_message_result_type.dart';
|
||||
import '../types/custom_tabs_relation_type.dart';
|
||||
import '../types/prewarming_token.dart';
|
||||
import '../util.dart';
|
||||
import '../debug_logging_settings.dart';
|
||||
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
|
||||
import '../web_uri.dart';
|
||||
import 'chrome_safari_browser_settings.dart';
|
||||
import 'chrome_safari_action_button.dart';
|
||||
import 'chrome_safari_browser_menu_item.dart';
|
||||
import 'chrome_safari_browser_secondary_toolbar.dart';
|
||||
/// Object specifying creation parameters for creating a [PlatformChromeSafariBrowser].
|
||||
///
|
||||
/// Platform specific implementations can add additional fields by extending
|
||||
/// this class.
|
||||
@immutable
|
||||
class PlatformChromeSafariBrowserCreationParams {
|
||||
/// Used by the platform implementation to create a new [PlatformChromeSafariBrowser].
|
||||
const PlatformChromeSafariBrowserCreationParams();
|
||||
}
|
||||
|
||||
///This class uses native [Chrome Custom Tabs](https://developer.android.com/reference/android/support/customtabs/package-summary) on Android
|
||||
///and [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) on iOS.
|
||||
@ -27,156 +24,62 @@ import 'chrome_safari_browser_secondary_toolbar.dart';
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
class PlatformChromeSafariBrowser extends ChannelController {
|
||||
abstract class PlatformChromeSafariBrowser extends PlatformInterface implements Disposable {
|
||||
///Debug settings.
|
||||
static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings();
|
||||
|
||||
/// Event handler object that handles the [PlatformChromeSafariBrowser] events.
|
||||
PlatformChromeSafariBrowserEvents? eventHandler;
|
||||
|
||||
///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.id}
|
||||
///View ID used internally.
|
||||
late final String id;
|
||||
|
||||
ChromeSafariBrowserActionButton? _actionButton;
|
||||
Map<int, ChromeSafariBrowserMenuItem> _menuItems = new HashMap();
|
||||
ChromeSafariBrowserSecondaryToolbar? _secondaryToolbar;
|
||||
bool _isOpened = false;
|
||||
static const MethodChannel _sharedChannel =
|
||||
const MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser');
|
||||
|
||||
PlatformChromeSafariBrowser() {
|
||||
id = IdGenerator.generate();
|
||||
channel =
|
||||
MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser_$id');
|
||||
handler = _handleMethod;
|
||||
initMethodCallHandler();
|
||||
_isOpened = false;
|
||||
///@{endtemplate}
|
||||
String get id {
|
||||
throw UnimplementedError(
|
||||
'id is not implemented on the current platform');
|
||||
}
|
||||
|
||||
_init() {
|
||||
channel =
|
||||
MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser_$id');
|
||||
handler = _handleMethod;
|
||||
initMethodCallHandler();
|
||||
/// Creates a new [PlatformChromeSafariBrowser]
|
||||
factory PlatformChromeSafariBrowser(PlatformChromeSafariBrowserCreationParams params) {
|
||||
assert(
|
||||
InAppWebViewPlatform.instance != null,
|
||||
'A platform implementation for `flutter_inappwebview` has not been set. Please '
|
||||
'ensure that an implementation of `InAppWebViewPlatform` has been set to '
|
||||
'`InAppWebViewPlatform.instance` before use. For unit testing, '
|
||||
'`InAppWebViewPlatform.instance` can be set with your own test implementation.',
|
||||
);
|
||||
final PlatformChromeSafariBrowser chromeSafariBrowser =
|
||||
InAppWebViewPlatform.instance!.createPlatformChromeSafariBrowser(params);
|
||||
PlatformInterface.verify(chromeSafariBrowser, _token);
|
||||
return chromeSafariBrowser;
|
||||
}
|
||||
|
||||
_debugLog(String method, dynamic args) {
|
||||
debugLog(
|
||||
className: this.runtimeType.toString(),
|
||||
id: id,
|
||||
debugLoggingSettings: PlatformChromeSafariBrowser.debugLoggingSettings,
|
||||
method: method,
|
||||
args: args);
|
||||
/// Creates a new [PlatformChromeSafariBrowser] to access static methods.
|
||||
factory PlatformChromeSafariBrowser.static() {
|
||||
assert(
|
||||
InAppWebViewPlatform.instance != null,
|
||||
'A platform implementation for `flutter_inappwebview` has not been set. Please '
|
||||
'ensure that an implementation of `InAppWebViewPlatform` has been set to '
|
||||
'`InAppWebViewPlatform.instance` before use. For unit testing, '
|
||||
'`InAppWebViewPlatform.instance` can be set with your own test implementation.',
|
||||
);
|
||||
final PlatformChromeSafariBrowser chromeSafariBrowserStatic =
|
||||
InAppWebViewPlatform.instance!.createPlatformChromeSafariBrowserStatic();
|
||||
PlatformInterface.verify(chromeSafariBrowserStatic, _token);
|
||||
return chromeSafariBrowserStatic;
|
||||
}
|
||||
|
||||
Future<dynamic> _handleMethod(MethodCall call) async {
|
||||
_debugLog(call.method, call.arguments);
|
||||
/// Used by the platform implementation to create a new [PlatformChromeSafariBrowser].
|
||||
///
|
||||
/// Should only be used by platform implementations because they can't extend
|
||||
/// a class that only contains a factory constructor.
|
||||
@protected
|
||||
PlatformChromeSafariBrowser.implementation(this.params) : super(token: _token);
|
||||
|
||||
switch (call.method) {
|
||||
case "onServiceConnected":
|
||||
onServiceConnected();
|
||||
break;
|
||||
case "onOpened":
|
||||
onOpened();
|
||||
break;
|
||||
case "onCompletedInitialLoad":
|
||||
final bool? didLoadSuccessfully = call.arguments["didLoadSuccessfully"];
|
||||
onCompletedInitialLoad(didLoadSuccessfully);
|
||||
break;
|
||||
case "onInitialLoadDidRedirect":
|
||||
final String? url = call.arguments["url"];
|
||||
final WebUri? uri = url != null ? WebUri(url) : null;
|
||||
onInitialLoadDidRedirect(uri);
|
||||
break;
|
||||
case "onNavigationEvent":
|
||||
final navigationEvent = CustomTabsNavigationEventType.fromNativeValue(
|
||||
call.arguments["navigationEvent"]);
|
||||
onNavigationEvent(navigationEvent);
|
||||
break;
|
||||
case "onRelationshipValidationResult":
|
||||
final relation =
|
||||
CustomTabsRelationType.fromNativeValue(call.arguments["relation"]);
|
||||
final requestedOrigin = call.arguments["requestedOrigin"] != null
|
||||
? WebUri(call.arguments["requestedOrigin"])
|
||||
: null;
|
||||
final bool result = call.arguments["result"];
|
||||
onRelationshipValidationResult(relation, requestedOrigin, result);
|
||||
break;
|
||||
case "onWillOpenInBrowser":
|
||||
onWillOpenInBrowser();
|
||||
break;
|
||||
case "onClosed":
|
||||
_isOpened = false;
|
||||
dispose();
|
||||
onClosed();
|
||||
break;
|
||||
case "onItemActionPerform":
|
||||
String url = call.arguments["url"];
|
||||
String title = call.arguments["title"];
|
||||
int id = call.arguments["id"].toInt();
|
||||
if (this._actionButton?.id == id) {
|
||||
if (this._actionButton?.action != null) {
|
||||
this._actionButton?.action!(url, title);
|
||||
}
|
||||
if (this._actionButton?.onClick != null) {
|
||||
this._actionButton?.onClick!(WebUri(url), title);
|
||||
}
|
||||
} else if (this._menuItems[id] != null) {
|
||||
if (this._menuItems[id]?.action != null) {
|
||||
this._menuItems[id]?.action!(url, title);
|
||||
}
|
||||
if (this._menuItems[id]?.onClick != null) {
|
||||
this._menuItems[id]?.onClick!(WebUri(url), title);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "onSecondaryItemActionPerform":
|
||||
final clickableIDs = this._secondaryToolbar?.clickableIDs;
|
||||
if (clickableIDs != null) {
|
||||
WebUri? url = call.arguments["url"] != null
|
||||
? WebUri(call.arguments["url"])
|
||||
: null;
|
||||
String name = call.arguments["name"];
|
||||
for (final clickable in clickableIDs) {
|
||||
var clickableFullname = clickable.id.name;
|
||||
if (clickable.id.defType != null &&
|
||||
!clickableFullname.contains("/")) {
|
||||
clickableFullname = "${clickable.id.defType}/$clickableFullname";
|
||||
}
|
||||
if (clickable.id.defPackage != null &&
|
||||
!clickableFullname.contains(":")) {
|
||||
clickableFullname =
|
||||
"${clickable.id.defPackage}:$clickableFullname";
|
||||
}
|
||||
if (clickableFullname == name) {
|
||||
if (clickable.onClick != null) {
|
||||
clickable.onClick!(url);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "onMessageChannelReady":
|
||||
onMessageChannelReady();
|
||||
break;
|
||||
case "onPostMessage":
|
||||
final String message = call.arguments["message"];
|
||||
onPostMessage(message);
|
||||
break;
|
||||
case "onVerticalScrollEvent":
|
||||
final bool isDirectionUp = call.arguments["isDirectionUp"];
|
||||
onVerticalScrollEvent(isDirectionUp);
|
||||
break;
|
||||
case "onGreatestScrollPercentageIncreased":
|
||||
final int scrollPercentage = call.arguments["scrollPercentage"];
|
||||
onGreatestScrollPercentageIncreased(scrollPercentage);
|
||||
break;
|
||||
case "onSessionEnded":
|
||||
final bool didUserInteract = call.arguments["didUserInteract"];
|
||||
onSessionEnded(didUserInteract);
|
||||
break;
|
||||
default:
|
||||
throw UnimplementedError("Unimplemented ${call.method} method");
|
||||
}
|
||||
}
|
||||
static final Object _token = Object();
|
||||
|
||||
/// The parameters used to initialize the [PlatformChromeSafariBrowser].
|
||||
final PlatformChromeSafariBrowserCreationParams params;
|
||||
|
||||
///Opens the [PlatformChromeSafariBrowser] instance with an [url].
|
||||
///
|
||||
@ -197,50 +100,16 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
Future<void> open(
|
||||
{WebUri? url,
|
||||
Future<void> open({WebUri? url,
|
||||
Map<String, String>? headers,
|
||||
List<WebUri>? otherLikelyURLs,
|
||||
WebUri? referrer,
|
||||
@Deprecated('Use settings instead')
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
ChromeSafariBrowserClassOptions? options,
|
||||
ChromeSafariBrowserSettings? settings}) async {
|
||||
assert(!_isOpened, 'The browser is already opened.');
|
||||
_isOpened = true;
|
||||
|
||||
if (Util.isIOS) {
|
||||
assert(url != null, 'The specified URL must not be null on iOS.');
|
||||
assert(['http', 'https'].contains(url!.scheme),
|
||||
'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported on iOS.');
|
||||
}
|
||||
if (url != null) {
|
||||
assert(url.toString().isNotEmpty, 'The specified URL must not be empty.');
|
||||
}
|
||||
|
||||
_init();
|
||||
|
||||
List<Map<String, dynamic>> menuItemList = [];
|
||||
_menuItems.forEach((key, value) {
|
||||
menuItemList.add(value.toMap());
|
||||
});
|
||||
|
||||
var initialSettings = settings?.toMap() ??
|
||||
options?.toMap() ??
|
||||
ChromeSafariBrowserSettings().toMap();
|
||||
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('id', () => id);
|
||||
args.putIfAbsent('url', () => url?.toString());
|
||||
args.putIfAbsent('headers', () => headers);
|
||||
args.putIfAbsent('otherLikelyURLs',
|
||||
() => otherLikelyURLs?.map((e) => e.toString()).toList());
|
||||
args.putIfAbsent('referrer', () => referrer?.toString());
|
||||
args.putIfAbsent('settings', () => initialSettings);
|
||||
args.putIfAbsent('actionButton', () => _actionButton?.toMap());
|
||||
args.putIfAbsent('secondaryToolbar', () => _secondaryToolbar?.toMap());
|
||||
args.putIfAbsent('menuItemList', () => menuItemList);
|
||||
await _sharedChannel.invokeMethod('open', args);
|
||||
ChromeSafariBrowserSettings? settings}) {
|
||||
throw UnimplementedError(
|
||||
'open is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Tells the browser to launch with [url].
|
||||
@ -262,14 +131,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
Map<String, String>? headers,
|
||||
List<WebUri>? otherLikelyURLs,
|
||||
WebUri? referrer,
|
||||
}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('url', () => url.toString());
|
||||
args.putIfAbsent('headers', () => headers);
|
||||
args.putIfAbsent('otherLikelyURLs',
|
||||
() => otherLikelyURLs?.map((e) => e.toString()).toList());
|
||||
args.putIfAbsent('referrer', () => referrer?.toString());
|
||||
await channel?.invokeMethod("launchUrl", args);
|
||||
}) {
|
||||
throw UnimplementedError(
|
||||
'launchUrl is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Tells the browser of a likely future navigation to a URL.
|
||||
@ -285,12 +149,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.mayLaunchUrl](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#mayLaunchUrl(android.net.Uri,android.os.Bundle,java.util.List%3Candroid.os.Bundle%3E)))
|
||||
Future<bool> mayLaunchUrl(
|
||||
{WebUri? url, List<WebUri>? otherLikelyURLs}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('url', () => url?.toString());
|
||||
args.putIfAbsent('otherLikelyURLs',
|
||||
() => otherLikelyURLs?.map((e) => e.toString()).toList());
|
||||
return await channel?.invokeMethod<bool>("mayLaunchUrl", args) ?? false;
|
||||
{WebUri? url, List<WebUri>? otherLikelyURLs}) {
|
||||
throw UnimplementedError(
|
||||
'mayLaunchUrl is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Requests to validate a relationship between the application and an origin.
|
||||
@ -309,14 +170,10 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.validateRelationship](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#validateRelationship(int,android.net.Uri,android.os.Bundle)))
|
||||
Future<bool> validateRelationship(
|
||||
{required CustomTabsRelationType relation,
|
||||
required WebUri origin}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('relation', () => relation.toNativeValue());
|
||||
args.putIfAbsent('origin', () => origin.toString());
|
||||
return await channel?.invokeMethod<bool>("validateRelationship", args) ??
|
||||
false;
|
||||
Future<bool> validateRelationship({required CustomTabsRelationType relation,
|
||||
required WebUri origin}) {
|
||||
throw UnimplementedError(
|
||||
'validateRelationship is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Closes the [PlatformChromeSafariBrowser] instance.
|
||||
@ -324,9 +181,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
Future<void> close() async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
await channel?.invokeMethod("close", args);
|
||||
Future<void> close() {
|
||||
throw UnimplementedError(
|
||||
'close is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Set a custom action button.
|
||||
@ -336,7 +193,8 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsIntent.Builder.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setActionButton(android.graphics.Bitmap,%20java.lang.String,%20android.app.PendingIntent,%20boolean)))
|
||||
void setActionButton(ChromeSafariBrowserActionButton actionButton) {
|
||||
this._actionButton = actionButton;
|
||||
throw UnimplementedError(
|
||||
'setActionButton is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Updates the [ChromeSafariBrowserActionButton.icon] and [ChromeSafariBrowserActionButton.description].
|
||||
@ -346,13 +204,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setActionButton(android.graphics.Bitmap,java.lang.String)))
|
||||
Future<void> updateActionButton(
|
||||
{required Uint8List icon, required String description}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('icon', () => icon);
|
||||
args.putIfAbsent('description', () => description);
|
||||
await channel?.invokeMethod("updateActionButton", args);
|
||||
_actionButton?.icon = icon;
|
||||
_actionButton?.description = description;
|
||||
{required Uint8List icon, required String description}) {
|
||||
throw UnimplementedError(
|
||||
'updateActionButton is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Sets the remote views displayed in the secondary toolbar in a custom tab.
|
||||
@ -363,7 +217,8 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///- Android ([Official API - CustomTabsIntent.Builder.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent)))
|
||||
void setSecondaryToolbar(
|
||||
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) {
|
||||
this._secondaryToolbar = secondaryToolbar;
|
||||
throw UnimplementedError(
|
||||
'setSecondaryToolbar is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Sets or updates (if already present) the Remote Views of the secondary toolbar in an existing custom tab session.
|
||||
@ -373,11 +228,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent)))
|
||||
Future<void> updateSecondaryToolbar(
|
||||
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('secondaryToolbar', () => secondaryToolbar.toMap());
|
||||
await channel?.invokeMethod("updateSecondaryToolbar", args);
|
||||
this._secondaryToolbar = secondaryToolbar;
|
||||
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) {
|
||||
throw UnimplementedError(
|
||||
'updateSecondaryToolbar is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Adds a [ChromeSafariBrowserMenuItem] to the menu.
|
||||
@ -388,7 +241,8 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///- Android
|
||||
///- iOS
|
||||
void addMenuItem(ChromeSafariBrowserMenuItem menuItem) {
|
||||
this._menuItems[menuItem.id] = menuItem;
|
||||
throw UnimplementedError(
|
||||
'addMenuItem is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Adds a list of [ChromeSafariBrowserMenuItem] to the menu.
|
||||
@ -399,9 +253,8 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///- Android
|
||||
///- iOS
|
||||
void addMenuItems(List<ChromeSafariBrowserMenuItem> menuItems) {
|
||||
menuItems.forEach((menuItem) {
|
||||
this._menuItems[menuItem.id] = menuItem;
|
||||
});
|
||||
throw UnimplementedError(
|
||||
'addMenuItems is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Sends a request to create a two way postMessage channel between the client
|
||||
@ -422,13 +275,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.requestPostMessageChannel](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#requestPostMessageChannel(android.net.Uri,android.net.Uri,android.os.Bundle)))
|
||||
Future<bool> requestPostMessageChannel(
|
||||
{required WebUri sourceOrigin, WebUri? targetOrigin}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent("sourceOrigin", () => sourceOrigin.toString());
|
||||
args.putIfAbsent("targetOrigin", () => targetOrigin.toString());
|
||||
return await channel?.invokeMethod<bool>(
|
||||
"requestPostMessageChannel", args) ??
|
||||
false;
|
||||
{required WebUri sourceOrigin, WebUri? targetOrigin}) {
|
||||
throw UnimplementedError(
|
||||
'requestPostMessageChannel is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Sends a postMessage request using the origin communicated via [requestPostMessageChannel].
|
||||
@ -441,12 +290,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.postMessage](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#postMessage(java.lang.String,android.os.Bundle)))
|
||||
Future<CustomTabsPostMessageResultType> postMessage(String message) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent("message", () => message);
|
||||
return CustomTabsPostMessageResultType.fromNativeValue(
|
||||
await channel?.invokeMethod<int>("postMessage", args)) ??
|
||||
CustomTabsPostMessageResultType.FAILURE_MESSAGING_ERROR;
|
||||
Future<CustomTabsPostMessageResultType> postMessage(String message) {
|
||||
throw UnimplementedError(
|
||||
'postMessage is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Returns whether the Engagement Signals API is available.
|
||||
@ -458,11 +304,19 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsSession.isEngagementSignalsApiAvailable](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#isEngagementSignalsApiAvailable(android.os.Bundle)))
|
||||
Future<bool> isEngagementSignalsApiAvailable() async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
return await channel?.invokeMethod<bool>(
|
||||
"isEngagementSignalsApiAvailable", args) ??
|
||||
false;
|
||||
Future<bool> isEngagementSignalsApiAvailable() {
|
||||
throw UnimplementedError(
|
||||
'isEngagementSignalsApiAvailable is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Returns `true` if the [PlatformChromeSafariBrowser] instance is opened, otherwise `false`.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
bool isOpened() {
|
||||
throw UnimplementedError(
|
||||
'isOpened is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///On Android, returns `true` if Chrome Custom Tabs is available.
|
||||
@ -472,20 +326,18 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
static Future<bool> isAvailable() async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
return await _sharedChannel.invokeMethod<bool>("isAvailable", args) ??
|
||||
false;
|
||||
Future<bool> isAvailable() {
|
||||
throw UnimplementedError(
|
||||
'isAvailable is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///The maximum number of allowed secondary toolbar items.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
static Future<int> getMaxToolbarItems() async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
return await _sharedChannel.invokeMethod<int>("getMaxToolbarItems", args) ??
|
||||
0;
|
||||
Future<int> getMaxToolbarItems() {
|
||||
throw UnimplementedError(
|
||||
'getMaxToolbarItems is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Returns the preferred package to use for Custom Tabs.
|
||||
@ -504,12 +356,10 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android ([Official API - CustomTabsClient.getPackageName](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#getPackageName(android.content.Context,java.util.List%3Cjava.lang.String%3E,boolean))))
|
||||
static Future<String?> getPackageName(
|
||||
{List<String>? packages, bool ignoreDefault = false}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent("packages", () => packages);
|
||||
args.putIfAbsent("ignoreDefault", () => ignoreDefault);
|
||||
return await _sharedChannel.invokeMethod<String?>("getPackageName", args);
|
||||
Future<String?> getPackageName(
|
||||
{List<String>? packages, bool ignoreDefault = false}) {
|
||||
throw UnimplementedError(
|
||||
'getPackageName is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Clear associated website data accrued from browsing activity within your app.
|
||||
@ -519,9 +369,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- iOS ([Official API - SFSafariViewController.DataStore.clearWebsiteData](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/datastore/3981117-clearwebsitedata))
|
||||
static Future<void> clearWebsiteData() async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
await _sharedChannel.invokeMethod("clearWebsiteData", args);
|
||||
Future<void> clearWebsiteData() {
|
||||
throw UnimplementedError(
|
||||
'clearWebsiteData is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Prewarms a connection to each URL. SFSafariViewController will automatically use a
|
||||
@ -544,13 +394,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections))
|
||||
static Future<PrewarmingToken?> prewarmConnections(List<WebUri> URLs) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('URLs', () => URLs.map((e) => e.toString()).toList());
|
||||
Map<String, dynamic>? result =
|
||||
(await _sharedChannel.invokeMethod("prewarmConnections", args))
|
||||
?.cast<String, dynamic>();
|
||||
return PrewarmingToken.fromMap(result);
|
||||
Future<PrewarmingToken?> prewarmConnections(List<WebUri> URLs) {
|
||||
throw UnimplementedError(
|
||||
'prewarmConnections is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Ends all prewarmed connections associated with the token, except for connections that are also kept alive by other tokens.
|
||||
@ -559,13 +405,21 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections))
|
||||
static Future<void> invalidatePrewarmingToken(
|
||||
PrewarmingToken prewarmingToken) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('prewarmingToken', () => prewarmingToken.toMap());
|
||||
await _sharedChannel.invokeMethod("invalidatePrewarmingToken", args);
|
||||
Future<void> invalidatePrewarmingToken(
|
||||
PrewarmingToken prewarmingToken) {
|
||||
throw UnimplementedError(
|
||||
'invalidatePrewarmingToken is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Disposes the channel.
|
||||
@override
|
||||
void dispose() {
|
||||
throw UnimplementedError(
|
||||
'dispose is not implemented on the current platform');
|
||||
}
|
||||
}
|
||||
|
||||
abstract class PlatformChromeSafariBrowserEvents {
|
||||
///Event fired when the when connecting from Android Custom Tabs Service.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
@ -678,20 +532,4 @@ class PlatformChromeSafariBrowser extends ChannelController {
|
||||
///- Android
|
||||
///- iOS
|
||||
void onClosed() {}
|
||||
|
||||
///Returns `true` if the [PlatformChromeSafariBrowser] instance is opened, otherwise `false`.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android
|
||||
///- iOS
|
||||
bool isOpened() {
|
||||
return _isOpened;
|
||||
}
|
||||
|
||||
///Disposes the channel.
|
||||
@override
|
||||
@mustCallSuper
|
||||
void dispose() {
|
||||
disposeChannel();
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,10 @@ abstract class PlatformInAppBrowser extends PlatformInterface implements Disposa
|
||||
///WebView Controller that can be used to access the [PlatformInAppWebViewController] API.
|
||||
///When [onExit] is fired, this will be `null` and cannot be used anymore.
|
||||
///@{endtemplate}
|
||||
PlatformInAppWebViewController? get webViewController;
|
||||
PlatformInAppWebViewController? get webViewController {
|
||||
throw UnimplementedError(
|
||||
'webViewController is not implemented on the current platform');
|
||||
}
|
||||
|
||||
/// Creates a new [PlatformInAppBrowser]
|
||||
factory PlatformInAppBrowser(PlatformInAppBrowserCreationParams params) {
|
||||
|
@ -48,16 +48,6 @@ List<ContentBlocker> _deserializeContentBlockers(
|
||||
return contentBlockers;
|
||||
}
|
||||
|
||||
Map<String, dynamic>? _serializeWebViewAssetLoader(
|
||||
PlatformWebViewAssetLoader? webViewAssetLoader) {
|
||||
return webViewAssetLoader?.toMap();
|
||||
}
|
||||
|
||||
PlatformWebViewAssetLoader? _deserializeWebViewAssetLoader(
|
||||
Map<String, dynamic>? map) {
|
||||
return PlatformWebViewAssetLoader.static().fromMap(map);
|
||||
}
|
||||
|
||||
///This class represents all the WebView settings available.
|
||||
@ExchangeableObject(copyMethod: true)
|
||||
class InAppWebViewSettings_ {
|
||||
@ -381,10 +371,7 @@ because there isn't any way to make the website data store non-persistent for th
|
||||
///Use a [WebViewAssetLoader] instance to load local files including application's static assets and resources using http(s):// URLs.
|
||||
///Loading local files using web-like URLs instead of `file://` is desirable as it is compatible with the Same-Origin policy.
|
||||
@SupportedPlatforms(platforms: [AndroidPlatform()])
|
||||
@ExchangeableObjectProperty(
|
||||
serializer: _serializeWebViewAssetLoader,
|
||||
deserializer: _deserializeWebViewAssetLoader)
|
||||
PlatformWebViewAssetLoader? webViewAssetLoader;
|
||||
WebViewAssetLoader_? webViewAssetLoader;
|
||||
|
||||
///Sets the text zoom of the page in percent. The default value is `100`.
|
||||
@SupportedPlatforms(platforms: [
|
||||
|
@ -1170,7 +1170,7 @@ class InAppWebViewSettings {
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android native WebView
|
||||
PlatformWebViewAssetLoader? webViewAssetLoader;
|
||||
WebViewAssetLoader? webViewAssetLoader;
|
||||
InAppWebViewSettings(
|
||||
{this.useShouldOverrideUrlLoading,
|
||||
this.useOnLoadResource,
|
||||
@ -1404,8 +1404,8 @@ class InAppWebViewSettings {
|
||||
? UtilColor.fromStringRepresentation(
|
||||
map['verticalScrollbarTrackColor'])
|
||||
: null,
|
||||
webViewAssetLoader:
|
||||
_deserializeWebViewAssetLoader(map['webViewAssetLoader']),
|
||||
webViewAssetLoader: WebViewAssetLoader.fromMap(
|
||||
map['webViewAssetLoader']?.cast<String, dynamic>()),
|
||||
);
|
||||
instance.accessibilityIgnoresInvertColors =
|
||||
map['accessibilityIgnoresInvertColors'];
|
||||
@ -1687,7 +1687,7 @@ class InAppWebViewSettings {
|
||||
"verticalScrollbarPosition": verticalScrollbarPosition?.toNativeValue(),
|
||||
"verticalScrollbarThumbColor": verticalScrollbarThumbColor?.toHex(),
|
||||
"verticalScrollbarTrackColor": verticalScrollbarTrackColor?.toHex(),
|
||||
"webViewAssetLoader": _serializeWebViewAssetLoader(webViewAssetLoader),
|
||||
"webViewAssetLoader": webViewAssetLoader?.toMap(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ class PlatformHeadlessInAppWebViewCreationParams
|
||||
/// Used by the platform implementation to create a new [PlatformHeadlessInAppWebView].
|
||||
const PlatformHeadlessInAppWebViewCreationParams(
|
||||
{this.initialSize = const Size(-1, -1),
|
||||
super.controllerFromPlatform,
|
||||
super.windowId,
|
||||
super.onWebViewCreated,
|
||||
super.onLoadStart,
|
||||
@ -154,7 +155,8 @@ class PlatformHeadlessInAppWebViewCreationParams
|
||||
///- Web
|
||||
///- MacOS
|
||||
///{@endtemplate}
|
||||
abstract class PlatformHeadlessInAppWebView extends PlatformInterface implements Disposable {
|
||||
abstract class PlatformHeadlessInAppWebView extends PlatformInterface
|
||||
implements Disposable {
|
||||
/// Creates a new [PlatformHeadlessInAppWebView]
|
||||
factory PlatformHeadlessInAppWebView(
|
||||
PlatformHeadlessInAppWebViewCreationParams params) {
|
||||
@ -166,7 +168,8 @@ abstract class PlatformHeadlessInAppWebView extends PlatformInterface implements
|
||||
'`InAppWebViewPlatform.instance` can be set with your own test implementation.',
|
||||
);
|
||||
final PlatformHeadlessInAppWebView webViewControllerDelegate =
|
||||
InAppWebViewPlatform.instance!.createPlatformHeadlessInAppWebView(params);
|
||||
InAppWebViewPlatform.instance!
|
||||
.createPlatformHeadlessInAppWebView(params);
|
||||
PlatformInterface.verify(webViewControllerDelegate, _token);
|
||||
return webViewControllerDelegate;
|
||||
}
|
||||
@ -176,7 +179,8 @@ abstract class PlatformHeadlessInAppWebView extends PlatformInterface implements
|
||||
/// Should only be used by platform implementations because they can't extend
|
||||
/// a class that only contains a factory constructor.
|
||||
@protected
|
||||
PlatformHeadlessInAppWebView.implementation(this.params) : super(token: _token);
|
||||
PlatformHeadlessInAppWebView.implementation(this.params)
|
||||
: super(token: _token);
|
||||
|
||||
static final Object _token = Object();
|
||||
|
||||
@ -184,12 +188,13 @@ abstract class PlatformHeadlessInAppWebView extends PlatformInterface implements
|
||||
final PlatformHeadlessInAppWebViewCreationParams params;
|
||||
|
||||
///WebView Controller that can be used to access the [InAppWebViewController] API.
|
||||
PlatformInAppWebViewController? get webViewController => throw UnimplementedError(
|
||||
PlatformInAppWebViewController? get webViewController =>
|
||||
throw UnimplementedError(
|
||||
'webViewController is not implemented on the current platform');
|
||||
|
||||
///View ID.
|
||||
String get id => throw UnimplementedError(
|
||||
'id is not implemented on the current platform');
|
||||
String get id =>
|
||||
throw UnimplementedError('id is not implemented on the current platform');
|
||||
|
||||
///Runs the headless WebView.
|
||||
///
|
||||
@ -201,8 +206,7 @@ abstract class PlatformHeadlessInAppWebView extends PlatformInterface implements
|
||||
///- Web
|
||||
///- MacOS
|
||||
Future<void> run() {
|
||||
throw UnimplementedError(
|
||||
'run is not implemented on the current platform');
|
||||
throw UnimplementedError('run is not implemented on the current platform');
|
||||
}
|
||||
|
||||
///Indicates if the headless WebView is running or not.
|
||||
@ -262,4 +266,3 @@ abstract class PlatformHeadlessInAppWebView extends PlatformInterface implements
|
||||
'dispose is not implemented on the current platform');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import '../types/disposable.dart';
|
||||
import 'in_app_webview_keep_alive.dart';
|
||||
import 'platform_webview.dart';
|
||||
import 'platform_headless_in_app_webview.dart';
|
||||
import 'platform_inappwebview_controller.dart';
|
||||
|
||||
/// Object specifying creation parameters for creating a [PlatformInAppWebViewWidget].
|
||||
///
|
||||
@ -23,6 +24,7 @@ class PlatformInAppWebViewWidgetCreationParams
|
||||
this.headlessWebView,
|
||||
this.keepAlive,
|
||||
this.preventGestureDelay,
|
||||
super.controllerFromPlatform,
|
||||
super.windowId,
|
||||
super.onWebViewCreated,
|
||||
super.onLoadStart,
|
||||
@ -184,7 +186,6 @@ class PlatformInAppWebViewWidgetCreationParams
|
||||
/// Interface for a platform implementation of a web view widget.
|
||||
abstract class PlatformInAppWebViewWidget extends PlatformInterface
|
||||
implements Disposable {
|
||||
|
||||
/// Creates a new [PlatformInAppWebViewWidget]
|
||||
factory PlatformInAppWebViewWidget(
|
||||
PlatformInAppWebViewWidgetCreationParams params) {
|
||||
@ -219,6 +220,8 @@ abstract class PlatformInAppWebViewWidget extends PlatformInterface
|
||||
/// Returns a Widget tree that embeds the created web view.
|
||||
Widget build(BuildContext context);
|
||||
|
||||
T controllerFromPlatform<T>(PlatformInAppWebViewController controller);
|
||||
|
||||
@override
|
||||
void dispose();
|
||||
}
|
||||
|
@ -16,7 +16,9 @@ import '../print_job/main.dart';
|
||||
///{@template flutter_inappwebview.WebView}
|
||||
///Class that represents a WebView. Used by [InAppWebView], [HeadlessInAppWebView] and the WebView of [PlatformInAppBrowser].
|
||||
///{@endtemplate}
|
||||
class PlatformWebViewCreationParams {
|
||||
class PlatformWebViewCreationParams<T> {
|
||||
final T Function(PlatformInAppWebViewController controller)? controllerFromPlatform;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.windowId}
|
||||
///The window id of a [CreateWindowAction.windowId].
|
||||
///
|
||||
@ -36,7 +38,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS
|
||||
///- Web
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller)? onWebViewCreated;
|
||||
final void Function(T controller)? onWebViewCreated;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onLoadStart}
|
||||
///Event fired when the `WebView` starts to load an [url].
|
||||
@ -52,7 +54,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview))
|
||||
///- Web
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller, WebUri? url)?
|
||||
final void Function(T controller, WebUri? url)?
|
||||
onLoadStart;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onLoadStop}
|
||||
@ -67,12 +69,12 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview))
|
||||
///- Web ([Official API - Window.onload](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller, WebUri? url)?
|
||||
final void Function(T controller, WebUri? url)?
|
||||
onLoadStop;
|
||||
|
||||
///Use [onReceivedError] instead.
|
||||
@Deprecated("Use onReceivedError instead")
|
||||
final void Function(PlatformInAppWebViewController controller, Uri? url, int code,
|
||||
final void Function(T controller, Uri? url, int code,
|
||||
String message)? onLoadError;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onReceivedError}
|
||||
@ -83,12 +85,12 @@ class PlatformWebViewCreationParams {
|
||||
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview))
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller,
|
||||
final void Function(T controller,
|
||||
WebResourceRequest request, WebResourceError error)? onReceivedError;
|
||||
|
||||
///Use [onReceivedHttpError] instead.
|
||||
@Deprecated("Use onReceivedHttpError instead")
|
||||
final void Function(PlatformInAppWebViewController controller, Uri? url,
|
||||
final void Function(T controller, Uri? url,
|
||||
int statusCode, String description)? onLoadHttpError;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onReceivedHttpError}
|
||||
@ -106,7 +108,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
|
||||
///{@endtemplate}
|
||||
final void Function(
|
||||
PlatformInAppWebViewController controller,
|
||||
T controller,
|
||||
WebResourceRequest request,
|
||||
WebResourceResponse errorResponse)? onReceivedHttpError;
|
||||
|
||||
@ -118,7 +120,7 @@ class PlatformWebViewCreationParams {
|
||||
///- iOS
|
||||
///- MacOS
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller, int progress)?
|
||||
final void Function(T controller, int progress)?
|
||||
onProgressChanged;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onConsoleMessage}
|
||||
@ -133,7 +135,7 @@ class PlatformWebViewCreationParams {
|
||||
///- Web
|
||||
///{@endtemplate}
|
||||
final void Function(
|
||||
PlatformInAppWebViewController controller, ConsoleMessage consoleMessage)?
|
||||
T controller, ConsoleMessage consoleMessage)?
|
||||
onConsoleMessage;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.shouldOverrideUrlLoading}
|
||||
@ -156,7 +158,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview))
|
||||
///{@endtemplate}
|
||||
final Future<NavigationActionPolicy?> Function(
|
||||
PlatformInAppWebViewController controller, NavigationAction navigationAction)?
|
||||
T controller, NavigationAction navigationAction)?
|
||||
shouldOverrideUrlLoading;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onLoadResource}
|
||||
@ -170,7 +172,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS
|
||||
///{@endtemplate}
|
||||
final void Function(
|
||||
PlatformInAppWebViewController controller, LoadedResource resource)?
|
||||
T controller, LoadedResource resource)?
|
||||
onLoadResource;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onScrollChanged}
|
||||
@ -190,12 +192,12 @@ class PlatformWebViewCreationParams {
|
||||
///- Web ([Official API - Window.onscroll](https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onscroll))
|
||||
///- MacOS
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller, int x, int y)?
|
||||
final void Function(T controller, int x, int y)?
|
||||
onScrollChanged;
|
||||
|
||||
///Use [onDownloadStartRequest] instead
|
||||
@Deprecated('Use onDownloadStartRequest instead')
|
||||
final void Function(PlatformInAppWebViewController controller, Uri url)?
|
||||
final void Function(T controller, Uri url)?
|
||||
onDownloadStart;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onDownloadStartRequest}
|
||||
@ -211,13 +213,13 @@ class PlatformWebViewCreationParams {
|
||||
///- iOS
|
||||
///- MacOS
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller,
|
||||
final void Function(T controller,
|
||||
DownloadStartRequest downloadStartRequest)? onDownloadStartRequest;
|
||||
|
||||
///Use [onLoadResourceWithCustomScheme] instead.
|
||||
@Deprecated('Use onLoadResourceWithCustomScheme instead')
|
||||
final Future<CustomSchemeResponse?> Function(
|
||||
PlatformInAppWebViewController controller, Uri url)? onLoadResourceCustomScheme;
|
||||
T controller, Uri url)? onLoadResourceCustomScheme;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onLoadResourceWithCustomScheme}
|
||||
///Event fired when the `WebView` finds the `custom-scheme` while loading a resource.
|
||||
@ -229,7 +231,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler))
|
||||
///{@endtemplate}
|
||||
final Future<CustomSchemeResponse?> Function(
|
||||
PlatformInAppWebViewController controller, WebResourceRequest request)?
|
||||
T controller, WebResourceRequest request)?
|
||||
onLoadResourceWithCustomScheme;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onCreateWindow}
|
||||
@ -271,7 +273,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview))
|
||||
///- Web
|
||||
///{@endtemplate}
|
||||
final Future<bool?> Function(PlatformInAppWebViewController controller,
|
||||
final Future<bool?> Function(T controller,
|
||||
CreateWindowAction createWindowAction)? onCreateWindow;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onCloseWindow}
|
||||
@ -283,7 +285,7 @@ class PlatformWebViewCreationParams {
|
||||
///- iOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose))
|
||||
///- MacOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller)? onCloseWindow;
|
||||
final void Function(T controller)? onCloseWindow;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onWindowFocus}
|
||||
///Event fired when the JavaScript `window` object of the WebView has received focus.
|
||||
@ -297,7 +299,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS
|
||||
///- Web ([Official API - Window.onfocus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller)? onWindowFocus;
|
||||
final void Function(T controller)? onWindowFocus;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onWindowBlur}
|
||||
///Event fired when the JavaScript `window` object of the WebView has lost focus.
|
||||
@ -311,7 +313,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS
|
||||
///- Web ([Official API - Window.onblur](https://developer.mozilla.org/en-US/docs/Web/API/Window/blur_event))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller)? onWindowBlur;
|
||||
final void Function(T controller)? onWindowBlur;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onJsAlert}
|
||||
///Event fired when javascript calls the `alert()` method to display an alert dialog.
|
||||
@ -325,7 +327,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview))
|
||||
///{@endtemplate}
|
||||
final Future<JsAlertResponse?> Function(
|
||||
PlatformInAppWebViewController controller, JsAlertRequest jsAlertRequest)?
|
||||
T controller, JsAlertRequest jsAlertRequest)?
|
||||
onJsAlert;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onJsConfirm}
|
||||
@ -340,7 +342,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview))
|
||||
///{@endtemplate}
|
||||
final Future<JsConfirmResponse?> Function(
|
||||
PlatformInAppWebViewController controller, JsConfirmRequest jsConfirmRequest)?
|
||||
T controller, JsConfirmRequest jsConfirmRequest)?
|
||||
onJsConfirm;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onJsPrompt}
|
||||
@ -355,7 +357,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview))
|
||||
///{@endtemplate}
|
||||
final Future<JsPromptResponse?> Function(
|
||||
PlatformInAppWebViewController controller, JsPromptRequest jsPromptRequest)?
|
||||
T controller, JsPromptRequest jsPromptRequest)?
|
||||
onJsPrompt;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onReceivedHttpAuthRequest}
|
||||
@ -368,7 +370,7 @@ class PlatformWebViewCreationParams {
|
||||
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
|
||||
///{@endtemplate}
|
||||
final Future<HttpAuthResponse?> Function(PlatformInAppWebViewController controller,
|
||||
final Future<HttpAuthResponse?> Function(T controller,
|
||||
HttpAuthenticationChallenge challenge)? onReceivedHttpAuthRequest;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onReceivedServerTrustAuthRequest}
|
||||
@ -383,7 +385,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
|
||||
///{@endtemplate}
|
||||
final Future<ServerTrustAuthResponse?> Function(
|
||||
PlatformInAppWebViewController controller, ServerTrustChallenge challenge)?
|
||||
T controller, ServerTrustChallenge challenge)?
|
||||
onReceivedServerTrustAuthRequest;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onReceivedClientCertRequest}
|
||||
@ -400,12 +402,12 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
|
||||
///{@endtemplate}
|
||||
final Future<ClientCertResponse?> Function(
|
||||
PlatformInAppWebViewController controller, ClientCertChallenge challenge)?
|
||||
T controller, ClientCertChallenge challenge)?
|
||||
onReceivedClientCertRequest;
|
||||
|
||||
///Use [FindInteractionController.onFindResultReceived] instead.
|
||||
@Deprecated('Use FindInteractionController.onFindResultReceived instead')
|
||||
final void Function(PlatformInAppWebViewController controller, int activeMatchOrdinal,
|
||||
final void Function(T controller, int activeMatchOrdinal,
|
||||
int numberOfMatches, bool isDoneCounting)? onFindResultReceived;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.shouldInterceptAjaxRequest}
|
||||
@ -426,7 +428,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS
|
||||
///{@endtemplate}
|
||||
final Future<AjaxRequest?> Function(
|
||||
PlatformInAppWebViewController controller, AjaxRequest ajaxRequest)?
|
||||
T controller, AjaxRequest ajaxRequest)?
|
||||
shouldInterceptAjaxRequest;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onAjaxReadyStateChange}
|
||||
@ -447,7 +449,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS
|
||||
///{@endtemplate}
|
||||
final Future<AjaxRequestAction?> Function(
|
||||
PlatformInAppWebViewController controller, AjaxRequest ajaxRequest)?
|
||||
T controller, AjaxRequest ajaxRequest)?
|
||||
onAjaxReadyStateChange;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onAjaxProgress}
|
||||
@ -468,7 +470,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS
|
||||
///{@endtemplate}
|
||||
final Future<AjaxRequestAction?> Function(
|
||||
PlatformInAppWebViewController controller, AjaxRequest ajaxRequest)?
|
||||
T controller, AjaxRequest ajaxRequest)?
|
||||
onAjaxProgress;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.shouldInterceptFetchRequest}
|
||||
@ -489,7 +491,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS
|
||||
///{@endtemplate}
|
||||
final Future<FetchRequest?> Function(
|
||||
PlatformInAppWebViewController controller, FetchRequest fetchRequest)?
|
||||
T controller, FetchRequest fetchRequest)?
|
||||
shouldInterceptFetchRequest;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onUpdateVisitedHistory}
|
||||
@ -511,12 +513,12 @@ class PlatformWebViewCreationParams {
|
||||
///- Web
|
||||
///{@endtemplate}
|
||||
final void Function(
|
||||
PlatformInAppWebViewController controller, WebUri? url, bool? isReload)?
|
||||
T controller, WebUri? url, bool? isReload)?
|
||||
onUpdateVisitedHistory;
|
||||
|
||||
///Use [onPrintRequest] instead
|
||||
@Deprecated("Use onPrintRequest instead")
|
||||
final void Function(PlatformInAppWebViewController controller, Uri? url)? onPrint;
|
||||
final void Function(T controller, Uri? url)? onPrint;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onPrintRequest}
|
||||
///Event fired when `window.print()` is called from JavaScript side.
|
||||
@ -536,7 +538,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS
|
||||
///- Web
|
||||
///{@endtemplate}
|
||||
final Future<bool?> Function(PlatformInAppWebViewController controller, WebUri? url,
|
||||
final Future<bool?> Function(T controller, WebUri? url,
|
||||
PlatformPrintJobController? printJobController)? onPrintRequest;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onLongPressHitTestResult}
|
||||
@ -548,7 +550,7 @@ class PlatformWebViewCreationParams {
|
||||
///- Android native WebView ([Official API - View.setOnLongClickListener](https://developer.android.com/reference/android/view/View#setOnLongClickListener(android.view.View.OnLongClickListener)))
|
||||
///- iOS ([Official API - UILongPressGestureRecognizer](https://developer.apple.com/documentation/uikit/uilongpressgesturerecognizer))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller,
|
||||
final void Function(T controller,
|
||||
InAppWebViewHitTestResult hitTestResult)? onLongPressHitTestResult;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onEnterFullscreen}
|
||||
@ -560,7 +562,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - NSWindow.didEnterFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419651-didenterfullscreennotification))
|
||||
///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller)? onEnterFullscreen;
|
||||
final void Function(T controller)? onEnterFullscreen;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onExitFullscreen}
|
||||
///Event fired when the current page has exited full screen mode.
|
||||
@ -575,7 +577,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - NSWindow.didExitFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419177-didexitfullscreennotification))
|
||||
///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller)? onExitFullscreen;
|
||||
final void Function(T controller)? onExitFullscreen;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onPageCommitVisible}
|
||||
///Called when the web view begins to receive web content.
|
||||
@ -590,7 +592,7 @@ class PlatformWebViewCreationParams {
|
||||
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview))
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller, WebUri? url)?
|
||||
final void Function(T controller, WebUri? url)?
|
||||
onPageCommitVisible;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onTitleChanged}
|
||||
@ -606,7 +608,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS
|
||||
///- Web
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller, String? title)?
|
||||
final void Function(T controller, String? title)?
|
||||
onTitleChanged;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onOverScrolled}
|
||||
@ -624,7 +626,7 @@ class PlatformWebViewCreationParams {
|
||||
///- Android native WebView ([Official API - WebView.onOverScrolled](https://developer.android.com/reference/android/webkit/WebView#onOverScrolled(int,%20int,%20boolean,%20boolean)))
|
||||
///- iOS
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller, int x, int y,
|
||||
final void Function(T controller, int x, int y,
|
||||
bool clampedX, bool clampedY)? onOverScrolled;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onZoomScaleChanged}
|
||||
@ -642,13 +644,13 @@ class PlatformWebViewCreationParams {
|
||||
///- Web
|
||||
///{@endtemplate}
|
||||
final void Function(
|
||||
PlatformInAppWebViewController controller, double oldScale, double newScale)?
|
||||
T controller, double oldScale, double newScale)?
|
||||
onZoomScaleChanged;
|
||||
|
||||
///Use [onSafeBrowsingHit] instead.
|
||||
@Deprecated("Use onSafeBrowsingHit instead")
|
||||
final Future<SafeBrowsingResponse?> Function(
|
||||
PlatformInAppWebViewController controller,
|
||||
T controller,
|
||||
Uri url,
|
||||
SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit;
|
||||
|
||||
@ -666,14 +668,14 @@ class PlatformWebViewCreationParams {
|
||||
///- Android native WebView ([Official API - WebViewClient.onSafeBrowsingHit](https://developer.android.com/reference/android/webkit/WebViewClient#onSafeBrowsingHit(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20int,%20android.webkit.SafeBrowsingResponse)))
|
||||
///{@endtemplate}
|
||||
final Future<SafeBrowsingResponse?> Function(
|
||||
PlatformInAppWebViewController controller,
|
||||
T controller,
|
||||
WebUri url,
|
||||
SafeBrowsingThreat? threatType)? onSafeBrowsingHit;
|
||||
|
||||
///Use [onPermissionRequest] instead.
|
||||
@Deprecated("Use onPermissionRequest instead")
|
||||
final Future<PermissionRequestResponse?> Function(
|
||||
PlatformInAppWebViewController controller,
|
||||
T controller,
|
||||
String origin,
|
||||
List<String> resources)? androidOnPermissionRequest;
|
||||
|
||||
@ -694,13 +696,13 @@ class PlatformWebViewCreationParams {
|
||||
///- iOS
|
||||
///- MacOS
|
||||
///{@endtemplate}
|
||||
final Future<PermissionResponse?> Function(PlatformInAppWebViewController controller,
|
||||
final Future<PermissionResponse?> Function(T controller,
|
||||
PermissionRequest permissionRequest)? onPermissionRequest;
|
||||
|
||||
///Use [onGeolocationPermissionsShowPrompt] instead.
|
||||
@Deprecated("Use onGeolocationPermissionsShowPrompt instead")
|
||||
final Future<GeolocationPermissionShowPromptResponse?> Function(
|
||||
PlatformInAppWebViewController controller, String origin)?
|
||||
T controller, String origin)?
|
||||
androidOnGeolocationPermissionsShowPrompt;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onGeolocationPermissionsShowPrompt}
|
||||
@ -714,12 +716,12 @@ class PlatformWebViewCreationParams {
|
||||
///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsShowPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback)))
|
||||
///{@endtemplate}
|
||||
final Future<GeolocationPermissionShowPromptResponse?> Function(
|
||||
PlatformInAppWebViewController controller, String origin)?
|
||||
T controller, String origin)?
|
||||
onGeolocationPermissionsShowPrompt;
|
||||
|
||||
///Use [onGeolocationPermissionsHidePrompt] instead.
|
||||
@Deprecated("Use onGeolocationPermissionsHidePrompt instead")
|
||||
final void Function(PlatformInAppWebViewController controller)?
|
||||
final void Function(T controller)?
|
||||
androidOnGeolocationPermissionsHidePrompt;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onGeolocationPermissionsHidePrompt}
|
||||
@ -729,13 +731,13 @@ class PlatformWebViewCreationParams {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsHidePrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsHidePrompt()))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller)?
|
||||
final void Function(T controller)?
|
||||
onGeolocationPermissionsHidePrompt;
|
||||
|
||||
///Use [shouldInterceptRequest] instead.
|
||||
@Deprecated("Use shouldInterceptRequest instead")
|
||||
final Future<WebResourceResponse?> Function(
|
||||
PlatformInAppWebViewController controller, WebResourceRequest request)?
|
||||
T controller, WebResourceRequest request)?
|
||||
androidShouldInterceptRequest;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.shouldInterceptRequest}
|
||||
@ -757,13 +759,13 @@ class PlatformWebViewCreationParams {
|
||||
///- Android native WebView ([Official API - WebViewClient.shouldInterceptRequest](https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest)))
|
||||
///{@endtemplate}
|
||||
final Future<WebResourceResponse?> Function(
|
||||
PlatformInAppWebViewController controller, WebResourceRequest request)?
|
||||
T controller, WebResourceRequest request)?
|
||||
shouldInterceptRequest;
|
||||
|
||||
///Use [onRenderProcessUnresponsive] instead.
|
||||
@Deprecated("Use onRenderProcessUnresponsive instead")
|
||||
final Future<WebViewRenderProcessAction?> Function(
|
||||
PlatformInAppWebViewController controller, Uri? url)?
|
||||
T controller, Uri? url)?
|
||||
androidOnRenderProcessUnresponsive;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onRenderProcessUnresponsive}
|
||||
@ -788,13 +790,13 @@ class PlatformWebViewCreationParams {
|
||||
///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessUnresponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)))
|
||||
///{@endtemplate}
|
||||
final Future<WebViewRenderProcessAction?> Function(
|
||||
PlatformInAppWebViewController controller, WebUri? url)?
|
||||
T controller, WebUri? url)?
|
||||
onRenderProcessUnresponsive;
|
||||
|
||||
///Use [onRenderProcessResponsive] instead.
|
||||
@Deprecated("Use onRenderProcessResponsive instead")
|
||||
final Future<WebViewRenderProcessAction?> Function(
|
||||
PlatformInAppWebViewController controller, Uri? url)?
|
||||
T controller, Uri? url)?
|
||||
androidOnRenderProcessResponsive;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onRenderProcessResponsive}
|
||||
@ -812,13 +814,13 @@ class PlatformWebViewCreationParams {
|
||||
///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessResponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)))
|
||||
///{@endtemplate}
|
||||
final Future<WebViewRenderProcessAction?> Function(
|
||||
PlatformInAppWebViewController controller, WebUri? url)?
|
||||
T controller, WebUri? url)?
|
||||
onRenderProcessResponsive;
|
||||
|
||||
///Use [onRenderProcessGone] instead.
|
||||
@Deprecated("Use onRenderProcessGone instead")
|
||||
final void Function(
|
||||
PlatformInAppWebViewController controller, RenderProcessGoneDetail detail)?
|
||||
T controller, RenderProcessGoneDetail detail)?
|
||||
androidOnRenderProcessGone;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onRenderProcessGone}
|
||||
@ -834,13 +836,13 @@ class PlatformWebViewCreationParams {
|
||||
///- Android native WebView ([Official API - WebViewClient.onRenderProcessGone](https://developer.android.com/reference/android/webkit/WebViewClient#onRenderProcessGone(android.webkit.WebView,%20android.webkit.RenderProcessGoneDetail)))
|
||||
///{@endtemplate}
|
||||
final void Function(
|
||||
PlatformInAppWebViewController controller, RenderProcessGoneDetail detail)?
|
||||
T controller, RenderProcessGoneDetail detail)?
|
||||
onRenderProcessGone;
|
||||
|
||||
///Use [onFormResubmission] instead.
|
||||
@Deprecated('Use onFormResubmission instead')
|
||||
final Future<FormResubmissionAction?> Function(
|
||||
PlatformInAppWebViewController controller, Uri? url)? androidOnFormResubmission;
|
||||
T controller, Uri? url)? androidOnFormResubmission;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onFormResubmission}
|
||||
///As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data.
|
||||
@ -849,17 +851,17 @@ class PlatformWebViewCreationParams {
|
||||
///- Android native WebView ([Official API - WebViewClient.onFormResubmission](https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message)))
|
||||
///{@endtemplate}
|
||||
final Future<FormResubmissionAction?> Function(
|
||||
PlatformInAppWebViewController controller, WebUri? url)? onFormResubmission;
|
||||
T controller, WebUri? url)? onFormResubmission;
|
||||
|
||||
///Use [onZoomScaleChanged] instead.
|
||||
@Deprecated('Use onZoomScaleChanged instead')
|
||||
final void Function(
|
||||
PlatformInAppWebViewController controller, double oldScale, double newScale)?
|
||||
T controller, double oldScale, double newScale)?
|
||||
androidOnScaleChanged;
|
||||
|
||||
///Use [onReceivedIcon] instead.
|
||||
@Deprecated('Use onReceivedIcon instead')
|
||||
final void Function(PlatformInAppWebViewController controller, Uint8List icon)?
|
||||
final void Function(T controller, Uint8List icon)?
|
||||
androidOnReceivedIcon;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onReceivedIcon}
|
||||
@ -870,13 +872,13 @@ class PlatformWebViewCreationParams {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android native WebView ([Official API - WebChromeClient.onReceivedIcon](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedIcon(android.webkit.WebView,%20android.graphics.Bitmap)))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller, Uint8List icon)?
|
||||
final void Function(T controller, Uint8List icon)?
|
||||
onReceivedIcon;
|
||||
|
||||
///Use [onReceivedTouchIconUrl] instead.
|
||||
@Deprecated('Use onReceivedTouchIconUrl instead')
|
||||
final void Function(
|
||||
PlatformInAppWebViewController controller, Uri url, bool precomposed)?
|
||||
T controller, Uri url, bool precomposed)?
|
||||
androidOnReceivedTouchIconUrl;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onReceivedTouchIconUrl}
|
||||
@ -890,13 +892,13 @@ class PlatformWebViewCreationParams {
|
||||
///- Android native WebView ([Official API - WebChromeClient.onReceivedTouchIconUrl](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTouchIconUrl(android.webkit.WebView,%20java.lang.String,%20boolean)))
|
||||
///{@endtemplate}
|
||||
final void Function(
|
||||
PlatformInAppWebViewController controller, WebUri url, bool precomposed)?
|
||||
T controller, WebUri url, bool precomposed)?
|
||||
onReceivedTouchIconUrl;
|
||||
|
||||
///Use [onJsBeforeUnload] instead.
|
||||
@Deprecated('Use onJsBeforeUnload instead')
|
||||
final Future<JsBeforeUnloadResponse?> Function(
|
||||
PlatformInAppWebViewController controller,
|
||||
T controller,
|
||||
JsBeforeUnloadRequest jsBeforeUnloadRequest)? androidOnJsBeforeUnload;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onJsBeforeUnload}
|
||||
@ -914,13 +916,13 @@ class PlatformWebViewCreationParams {
|
||||
///- Android native WebView ([Official API - WebChromeClient.onJsBeforeUnload](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsBeforeUnload(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)))
|
||||
///{@endtemplate}
|
||||
final Future<JsBeforeUnloadResponse?> Function(
|
||||
PlatformInAppWebViewController controller,
|
||||
T controller,
|
||||
JsBeforeUnloadRequest jsBeforeUnloadRequest)? onJsBeforeUnload;
|
||||
|
||||
///Use [onReceivedLoginRequest] instead.
|
||||
@Deprecated('Use onReceivedLoginRequest instead')
|
||||
final void Function(
|
||||
PlatformInAppWebViewController controller, LoginRequest loginRequest)?
|
||||
T controller, LoginRequest loginRequest)?
|
||||
androidOnReceivedLoginRequest;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onReceivedLoginRequest}
|
||||
@ -932,7 +934,7 @@ class PlatformWebViewCreationParams {
|
||||
///- Android native WebView ([Official API - WebViewClient.onReceivedLoginRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedLoginRequest(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String)))
|
||||
///{@endtemplate}
|
||||
final void Function(
|
||||
PlatformInAppWebViewController controller, LoginRequest loginRequest)?
|
||||
T controller, LoginRequest loginRequest)?
|
||||
onReceivedLoginRequest;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onPermissionRequestCanceled}
|
||||
@ -947,7 +949,7 @@ class PlatformWebViewCreationParams {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android native WebView ([Official API - WebChromeClient.onPermissionRequestCanceled](https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequestCanceled(android.webkit.PermissionRequest)))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller,
|
||||
final void Function(T controller,
|
||||
PermissionRequest permissionRequest)? onPermissionRequestCanceled;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onRequestFocus}
|
||||
@ -957,11 +959,11 @@ class PlatformWebViewCreationParams {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android native WebView ([Official API - WebChromeClient.onRequestFocus](https://developer.android.com/reference/android/webkit/WebChromeClient#onRequestFocus(android.webkit.WebView)))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller)? onRequestFocus;
|
||||
final void Function(T controller)? onRequestFocus;
|
||||
|
||||
///Use [onWebContentProcessDidTerminate] instead.
|
||||
@Deprecated('Use onWebContentProcessDidTerminate instead')
|
||||
final void Function(PlatformInAppWebViewController controller)?
|
||||
final void Function(T controller)?
|
||||
iosOnWebContentProcessDidTerminate;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onWebContentProcessDidTerminate}
|
||||
@ -971,12 +973,12 @@ class PlatformWebViewCreationParams {
|
||||
///- iOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi))
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller)?
|
||||
final void Function(T controller)?
|
||||
onWebContentProcessDidTerminate;
|
||||
|
||||
///Use [onDidReceiveServerRedirectForProvisionalNavigation] instead.
|
||||
@Deprecated('Use onDidReceiveServerRedirectForProvisionalNavigation instead')
|
||||
final void Function(PlatformInAppWebViewController controller)?
|
||||
final void Function(T controller)?
|
||||
iosOnDidReceiveServerRedirectForProvisionalNavigation;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onDidReceiveServerRedirectForProvisionalNavigation}
|
||||
@ -986,13 +988,13 @@ class PlatformWebViewCreationParams {
|
||||
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview))
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview))
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller)?
|
||||
final void Function(T controller)?
|
||||
onDidReceiveServerRedirectForProvisionalNavigation;
|
||||
|
||||
///Use [onNavigationResponse] instead.
|
||||
@Deprecated('Use onNavigationResponse instead')
|
||||
final Future<IOSNavigationResponseAction?> Function(
|
||||
PlatformInAppWebViewController controller,
|
||||
T controller,
|
||||
IOSWKNavigationResponse navigationResponse)? iosOnNavigationResponse;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onNavigationResponse}
|
||||
@ -1007,13 +1009,13 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
|
||||
///{@endtemplate}
|
||||
final Future<NavigationResponseAction?> Function(
|
||||
PlatformInAppWebViewController controller,
|
||||
T controller,
|
||||
NavigationResponse navigationResponse)? onNavigationResponse;
|
||||
|
||||
///Use [shouldAllowDeprecatedTLS] instead.
|
||||
@Deprecated('Use shouldAllowDeprecatedTLS instead')
|
||||
final Future<IOSShouldAllowDeprecatedTLSAction?> Function(
|
||||
PlatformInAppWebViewController controller,
|
||||
T controller,
|
||||
URLAuthenticationChallenge challenge)? iosShouldAllowDeprecatedTLS;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.shouldAllowDeprecatedTLS}
|
||||
@ -1030,7 +1032,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview))
|
||||
///{@endtemplate}
|
||||
final Future<ShouldAllowDeprecatedTLSAction?> Function(
|
||||
PlatformInAppWebViewController controller,
|
||||
T controller,
|
||||
URLAuthenticationChallenge challenge)? shouldAllowDeprecatedTLS;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.onCameraCaptureStateChanged}
|
||||
@ -1045,7 +1047,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS
|
||||
///{@endtemplate}
|
||||
final Future<void> Function(
|
||||
PlatformInAppWebViewController controller,
|
||||
T controller,
|
||||
MediaCaptureState? oldState,
|
||||
MediaCaptureState? newState,
|
||||
)? onCameraCaptureStateChanged;
|
||||
@ -1062,7 +1064,7 @@ class PlatformWebViewCreationParams {
|
||||
///- MacOS
|
||||
///{@endtemplate}
|
||||
final Future<void> Function(
|
||||
PlatformInAppWebViewController controller,
|
||||
T controller,
|
||||
MediaCaptureState? oldState,
|
||||
MediaCaptureState? newState,
|
||||
)? onMicrophoneCaptureStateChanged;
|
||||
@ -1077,7 +1079,7 @@ class PlatformWebViewCreationParams {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- iOS
|
||||
///{@endtemplate}
|
||||
final void Function(PlatformInAppWebViewController controller, Size oldContentSize,
|
||||
final void Function(T controller, Size oldContentSize,
|
||||
Size newContentSize)? onContentSizeChanged;
|
||||
|
||||
///{@template flutter_inappwebview.WebView.initialUrlRequest}
|
||||
@ -1178,7 +1180,8 @@ class PlatformWebViewCreationParams {
|
||||
|
||||
///{@macro flutter_inappwebview.WebView}
|
||||
const PlatformWebViewCreationParams(
|
||||
{this.windowId,
|
||||
{this.controllerFromPlatform,
|
||||
this.windowId,
|
||||
this.onWebViewCreated,
|
||||
this.onLoadStart,
|
||||
this.onLoadStop,
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
|
||||
import 'chrome_safari_browser/platform_chrome_safari_browser.dart';
|
||||
import 'find_interaction/platform_find_interaction_controller.dart';
|
||||
import 'in_app_browser/platform_in_app_browser.dart';
|
||||
import 'in_app_webview/platform_headless_in_app_webview.dart';
|
||||
@ -348,26 +349,6 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
|
||||
'createPlatformTracingController is not implemented on the current platform.');
|
||||
}
|
||||
|
||||
/// Creates a new [PlatformWebViewAssetLoader].
|
||||
///
|
||||
/// This function should only be called by the app-facing package.
|
||||
/// Look at using [WebViewAssetLoader] in `flutter_inappwebview` instead.
|
||||
PlatformWebViewAssetLoader createPlatformWebViewAssetLoader(
|
||||
PlatformWebViewAssetLoaderCreationParams params,
|
||||
) {
|
||||
throw UnimplementedError(
|
||||
'createPlatformWebViewAssetLoader is not implemented on the current platform.');
|
||||
}
|
||||
|
||||
/// Creates a new empty [PlatformWebViewAssetLoader] to access static methods.
|
||||
///
|
||||
/// This function should only be called by the app-facing package.
|
||||
/// Look at using [WebViewAssetLoader] in `flutter_inappwebview` instead.
|
||||
PlatformWebViewAssetLoader createPlatformWebViewAssetLoaderStatic() {
|
||||
throw UnimplementedError(
|
||||
'createPlatformWebViewAssetLoaderStatic is not implemented on the current platform.');
|
||||
}
|
||||
|
||||
/// Creates a new [PlatformPathHandler].
|
||||
///
|
||||
/// This function should only be called by the app-facing package.
|
||||
@ -440,4 +421,24 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
|
||||
PlatformInAppLocalhostServerCreationParams params) {
|
||||
return DefaultInAppLocalhostServer(params);
|
||||
}
|
||||
|
||||
/// Creates a new [PlatformChromeSafariBrowser].
|
||||
///
|
||||
/// This function should only be called by the app-facing package.
|
||||
/// Look at using [ChromeSafariBrowser] in `flutter_inappwebview` instead.
|
||||
PlatformChromeSafariBrowser createPlatformChromeSafariBrowser(
|
||||
PlatformChromeSafariBrowserCreationParams params,
|
||||
) {
|
||||
throw UnimplementedError(
|
||||
'createPlatformChromeSafariBrowser is not implemented on the current platform.');
|
||||
}
|
||||
|
||||
/// Creates a new empty [PlatformChromeSafariBrowser] to access static methods.
|
||||
///
|
||||
/// This function should only be called by the app-facing package.
|
||||
/// Look at using [ChromeSafariBrowser] in `flutter_inappwebview` instead.
|
||||
PlatformChromeSafariBrowser createPlatformChromeSafariBrowserStatic() {
|
||||
throw UnimplementedError(
|
||||
'createPlatformChromeSafariBrowserStatic is not implemented on the current platform.');
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user