-
Notifications
You must be signed in to change notification settings - Fork 12
/
SBIconListModel.xm
50 lines (42 loc) · 1.43 KB
/
SBIconListModel.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#import "HSWidgetViewController.h"
#import "SBIconListModel.h"
%hook SBIconListModel
%property (nonatomic, assign) PageType pageLayoutType; // PageType enum
%property (nonatomic, retain) NSMutableArray *widgetViewControllers;
-(instancetype)initWithFolder:(id)arg1 maxIconCount:(NSUInteger)arg2 { // iOS 10 - 12
self = %orig(arg1, arg2);
if (self != nil) {
self.pageLayoutType = PageTypeNone;
self.widgetViewControllers = nil;
}
return self;
}
-(instancetype)initWithUniqueIdentifier:(id)arg1 folder:(id)arg2 maxIconCount:(NSUInteger)arg3 { // iOS 13
self = %orig(arg1, arg2, arg3);
if (self != nil) {
self.pageLayoutType = PageTypeNone;
self.widgetViewControllers = nil;
}
return self;
}
-(BOOL)addIcon:(id)arg1 asDirty:(BOOL)arg2 {
BOOL result = %orig(arg1, arg2);
[[NSNotificationCenter defaultCenter] postNotificationName:HSWidgetAvailableSpaceDidChangeNotification object:nil userInfo:nil];
return result;
}
-(void)removeIconAtIndex:(NSUInteger)arg1 {
%orig(arg1);
[[NSNotificationCenter defaultCenter] postNotificationName:HSWidgetAvailableSpaceDidChangeNotification object:nil userInfo:nil];
}
-(void)dealloc {
if (self.widgetViewControllers != nil) {
for (HSWidgetViewController *widgetViewController in self.widgetViewControllers) {
[widgetViewController _setDelegate:nil];
[widgetViewController.view removeFromSuperview];
[widgetViewController release];
}
self.widgetViewControllers = nil;
}
%orig();
}
%end