forked from iMokhles/Cydia-Pull-Down
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tweak.xm
64 lines (49 loc) · 1.48 KB
/
Tweak.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <substrate.h>
#import <iMoMacros.h>
@interface Cydia
- (bool)requestUpdate;
@end
BOOL isSearchPage;
%hook FilteredPackageListController
- (void) viewWillAppear:(BOOL)animated {
UITableView *mainList = MSHookIvar<UITableView *>(self, "list_");
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];
if (!isSearchPage)
[mainList addSubview:refreshControl];
%orig;
}
%new
-(void)handleRefresh:(UIRefreshControl *)refresh {
Cydia *cyAppDelegate = (Cydia *)[UIApplication sharedApplication];
[cyAppDelegate requestUpdate];
[refresh endRefreshing];
}
%end
%hook SourcesController
- (void) viewWillAppear:(BOOL)animated {
UITableView *mainList = MSHookIvar<UITableView *>(self, "list_");
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];
[mainList addSubview:refreshControl];
%orig;
}
%new
-(void)handleRefresh:(UIRefreshControl *)refresh {
Cydia *cyAppDelegate = (Cydia *)[UIApplication sharedApplication];
[cyAppDelegate requestUpdate];
[refresh endRefreshing];
}
%end
%hook SearchController
- (void) viewWillAppear:(BOOL)animated {
isSearchPage = YES;
%orig;
}
- (void) viewDisappear:(BOOL)animated {
isSearchPage = NO;
%orig;
}
%end