Skip to content

Commit 22e492d

Browse files
platform_interface: Updated static fromMap implementation for some classes, ios and macos: Moved WKUserContentController initialization on preWKWebViewConfiguration to fix possible undefined is not an object (evaluating 'window.webkit.messageHandlers') javascript error
1 parent f67ae1f commit 22e492d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+231
-107
lines changed

dev_packages/generators/lib/src/exchangeable_object_generator.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ class ExchangeableObjectGenerator
335335
.trim();
336336
value = "map['$newFieldName']";
337337
}
338+
final mapValue = value;
338339

339340
final customDeserializer = _coreCheckerObjectProperty
340341
.firstAnnotationOf(fieldElement)
@@ -361,7 +362,14 @@ class ExchangeableObjectGenerator
361362
if (isRequiredParameter || fieldElement.isFinal || annotation.read("fromMapForceAllInline").boolValue) {
362363
requiredFields.add('$fieldName: $value,');
363364
} else {
365+
final isFieldNullable = Util.typeIsNullable(fieldElement.type);
366+
if (!isFieldNullable) {
367+
nonRequiredFields.add("if ($mapValue != null) {");
368+
}
364369
nonRequiredFields.add("instance.$fieldName = $value;");
370+
if (!isFieldNullable) {
371+
nonRequiredFields.add("}");
372+
}
365373
}
366374
}
367375
}

flutter_inappwebview/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
## 6.2.0
2+
3+
- Updated dependencies to the latest versions for all platform implementations:
4+
- `flutter_inappwebview_platform_interface`: `^1.3.0` -> `^1.4.0`
5+
- `flutter_inappwebview_android`: `^1.1.3` -> `^1.2.0`
6+
- `flutter_inappwebview_ios`: `^1.1.2` -> `^1.2.0`
7+
- `flutter_inappwebview_macos`: `^1.1.2` -> `^1.2.0`
8+
- `flutter_inappwebview_web`: `^1.1.2` -> `^1.2.0`
9+
- `flutter_inappwebview_windows`: `^0.6.0` -> `^0.7.0`
10+
11+
#### Platform Interface
12+
- Updated static `fromMap` implementation for some classes
13+
14+
#### iOS Platform
15+
- Moved `WKUserContentController` initialization on `preWKWebViewConfiguration` to fix possible `undefined is not an object (evaluating 'window.webkit.messageHandlers')` javascript error
16+
17+
#### macOS Platform
18+
- Moved `WKUserContentController` initialization on `preWKWebViewConfiguration` to fix possible `undefined is not an object (evaluating 'window.webkit.messageHandlers')` javascript error
19+
120
## 6.1.5
221

322
- Updated dependencies to the latest versions for all platform implementations:
Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +0,0 @@
1-
// This is a basic Flutter widget test.
2-
//
3-
// To perform an interaction with a widget in your test, use the WidgetTester
4-
// utility in the flutter_test package. For example, you can send tap and scroll
5-
// gestures. You can also use WidgetTester to find child widgets in the widget
6-
// tree, read text, and verify that the values of widget properties are correct.
7-
8-
import 'package:flutter/material.dart';
9-
import 'package:flutter_test/flutter_test.dart';
10-
11-
import 'package:example/main.dart';
12-
13-
void main() {
14-
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15-
// Build our app and trigger a frame.
16-
await tester.pumpWidget(const MyApp());
17-
18-
// Verify that our counter starts at 0.
19-
expect(find.text('0'), findsOneWidget);
20-
expect(find.text('1'), findsNothing);
21-
22-
// Tap the '+' icon and trigger a frame.
23-
await tester.tap(find.byIcon(Icons.add));
24-
await tester.pump();
25-
26-
// Verify that our counter has incremented.
27-
expect(find.text('0'), findsNothing);
28-
expect(find.text('1'), findsOneWidget);
29-
});
30-
}

flutter_inappwebview/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_inappwebview
22
description: A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser window.
3-
version: 6.1.5
3+
version: 6.2.0
44
homepage: https://inappwebview.dev/
55
repository: https://github.com/pichillilorenzo/flutter_inappwebview
66
issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues
@@ -20,7 +20,7 @@ environment:
2020
dependencies:
2121
flutter:
2222
sdk: flutter
23-
flutter_inappwebview_platform_interface: ^1.3.0
23+
flutter_inappwebview_platform_interface: ^1.4.0
2424
flutter_inappwebview_android: ^1.1.3
2525
flutter_inappwebview_ios: ^1.1.2
2626
flutter_inappwebview_macos: ^1.1.2

flutter_inappwebview_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.2.0
2+
3+
- Updated flutter_inappwebview_platform_interface version to ^1.4.0
4+
15
## 1.1.3
26

37
- Updated flutter_inappwebview_platform_interface version to ^1.3.0

flutter_inappwebview_android/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_inappwebview_android
22
description: Android implementation of the flutter_inappwebview plugin.
3-
version: 1.1.3
3+
version: 1.2.0
44
homepage: https://inappwebview.dev/
55
repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_android
66
issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues
@@ -20,7 +20,7 @@ environment:
2020
dependencies:
2121
flutter:
2222
sdk: flutter
23-
flutter_inappwebview_platform_interface: ^1.3.0
23+
flutter_inappwebview_platform_interface: ^1.4.0
2424

2525
dev_dependencies:
2626
flutter_test:

flutter_inappwebview_ios/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.2.0
2+
3+
- Updated flutter_inappwebview_platform_interface version to ^1.4.0
4+
- Moved `WKUserContentController` initialization on `preWKWebViewConfiguration` to fix possible `undefined is not an object (evaluating 'window.webkit.messageHandlers')` javascript error
5+
16
## 1.1.2
27

38
- Updated flutter_inappwebview_platform_interface version to ^1.3.0

flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
546546
// This is a limitation of the official WebKit API.
547547
return
548548
}
549-
configuration.userContentController = WKUserContentController()
550549
configuration.userContentController.initialize()
551550

552551
if let applePayAPIEnabled = settings?.applePayAPIEnabled, applePayAPIEnabled {
@@ -595,7 +594,8 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
595594

596595
public static func preWKWebViewConfiguration(settings: InAppWebViewSettings?) -> WKWebViewConfiguration {
597596
let configuration = WKWebViewConfiguration()
598-
597+
// initialzie WKUserContentController here to fix possible "undefined is not an object (evaluating 'window.webkit.messageHandlers')" javascript error
598+
configuration.userContentController = WKUserContentController()
599599
configuration.processPool = WKProcessPoolManager.sharedProcessPool
600600

601601
if let settings = settings {

flutter_inappwebview_ios/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_inappwebview_ios
22
description: iOS implementation of the flutter_inappwebview plugin.
3-
version: 1.1.2
3+
version: 1.2.0
44
homepage: https://inappwebview.dev/
55
repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_ios
66
issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues
@@ -20,7 +20,7 @@ environment:
2020
dependencies:
2121
flutter:
2222
sdk: flutter
23-
flutter_inappwebview_platform_interface: ^1.3.0
23+
flutter_inappwebview_platform_interface: ^1.4.0
2424

2525
dev_dependencies:
2626
flutter_test:

flutter_inappwebview_macos/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.2.0
2+
3+
- Updated flutter_inappwebview_platform_interface version to ^1.4.0
4+
- Moved `WKUserContentController` initialization on `preWKWebViewConfiguration` to fix possible `undefined is not an object (evaluating 'window.webkit.messageHandlers')` javascript error
5+
16
## 1.1.2
27

38
- Updated flutter_inappwebview_platform_interface version to ^1.3.0

0 commit comments

Comments
 (0)