Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
jsharp83 committed Oct 5, 2023
1 parent aff2a34 commit 3930794
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 619 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,49 +96,44 @@ private FileChooserMode(final int index) {
/**
* Indicates the type of message logged to the console.
*
* <p>See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel.
* See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel.
*/
public enum ConsoleMessageLevel {
/**
* Indicates a message is logged for debugging.
*
* <p>See
* https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#DEBUG.
* See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#DEBUG.
*/
DEBUG(0),
/**
* Indicates a message is provided as an error.
*
* <p>See
* https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#ERROR.
* See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#ERROR.
*/
ERROR(1),
/**
* Indicates a message is provided as a basic log message.
*
* <p>See
* https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#LOG.
* See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#LOG.
*/
LOG(2),
/**
* Indicates a message is provided as a tip.
*
* <p>See
* https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#TIP.
* See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#TIP.
*/
TIP(3),
/**
* Indicates a message is provided as a warning.
*
* <p>See
* https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#WARNING.
* See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#WARNING.
*/
WARNING(4),
/**
* Indicates a message with an unknown level.
*
* <p>This does not represent an actual value provided by the platform and only indicates a
* value was provided that isn't currently supported.
* This does not represent an actual value provided by the platform and only
* indicates a value was provided that isn't currently supported.
*/
UNKNOWN(5);

Expand Down Expand Up @@ -558,9 +553,9 @@ ArrayList<Object> toList() {
/**
* Represents a JavaScript console message from WebCore.
*
* <p>See https://developer.android.com/reference/android/webkit/ConsoleMessage
* See https://developer.android.com/reference/android/webkit/ConsoleMessage
*
* <p>Generated class from Pigeon that represents data sent in messages.
* Generated class from Pigeon that represents data sent in messages.
*/
public static final class ConsoleMessage {
private @NonNull Long lineNumber;
Expand Down Expand Up @@ -671,10 +666,7 @@ ArrayList<Object> toList() {
static @NonNull ConsoleMessage fromList(@NonNull ArrayList<Object> list) {
ConsoleMessage pigeonResult = new ConsoleMessage();
Object lineNumber = list.get(0);
pigeonResult.setLineNumber(
(lineNumber == null)
? null
: ((lineNumber instanceof Integer) ? (Integer) lineNumber : (Long) lineNumber));
pigeonResult.setLineNumber((lineNumber == null) ? null : ((lineNumber instanceof Integer) ? (Integer) lineNumber : (Long) lineNumber));
Object message = list.get(1);
pigeonResult.setMessage((String) message);
Object level = list.get(2);
Expand Down Expand Up @@ -1761,7 +1753,7 @@ public interface WebSettingsHostApi {

void setTextZoom(@NonNull Long instanceId, @NonNull Long textZoom);

@NonNull
@NonNull
String getUserAgentString(@NonNull Long instanceId);

/** The codec used by WebSettingsHostApi. */
Expand Down Expand Up @@ -2123,21 +2115,18 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
"dev.flutter.pigeon.webview_flutter_android.WebSettingsHostApi.getUserAgentString",
getCodec());
binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettingsHostApi.getUserAgentString", getCodec());
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
ArrayList<Object> args = (ArrayList<Object>) message;
Number instanceIdArg = (Number) args.get(0);
try {
String output =
api.getUserAgentString(
(instanceIdArg == null) ? null : instanceIdArg.longValue());
String output = api.getUserAgentString((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, output);
} catch (Throwable exception) {
}
catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
Expand Down Expand Up @@ -2453,8 +2442,7 @@ public interface WebChromeClientHostApi {

void setSynchronousReturnValueForOnShowFileChooser(@NonNull Long instanceId, @NonNull Boolean value);

void setSynchronousReturnValueForOnConsoleMessage(
@NonNull Long instanceId, @NonNull Boolean value);
void setSynchronousReturnValueForOnConsoleMessage(@NonNull Long instanceId, @NonNull Boolean value);

void setSynchronousReturnValueForOnJsAlert(@NonNull Long instanceId, @NonNull Boolean value);

Expand Down Expand Up @@ -2520,9 +2508,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
"dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnConsoleMessage",
getCodec());
binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnConsoleMessage", getCodec());
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
Expand All @@ -2531,10 +2517,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC
Number instanceIdArg = (Number) args.get(0);
Boolean valueArg = (Boolean) args.get(1);
try {
api.setSynchronousReturnValueForOnConsoleMessage(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg);
api.setSynchronousReturnValueForOnConsoleMessage((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg);
wrapped.add(0, null);
} catch (Throwable exception) {
}
catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
Expand Down Expand Up @@ -2696,6 +2682,8 @@ private WebChromeClientFlutterApiCodec() {}
protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) {
switch (type) {
case (byte) 128:
return ConsoleMessage.fromList((ArrayList<Object>) readValue(buffer));
case (byte) 129:
return JavaScriptDialogData.fromList((ArrayList<Object>) readValue(buffer));
default:
return super.readValueOfType(type, buffer);
Expand All @@ -2704,8 +2692,11 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) {

@Override
protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) {
if (value instanceof JavaScriptDialogData) {
if (value instanceof ConsoleMessage) {
stream.write(128);
writeValue(stream, ((ConsoleMessage) value).toList());
} else if (value instanceof JavaScriptDialogData) {
stream.write(129);
writeValue(stream, ((JavaScriptDialogData) value).toList());
} else {
super.writeValue(stream, value);
Expand Down Expand Up @@ -2795,6 +2786,15 @@ public void onGeolocationPermissionsHidePrompt(@NonNull Long identifierArg, @Non
new ArrayList<Object>(Collections.singletonList(identifierArg)),
channelReply -> callback.reply(null));
}
/** Callback to Dart function `WebChromeClient.onConsoleMessage`. */
public void onConsoleMessage(@NonNull Long instanceIdArg, @NonNull ConsoleMessage messageArg, @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onConsoleMessage", getCodec());
channel.send(
new ArrayList<Object>(Arrays.asList(instanceIdArg, messageArg)),
channelReply -> callback.reply(null));
}
public void onJsAlert(@NonNull Long instanceIdArg, @NonNull JavaScriptDialogData dataArg, @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ public void setReturnValueForOnJsPrompt(boolean value) {
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
if( returnValueForOnJsAlert ) {
GeneratedAndroidWebView.JavaScriptDialogData(url: url);

GeneratedAndroidWebView.JavaScriptDialogData data = new GeneratedAndroidWebView.JavaScriptDialogData();
data.setUrl(url);
data.setMessage(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,22 @@ enum ConsoleMessageLevel {
///
/// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#DEBUG.
debug,

/// Indicates a message is provided as an error.
///
/// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#ERROR.
error,

/// Indicates a message is provided as a basic log message.
///
/// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#LOG.
log,

/// Indicates a message is provided as a tip.
///
/// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#TIP.
tip,

/// Indicates a message is provided as a warning.
///
/// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#WARNING.
warning,

/// Indicates a message with an unknown level.
///
/// This does not represent an actual value provided by the platform and only
Expand Down Expand Up @@ -1440,8 +1435,7 @@ class WebSettingsHostApi {

Future<String> getUserAgentString(int arg_instanceId) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.webview_flutter_android.WebSettingsHostApi.getUserAgentString',
codec,
'dev.flutter.pigeon.webview_flutter_android.WebSettingsHostApi.getUserAgentString', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_instanceId]) as List<Object?>?;
Expand Down Expand Up @@ -1952,14 +1946,12 @@ class WebChromeClientHostApi {
}
}

Future<void> setSynchronousReturnValueForOnConsoleMessage(
int arg_instanceId, bool arg_value) async {
Future<void> setSynchronousReturnValueForOnConsoleMessage(int arg_instanceId, bool arg_value) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnConsoleMessage',
codec,
'dev.flutter.pigeon.webview_flutter_android.WebChromeClientHostApi.setSynchronousReturnValueForOnConsoleMessage', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel
.send(<Object?>[arg_instanceId, arg_value]) as List<Object?>?;
final List<Object?>? replyList =
await channel.send(<Object?>[arg_instanceId, arg_value]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
Expand Down Expand Up @@ -2115,6 +2107,9 @@ class _WebChromeClientFlutterApiCodec extends StandardMessageCodec {
if (value is ConsoleMessage) {
buffer.putUint8(128);
writeValue(buffer, value.encode());
} else if (value is JavaScriptDialogData) {
buffer.putUint8(129);
writeValue(buffer, value.encode());
} else {
super.writeValue(buffer, value);
}
Expand All @@ -2123,8 +2118,10 @@ class _WebChromeClientFlutterApiCodec extends StandardMessageCodec {
@override
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 128:
case 128:
return ConsoleMessage.decode(readValue(buffer)!);
case 129:
return JavaScriptDialogData.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
}
Expand Down Expand Up @@ -2156,16 +2153,15 @@ abstract class WebChromeClientFlutterApi {
/// Callback to Dart function `WebChromeClient.onConsoleMessage`.
void onConsoleMessage(int instanceId, ConsoleMessage message);

Future<void> onJsAlert(int instanceId, String message);
Future<void> onJsAlert(int instanceId, JavaScriptDialogData data);

Future<bool> onJsConfirm(int instanceId, JavaScriptDialogData data);

Future<String> onJsPrompt(int instanceId, JavaScriptDialogData data);


static void setup(WebChromeClientFlutterApi? api,
{BinaryMessenger? binaryMessenger}) {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
static void setup(WebChromeClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) {
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onProgressChanged', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
Expand Down Expand Up @@ -2326,15 +2322,14 @@ abstract class WebChromeClientFlutterApi {
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onConsoleMessage',
codec,
'dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onConsoleMessage', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onConsoleMessage was null.');
'Argument for dev.flutter.pigeon.webview_flutter_android.WebChromeClientFlutterApi.onConsoleMessage was null.');
final List<Object?> args = (message as List<Object?>?)!;
final int? arg_instanceId = (args[0] as int?);
assert(arg_instanceId != null,
Expand Down
Loading

0 comments on commit 3930794

Please sign in to comment.