From 9da06edbc349b453728406dd68f39740ec43843c Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Tue, 11 Jun 2019 18:32:59 -0700 Subject: [PATCH 1/2] Decorate UIApplicationDelegate wrappers with matching UIKit deprecation --- .../platform/darwin/ios/framework/Headers/FlutterPlugin.h | 7 ++----- .../framework/Headers/FlutterPluginAppLifeCycleDelegate.h | 7 ++----- .../darwin/ios/framework/Source/FlutterAppDelegate.mm | 3 +++ .../framework/Source/FlutterPluginAppLifeCycleDelegate.mm | 4 ++++ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h b/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h index 9f5c8c3541db0..3d42bc2e4b833 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h @@ -120,11 +120,8 @@ typedef void (*FlutterPluginRegistrantCallback)(NSObject* /** * 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. @@ -145,7 +142,7 @@ typedef void (*FlutterPluginRegistrantCallback)(NSObject* * 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. diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h b/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h index d593606b6ff8f..9feb9894acb69 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h @@ -67,11 +67,8 @@ 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. @@ -90,7 +87,7 @@ 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. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index f0dd78e111457..b918437cf6f69 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -92,10 +92,13 @@ - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } +#pragma GCC diagnostic push +#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 diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm index afeff246fcd82..884af0d5f08da 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm @@ -228,6 +228,9 @@ - (void)application:(UIApplication*)application } } + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - (void)application:(UIApplication*)application didReceiveLocalNotification:(UILocalNotification*)notification { for (id plugin in _pluginDelegates) { @@ -239,6 +242,7 @@ - (void)application:(UIApplication*)application } } } +#pragma GCC diagnostic pop - (void)userNotificationCenter:(UNUserNotificationCenter*)center willPresentNotification:(UNNotification*)notification From 2b3fc570977a31c978bda6ec4a27986ed67988e6 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Wed, 12 Jun 2019 15:42:27 -0700 Subject: [PATCH 2/2] Run format.sh --- .../darwin/ios/framework/Headers/FlutterPlugin.h | 10 ++++++++-- .../Headers/FlutterPluginAppLifeCycleDelegate.h | 10 ++++++++-- .../Source/FlutterPluginAppLifeCycleDelegate.mm | 1 - 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h b/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h index 3d42bc2e4b833..8d63dbc02caad 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h @@ -121,7 +121,10 @@ typedef void (*FlutterPluginRegistrantCallback)(NSObject* * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. */ - (void)application:(UIApplication*)application - didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings API_DEPRECATED("See -[UIApplicationDelegate application:didRegisterUserNotificationSettings:] deprecation", ios(8.0, 10.0)); + 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. @@ -142,7 +145,10 @@ typedef void (*FlutterPluginRegistrantCallback)(NSObject* * Calls all plugins registered for `UIApplicationDelegate` callbacks. */ - (void)application:(UIApplication*)application - didReceiveLocalNotification:(UILocalNotification*)notification API_DEPRECATED("See -[UIApplicationDelegate application:didReceiveLocalNotification:] deprecation", ios(4.0, 10.0)); + didReceiveLocalNotification:(UILocalNotification*)notification + API_DEPRECATED( + "See -[UIApplicationDelegate application:didReceiveLocalNotification:] deprecation", + ios(4.0, 10.0)); /** * Calls all plugins registered for `UNUserNotificationCenterDelegate` callbacks. diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h b/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h index 9feb9894acb69..b791d907a59f5 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h @@ -68,7 +68,10 @@ FLUTTER_EXPORT * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. */ - (void)application:(UIApplication*)application - didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings API_DEPRECATED("See -[UIApplicationDelegate application:didRegisterUserNotificationSettings:] deprecation", ios(8.0, 10.0)); + didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings + API_DEPRECATED( + "See -[UIApplicationDelegate application:didRegisterUserNotificationSettings:] deprecation", + ios(8.0, 10.0)); /** * Calls all plugins registered for `UIApplicationDelegate` callbacks. @@ -87,7 +90,10 @@ FLUTTER_EXPORT * Calls all plugins registered for `UIApplicationDelegate` callbacks. */ - (void)application:(UIApplication*)application - didReceiveLocalNotification:(UILocalNotification*)notification API_DEPRECATED("See -[UIApplicationDelegate application:didReceiveLocalNotification:] deprecation", ios(4.0, 10.0)); + didReceiveLocalNotification:(UILocalNotification*)notification + API_DEPRECATED( + "See -[UIApplicationDelegate application:didReceiveLocalNotification:] deprecation", + ios(4.0, 10.0)); /** * Calls all plugins registered for `UNUserNotificationCenterDelegate` callbacks. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm index 884af0d5f08da..37016945dfd8d 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm @@ -228,7 +228,6 @@ - (void)application:(UIApplication*)application } } - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - (void)application:(UIApplication*)application