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

Commit 9c9931a

Browse files
committed
format
1 parent 3b2d3d4 commit 9c9931a

7 files changed

+119
-104
lines changed

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

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -309,33 +309,36 @@ - (void)logCapabilityConfigurationWarningIfNeeded:(SEL)selector {
309309
}
310310
}
311311
}
312-
312+
313313
#pragma mark - State Restoration
314314

315-
- (BOOL)application:(UIApplication *)application shouldSaveApplicationState:(NSCoder *)coder {
316-
[coder encodeInt64: self.lastAppModificationTime forKey:@"mod-date"];
315+
- (BOOL)application:(UIApplication*)application shouldSaveApplicationState:(NSCoder*)coder {
316+
[coder encodeInt64:self.lastAppModificationTime forKey:@"mod-date"];
317317
return YES;
318318
}
319-
320-
- (BOOL)application:(UIApplication *)application shouldRestoreApplicationState:(NSCoder *)coder {
319+
320+
- (BOOL)application:(UIApplication*)application shouldRestoreApplicationState:(NSCoder*)coder {
321321
int64_t stateDate = [coder decodeInt64ForKey:@"mod-date"];
322322
return self.lastAppModificationTime == stateDate;
323323
}
324-
325-
- (BOOL)application:(UIApplication *)application shouldSaveSecureApplicationState:(NSCoder *)coder {
326-
[coder encodeInt64: self.lastAppModificationTime forKey:@"mod-date"];
324+
325+
- (BOOL)application:(UIApplication*)application shouldSaveSecureApplicationState:(NSCoder*)coder {
326+
[coder encodeInt64:self.lastAppModificationTime forKey:@"mod-date"];
327327
return YES;
328328
}
329329

330-
- (BOOL)application:(UIApplication *)application shouldRestoreSecureApplicationState:(NSCoder *)coder {
330+
- (BOOL)application:(UIApplication*)application
331+
shouldRestoreSecureApplicationState:(NSCoder*)coder {
331332
int64_t stateDate = [coder decodeInt64ForKey:@"mod-date"];
332333
return self.lastAppModificationTime == stateDate;
333334
}
334-
335+
335336
- (int64_t)lastAppModificationTime {
336-
NSDate *fileDate;
337-
[[[NSBundle mainBundle] executableURL] getResourceValue:&fileDate forKey:NSURLContentModificationDateKey error:nil];
337+
NSDate* fileDate;
338+
[[[NSBundle mainBundle] executableURL] getResourceValue:&fileDate
339+
forKey:NSURLContentModificationDateKey
340+
error:nil];
338341
return [fileDate timeIntervalSince1970];
339342
}
340-
343+
341344
@end

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ - (instancetype)initWithName:(NSString*)labelPrefix project:(FlutterDartProject*
106106
- (instancetype)initWithName:(NSString*)labelPrefix
107107
project:(FlutterDartProject*)project
108108
allowHeadlessExecution:(BOOL)allowHeadlessExecution {
109-
return [self initWithName:labelPrefix project:project allowHeadlessExecution:allowHeadlessExecution restorationEnabled:NO];
109+
return [self initWithName:labelPrefix
110+
project:project
111+
allowHeadlessExecution:allowHeadlessExecution
112+
restorationEnabled:NO];
110113
}
111114

112115
- (instancetype)initWithName:(NSString*)labelPrefix
@@ -435,7 +438,7 @@ - (void)setupChannels {
435438
initWithName:@"flutter/restoration"
436439
binaryMessenger:self.binaryMessenger
437440
codec:[FlutterStandardMethodCodec sharedInstance]]);
438-
441+
439442
_platformChannel.reset([[FlutterMethodChannel alloc]
440443
initWithName:@"flutter/platform"
441444
binaryMessenger:self.binaryMessenger
@@ -475,8 +478,10 @@ - (void)setupChannels {
475478
_textInputPlugin.get().textInputDelegate = self;
476479

477480
_platformPlugin.reset([[FlutterPlatformPlugin alloc] initWithEngine:[self getWeakPtr]]);
478-
479-
_restorationPlugin.reset([[FlutterRestorationPlugin alloc] initWithChannel:_restorationChannel.get() restorationEnabled:_restorationEnabled]);
481+
482+
_restorationPlugin.reset([[FlutterRestorationPlugin alloc]
483+
initWithChannel:_restorationChannel.get()
484+
restorationEnabled:_restorationEnabled]);
480485
}
481486

482487
- (void)maybeSetupPlatformViewChannels {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ - (instancetype)initWithName:(NSString*)labelPrefix
4444
- (instancetype)initWithName:(NSString*)labelPrefix
4545
project:(FlutterDartProject*)projectOrNil
4646
allowHeadlessExecution:(BOOL)allowHeadlessExecution
47-
restorationEnabled:(BOOL)restorationEnabled{
47+
restorationEnabled:(BOOL)restorationEnabled {
4848
NSAssert(allowHeadlessExecution == YES,
4949
@"Cannot initialize a FlutterHeadlessDartRunner without headless execution.");
5050
return [super initWithName:labelPrefix

shell/platform/darwin/ios/framework/Source/FlutterRestorationPlugin.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
@interface FlutterRestorationPlugin : NSObject
1414
- (instancetype)init NS_UNAVAILABLE;
1515
+ (instancetype)new NS_UNAVAILABLE;
16-
- (instancetype)initWithChannel:(FlutterMethodChannel*)channel restorationEnabled:(BOOL)waitForData NS_DESIGNATED_INITIALIZER;
16+
- (instancetype)initWithChannel:(FlutterMethodChannel*)channel
17+
restorationEnabled:(BOOL)waitForData NS_DESIGNATED_INITIALIZER;
1718

1819
- (NSData*)restorationData;
19-
- (void)restorationData:(NSData *)data;
20+
- (void)restorationData:(NSData*)data;
2021
- (void)restorationComplete;
2122
- (void)reset;
2223
@end

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include "flutter/fml/logging.h"
1111

12-
1312
@implementation FlutterRestorationPlugin {
1413
BOOL _waitForData;
1514
BOOL _restorationEnabled;
@@ -18,12 +17,14 @@ @implementation FlutterRestorationPlugin {
1817
}
1918

2019
- (instancetype)init {
21-
@throw([NSException exceptionWithName:@"FlutterRestorationPlugin must initWithChannel:restorationEnabled:"
22-
reason:nil
23-
userInfo:nil]);
20+
@throw([NSException
21+
exceptionWithName:@"FlutterRestorationPlugin must initWithChannel:restorationEnabled:"
22+
reason:nil
23+
userInfo:nil]);
2424
}
2525

26-
- (instancetype)initWithChannel:(FlutterMethodChannel*)channel restorationEnabled:(BOOL)restorationEnabled {
26+
- (instancetype)initWithChannel:(FlutterMethodChannel*)channel
27+
restorationEnabled:(BOOL)restorationEnabled {
2728
FML_DCHECK(channel) << "channel must be set";
2829
self = [super init];
2930
if (self) {
@@ -47,7 +48,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
4748
result(nil);
4849
} else if ([[call method] isEqualToString:@"get"]) {
4950
if (!_restorationEnabled || !_waitForData) {
50-
result( [self dataForFramework] );
51+
result([self dataForFramework]);
5152
return;
5253
}
5354
_pendingRequest = [result retain];
@@ -68,7 +69,7 @@ - (void)restorationData:(NSData*)data {
6869
_restorationData = newData;
6970
_waitForData = NO;
7071
if (_pendingRequest != nil) {
71-
_pendingRequest( [self dataForFramework] );
72+
_pendingRequest([self dataForFramework]);
7273
[_pendingRequest release];
7374
_pendingRequest = nil;
7475
}
@@ -78,7 +79,7 @@ - (void)restorationComplete {
7879
_waitForData = NO;
7980
if (_pendingRequest != nil) {
8081
NSAssert(_restorationEnabled, @"No request can be pending when restoration is disabled.");
81-
_pendingRequest( [self dataForFramework] );
82+
_pendingRequest([self dataForFramework]);
8283
[_pendingRequest release];
8384
_pendingRequest = nil;
8485
}
@@ -97,12 +98,15 @@ - (void)reset {
9798

9899
- (NSDictionary*)dataForFramework {
99100
if (!_restorationEnabled) {
100-
return @{ @"enabled": @NO };
101+
return @{@"enabled" : @NO};
101102
}
102103
if (_restorationData == nil) {
103-
return @{ @"enabled": @YES };
104+
return @{@"enabled" : @YES};
104105
}
105-
return @{@"enabled": @YES, @"data": [FlutterStandardTypedData typedDataWithBytes:_restorationData]};
106+
return @{
107+
@"enabled" : @YES,
108+
@"data" : [FlutterStandardTypedData typedDataWithBytes:_restorationData]
109+
};
106110
}
107111

108112
@end

0 commit comments

Comments
 (0)