Skip to content

Commit fc98712

Browse files
Updated code docs, Fixed some missing macOS asserts, fix #1447
1 parent 2d32eff commit fc98712

Some content is hidden

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

41 files changed

+1226
-998
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 6.0.0-beta.19
2+
3+
- Updated code docs
4+
- Fixed "Cannot Grant Permission at Android 21" [#1447](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1447)
5+
- Fixed some missing macOS asserts
6+
17
## 6.0.0-beta.18
28

39
- Fixed `InAppWebViewSettings` automatic infer if `initialSettings` is `null`
@@ -158,6 +164,10 @@
158164
- Removed `URLProtectionSpace.iosIsProxy` property
159165
- `historyUrl` and `baseUrl` of `InAppWebViewInitialData` can be `null`
160166

167+
## 5.7.2+1
168+
169+
- Fixed "Cannot Grant Permission at Android 21" [#1447](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1447)
170+
161171
## 5.7.2
162172

163173
- Removed Android Hybrid Composition constraint to use the pull-to-refresh feature

android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebViewChromeClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ private Boolean isArrayEmpty(String[] arr) {
12111211

12121212
@Override
12131213
public void onPermissionRequest(final PermissionRequest request) {
1214-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
1214+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
12151215
final WebViewChannelDelegate.PermissionRequestCallback callback = new WebViewChannelDelegate.PermissionRequestCallback() {
12161216
@Override
12171217
public boolean nonNullSuccess(@NonNull PermissionResponse response) {

dev_packages/generators/lib/src/util.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ abstract class Util {
3434
final platformName = platform.getField("name")!.toStringValue();
3535
final note = platform.getField("note")?.toStringValue();
3636
if (note != null) {
37-
platformNoteList.add("///**NOTE for $platformName**: $note");
37+
final noteLines = note.split("\n");
38+
var platformNote =
39+
"///**NOTE for $platformName**: ${noteLines[0].trim()}";
40+
for (int i = 1; i < noteLines.length; i++) {
41+
platformNote += "\n///${noteLines[i].trim()}";
42+
}
43+
platformNoteList.add(platformNote);
3844
}
3945

4046
final apiName = platform.getField("apiName")?.toStringValue();

example/integration_test/chrome_safari_browser/open_and_close.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void openAndClose() {
4545
activityButton: ActivityButton(
4646
templateImage: UIImage(systemName: "sun.max"),
4747
extensionIdentifier:
48-
"com.pichillilorenzo.flutter-inappwebview-6-Example.test")));
48+
"com.pichillilorenzo.flutter-inappwebview6-example.test")));
4949
await chromeSafariBrowser.opened.future;
5050
expect(chromeSafariBrowser.isOpened(), true);
5151
expect(() async {

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@
451451
MARKETING_VERSION = 1.0;
452452
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
453453
MTL_FAST_MATH = YES;
454-
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-6-Example.test";
454+
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview6-example.test";
455455
PRODUCT_NAME = "$(TARGET_NAME)";
456456
SKIP_INSTALL = YES;
457457
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
@@ -484,7 +484,7 @@
484484
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
485485
MARKETING_VERSION = 1.0;
486486
MTL_FAST_MATH = YES;
487-
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-6-Example.test";
487+
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview6-example.test";
488488
PRODUCT_NAME = "$(TARGET_NAME)";
489489
SKIP_INSTALL = YES;
490490
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -627,7 +627,7 @@
627627
"$(inherited)",
628628
"$(PROJECT_DIR)/Flutter",
629629
);
630-
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-6-Example";
630+
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview6-example";
631631
PRODUCT_NAME = "$(TARGET_NAME)";
632632
PROVISIONING_PROFILE_SPECIFIER = "";
633633
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -659,7 +659,7 @@
659659
"$(inherited)",
660660
"$(PROJECT_DIR)/Flutter",
661661
);
662-
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-6-Example";
662+
PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview6-example";
663663
PRODUCT_NAME = "$(TARGET_NAME)";
664664
PROVISIONING_PROFILE_SPECIFIER = "";
665665
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

lib/src/chrome_safari_browser/chrome_safari_browser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class ChromeSafariBrowser {
208208
// ignore: deprecated_member_use_from_same_package
209209
ChromeSafariBrowserClassOptions? options,
210210
ChromeSafariBrowserSettings? settings}) async {
211-
if (!kIsWeb && defaultTargetPlatform == TargetPlatform.iOS) {
211+
if (Util.isIOS) {
212212
assert(url != null, 'The specified URL must not be null on iOS.');
213213
assert(['http', 'https'].contains(url!.scheme),
214214
'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported on iOS.');

lib/src/chrome_safari_browser/chrome_safari_browser_settings.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'dart:ui';
22

3-
import 'package:flutter/foundation.dart';
43
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
54

65
import '../types/activity_button.dart';
@@ -341,10 +340,9 @@ class ChromeSafariBrowserClassOptions {
341340

342341
Map<String, dynamic> toMap() {
343342
Map<String, dynamic> options = {};
344-
if (defaultTargetPlatform == TargetPlatform.android)
343+
if (Util.isAndroid)
345344
options.addAll(this.android?.toMap() ?? {});
346-
else if (defaultTargetPlatform == TargetPlatform.iOS)
347-
options.addAll(this.ios?.toMap() ?? {});
345+
else if (Util.isIOS) options.addAll(this.ios?.toMap() ?? {});
348346

349347
return options;
350348
}

lib/src/context_menu.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import 'package:flutter/foundation.dart';
2-
31
import 'in_app_webview/webview.dart';
42
import 'types/main.dart';
3+
import 'util.dart';
54

65
///Class that represents the WebView context menu. It used by [WebView.contextMenu].
76
///
@@ -89,11 +88,11 @@ class ContextMenuItem {
8988
@Deprecated("Use id instead") this.iosId,
9089
required this.title,
9190
this.action}) {
92-
if (defaultTargetPlatform == TargetPlatform.android) {
91+
if (Util.isAndroid) {
9392
// ignore: deprecated_member_use_from_same_package
9493
this.id = this.id ?? this.androidId;
9594
assert(this.id is int);
96-
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
95+
} else if (Util.isIOS) {
9796
// ignore: deprecated_member_use_from_same_package
9897
this.id = this.id ?? this.iosId;
9998
}

lib/src/cookie_manager.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'in_app_webview/headless_in_app_webview.dart';
88
import 'platform_util.dart';
99

1010
import 'types/main.dart';
11+
import 'util.dart';
1112
import 'web_uri.dart';
1213

1314
///Class that implements a singleton object (shared instance) which manages the cookies used by WebView instances.
@@ -519,14 +520,13 @@ class CookieManager {
519520
}
520521

521522
Future<bool> _shouldUseJavascript() async {
522-
if (kIsWeb) {
523+
if (Util.isWeb) {
523524
return true;
524525
}
525-
if (defaultTargetPlatform == TargetPlatform.iOS ||
526-
defaultTargetPlatform == TargetPlatform.macOS) {
526+
if (Util.isIOS || Util.isMacOS) {
527527
final platformUtil = PlatformUtil.instance();
528528
final systemVersion = await platformUtil.getSystemVersion();
529-
return defaultTargetPlatform == TargetPlatform.iOS
529+
return Util.isIOS
530530
? systemVersion.compareTo("11") == -1
531531
: systemVersion.compareTo("10.13") == -1;
532532
}

lib/src/in_app_browser/in_app_browser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ class InAppBrowser {
972972
///[permissionRequest] represents the permission request with an array of resources the web content wants to access
973973
///and the origin of the web page which is trying to access the restricted resources.
974974
///
975-
///**NOTE for Android**: available only on Android 23+.
975+
///**NOTE for Android**: available only on Android 21+.
976976
///
977977
///**NOTE for iOS**: available only on iOS 15.0+. The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT].
978978
///

0 commit comments

Comments
 (0)