Unverified Commit 3122786a authored by gaaclarke's avatar gaaclarke Committed by GitHub

Fixed build of example code to use new binary messenger API. (#35825)

Fixed build of example code to use new binary messenger API.
parent 70bb5d1d
...@@ -272,12 +272,10 @@ Future<void> _runBuildTests() async { ...@@ -272,12 +272,10 @@ Future<void> _runBuildTests() async {
continue; continue;
} }
final String examplePath = fileEntity.path; final String examplePath = fileEntity.path;
final String basename = path.basename(examplePath);
final bool expectIpaBuildFailure = basename == 'platform_channel_swift'; // Remove when https://github.com/flutter/flutter/issues/35773 is fixed.
await _flutterBuildAot(examplePath); await _flutterBuildAot(examplePath);
await _flutterBuildApk(examplePath); await _flutterBuildApk(examplePath);
await _flutterBuildIpa(examplePath, expectIpaBuildFailure: expectIpaBuildFailure); await _flutterBuildIpa(examplePath);
} }
await _flutterBuildDart2js(path.join('dev', 'integration_tests', 'web')); await _flutterBuildDart2js(path.join('dev', 'integration_tests', 'web'));
...@@ -322,7 +320,7 @@ Future<void> _flutterBuildApk(String relativePathToApplication) async { ...@@ -322,7 +320,7 @@ Future<void> _flutterBuildApk(String relativePathToApplication) async {
print('Done.'); print('Done.');
} }
Future<void> _flutterBuildIpa(String relativePathToApplication, {bool expectIpaBuildFailure = false}) async { Future<void> _flutterBuildIpa(String relativePathToApplication) async {
if (!Platform.isMacOS) { if (!Platform.isMacOS) {
return; return;
} }
...@@ -341,7 +339,7 @@ Future<void> _flutterBuildIpa(String relativePathToApplication, {bool expectIpaB ...@@ -341,7 +339,7 @@ Future<void> _flutterBuildIpa(String relativePathToApplication, {bool expectIpaB
await runCommand(flutter, await runCommand(flutter,
<String>['build', 'ios', '--no-codesign', '--debug', '-v'], <String>['build', 'ios', '--no-codesign', '--debug', '-v'],
workingDirectory: path.join(flutterRoot, relativePathToApplication), workingDirectory: path.join(flutterRoot, relativePathToApplication),
expectNonZeroExit: expectIpaBuildFailure, expectNonZeroExit: false,
timeout: _kShortTimeout, timeout: _kShortTimeout,
); );
print('Done.'); print('Done.');
......
...@@ -31,7 +31,7 @@ enum MyFlutterErrorCode { ...@@ -31,7 +31,7 @@ enum MyFlutterErrorCode {
fatalError("rootViewController is not type FlutterViewController") fatalError("rootViewController is not type FlutterViewController")
} }
let batteryChannel = FlutterMethodChannel(name: ChannelName.battery, let batteryChannel = FlutterMethodChannel(name: ChannelName.battery,
binaryMessenger: controller) binaryMessenger: controller.binaryMessenger)
batteryChannel.setMethodCallHandler({ batteryChannel.setMethodCallHandler({
[weak self] (call: FlutterMethodCall, result: FlutterResult) -> Void in [weak self] (call: FlutterMethodCall, result: FlutterResult) -> Void in
guard call.method == "getBatteryLevel" else { guard call.method == "getBatteryLevel" else {
...@@ -42,7 +42,7 @@ enum MyFlutterErrorCode { ...@@ -42,7 +42,7 @@ enum MyFlutterErrorCode {
}) })
let chargingChannel = FlutterEventChannel(name: ChannelName.charging, let chargingChannel = FlutterEventChannel(name: ChannelName.charging,
binaryMessenger: controller) binaryMessenger: controller.binaryMessenger)
chargingChannel.setStreamHandler(self) chargingChannel.setStreamHandler(self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions) return super.application(application, didFinishLaunchingWithOptions: launchOptions)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment