Skip to content

Commit 2404ba9

Browse files
author
Franco Bugnano
committed
Upgreded inappwebview to v6.0.0-beta.3
1 parent 0021aea commit 2404ba9

File tree

4 files changed

+39
-32
lines changed

4 files changed

+39
-32
lines changed

lib/src/chatbox.dart

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class ChatBoxState extends State<ChatBox> {
145145
_webViewCreated = true;
146146

147147
if (Platform.isAndroid) {
148-
AndroidInAppWebViewController.setWebContentsDebuggingEnabled(kDebugMode);
148+
InAppWebViewController.setWebContentsDebuggingEnabled(kDebugMode);
149149
}
150150

151151
// Here a Timer is needed, as we can't change the widget's state while the widget
@@ -191,36 +191,32 @@ class ChatBoxState extends State<ChatBox> {
191191

192192
return InAppWebView(
193193
initialUrlRequest: URLRequest(url: null),
194-
initialOptions: InAppWebViewGroupOptions(
195-
android: AndroidInAppWebViewOptions(
196-
useHybridComposition: true,
197-
),
198-
ios: IOSInAppWebViewOptions(
199-
disableInputAccessoryView: true,
200-
)
194+
initialSettings: InAppWebViewSettings(
195+
useHybridComposition: true,
196+
disableInputAccessoryView: true,
201197
),
202198
onWebViewCreated: _onWebViewCreated,
203199
onLoadStop: _onLoadStop,
204200
onConsoleMessage: (InAppWebViewController controller, ConsoleMessage message) {
205201
print("chatbox [${message.messageLevel}] ${message.message}");
206202
},
207-
androidOnGeolocationPermissionsShowPrompt: (InAppWebViewController controller, String origin) async {
208-
print("📘 chatbox androidOnGeolocationPermissionsShowPrompt");
203+
onGeolocationPermissionsShowPrompt: (InAppWebViewController controller, String origin) async {
204+
print("📘 chatbox onGeolocationPermissionsShowPrompt ($origin)");
209205

210206
final granted = await Permission.location.request().isGranted;
211207

212208
return GeolocationPermissionShowPromptResponse(origin: origin, allow: granted, retain: true);
213209
},
214-
androidOnPermissionRequest: (InAppWebViewController controller, String origin, List<String> resources) async {
215-
print("📘 chatbox androidOnPermissionRequest: $resources");
210+
onPermissionRequest: (InAppWebViewController controller, PermissionRequest permissionRequest) async {
211+
print("📘 chatbox onPermissionRequest");
216212

217213
var granted = false;
218214

219-
if (resources.indexOf("android.webkit.resource.AUDIO_CAPTURE") >= 0) {
215+
if (permissionRequest.resources.indexOf(PermissionResourceType.MICROPHONE) >= 0) {
220216
granted = await Permission.microphone.request().isGranted;
221217
}
222218

223-
return PermissionRequestResponse(resources: resources, action: granted ? PermissionRequestResponseAction.GRANT : PermissionRequestResponseAction.DENY);
219+
return PermissionResponse(resources: permissionRequest.resources, action: granted ? PermissionResponseAction.GRANT : PermissionResponseAction.DENY);
224220
},
225221
gestureRecognizers: {
226222
// We need only the VerticalDragGestureRecognizer in order to be able to scroll through the messages
@@ -576,13 +572,17 @@ class ChatBoxState extends State<ChatBox> {
576572
void execute(String statement) {
577573
final controller = _webViewController;
578574

579-
if (kDebugMode) {
580-
print('📘 chatbox.execute: $statement');
581-
}
582-
583575
if (controller != null) {
576+
if (kDebugMode) {
577+
print('📗 chatbox.execute: $statement');
578+
}
579+
584580
controller.evaluateJavascript(source: statement);
585581
} else {
582+
if (kDebugMode) {
583+
print('📘 chatbox.execute: $statement');
584+
}
585+
586586
this._pending.add(statement);
587587
}
588588
}

lib/src/conversationlist.dart

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class ConversationListState extends State<ConversationList> {
129129
_webViewCreated = true;
130130

131131
if (Platform.isAndroid) {
132-
AndroidInAppWebViewController.setWebContentsDebuggingEnabled(kDebugMode);
132+
InAppWebViewController.setWebContentsDebuggingEnabled(kDebugMode);
133133
}
134134

135135
// Here a Timer is needed, as we can't change the widget's state while the widget
@@ -151,13 +151,9 @@ class ConversationListState extends State<ConversationList> {
151151

152152
return InAppWebView(
153153
initialUrlRequest: URLRequest(url: null),
154-
initialOptions: InAppWebViewGroupOptions(
155-
android: AndroidInAppWebViewOptions(
156-
useHybridComposition: true,
157-
),
158-
ios: IOSInAppWebViewOptions(
159-
disableInputAccessoryView: true,
160-
)
154+
initialSettings: InAppWebViewSettings(
155+
useHybridComposition: true,
156+
disableInputAccessoryView: true,
161157
),
162158
onWebViewCreated: _onWebViewCreated,
163159
onLoadStop: _onLoadStop,
@@ -305,13 +301,17 @@ class ConversationListState extends State<ConversationList> {
305301
void execute(String statement) {
306302
final controller = _webViewController;
307303

308-
if (kDebugMode) {
309-
print('📘 conversationlist.execute: $statement');
310-
}
311-
312304
if (controller != null) {
305+
if (kDebugMode) {
306+
print('📗 conversationlist.execute: $statement');
307+
}
308+
313309
controller.evaluateJavascript(source: statement);
314310
} else {
311+
if (kDebugMode) {
312+
print('📘 conversationlist.execute: $statement');
313+
}
314+
315315
this._pending.add(statement);
316316
}
317317
}

pubspec.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,14 @@ packages:
166166
name: flutter_inappwebview
167167
url: "https://pub.dartlang.org"
168168
source: hosted
169-
version: "5.4.4+3"
169+
version: "6.0.0-beta.3"
170+
flutter_inappwebview_internal_annotations:
171+
dependency: transitive
172+
description:
173+
name: flutter_inappwebview_internal_annotations
174+
url: "https://pub.dartlang.org"
175+
source: hosted
176+
version: "1.1.0"
170177
flutter_local_notifications:
171178
dependency: "direct main"
172179
description:

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies:
1515
flutter:
1616
sdk: flutter
1717

18-
flutter_inappwebview: ^5.4.4+3
18+
flutter_inappwebview: ^6.0.0-beta.3
1919
crypto: ^3.0.1
2020
firebase_core: ^1.24.0
2121
firebase_messaging: ^13.1.0

0 commit comments

Comments
 (0)