Skip to content

Instantly share code, notes, and snippets.

@jontelang
Created March 15, 2013 05:54
Show Gist options
  • Save jontelang/5167753 to your computer and use it in GitHub Desktop.
Save jontelang/5167753 to your computer and use it in GitHub Desktop.
arrivar
%hook SBUIController
@interface SBIconController : NSObject
+(id)sharedInstance;
@end
@interface SBIconListView : UIView
@end
@interface SBIconListModel : NSObject
-(id)icons;
@end
@interface SBApplicationIcon
-(id)displayName;
-(void)setBadge:(id)arg;
@end
+(id)sharedInstance{
id s = %orig;
//NSLog(@" - - x x x x x x x x x x xx x x x x x x x x x x x x x x x x x x x x x accessing sharedInstance");
SBIconController *sbic = [objc_getClass("SBIconController") sharedInstance];
//NSLog(@"sbic: %@", sbic);
NSMutableArray *arr = MSHookIvar<NSMutableArray *>(sbic, "_rootIconLists");
//NSLog(@"arr: %@", arr);
if( [arr count] > 0 )
{
SBIconListView *ilv = [arr objectAtIndex:0];
//NSLog(@"ivl: %@", ilv);
SBIconListModel *model = MSHookIvar<SBIconListModel *>(ilv, "_model");
//NSLog(@"model: %@", model);
//NSLog(@"model -icons: %@", [model icons]);
for(SBApplicationIcon *icon in [model icons])
{
//NSLog(@"icon: %@", [icon displayName]);
if( [[icon displayName] isEqual:@"Clock"] )
{
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.apple.mobiletimer.plist"];
NSArray *alarms = [dict valueForKey:@"Alarms"];
NSDictionary *alarm_0 = [alarms objectAtIndex:0];
int hour = [[alarm_0 valueForKey:@"hour"] intValue];
int minute = [[alarm_0 valueForKey:@"minute"] intValue];
NSString *str_hour = [NSString stringWithFormat:@"%i",hour];
NSString *str_minute = [NSString stringWithFormat:@"%i",minute];
if(hour < 10){ str_hour = [NSString stringWithFormat:@"0%i",hour]; }
if(minute < 10){ str_minute = [NSString stringWithFormat:@"0%i",minute]; }
[icon setBadge:[NSString stringWithFormat:@"%@:%@",str_hour,str_minute]];
}
}
}
return s;
}
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment