Skip to content

Commit 376bb6e

Browse files
authored
feat(auth,macos): add support for publish and addApplicationDelegate on macOS FlutterPluginRegistrar (#17518)
* feat(auth,macos): add support for `publish` and `addApplicationDelegat`e on macOS FlutterPluginRegistrar * chore: refactor code * chore: use TARGET_OS_IPHONE * chore: fix formatting
1 parent e6dd8fd commit 376bb6e

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

packages/firebase_analytics/firebase_analytics/ios/firebase_analytics/Sources/firebase_analytics/FirebaseAnalyticsMessages.g.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func deepHashFirebaseAnalyticsMessages(value: Any?, hasher: inout Hasher) {
134134
/// Generated class from Pigeon that represents data sent in messages.
135135
struct AnalyticsEvent: Hashable {
136136
var name: String
137-
var parameters: [String?: Any?]? = nil
137+
var parameters: [String?: Any?]?
138138

139139
// swift-format-ignore: AlwaysUseLowerCamelCase
140140
static func fromList(_ pigeonVar_list: [Any?]) -> AnalyticsEvent? {

packages/firebase_app_installations/firebase_app_installations/ios/firebase_app_installations/Sources/firebase_app_installations/IdChangedStreamHandler.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class IdChangedStreamHandler: NSObject, FlutterStreamHandler {
4545
}
4646
}
4747

48-
public func onListen(withArguments _: Any?,
49-
eventSink events: @escaping FlutterEventSink) -> FlutterError? {
48+
func onListen(withArguments _: Any?,
49+
eventSink events: @escaping FlutterEventSink) -> FlutterError? {
5050
eventSink = events
5151

5252
installationIDObserver = NotificationCenter.default.addObserver(
@@ -63,7 +63,7 @@ class IdChangedStreamHandler: NSObject, FlutterStreamHandler {
6363
return nil
6464
}
6565

66-
public func onCancel(withArguments _: Any?) -> FlutterError? {
66+
func onCancel(withArguments _: Any?) -> FlutterError? {
6767
if let observer = installationIDObserver {
6868
NotificationCenter.default.removeObserver(observer)
6969
installationIDObserver = nil

packages/firebase_auth/firebase_auth/example/macos/Runner/AppDelegate.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ class AppDelegate: FlutterAppDelegate {
66
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
77
return true
88
}
9+
10+
override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
11+
return true
12+
}
913
}

packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.m

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,12 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
152152

153153
[registrar addMethodCallDelegate:instance channel:channel];
154154

155-
#if TARGET_OS_OSX
156-
// TODO(Salakar): Publish does not exist on MacOS version of
157-
// FlutterPluginRegistrar.
158-
// TODO(Salakar): addApplicationDelegate does not exist on MacOS version of
159-
// FlutterPluginRegistrar. (https://github.com/flutter/flutter/issues/41471)
160-
SetUpFirebaseAuthHostApi(registrar.messenger, instance);
161-
SetUpFirebaseAuthUserHostApi(registrar.messenger, instance);
162-
#else
163155
[registrar publish:instance];
164156
[registrar addApplicationDelegate:instance];
165157
SetUpFirebaseAuthHostApi(registrar.messenger, instance);
166158
SetUpFirebaseAuthUserHostApi(registrar.messenger, instance);
159+
160+
#if TARGET_OS_IPHONE
167161
SetUpMultiFactorUserHostApi(registrar.messenger, instance);
168162
SetUpMultiFactoResolverHostApi(registrar.messenger, instance);
169163
SetUpMultiFactorTotpHostApi(registrar.messenger, instance);

0 commit comments

Comments
 (0)