-
Notifications
You must be signed in to change notification settings - Fork 7
/
ForcyMenus.xm
135 lines (106 loc) · 6.58 KB
/
ForcyMenus.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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#import "Forcy.h"
%group SpringBoardMenus
%hook SpringBoard
-(void)applicationDidFinishLaunching:(id)application {
%orig();
[SAUIUnlockDevice unlockDevice];
SBApplication *photoApp = [[%c(SBApplicationController) sharedInstance] applicationWithBundleIdentifier:@"com.apple.mobileslideshow"];
UIApplicationShortcutIcon *photoSearchIcon = [UIApplicationShortcutIcon iconWithType:UIApplicationShortcutIconTypeSearch];
UIApplicationShortcutIcon *photoFavoritesIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:@"QuickActionFavorite-OrbHW"];
UIApplicationShortcutIcon *photosYearIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:@"QuickActionAYearAgo-OrbHW"];
SBSApplicationShortcutItem *photoSearch = [%c(SBSApplicationShortcutItem) alloc];
photoSearch.localizedTitle = @"Search";
photoSearch.type = @"com.apple.photos.shortcuts.search";
photoSearch.icon = [photoSearchIcon sbsShortcutIcon];
SBSApplicationShortcutItem *photoFavorites = [%c(SBSApplicationShortcutItem) alloc];
photoFavorites.localizedTitle = @"Favorites";
photoFavorites.type = @"com.apple.photos.shortcuts.favorites";
photoFavorites.icon = [photoFavoritesIcon sbsShortcutIcon];
SBSApplicationShortcutItem *photoYear = [%c(SBSApplicationShortcutItem) alloc];
photoYear.localizedTitle = @"One Year Ago";
photoYear.type = @"com.apple.photos.shortcuts.oneyearago";
photoYear.icon = [photosYearIcon sbsShortcutIcon];
SBSApplicationShortcutItem *photoRecent = [%c(SBSApplicationShortcutItem) alloc];
UIApplicationShortcutIcon *photoRecentIcon = [UIApplicationShortcutIcon iconWithCustomImage:[self getLatestPhoto]];
photoRecent.icon = [photoRecentIcon sbsShortcutIcon];
photoRecent.localizedTitle = @"Most Recent";
photoRecent.type = @"com.apple.photos.shortcuts.recentphoto";
photoApp.staticShortcutItems = [[NSArray alloc] initWithObjects:photoRecent, photoFavorites, photoYear, photoSearch, nil];
SBApplication *mapsApp = [[%c(SBApplicationController) sharedInstance] applicationWithBundleIdentifier:@"com.apple.Maps"];
UIApplicationShortcutIcon *mapsHomeIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:@"action-home-OrbHW"];
UIApplicationShortcutIcon *mapsLocationIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:@"action-drop-pin-OrbHW"];
UIApplicationShortcutIcon *mapsShareIcon = [UIApplicationShortcutIcon iconWithType:UIApplicationShortcutIconTypeShare];
UIApplicationShortcutIcon *mapsSearchIcon = [UIApplicationShortcutIcon iconWithType:UIApplicationShortcutIconTypeSearch];
SBSApplicationShortcutItem *mapsHome = [%c(SBSApplicationShortcutItem) alloc];
mapsHome.localizedTitle = @"Directions Home";
mapsHome.type = @"com.apple.Maps.directions";
mapsHome.icon = [mapsHomeIcon sbsShortcutIcon];
SBSApplicationShortcutItem *mapsMarkLocation = [%c(SBSApplicationShortcutItem) alloc];
mapsMarkLocation.localizedTitle = @"Mark My Location";
mapsMarkLocation.type = @"com.apple.Maps.mark-my-location";
mapsMarkLocation.icon = [mapsLocationIcon sbsShortcutIcon];
SBSApplicationShortcutItem *mapsShareLocation = [%c(SBSApplicationShortcutItem) alloc];
mapsShareLocation.localizedTitle = @"Send My Location";
mapsShareLocation.type = @"com.apple.Maps.share-location";
mapsShareLocation.icon = [mapsShareIcon sbsShortcutIcon];
SBSApplicationShortcutItem *mapsSearch = [%c(SBSApplicationShortcutItem) alloc];
mapsSearch.localizedTitle = @"Search Nearby";
mapsSearch.type = @"com.apple.Maps.search-nearby";
mapsSearch.icon = [mapsSearchIcon sbsShortcutIcon];
mapsApp.staticShortcutItems = [[NSArray alloc] initWithObjects:mapsHome, mapsMarkLocation, mapsShareLocation, mapsSearch, nil];
SBApplication *snapchatApp = [[%c(SBApplicationController) sharedInstance] applicationWithBundleIdentifier:@"com.toyopagroup.picaboo"];
UIApplicationShortcutIcon *snapchatAddFriendsIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:@"quickaction_addfriends"];
UIApplicationShortcutIcon *snapchatChatIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:@"quickaction_chat"];
SBSApplicationShortcutItem *snapchatAddFriends = [%c(SBSApplicationShortcutItem) alloc];
snapchatAddFriends.localizedTitle = @"Add Friends";
snapchatAddFriends.type = @"com.snapchat.quick_action_type.add_friends";
snapchatAddFriends.icon = [snapchatAddFriendsIcon sbsShortcutIcon];
SBSApplicationShortcutItem *snapchatChat = [%c(SBSApplicationShortcutItem) alloc];
snapchatChat.localizedTitle = @"Chat With...";
snapchatChat.type = @"com.snapchat.quick_action_type.chat_with";
snapchatChat.icon = [snapchatChatIcon sbsShortcutIcon];
snapchatApp.staticShortcutItems = [[NSArray alloc] initWithObjects:snapchatAddFriends,snapchatChat, nil];
[mapsSearch release];
[mapsHome release];
[mapsShareLocation release];
[mapsMarkLocation release];
[photoFavorites release];
[photoRecent release];
[photoYear release];
[photoSearch release];
[snapchatChat release];
[snapchatAddFriends release];
}
%new
-(UIImage*)getLatestPhoto{
/*PHImageManager *imgManager = [PHImageManager defaultManager];
PHImageRequestOptions *requestOptions = [[PHImageRequestOptions alloc] init];
requestOptions.synchronous = TRUE;
PHFetchOptions *fetchOptions = [[PHFetchOptions alloc] init];
fetchOptions.sortDescriptors = [[NSArray alloc] initWithObjects:[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending: TRUE], nil];
__block UIImage *finalImage = nil;
if ([PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:fetchOptions]) {
PHFetchResult *fetchResult = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:fetchOptions];
if (fetchResult.count > 0) {
[imgManager requestImageForAsset:[fetchResult objectAtIndex:(fetchResult.count-1)] targetSize:PHImageManagerMaximumSize contentMode:PHImageContentModeAspectFill options:requestOptions resultHandler:^(UIImage *result, NSDictionary *info){
finalImage = result;
}];
}
}*/
return [DCIMImageWellUtilities cameraPreviewWellImage];
}
%end
%hook TFNTwitterDeviceFeatureSwitches
+ (_Bool)isNewMessageShortcutEnabled {
return YES;
}
+ (_Bool)areApplicationShortcutsEnabled {
return YES;
}
%end
%end
%ctor {
if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.springboard"]) {
%init(SpringBoardMenus);
}
}