Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ typedef void (*FlutterPluginRegistrantCallback)(NSObject<FlutterPluginRegistry>*
/**
* Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- (void)application:(UIApplication*)application
didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings;
#pragma GCC diagnostic pop
didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings
API_DEPRECATED(
"See -[UIApplicationDelegate application:didRegisterUserNotificationSettings:] deprecation",
ios(8.0, 10.0));

/**
* Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
Expand All @@ -145,7 +145,10 @@ typedef void (*FlutterPluginRegistrantCallback)(NSObject<FlutterPluginRegistry>*
* Calls all plugins registered for `UIApplicationDelegate` callbacks.
*/
- (void)application:(UIApplication*)application
didReceiveLocalNotification:(UILocalNotification*)notification;
didReceiveLocalNotification:(UILocalNotification*)notification
API_DEPRECATED(
"See -[UIApplicationDelegate application:didReceiveLocalNotification:] deprecation",
ios(4.0, 10.0));

/**
* Calls all plugins registered for `UNUserNotificationCenterDelegate` callbacks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ FLUTTER_EXPORT
/**
* Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- (void)application:(UIApplication*)application
didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings;
#pragma GCC diagnostic pop
didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings
API_DEPRECATED(
"See -[UIApplicationDelegate application:didRegisterUserNotificationSettings:] deprecation",
ios(8.0, 10.0));

/**
* Calls all plugins registered for `UIApplicationDelegate` callbacks.
Expand All @@ -90,7 +90,10 @@ FLUTTER_EXPORT
* Calls all plugins registered for `UIApplicationDelegate` callbacks.
*/
- (void)application:(UIApplication*)application
didReceiveLocalNotification:(UILocalNotification*)notification;
didReceiveLocalNotification:(UILocalNotification*)notification
API_DEPRECATED(
"See -[UIApplicationDelegate application:didReceiveLocalNotification:] deprecation",
ios(4.0, 10.0));

/**
* Calls all plugins registered for `UNUserNotificationCenterDelegate` callbacks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,13 @@ - (void)application:(UIApplication*)application
didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

#pragma GCC diagnostic push
Copy link
Contributor

Choose a reason for hiding this comment

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

This overall looks good, are these the best we can do though? Would it make any sense to just conditionally compile them instead based on the SDK level?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't want the symbol to disappear if they change the deployment target. As of March, all apps submitted to the App Store must use iOS SDK 12, and the flutter create template defaults to iOS 8. Since the replacement APIs aren't drag-and-drop, it will probably take some thought for developers to move off of them, and I don't want them to rush the process because they need to make an App Store submission to, say, fix a critical bug, but they can't compile because this symbol is gone. I'd rather pass the buck of behavior changes off to UIKit and give developers a warning that they need to swap it out.

Deprecating in the header and suppressing the deprecation warning in the implementation is the strange but standard pattern. :-(

#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- (void)application:(UIApplication*)application
didReceiveLocalNotification:(UILocalNotification*)notification {
[_lifeCycleDelegate application:application didReceiveLocalNotification:notification];
}
#pragma GCC diagnostic pop

- (void)userNotificationCenter:(UNUserNotificationCenter*)center
willPresentNotification:(UNNotification*)notification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ - (void)application:(UIApplication*)application
}
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- (void)application:(UIApplication*)application
didReceiveLocalNotification:(UILocalNotification*)notification {
for (id<FlutterPlugin> plugin in _pluginDelegates) {
Expand All @@ -239,6 +241,7 @@ - (void)application:(UIApplication*)application
}
}
}
#pragma GCC diagnostic pop

- (void)userNotificationCenter:(UNUserNotificationCenter*)center
willPresentNotification:(UNNotification*)notification
Expand Down