[ios] Always create light mode categories icons for the system search

Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
Yannik Bloscheck
2025-07-12 01:11:00 +02:00
committed by Konstantin Pastbin
parent 9c70433007
commit 73a3d1850b

View File

@@ -44,11 +44,12 @@
NSString * categoryKeyString = @(categoryKey.c_str()); NSString * categoryKeyString = @(categoryKey.c_str());
NSString * imageName = [NSString stringWithFormat:@"Search/Categories/%@", [categoryKeyString stringByReplacingOccurrencesOfString: @"category_" withString:@""]]; NSString * imageName = [NSString stringWithFormat:@"Search/Categories/%@", [categoryKeyString stringByReplacingOccurrencesOfString: @"category_" withString:@""]];
UIImage * image = [UIImage imageNamed:imageName inBundle:nil compatibleWithTraitCollection:[UITraitCollection traitCollectionWithUserInterfaceStyle: UIUserInterfaceStyleLight]];
UIGraphicsBeginImageContext(CGSizeMake(360, 360)); UIGraphicsBeginImageContext(CGSizeMake(360, 360));
[[UIImage imageNamed:imageName] drawInRect:CGRectMake(0, 0, 360, 360)]; [image drawInRect:CGRectMake(0, 0, 360, 360)];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext(); UIImage * resizedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext() ; UIGraphicsEndImageContext() ;
attrSet.thumbnailData = UIImagePNGRepresentation(image); attrSet.thumbnailData = UIImagePNGRepresentation(resizedImage);
CSSearchableItem * item = CSSearchableItem * item =
[[CSSearchableItem alloc] initWithUniqueIdentifier:categoryKeyString [[CSSearchableItem alloc] initWithUniqueIdentifier:categoryKeyString