Skip to content

Commit

Permalink
show app icons in prefs
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanArbuckle committed Jan 18, 2021
1 parent 254eab8 commit f83f107
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions carplayenableprefs/CPAppListController.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
NSDictionary *currentApp = _appList[indexPath.row];
NSString *appName = currentApp[@"name"];
NSString *appIdentifier = currentApp[@"bundleID"];
UIImage *appIcon = [UIImage imageWithData:currentApp[@"iconImage"]];

// Setup the cell
[[cell textLabel] setText:appName];
[[cell imageView] setImage:appIcon];
if ([self isAppCarplayEnabled:appIdentifier])
{
[cell setAccessoryType:UITableViewCellAccessoryCheckmark];
Expand Down
7 changes: 6 additions & 1 deletion src/hooks/SpringBoard.xm
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,14 @@ Invoked when SpringBoard finishes launching
continue;
}

// Grab icon data
UIImage *appIconImage = objcInvoke_3(objc_getClass("UIImage"), @"_applicationIconImageForBundleIdentifier:format:scale:", identifier, 0, [UIScreen mainScreen].scale);
NSData *iconImageData = UIImagePNGRepresentation(appIconImage);

NSDictionary *appInfoDict = @{
@"name": objcInvoke(appInfo, @"displayName"),
@"bundleID": identifier
@"bundleID": identifier,
@"iconImage": iconImageData
};
[appList addObject:appInfoDict];

Expand Down

0 comments on commit f83f107

Please sign in to comment.