Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Rename allowChannelBufferOverflow to `setWarnsOnChannelOv… #46361

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ public void resizeChannelBuffer(int newSize) {

/**
* Toggles whether the channel should show warning messages when discarding messages due to
* overflow. When 'allowed' is true the channel is expected to overflow and warning messages will
* overflow. When 'warns' is false the channel is expected to overflow and warning messages will
* not be shown.
*/
public void allowChannelBufferOverflow(boolean allowed) {
allowChannelBufferOverflow(messenger, name, allowed);
public void setWarnsOnChannelOverflow(boolean warns) {
setWarnsOnChannelOverflow(messenger, name, warns);
}

private static ByteBuffer packetFromEncodedMessage(ByteBuffer message) {
Expand Down Expand Up @@ -182,13 +182,13 @@ public static void resizeChannelBuffer(

/**
* Toggles whether the channel should show warning messages when discarding messages due to
* overflow. When 'allowed' is true the channel is expected to overflow and warning messages will
* overflow. When 'warns' is false the channel is expected to overflow and warning messages will
* not be shown.
*/
public static void allowChannelBufferOverflow(
@NonNull BinaryMessenger messenger, @NonNull String channel, boolean allowed) {
public static void setWarnsOnChannelOverflow(
@NonNull BinaryMessenger messenger, @NonNull String channel, boolean warns) {
final StandardMethodCodec codec = StandardMethodCodec.INSTANCE;
Object[] arguments = {channel, allowed};
Object[] arguments = {channel, !warns};
MethodCall methodCall = new MethodCall("overflow", Arrays.asList(arguments));
ByteBuffer message = codec.encodeMethodCall(methodCall);
ByteBuffer packet = packetFromEncodedMessage(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ public void resizeChannelBuffer(int newSize) {

/**
* Toggles whether the channel should show warning messages when discarding messages due to
* overflow. When 'allowed' is true the channel is expected to overflow and warning messages will
* overflow. When 'warns' is false the channel is expected to overflow and warning messages will
* not be shown.
*/
public void allowChannelBufferOverflow(boolean allowed) {
BasicMessageChannel.allowChannelBufferOverflow(messenger, name, allowed);
public void setWarnsOnChannelOverflow(boolean warns) {
BasicMessageChannel.setWarnsOnChannelOverflow(messenger, name, warns);
}

/** A handler of incoming method calls. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void overflowChannelBufferMessageIsWellformed() {
String channel = "flutter/test";
MethodChannel rawChannel = new MethodChannel(dartExecutor, channel);

rawChannel.allowChannelBufferOverflow(true);
rawChannel.setWarnsOnChannelOverflow(false);

// Created from the following Dart code:
// MethodCall methodCall = const MethodCall('overflow', ['flutter/test', true]);
Expand Down