-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCBRAppList.m
More file actions
96 lines (85 loc) · 3 KB
/
CBRAppList.m
File metadata and controls
96 lines (85 loc) · 3 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#import "CBRAppList.h"
#import <objc/runtime.h>
@interface SBApplicationController : NSObject
+ (id)sharedInstance;
- (id)allBundleIdentifiers;
@end
@implementation CBRAppList
+ (NSArray *)allAppIdentifiers {
static NSArray *allAppIdentifiers = nil;
static dispatch_once_t predicate;
dispatch_once(&predicate, ^{
NSMutableArray *array = [NSMutableArray array];
SBApplicationController *controller = [objc_getClass("SBApplicationController") sharedInstance];
NSSet *hiddenIdentifiers = [self hiddenIdentifiers];
for (NSString *bundleIdentifier in [controller allBundleIdentifiers]) {
if (![hiddenIdentifiers containsObject:bundleIdentifier]) {
[array addObject:bundleIdentifier];
}
}
allAppIdentifiers = [array copy];
});
return allAppIdentifiers;
}
+ (NSString *)randomAppIdentifier {
NSArray *identifiers = [self allAppIdentifiers];
return identifiers[arc4random() % [identifiers count]];
}
// Thanks to AppList (https://github.com/rpetrich/AppList).
+ (NSSet *)hiddenIdentifiers {
return [NSSet setWithObjects:
@"com.apple.AdSheet",
@"com.apple.AdSheetPhone",
@"com.apple.AdSheetPad",
@"com.apple.DataActivation",
@"com.apple.DemoApp",
@"com.apple.Diagnostics",
@"com.apple.fieldtest",
@"com.apple.iosdiagnostics",
@"com.apple.iphoneos.iPodOut",
@"com.apple.TrustMe",
@"com.apple.WebSheet",
@"com.apple.springboard",
@"com.apple.purplebuddy",
@"com.apple.datadetectors.DDActionsService",
@"com.apple.FacebookAccountMigrationDialog",
@"com.apple.iad.iAdOptOut",
@"com.apple.ios.StoreKitUIService",
@"com.apple.TextInput.kbd",
@"com.apple.MailCompositionService",
@"com.apple.mobilesms.compose",
@"com.apple.quicklook.quicklookd",
@"com.apple.ShoeboxUIService",
@"com.apple.social.remoteui.SocialUIService",
@"com.apple.WebViewService",
@"com.apple.gamecenter.GameCenterUIService",
@"com.apple.appleaccount.AACredentialRecoveryDialog",
@"com.apple.CompassCalibrationViewService",
@"com.apple.WebContentFilter.remoteUI.WebContentAnalysisUI",
@"com.apple.PassbookUIService",
@"com.apple.uikit.PrintStatus",
@"com.apple.Copilot",
@"com.apple.MusicUIService",
@"com.apple.AccountAuthenticationDialog",
@"com.apple.MobileReplayer",
@"com.apple.SiriViewService",
@"com.apple.TencentWeiboAccountMigrationDialog",
// iOS 8.
@"com.apple.AskPermissionUI",
@"com.apple.CoreAuthUI",
@"com.apple.family",
@"com.apple.mobileme.fmip1",
@"com.apple.GameController",
@"com.apple.HealthPrivacyService",
@"com.apple.InCallService",
@"com.apple.mobilesms.notification",
@"com.apple.PhotosViewService",
@"com.apple.PreBoard",
@"com.apple.PrintKit.Print-Center",
@"com.apple.share",
@"com.apple.SharedWebCredentialViewService",
@"com.apple.webapp",
@"com.apple.webapp1",
nil];
}
@end