Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5ff70d0

Browse files
committed
Use getter syntax rather than referencing ivar directly
Except in the initialiser, where `self` is not yet fully initialised. In this case, it's a simple property so this really makes no real difference, but best practices etc.
1 parent c353189 commit 5ff70d0

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ - (instancetype)init {
3434

3535
- (BOOL)application:(UIApplication*)application
3636
willFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
37-
return [_lifeCycleDelegate application:application willFinishLaunchingWithOptions:launchOptions];
37+
return [self.lifeCycleDelegate application:application
38+
willFinishLaunchingWithOptions:launchOptions];
3839
}
3940

4041
- (BOOL)application:(UIApplication*)application
4142
didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
42-
return [_lifeCycleDelegate application:application didFinishLaunchingWithOptions:launchOptions];
43+
return [self.lifeCycleDelegate application:application
44+
didFinishLaunchingWithOptions:launchOptions];
4345
}
4446

4547
// Returns the key window's rootViewController, if it's a FlutterViewController.
@@ -79,39 +81,39 @@ - (void)applicationWillTerminate:(UIApplication*)application {
7981
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
8082
- (void)application:(UIApplication*)application
8183
didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings {
82-
[_lifeCycleDelegate application:application
84+
[self.lifeCycleDelegate application:application
8385
didRegisterUserNotificationSettings:notificationSettings];
8486
}
8587
#pragma GCC diagnostic pop
8688

8789
- (void)application:(UIApplication*)application
8890
didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
89-
[_lifeCycleDelegate application:application
91+
[self.lifeCycleDelegate application:application
9092
didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
9193
}
9294

9395
- (void)application:(UIApplication*)application
9496
didFailToRegisterForRemoteNotificationsWithError:(NSError*)error {
95-
[_lifeCycleDelegate application:application
97+
[self.lifeCycleDelegate application:application
9698
didFailToRegisterForRemoteNotificationsWithError:error];
9799
}
98100

99101
#pragma GCC diagnostic push
100102
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
101103
- (void)application:(UIApplication*)application
102104
didReceiveLocalNotification:(UILocalNotification*)notification {
103-
[_lifeCycleDelegate application:application didReceiveLocalNotification:notification];
105+
[self.lifeCycleDelegate application:application didReceiveLocalNotification:notification];
104106
}
105107
#pragma GCC diagnostic pop
106108

107109
- (void)userNotificationCenter:(UNUserNotificationCenter*)center
108110
willPresentNotification:(UNNotification*)notification
109111
withCompletionHandler:
110112
(void (^)(UNNotificationPresentationOptions options))completionHandler {
111-
if ([_lifeCycleDelegate respondsToSelector:_cmd]) {
112-
[_lifeCycleDelegate userNotificationCenter:center
113-
willPresentNotification:notification
114-
withCompletionHandler:completionHandler];
113+
if ([self.lifeCycleDelegate respondsToSelector:_cmd]) {
114+
[self.lifeCycleDelegate userNotificationCenter:center
115+
willPresentNotification:notification
116+
withCompletionHandler:completionHandler];
115117
}
116118
}
117119

@@ -121,10 +123,10 @@ - (void)userNotificationCenter:(UNUserNotificationCenter*)center
121123
- (void)userNotificationCenter:(UNUserNotificationCenter*)center
122124
didReceiveNotificationResponse:(UNNotificationResponse*)response
123125
withCompletionHandler:(void (^)(void))completionHandler {
124-
if ([_lifeCycleDelegate respondsToSelector:_cmd]) {
125-
[_lifeCycleDelegate userNotificationCenter:center
126-
didReceiveNotificationResponse:response
127-
withCompletionHandler:completionHandler];
126+
if ([self.lifeCycleDelegate respondsToSelector:_cmd]) {
127+
[self.lifeCycleDelegate userNotificationCenter:center
128+
didReceiveNotificationResponse:response
129+
withCompletionHandler:completionHandler];
128130
}
129131
}
130132

@@ -139,7 +141,7 @@ - (BOOL)isFlutterDeepLinkingEnabled {
139141
- (BOOL)application:(UIApplication*)application
140142
openURL:(NSURL*)url
141143
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options {
142-
if ([_lifeCycleDelegate application:application openURL:url options:options]) {
144+
if ([self.lifeCycleDelegate application:application openURL:url options:options]) {
143145
return YES;
144146
}
145147

@@ -172,31 +174,31 @@ - (BOOL)handleOpenURL:(NSURL*)url
172174
}
173175

174176
- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url {
175-
return [_lifeCycleDelegate application:application handleOpenURL:url];
177+
return [self.lifeCycleDelegate application:application handleOpenURL:url];
176178
}
177179

178180
- (BOOL)application:(UIApplication*)application
179181
openURL:(NSURL*)url
180182
sourceApplication:(NSString*)sourceApplication
181183
annotation:(id)annotation {
182-
return [_lifeCycleDelegate application:application
183-
openURL:url
184-
sourceApplication:sourceApplication
185-
annotation:annotation];
184+
return [self.lifeCycleDelegate application:application
185+
openURL:url
186+
sourceApplication:sourceApplication
187+
annotation:annotation];
186188
}
187189

188190
- (void)application:(UIApplication*)application
189191
performActionForShortcutItem:(UIApplicationShortcutItem*)shortcutItem
190192
completionHandler:(void (^)(BOOL succeeded))completionHandler {
191-
[_lifeCycleDelegate application:application
192-
performActionForShortcutItem:shortcutItem
193-
completionHandler:completionHandler];
193+
[self.lifeCycleDelegate application:application
194+
performActionForShortcutItem:shortcutItem
195+
completionHandler:completionHandler];
194196
}
195197

196198
- (void)application:(UIApplication*)application
197199
handleEventsForBackgroundURLSession:(nonnull NSString*)identifier
198200
completionHandler:(nonnull void (^)())completionHandler {
199-
[_lifeCycleDelegate application:application
201+
[self.lifeCycleDelegate application:application
200202
handleEventsForBackgroundURLSession:identifier
201203
completionHandler:completionHandler];
202204
}
@@ -207,9 +209,9 @@ - (BOOL)application:(UIApplication*)application
207209
restorationHandler:
208210
(void (^)(NSArray<id<UIUserActivityRestoring>>* __nullable restorableObjects))
209211
restorationHandler {
210-
if ([_lifeCycleDelegate application:application
211-
continueUserActivity:userActivity
212-
restorationHandler:restorationHandler]) {
212+
if ([self.lifeCycleDelegate application:application
213+
continueUserActivity:userActivity
214+
restorationHandler:restorationHandler]) {
213215
return YES;
214216
}
215217

@@ -245,30 +247,30 @@ - (NSObject*)valuePublishedByPlugin:(NSString*)pluginKey {
245247
#pragma mark - Selectors handling
246248

247249
- (void)addApplicationLifeCycleDelegate:(NSObject<FlutterApplicationLifeCycleDelegate>*)delegate {
248-
[_lifeCycleDelegate addDelegate:delegate];
250+
[self.lifeCycleDelegate addDelegate:delegate];
249251
}
250252

251253
#pragma mark - UIApplicationDelegate method dynamic implementation
252254

253255
- (BOOL)respondsToSelector:(SEL)selector {
254-
if ([_lifeCycleDelegate isSelectorAddedDynamically:selector]) {
256+
if ([self.lifeCycleDelegate isSelectorAddedDynamically:selector]) {
255257
return [self delegateRespondsSelectorToPlugins:selector];
256258
}
257259
return [super respondsToSelector:selector];
258260
}
259261

260262
- (BOOL)delegateRespondsSelectorToPlugins:(SEL)selector {
261-
if ([_lifeCycleDelegate hasPluginThatRespondsToSelector:selector]) {
262-
return [_lifeCycleDelegate respondsToSelector:selector];
263+
if ([self.lifeCycleDelegate hasPluginThatRespondsToSelector:selector]) {
264+
return [self.lifeCycleDelegate respondsToSelector:selector];
263265
} else {
264266
return NO;
265267
}
266268
}
267269

268270
- (id)forwardingTargetForSelector:(SEL)aSelector {
269-
if ([_lifeCycleDelegate isSelectorAddedDynamically:aSelector]) {
271+
if ([self.lifeCycleDelegate isSelectorAddedDynamically:aSelector]) {
270272
[self logCapabilityConfigurationWarningIfNeeded:aSelector];
271-
return _lifeCycleDelegate;
273+
return self.lifeCycleDelegate;
272274
}
273275
return [super forwardingTargetForSelector:aSelector];
274276
}

0 commit comments

Comments
 (0)