Skip to content

Commit 674067d

Browse files
authored
[various] Add engineIdentifier to fake plugin registrars (flutter#13574)
flutter#195881 added a required engineIdentifier property to FlutterBaseRegistrar (iOS) and FlutterPluginRegistrar (macOS), which breaks compilation of the test-only registrar fakes and blocks the Flutter roll (flutter#13569). Implement the property in each fake in a way that also compiles against stable, where the property does not exist yet. Fixes flutter#196065 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 920c2ee commit 674067d

7 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎packages/google_maps_flutter/google_maps_flutter_ios/example/ios/RunnerTests/GoogleMapsTests.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class StubBinaryMessenger: NSObject, FlutterBinaryMessenger {
3939
}
4040

4141
class StubPluginRegistrar: NSObject, FlutterPluginRegistrar {
42+
var engineIdentifier: Int64 { 0 }
4243
var viewController: UIViewController? { nil }
4344
func publish(_ value: NSObject) {}
4445
func addMethodCallDelegate(_ delegate: any FlutterPlugin, channel: FlutterMethodChannel) {}

‎packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/ios/RunnerTests/GoogleMapsTests.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class MockMapEventHandler: TestMapEventHandler {
6060
}
6161

6262
class StubPluginRegistrar: NSObject, FlutterPluginRegistrar {
63+
var engineIdentifier: Int64 { 0 }
6364
var viewController: UIViewController? { nil }
6465
func publish(_ value: NSObject) {}
6566
func addMethodCallDelegate(_ delegate: any FlutterPlugin, channel: FlutterMethodChannel) {}

‎packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/ios/RunnerTests/GoogleMapsTests.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class MockMapEventHandler: TestMapEventHandler {
6060
}
6161

6262
class StubPluginRegistrar: NSObject, FlutterPluginRegistrar {
63+
var engineIdentifier: Int64 { 0 }
6364
var viewController: UIViewController? { nil }
6465
func publish(_ value: NSObject) {}
6566
func addMethodCallDelegate(_ delegate: any FlutterPlugin, channel: FlutterMethodChannel) {}

‎packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/ios/RunnerTests/GoogleMapsTests.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class MockMapEventHandler: TestMapEventHandler {
6060
}
6161

6262
class StubPluginRegistrar: NSObject, FlutterPluginRegistrar {
63+
var engineIdentifier: Int64 { 0 }
6364
var viewController: UIViewController? { nil }
6465
func publish(_ value: NSObject) {}
6566
func addMethodCallDelegate(_ delegate: any FlutterPlugin, channel: FlutterMethodChannel) {}

‎packages/image_picker/image_picker_ios/example/ios/RunnerTests/TestDoubles.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ final class StubViewProvider: ViewProvider {
2222

2323
/// Minimal `FlutterPluginRegistrar` so tests can exercise `DefaultViewProvider`.
2424
final class TestFlutterPluginRegistrar: NSObject, FlutterPluginRegistrar {
25+
var engineIdentifier: Int64 { 0 }
2526
var viewController: UIViewController?
2627

2728
func publish(_ value: NSObject) {}

‎packages/in_app_purchase/in_app_purchase_storekit/example/shared/RunnerTests/Stubs.m‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,12 @@ - (void)startProductRequestWithCompletionHandler:(nonnull ProductRequestCompleti
540540
// This FlutterPluginRegistrar is a protocol, so to make a stub it has to be implemented.
541541
@implementation FlutterPluginRegistrarStub
542542

543+
// Implemented as a method rather than via @synthesize so that this compiles
544+
// against Flutter versions that do not yet declare `engineIdentifier`.
545+
- (int64_t)engineIdentifier {
546+
return 0;
547+
}
548+
543549
- (void)addApplicationDelegate:(nonnull NSObject<FlutterPlugin> *)delegate {
544550
if (self.addApplicationDelegateStub) {
545551
self.addApplicationDelegateStub(delegate);

‎packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/FWFWebViewFlutterWKWebViewExternalAPITests.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ class TestFlutterTextureRegistry: NSObject, FlutterTextureRegistry {
128128

129129
class TestFlutterPluginRegistrar: NSObject, FlutterPluginRegistrar {
130130
var publishedValue: NSObject? = nil
131+
var engineIdentifier: Int64 { 0 }
131132

132133
#if os(iOS)
133134
var viewController: UIViewController?

0 commit comments

Comments
 (0)