Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
format
  • Loading branch information
jmagman committed Aug 14, 2025
commit eef8b0a0283c6e41014694e0757d8d3441808b16
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,35 @@ @implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
if (@available(iOS 14, *)) {
if (@available(iOS 14, *)) {
// Seed the photo library with at least one image for tests to operate on.
NSString *photoAddedKey = @"PhotoAdded";
BOOL photoAdded = [NSUserDefaults.standardUserDefaults boolForKey:photoAddedKey];
if (!photoAdded) {
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
__block NSError *saveError = nil;
[PHPhotoLibrary
requestAuthorizationForAccessLevel:PHAccessLevelAddOnly
handler:^(PHAuthorizationStatus status) {
if ([PHPhotoLibrary.sharedPhotoLibrary
performChangesAndWait:^{
NSURL *jpgImageTall =
[bundle URLForResource:@"jpgImageTall"
withExtension:@"jpg"];
[PHAssetChangeRequest
creationRequestForAssetFromImageAtFileURL:
jpgImageTall];
}
error:&saveError]) {
[NSUserDefaults.standardUserDefaults setBool:YES forKey:photoAddedKey];
} else {
os_log_error(OS_LOG_DEFAULT, "%@", saveError);
}
}];
}
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
__block NSError *saveError = nil;
[PHPhotoLibrary
requestAuthorizationForAccessLevel:PHAccessLevelAddOnly
handler:^(PHAuthorizationStatus status) {
if ([PHPhotoLibrary.sharedPhotoLibrary
performChangesAndWait:^{
NSURL *jpgImageTall =
[bundle URLForResource:@"jpgImageTall"
withExtension:@"jpg"];
[PHAssetChangeRequest
creationRequestForAssetFromImageAtFileURL:
jpgImageTall];
}
error:&saveError]) {
[NSUserDefaults.standardUserDefaults
setBool:YES
forKey:photoAddedKey];
} else {
os_log_error(OS_LOG_DEFAULT, "%@", saveError);
}
}];
}
}
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

Expand Down