Skip to content

Commit

Permalink
Resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
TheVinhLuong committed Apr 29, 2023
1 parent 1ea39bc commit e6a5c55
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v9.2.4), do not edit directly.
// Autogenerated from Pigeon (v9.2.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon

package io.flutter.plugins.webviewflutter;
Expand Down Expand Up @@ -1501,6 +1501,23 @@ public void create(@NonNull Long identifierArg, @NonNull Reply<Void> callback) {
new ArrayList<Object>(Collections.singletonList(identifierArg)),
channelReply -> callback.reply(null));
}

public void onScrollPosChange(
@NonNull Long webViewInstanceIdArg,
@NonNull Long xArg,
@NonNull Long yArg,
@NonNull Long oldXArg,
@NonNull Long oldYArg,
@NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
"dev.flutter.pigeon.WebViewFlutterApi.onScrollPosChange",
getCodec());
channel.send(
new ArrayList<Object>(Arrays.asList(webViewInstanceIdArg, xArg, yArg, oldXArg, oldYArg)),
channelReply -> callback.reply(null));
}
}
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface WebSettingsHostApi {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void onScrollChanged(
@NonNull Long yArg,
@NonNull Long oldXArg,
@NonNull Long oldYArg,
WebViewFlutterApi.Reply<Void> callback) {
@NonNull WebViewFlutterApi.Reply<Void> callback) {
api.onScrollPosChange(
Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(instance)),
xArg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ public WebChromeClient getWebChromeClient() {
@Override
protected void onScrollChanged(int l, int t, int oldL, int oldT) {
super.onScrollChanged(l, t, oldL, oldT);
webViewFlutterApi.onScrollChanged(
this, (long) l, (long) t, (long) oldL, (long) oldT, reply -> {});
api.onScrollChanged(
this, (long) l, (long) t, (long) oldL, (long) oldT, reply -> {});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public void setImportantForAutofillForParentFlutterView() {

@Test
public void onScrollPosChange() {
final InstanceManager instanceManager = InstanceManager.open(identifier -> {});
final InstanceManager instanceManager = InstanceManager.create(identifier -> {});

final WebViewFlutterApiImpl flutterApiImpl =
new WebViewFlutterApiImpl(mockBinaryMessenger, instanceManager);
Expand All @@ -375,6 +375,6 @@ public void onScrollPosChange() {
verify(mockFlutterApi)
.onScrollPosChange(eq(instanceIdentifier), eq(0L), eq(1L), eq(2L), eq(3L), any());

instanceManager.close();
instanceManager.stopFinalizationListener();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class AndroidWebViewProxy {
});

/// Constructs a [android_webview.WebView].
final android_webview.WebView Function(required Function(int left, int top, int oldLeft, int oldTop)?
onScrollChanged) createAndroidWebView;
final android_webview.WebView Function(
{Function(int left, int top, int oldLeft, int oldTop)?
onScrollChanged}) createAndroidWebView;

/// Constructs a [android_webview.WebChromeClient].
final android_webview.WebChromeClient Function({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v9.2.4), do not edit directly.
// Autogenerated from Pigeon (v9.2.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import

Expand Down Expand Up @@ -992,6 +992,9 @@ abstract class WebViewFlutterApi {
/// Create a new Dart instance and add it to the `InstanceManager`.
void create(int identifier);

void onScrollPosChange(
int webViewInstanceId, int x, int y, int oldX, int oldY);

static void setup(WebViewFlutterApi? api,
{BinaryMessenger? binaryMessenger}) {
{
Expand All @@ -1013,6 +1016,38 @@ abstract class WebViewFlutterApi {
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.WebViewFlutterApi.onScrollPosChange', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewFlutterApi.onScrollPosChange was null.');
final List<Object?> args = (message as List<Object?>?)!;
final int? arg_webViewInstanceId = (args[0] as int?);
assert(arg_webViewInstanceId != null,
'Argument for dev.flutter.pigeon.WebViewFlutterApi.onScrollPosChange was null, expected non-null int.');
final int? arg_x = (args[1] as int?);
assert(arg_x != null,
'Argument for dev.flutter.pigeon.WebViewFlutterApi.onScrollPosChange was null, expected non-null int.');
final int? arg_y = (args[2] as int?);
assert(arg_y != null,
'Argument for dev.flutter.pigeon.WebViewFlutterApi.onScrollPosChange was null, expected non-null int.');
final int? arg_oldX = (args[3] as int?);
assert(arg_oldX != null,
'Argument for dev.flutter.pigeon.WebViewFlutterApi.onScrollPosChange was null, expected non-null int.');
final int? arg_oldY = (args[4] as int?);
assert(arg_oldY != null,
'Argument for dev.flutter.pigeon.WebViewFlutterApi.onScrollPosChange was null, expected non-null int.');
api.onScrollPosChange(
arg_webViewInstanceId!, arg_x!, arg_y!, arg_oldX!, arg_oldY!);
return;
});
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,14 @@ class AndroidWebViewController extends PlatformWebViewController {
late final android_webview.WebView _webView =
_androidWebViewParams.androidWebViewProxy.createAndroidWebView(
onScrollChanged: withWeakReferenceTo(this,
(WeakReference<AndroidWebViewController> weakReference) {
return (int l, int t, int oldL, int oldT) async {
if (weakReference.target?._onContentOffsetChangedCallback !=
null) {
return weakReference.target!._onContentOffsetChangedCallback!(
l, t, oldL, oldT);
}
};
})
);
(WeakReference<AndroidWebViewController> weakReference) {
return (int l, int t, int oldL, int oldT) async {
if (weakReference.target?._onContentOffsetChangedCallback != null) {
return weakReference.target!._onContentOffsetChangedCallback!(
l, t, oldL, oldT);
}
};
}));

late final android_webview.WebChromeClient _webChromeClient =
_androidWebViewParams.androidWebViewProxy.createAndroidWebChromeClient(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ void main() {
)? onPermissionRequest,
}) =>
MockWebChromeClient(),
createAndroidWebView: ({
required dynamic Function(int, int, int, int)?
onScrollChanged}) => nonNullMockWebView,
createAndroidWebView:
({dynamic Function(int, int, int, int)? onScrollChanged}) =>
nonNullMockWebView,
createAndroidWebViewClient: ({
void Function(android_webview.WebView webView, String url)?
onPageFinished,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,22 @@ class MockAndroidWebViewController extends _i1.Mock
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
@override
_i9.Future<void> setOnContentOffsetChanged(
void Function(
int,
int,
int,
int,
)? onOffsetChange) =>
(super.noSuchMethod(
Invocation.method(
#setOnContentOffsetChanged,
[onOffsetChange],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
@override
_i9.Future<void> setMediaPlaybackRequiresUserGesture(bool? require) =>
(super.noSuchMethod(
Invocation.method(
Expand Down Expand Up @@ -727,17 +743,41 @@ class MockAndroidWebViewController extends _i1.Mock
class MockAndroidWebViewProxy extends _i1.Mock
implements _i10.AndroidWebViewProxy {
@override
_i2.WebView Function() get createAndroidWebView => (super.noSuchMethod(
_i2.WebView Function(
dynamic Function(
int,
int,
int,
int,
)?) get createAndroidWebView => (super.noSuchMethod(
Invocation.getter(#createAndroidWebView),
returnValue: () => _FakeWebView_7(
returnValue: (dynamic Function(
int,
int,
int,
int,
)? onScrollChanged) =>
_FakeWebView_7(
this,
Invocation.getter(#createAndroidWebView),
),
returnValueForMissingStub: () => _FakeWebView_7(
returnValueForMissingStub: (dynamic Function(
int,
int,
int,
int,
)? onScrollChanged) =>
_FakeWebView_7(
this,
Invocation.getter(#createAndroidWebView),
),
) as _i2.WebView Function());
) as _i2.WebView Function(
dynamic Function(
int,
int,
int,
int,
)?));
@override
_i2.WebChromeClient Function({
void Function(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v9.2.4), do not edit directly.
// Autogenerated from Pigeon (v9.2.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import
// ignore_for_file: avoid_relative_lib_imports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ abstract class PlatformWebViewController extends PlatformInterface {
/// Toggle the listener for content offset changes. Set to null to stop listening.
Future<void> setOnContentOffsetChanged(
void Function(int left, int top, int oldLeft, int oldTop)?
onOffsetChange) {
onOffsetChange) {
throw UnimplementedError(
'setOnContentOffsetChanged is not implemented on the current platform');
}
Expand Down

0 comments on commit e6a5c55

Please sign in to comment.