Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Migrate away from deprecated BinaryMessages #2444

Merged
merged 4 commits into from
Jan 3, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/connectivity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.4.7

* Migrate deprecated BinaryMessages to ServicesBinding.instance.defaultBinaryMessenger.
* Bump Flutter SDK to 1.12.13+hotfix.5 or greater (current stable).

## 0.4.6+1

* Remove the deprecated `author:` field from pubspec.yaml
Expand Down
4 changes: 2 additions & 2 deletions packages/connectivity/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: connectivity
description: Flutter plugin for discovering the state of the network (WiFi &
mobile/cellular) connectivity on Android and iOS.
homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity
version: 0.4.6+1
version: 0.4.7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a patch bump, no new feature is introduced.


flutter:
plugin:
Expand All @@ -28,4 +28,4 @@ dev_dependencies:

environment:
sdk: ">=2.0.0-dev.28.0 <3.0.0"
flutter: ">=1.10.0 <2.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
6 changes: 2 additions & 4 deletions packages/connectivity/test/connectivity_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ void main() {
.setMockMethodCallHandler((MethodCall methodCall) async {
switch (methodCall.method) {
case 'listen':
// TODO(hterkelsen): Remove this when defaultBinaryMessages is in stable.
// https://github.com/flutter/flutter/issues/33446
// ignore: deprecated_member_use
await BinaryMessages.handlePlatformMessage(
await ServicesBinding.instance.defaultBinaryMessenger
.handlePlatformMessage(
Connectivity.eventChannel.name,
Connectivity.eventChannel.codec.encodeSuccessEnvelope('wifi'),
(_) {},
Expand Down
5 changes: 5 additions & 0 deletions packages/sensors/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.4.2

* Migrate from deprecated BinaryMessages to ServicesBinding.instance.defaultBinaryMessenger.
* Require Flutter SDK 1.12.13+hotfix.5 or greater (current stable).

## 0.4.1+5

* Fix example `setState()` called after `dispose()` by canceling the timer.
Expand Down
4 changes: 2 additions & 2 deletions packages/sensors/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: sensors
description: Flutter plugin for accessing the Android and iOS accelerometer and
gyroscope sensors.
homepage: https://github.com/flutter/plugins/tree/master/packages/sensors
version: 0.4.1+5
version: 0.4.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patch bump


flutter:
plugin:
Expand All @@ -26,4 +26,4 @@ dev_dependencies:

environment:
sdk: ">=2.0.0-dev.28.0 <3.0.0"
flutter: ">=1.10.0 <2.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
11 changes: 3 additions & 8 deletions packages/sensors/test/sensors_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,15 @@ void _initializeFakeSensorChannel(String channelName, List<double> sensorData) {
const StandardMethodCodec standardMethod = StandardMethodCodec();

void _emitEvent(ByteData event) {
// TODO(hterkelsen): Remove this when defaultBinaryMessages is in stable.
// https://github.com/flutter/flutter/issues/33446
// ignore: deprecated_member_use
BinaryMessages.handlePlatformMessage(
ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
channelName,
event,
(ByteData reply) {},
);
}

// TODO(hterkelsen): Remove this when defaultBinaryMessages is in stable.
// https://github.com/flutter/flutter/issues/33446
// ignore: deprecated_member_use
BinaryMessages.setMockMessageHandler(channelName, (ByteData message) async {
ServicesBinding.instance.defaultBinaryMessenger
.setMockMessageHandler(channelName, (ByteData message) async {
final MethodCall methodCall = standardMethod.decodeMethodCall(message);
if (methodCall.method == 'listen') {
_emitEvent(standardMethod.encodeSuccessEnvelope(sensorData));
Expand Down
4 changes: 4 additions & 0 deletions packages/webview_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.20

* Migrate from deprecated BinaryMessages to ServicesBinding.instance.defaultBinaryMessenger.

## 0.3.19+1

* Raise min Flutter SDK requirement to the latest stable. v2 embedding apps no
Expand Down
2 changes: 1 addition & 1 deletion packages/webview_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: webview_flutter
description: A Flutter plugin that provides a WebView widget on Android and iOS.
version: 0.3.19+1
version: 0.3.20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

homepage: https://github.com/flutter/plugins/tree/master/packages/webview_flutter

environment:
Expand Down
23 changes: 6 additions & 17 deletions packages/webview_flutter/test/webview_flutter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -994,11 +994,8 @@ class FakePlatformWebView {
};
final ByteData data = codec
.encodeMethodCall(MethodCall('javascriptChannelMessage', arguments));
// TODO(hterkelsen): Remove this when defaultBinaryMessages is in stable.
// https://github.com/flutter/flutter/issues/33446
// ignore: deprecated_member_use
BinaryMessages.handlePlatformMessage(
channel.name, data, (ByteData data) {});
ServicesBinding.instance.defaultBinaryMessenger
.handlePlatformMessage(channel.name, data, (ByteData data) {});
}

// Fakes a main frame navigation that was initiated by the webview, e.g when
Expand All @@ -1016,10 +1013,8 @@ class FakePlatformWebView {
};
final ByteData data =
codec.encodeMethodCall(MethodCall('navigationRequest', arguments));
// TODO(hterkelsen): Remove this when defaultBinaryMessages is in stable.
// https://github.com/flutter/flutter/issues/33446
// ignore: deprecated_member_use
BinaryMessages.handlePlatformMessage(channel.name, data, (ByteData data) {
ServicesBinding.instance.defaultBinaryMessenger
.handlePlatformMessage(channel.name, data, (ByteData data) {
final bool allow = codec.decodeEnvelope(data);
if (allow) {
_loadUrl(url);
Expand All @@ -1035,10 +1030,7 @@ class FakePlatformWebView {
<dynamic, dynamic>{'url': currentUrl},
));

// TODO(hterkelsen): Remove this when defaultBinaryMessages is in stable.
// https://github.com/flutter/flutter/issues/33446
// ignore: deprecated_member_use
BinaryMessages.handlePlatformMessage(
ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
channel.name,
data,
(ByteData data) {},
Expand All @@ -1053,10 +1045,7 @@ class FakePlatformWebView {
<dynamic, dynamic>{'url': currentUrl},
));

// TODO(hterkelsen): Remove this when defaultBinaryMessages is in stable.
// https://github.com/flutter/flutter/issues/33446
// ignore: deprecated_member_use
BinaryMessages.handlePlatformMessage(
ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
channel.name,
data,
(ByteData data) {},
Expand Down