Skip to content

Commit d6db986

Browse files
committed
format
1 parent a3d2475 commit d6db986

File tree

1 file changed

+24
-22
lines changed
  • packages/image_picker/image_picker_ios/example/ios/Runner

1 file changed

+24
-22
lines changed

packages/image_picker/image_picker_ios/example/ios/Runner/AppDelegate.m

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,35 @@ @implementation AppDelegate
1313
- (BOOL)application:(UIApplication *)application
1414
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
1515
[GeneratedPluginRegistrant registerWithRegistry:self];
16-
if (@available(iOS 14, *)) {
16+
if (@available(iOS 14, *)) {
1717
// Seed the photo library with at least one image for tests to operate on.
1818
NSString *photoAddedKey = @"PhotoAdded";
1919
BOOL photoAdded = [NSUserDefaults.standardUserDefaults boolForKey:photoAddedKey];
2020
if (!photoAdded) {
21-
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
22-
__block NSError *saveError = nil;
23-
[PHPhotoLibrary
24-
requestAuthorizationForAccessLevel:PHAccessLevelAddOnly
25-
handler:^(PHAuthorizationStatus status) {
26-
if ([PHPhotoLibrary.sharedPhotoLibrary
27-
performChangesAndWait:^{
28-
NSURL *jpgImageTall =
29-
[bundle URLForResource:@"jpgImageTall"
30-
withExtension:@"jpg"];
31-
[PHAssetChangeRequest
32-
creationRequestForAssetFromImageAtFileURL:
33-
jpgImageTall];
34-
}
35-
error:&saveError]) {
36-
[NSUserDefaults.standardUserDefaults setBool:YES forKey:photoAddedKey];
37-
} else {
38-
os_log_error(OS_LOG_DEFAULT, "%@", saveError);
39-
}
40-
}];
41-
}
21+
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
22+
__block NSError *saveError = nil;
23+
[PHPhotoLibrary
24+
requestAuthorizationForAccessLevel:PHAccessLevelAddOnly
25+
handler:^(PHAuthorizationStatus status) {
26+
if ([PHPhotoLibrary.sharedPhotoLibrary
27+
performChangesAndWait:^{
28+
NSURL *jpgImageTall =
29+
[bundle URLForResource:@"jpgImageTall"
30+
withExtension:@"jpg"];
31+
[PHAssetChangeRequest
32+
creationRequestForAssetFromImageAtFileURL:
33+
jpgImageTall];
34+
}
35+
error:&saveError]) {
36+
[NSUserDefaults.standardUserDefaults
37+
setBool:YES
38+
forKey:photoAddedKey];
39+
} else {
40+
os_log_error(OS_LOG_DEFAULT, "%@", saveError);
41+
}
42+
}];
4243
}
44+
}
4345
return [super application:application didFinishLaunchingWithOptions:launchOptions];
4446
}
4547

0 commit comments

Comments
 (0)