Skip to content

Instantly share code, notes, and snippets.

@KaneBuckthorpe
Created November 7, 2018 01:34
Show Gist options
  • Save KaneBuckthorpe/da9206cb7e34cba065496537c24737fa to your computer and use it in GitHub Desktop.
Save KaneBuckthorpe/da9206cb7e34cba065496537c24737fa to your computer and use it in GitHub Desktop.
SBIconModel useful methods + function for SBIconView Badges
/////THANKS @Tonyk766
///SBIconModel
-(void)deleteIconState;
Resets all icons states (which means removes folders and resets to default icons in dock and sorted the stock way)
-(BOOL)sortsIconsAlphabetically;
If true and then refresh/update/reload icons, apps will be sorted in alphabetical order
-(SBIcon *)leafIconForIdentifier:(NSString *)arg1;
returns value of `SBIcon`, could be used to get sbicon from just bundle id
-(NSDictionary *)leafIconsByIdentifier;
Dictionary with all apps' bundle id with their associeted sbicon
-(BOOL)isIconVisible:(SBIcon *)arg1;
If returned false the icon won't be visible.
-(void)layout;
Layout icons, could be used after a method to update the layout, example in -(void)loadAllIcons emthod
-(void)loadAllIcons;
Recycle/clear cahce of icons. icons won't appear apps layout again (could do that with -(void)layout)
SBIconView+Notifications.m
static SBIconView *iconViewForBundleID(NSString *bundleIdentifier, BOOL shouldAddBadge) {
SBApplication *app = [[%c(SBApplicationController) sharedInstanceIfExists] applicationWithBundleIdentifier:bundleIdentifier];
SBApplicationIcon *appIcon = [[%c(SBApplicationIcon) alloc] initWithApplication:app];
SBIconView *iconView = [[%c(SBIconView) alloc] initWithContentType:0];
[iconView _setIcon:appIcon animated:YES];
if (shouldAddBadge)
[%c(SBIconBadgeView) checkoutAccessoryImagesForIcon:appIcon location:0];
return iconView;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment