-
Notifications
You must be signed in to change notification settings - Fork 6
/
HomeScreenQuickActions.xm
1524 lines (1391 loc) · 80.4 KB
/
HomeScreenQuickActions.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Home Screen Quick Actions - Control Home Screen Quick Actions on iOS/iPadOS
* Copyright (C) 2020 Tomasz Poliszuk
*
* Home Screen Quick Actions is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* Home Screen Quick Actions is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Home Screen Quick Actions. If not, see <https://www.gnu.org/licenses/>.
*/
#import <dlfcn.h>
#include "HomeScreenQuickActions.h"
#define kIconController [%c(SBIconController) sharedInstance]
#define kIconManager [kIconController iconManager]
#define kFloatingDockController [kIconController floatingDockController]
#define kDismissFloatingDockIfPresented [kFloatingDockController _dismissFloatingDockIfPresentedAnimated:YES completionHandler:nil]
#define kPresentFloatingDockIfDismissed [kFloatingDockController _presentFloatingDockIfDismissedAnimated:YES completionHandler:nil]
NSMutableDictionary *tweakSettings;
static bool enableTweak;
static int uiStyle;
static bool showSeparators;
static bool reverseQuickActionsOrder;
// Installed Applications (Native)
static bool appQuickActionDelete;
static NSString *appQuickActionDeleteTitle = @"";
static NSString *appQuickActionDeleteSubtitle = @"";
static bool appQuickActionEditHomeScreen;
static NSString *appQuickActionEditHomeScreenTitle = @"";
static NSString *appQuickActionEditHomeScreenSubtitle = @"";
static bool appQuickActionShare;
static NSString *appQuickActionShareTitle = @"";
static NSString *appQuickActionShareSubtitle = @"";
static bool appQuickActionShowAllWindows;
static NSString *appQuickActionShowAllWindowsTitle = @"";
static NSString *appQuickActionShowAllWindowsSubtitle = @"";
// Installed Applications (Custom)
static bool appCustomQuickActionShareBundleID; // (Beta)
static NSString *appCustomQuickActionShareBundleIDTitle = @"";
static NSString *appCustomQuickActionShareBundleIDSubtitle = @"";
static bool appCustomQuickActionCopyBundleID;
static NSString *appCustomQuickActionCopyBundleIDTitle = @"";
static NSString *appCustomQuickActionCopyBundleIDSubtitle = @"";
static bool appCustomQuickActionOpenAppInFilza;
static NSString *appCustomQuickActionOpenAppInFilzaTitle = @"";
static NSString *appCustomQuickActionOpenAppInFilzaSubtitle = @"";
static bool appCustomQuickActionClearBadge;
static NSString *appCustomQuickActionClearBadgeTitle = @"";
static NSString *appCustomQuickActionClearBadgeSubtitle = @"";
static bool appCustomQuickActionClearCache;
static NSString *appCustomQuickActionClearCacheTitle = @"";
static NSString *appCustomQuickActionClearCacheSubtitle = @"";
static bool appCustomQuickActionReset;
static NSString *appCustomQuickActionResetTitle = @"";
static NSString *appCustomQuickActionResetSubtitle = @"";
static bool appCustomQuickActionOffload;
static NSString *appCustomQuickActionOffloadTitle = @"";
static NSString *appCustomQuickActionOffloadSubtitle = @"";
static bool appCustomQuickActionOpenAppSettings;
static NSString *appCustomQuickActionOpenAppSettingsTitle = @"";
static NSString *appCustomQuickActionOpenAppSettingsSubtitle = @"";
// Offloaded Applications (Native)
static bool offloadedAppQuickActionEditHomeScreen;
static NSString *offloadedAppQuickActionEditHomeScreenTitle = @"";
static NSString *offloadedAppQuickActionEditHomeScreenSubtitle = @"";
// Offloaded Applications (Custom)
static bool offloadedAppCustomQuickActionShareBundleID; // (Beta)
static NSString *offloadedAppCustomQuickActionShareBundleIDTitle = @"";
static NSString *offloadedAppCustomQuickActionShareBundleIDSubtitle = @"";
static bool offloadedAppCustomQuickActionCopyBundleID;
static NSString *offloadedAppCustomQuickActionCopyBundleIDTitle = @"";
static NSString *offloadedAppCustomQuickActionCopyBundleIDSubtitle = @"";
static bool offloadedAppCustomQuickActionOpenAppInFilza;
static NSString *offloadedAppCustomQuickActionOpenAppInFilzaTitle = @"";
static NSString *offloadedAppCustomQuickActionOpenAppInFilzaSubtitle = @"";
// Folders (Native)
static bool folderQuickActionRemove; // iOS14
static NSString *folderQuickActionRemoveTitle = @"";
static NSString *folderQuickActionRemoveSubtitle = @"";
static bool folderQuickActionEditHomeScreen;
static NSString *folderQuickActionEditHomeScreenTitle = @"";
static NSString *folderQuickActionEditHomeScreenSubtitle = @"";
static bool folderQuickActionRename;
static NSString *folderQuickActionRenameTitle = @"";
static NSString *folderQuickActionRenameSubtitle = @"";
static bool folderQuickActionUnreadNotifications;
// Folders (Custom)
static bool folderCustomQuickActionShareBundleID; // (Beta)
static NSString *folderCustomQuickActionShareBundleIDTitle = @"";
static NSString *folderCustomQuickActionShareBundleIDSubtitle = @"";
static bool folderCustomQuickActionCopyBundleID;
static NSString *folderCustomQuickActionCopyBundleIDTitle = @"";
static NSString *folderCustomQuickActionCopyBundleIDSubtitle = @"";
static bool folderCustomQuickActionClearBadge;
static NSString *folderCustomQuickActionClearBadgeTitle = @"";
static NSString *folderCustomQuickActionClearBadgeSubtitle = @"";
static bool folderCustomQuickActionClearCache; // (Beta)
static NSString *folderCustomQuickActionClearCacheTitle = @"";
static NSString *folderCustomQuickActionClearCacheSubtitle = @"";
static bool folderCustomQuickActionReset; // (Beta)
static NSString *folderCustomQuickActionResetTitle = @"";
static NSString *folderCustomQuickActionResetSubtitle = @"";
static bool folderCustomQuickActionOffload;
static NSString *folderCustomQuickActionOffloadTitle = @"";
static NSString *folderCustomQuickActionOffloadSubtitle = @"";
static bool folderCustomQuickActionAppList; // (Beta)
static int folderCustomQuickActionAppListMax;
// Widgets (Native)
static bool widgetQuickActionRemove; // iOS14
static NSString *widgetQuickActionRemoveTitle = @"";
static NSString *widgetQuickActionRemoveSubtitle = @"";
static bool widgetQuickActionEditHomeScreen; // iOS14
static NSString *widgetQuickActionEditHomeScreenTitle = @"";
static NSString *widgetQuickActionEditHomeScreenSubtitle = @"";
static bool widgetQuickActionConfigure; // iOS14
static NSString *widgetQuickActionConfigureTitle = @"";
static NSString *widgetQuickActionConfigureSubtitle = @"";
static bool widgetStackQuickActionConfigure; // iOS14
static NSString *widgetStackQuickActionConfigureTitle = @"";
static NSString *widgetStackQuickActionConfigureSubtitle = @"";
static bool widgetsInQuickActions; // iOS13
// Bookmarks (Native)
static bool bookmarkQuickActionDelete;
static NSString *bookmarkQuickActionDeleteTitle = @"";
static NSString *bookmarkQuickActionDeleteSubtitle = @"";
static bool bookmarkQuickActionShare;
static NSString *bookmarkQuickActionShareTitle = @"";
static NSString *bookmarkQuickActionShareSubtitle = @"";
static bool bookmarkQuickActionEditHomeScreen;
static NSString *bookmarkQuickActionEditHomeScreenTitle = @"";
static NSString *bookmarkQuickActionEditHomeScreenSubtitle = @"";
// Visible in App Library (Native)
static bool appQuickActionAddToHomeScreen; // iOS14
static NSString *appQuickActionAddToHomeScreenTitle = @"";
static NSString *appQuickActionAddToHomeScreenSubtitle = @"";
// Visible during downloading app (Native)
static bool appQuickActionPrioritizeDownload;
static NSString *appQuickActionPrioritizeDownloadTitle = @"";
static NSString *appQuickActionPrioritizeDownloadSubtitle = @"";
static bool appQuickActionPauseDownload;
static NSString *appQuickActionPauseDownloadTitle = @"";
static NSString *appQuickActionPauseDownloadSubtitle = @"";
static bool appQuickActionCancelDownload;
static NSString *appQuickActionCancelDownloadTitle = @"";
static NSString *appQuickActionCancelDownloadSubtitle = @"";
// visible in iPad Dock recents/suggestions (Native)
static bool appQuickActionHide;
static NSString *appQuickActionHideTitle = @"";
static NSString *appQuickActionHideSubtitle = @"";
void SettingsChanged() {
CFArrayRef keyList = CFPreferencesCopyKeyList(
CFSTR(packageName),
kCFPreferencesCurrentUser,
kCFPreferencesAnyHost
);
if(keyList) {
tweakSettings = (
NSMutableDictionary *)CFBridgingRelease(
CFPreferencesCopyMultiple(
keyList,
CFSTR(packageName),
kCFPreferencesCurrentUser,
kCFPreferencesAnyHost
)
);
CFRelease(keyList);
} else {
tweakSettings = nil;
}
if (!tweakSettings) {
tweakSettings = [NSMutableDictionary dictionaryWithContentsOfFile:userSettingsFile];
}
enableTweak = [([tweakSettings objectForKey:@"enableTweak"] ?: @(YES)) boolValue];
uiStyle = [([tweakSettings valueForKey:@"uiStyle"] ?: @(999)) integerValue];
showSeparators = [([tweakSettings objectForKey:@"showSeparators"] ?: @(YES)) boolValue];
reverseQuickActionsOrder = [([tweakSettings objectForKey:@"reverseQuickActionsOrder"] ?: @(NO)) boolValue];
// Installed Applications (Native)
appQuickActionDelete = [([tweakSettings objectForKey:@"appQuickActionDelete"] ?: @(YES)) boolValue];
appQuickActionDeleteTitle = [tweakSettings objectForKey:@"appQuickActionDeleteTitle"];
appQuickActionDeleteSubtitle = [tweakSettings objectForKey:@"appQuickActionDeleteSubtitle"];
appQuickActionEditHomeScreen = [([tweakSettings objectForKey:@"appQuickActionEditHomeScreen"] ?: @(YES)) boolValue];
appQuickActionEditHomeScreenTitle = [tweakSettings objectForKey:@"appQuickActionEditHomeScreenTitle"];
appQuickActionEditHomeScreenSubtitle = [tweakSettings objectForKey:@"appQuickActionEditHomeScreenSubtitle"];
appQuickActionShare = [([tweakSettings objectForKey:@"appQuickActionShare"] ?: @(YES)) boolValue];
appQuickActionShareTitle = [tweakSettings objectForKey:@"appQuickActionShareTitle"];
appQuickActionShareSubtitle = [tweakSettings objectForKey:@"appQuickActionShareSubtitle"];
appQuickActionShowAllWindows = [([tweakSettings objectForKey:@"appQuickActionShowAllWindows"] ?: @(YES)) boolValue];
appQuickActionShowAllWindowsTitle = [tweakSettings objectForKey:@"appQuickActionShowAllWindowsTitle"];
appQuickActionShowAllWindowsSubtitle = [tweakSettings objectForKey:@"appQuickActionShowAllWindowsSubtitle"];
// Installed Applications (Custom)
appCustomQuickActionShareBundleID = [([tweakSettings objectForKey:@"appCustomQuickActionShareBundleID"] ?: @(NO)) boolValue]; // (Beta)
appCustomQuickActionShareBundleIDTitle = [tweakSettings objectForKey:@"appCustomQuickActionShareBundleIDTitle"];
appCustomQuickActionShareBundleIDSubtitle = [tweakSettings objectForKey:@"appCustomQuickActionShareBundleIDSubtitle"];
appCustomQuickActionCopyBundleID = [([tweakSettings objectForKey:@"appCustomQuickActionCopyBundleID"] ?: @(NO)) boolValue];
appCustomQuickActionCopyBundleIDTitle = [tweakSettings objectForKey:@"appCustomQuickActionCopyBundleIDTitle"];
appCustomQuickActionCopyBundleIDSubtitle = [tweakSettings objectForKey:@"appCustomQuickActionCopyBundleIDSubtitle"];
appCustomQuickActionOpenAppInFilza = [([tweakSettings objectForKey:@"appCustomQuickActionOpenAppInFilza"] ?: @(NO)) boolValue];
appCustomQuickActionOpenAppInFilzaTitle = [tweakSettings objectForKey:@"appCustomQuickActionOpenAppInFilzaTitle"];
appCustomQuickActionOpenAppInFilzaSubtitle = [tweakSettings objectForKey:@"appCustomQuickActionOpenAppInFilzaSubtitle"];
appCustomQuickActionClearBadge = [([tweakSettings objectForKey:@"appCustomQuickActionClearBadge"] ?: @(NO)) boolValue];
appCustomQuickActionClearBadgeTitle = [tweakSettings objectForKey:@"appCustomQuickActionClearBadgeTitle"];
appCustomQuickActionClearBadgeSubtitle = [tweakSettings objectForKey:@"appCustomQuickActionClearBadgeSubtitle"];
appCustomQuickActionClearCache = [([tweakSettings objectForKey:@"appCustomQuickActionClearCache"] ?: @(NO)) boolValue];
appCustomQuickActionClearCacheTitle = [tweakSettings objectForKey:@"appCustomQuickActionClearCacheTitle"];
appCustomQuickActionClearCacheSubtitle = [tweakSettings objectForKey:@"appCustomQuickActionClearCacheSubtitle"];
appCustomQuickActionReset = [([tweakSettings objectForKey:@"appCustomQuickActionReset"] ?: @(NO)) boolValue];
appCustomQuickActionResetTitle = [tweakSettings objectForKey:@"appCustomQuickActionResetTitle"];
appCustomQuickActionResetSubtitle = [tweakSettings objectForKey:@"appCustomQuickActionResetSubtitle"];
appCustomQuickActionOffload = [([tweakSettings objectForKey:@"appCustomQuickActionOffload"] ?: @(NO)) boolValue];
appCustomQuickActionOffloadTitle = [tweakSettings objectForKey:@"appCustomQuickActionOffloadTitle"];
appCustomQuickActionOffloadSubtitle = [tweakSettings objectForKey:@"appCustomQuickActionOffloadSubtitle"];
appCustomQuickActionOpenAppSettings = [([tweakSettings objectForKey:@"appCustomQuickActionOpenAppSettings"] ?: @(NO)) boolValue];
appCustomQuickActionOpenAppSettingsTitle = [tweakSettings objectForKey:@"appCustomQuickActionOpenAppSettingsTitle"];
appCustomQuickActionOpenAppSettingsSubtitle = [tweakSettings objectForKey:@"appCustomQuickActionOpenAppSettingsSubtitle"];
// Offloaded Applications (Native)
offloadedAppQuickActionEditHomeScreen = [([tweakSettings objectForKey:@"offloadedAppQuickActionEditHomeScreen"] ?: @(YES)) boolValue]; // (Beta)
offloadedAppQuickActionEditHomeScreenTitle = [tweakSettings objectForKey:@"offloadedAppQuickActionEditHomeScreenTitle"];
offloadedAppQuickActionEditHomeScreenSubtitle = [tweakSettings objectForKey:@"offloadedAppQuickActionEditHomeScreenSubtitle"];
// Offloaded Applications (Custom)
offloadedAppCustomQuickActionShareBundleID = [([tweakSettings objectForKey:@"offloadedAppCustomQuickActionShareBundleID"] ?: @(NO)) boolValue];
offloadedAppCustomQuickActionShareBundleIDTitle = [tweakSettings objectForKey:@"offloadedAppCustomQuickActionShareBundleIDTitle"];
offloadedAppCustomQuickActionShareBundleIDSubtitle = [tweakSettings objectForKey:@"offloadedAppCustomQuickActionShareBundleIDSubtitle"];
offloadedAppCustomQuickActionCopyBundleID = [([tweakSettings objectForKey:@"offloadedAppCustomQuickActionCopyBundleID"] ?: @(NO)) boolValue];
offloadedAppCustomQuickActionCopyBundleIDTitle = [tweakSettings objectForKey:@"offloadedAppCustomQuickActionCopyBundleIDTitle"];
offloadedAppCustomQuickActionCopyBundleIDSubtitle = [tweakSettings objectForKey:@"offloadedAppCustomQuickActionCopyBundleIDSubtitle"];
offloadedAppCustomQuickActionOpenAppInFilza = [([tweakSettings objectForKey:@"offloadedAppCustomQuickActionOpenAppInFilza"] ?: @(NO)) boolValue];
offloadedAppCustomQuickActionOpenAppInFilzaTitle = [tweakSettings objectForKey:@"offloadedAppCustomQuickActionOpenAppInFilzaTitle"];
offloadedAppCustomQuickActionOpenAppInFilzaSubtitle = [tweakSettings objectForKey:@"offloadedAppCustomQuickActionOpenAppInFilzaSubtitle"];
// Folders (Native)
folderQuickActionRemove = [([tweakSettings objectForKey:@"folderQuickActionRemove"] ?: @(YES)) boolValue];
folderQuickActionRemoveTitle = [tweakSettings objectForKey:@"folderQuickActionRemoveTitle"];
folderQuickActionRemoveSubtitle = [tweakSettings objectForKey:@"folderQuickActionRemoveSubtitle"];
folderQuickActionEditHomeScreen = [([tweakSettings objectForKey:@"folderQuickActionEditHomeScreen"] ?: @(YES)) boolValue];
folderQuickActionEditHomeScreenTitle = [tweakSettings objectForKey:@"folderQuickActionEditHomeScreenTitle"];
folderQuickActionEditHomeScreenSubtitle = [tweakSettings objectForKey:@"folderQuickActionEditHomeScreenSubtitle"];
folderQuickActionRename = [([tweakSettings objectForKey:@"folderQuickActionRename"] ?: @(YES)) boolValue];
folderQuickActionRenameTitle = [tweakSettings objectForKey:@"folderQuickActionRenameTitle"];
folderQuickActionRenameSubtitle = [tweakSettings objectForKey:@"folderQuickActionRenameSubtitle"];
folderQuickActionUnreadNotifications = [([tweakSettings objectForKey:@"folderQuickActionUnreadNotifications"] ?: @(YES)) boolValue];
// Folders (Custom)
folderCustomQuickActionShareBundleID = [([tweakSettings objectForKey:@"folderCustomQuickActionShareBundleID"] ?: @(NO)) boolValue]; // (Beta)
folderCustomQuickActionShareBundleIDTitle = [tweakSettings objectForKey:@"folderCustomQuickActionShareBundleIDTitle"];
folderCustomQuickActionShareBundleIDSubtitle = [tweakSettings objectForKey:@"folderCustomQuickActionShareBundleIDSubtitle"];
folderCustomQuickActionCopyBundleID = [([tweakSettings objectForKey:@"folderCustomQuickActionCopyBundleID"] ?: @(NO)) boolValue];
folderCustomQuickActionCopyBundleIDTitle = [tweakSettings objectForKey:@"folderCustomQuickActionCopyBundleIDTitle"];
folderCustomQuickActionCopyBundleIDSubtitle = [tweakSettings objectForKey:@"folderCustomQuickActionCopyBundleIDSubtitle"];
folderCustomQuickActionClearBadge = [([tweakSettings objectForKey:@"folderCustomQuickActionClearBadge"] ?: @(NO)) boolValue];
folderCustomQuickActionClearBadgeTitle = [tweakSettings objectForKey:@"folderCustomQuickActionClearBadgeTitle"];
folderCustomQuickActionClearBadgeSubtitle = [tweakSettings objectForKey:@"folderCustomQuickActionClearBadgeSubtitle"];
folderCustomQuickActionClearCache = [([tweakSettings objectForKey:@"folderCustomQuickActionClearCache"] ?: @(NO)) boolValue]; // (Beta)
folderCustomQuickActionClearCacheTitle = [tweakSettings objectForKey:@"folderCustomQuickActionClearCacheTitle"];
folderCustomQuickActionClearCacheSubtitle = [tweakSettings objectForKey:@"folderCustomQuickActionClearCacheSubtitle"];
folderCustomQuickActionReset = [([tweakSettings objectForKey:@"folderCustomQuickActionReset"] ?: @(NO)) boolValue]; // (Beta)
folderCustomQuickActionResetTitle = [tweakSettings objectForKey:@"folderCustomQuickActionResetTitle"];
folderCustomQuickActionResetSubtitle = [tweakSettings objectForKey:@"folderCustomQuickActionResetSubtitle"];
folderCustomQuickActionOffload = [([tweakSettings objectForKey:@"folderCustomQuickActionOffload"] ?: @(NO)) boolValue];
folderCustomQuickActionOffloadTitle = [tweakSettings objectForKey:@"folderCustomQuickActionOffloadTitle"];
folderCustomQuickActionOffloadSubtitle = [tweakSettings objectForKey:@"folderCustomQuickActionOffloadSubtitle"];
folderCustomQuickActionAppList = [([tweakSettings objectForKey:@"folderCustomQuickActionAppList"] ?: @(NO)) boolValue]; // (Beta)
folderCustomQuickActionAppListMax = [([tweakSettings valueForKey:@"folderCustomQuickActionAppListMax"] ?: @(6)) integerValue];
// Widgets (Native)
widgetQuickActionRemove = [([tweakSettings objectForKey:@"widgetQuickActionRemove"] ?: @(YES)) boolValue];
widgetQuickActionRemoveTitle = [tweakSettings objectForKey:@"widgetQuickActionRemoveTitle"];
widgetQuickActionRemoveSubtitle = [tweakSettings objectForKey:@"widgetQuickActionRemoveSubtitle"];
widgetQuickActionEditHomeScreen = [([tweakSettings objectForKey:@"widgetQuickActionEditHomeScreen"] ?: @(YES)) boolValue];
widgetQuickActionEditHomeScreenTitle = [tweakSettings objectForKey:@"widgetQuickActionEditHomeScreenTitle"];
widgetQuickActionEditHomeScreenSubtitle = [tweakSettings objectForKey:@"widgetQuickActionEditHomeScreenSubtitle"];
widgetQuickActionConfigure = [([tweakSettings objectForKey:@"widgetQuickActionConfigure"] ?: @(YES)) boolValue];
widgetQuickActionConfigureTitle = [tweakSettings objectForKey:@"widgetQuickActionConfigureTitle"];
widgetQuickActionConfigureSubtitle = [tweakSettings objectForKey:@"widgetQuickActionConfigureSubtitle"];
widgetStackQuickActionConfigure = [([tweakSettings objectForKey:@"widgetStackQuickActionConfigure"] ?: @(YES)) boolValue];
widgetStackQuickActionConfigureTitle = [tweakSettings objectForKey:@"widgetStackQuickActionConfigureTitle"];
widgetStackQuickActionConfigureSubtitle = [tweakSettings objectForKey:@"widgetStackQuickActionConfigureSubtitle"];
widgetsInQuickActions = [([tweakSettings objectForKey:@"widgetsInQuickActions"] ?: @(YES)) boolValue];
// Bookmarks (Native)
bookmarkQuickActionDelete = [([tweakSettings objectForKey:@"bookmarkQuickActionDelete"] ?: @(YES)) boolValue];
bookmarkQuickActionDeleteTitle = [tweakSettings objectForKey:@"bookmarkQuickActionDeleteTitle"];
bookmarkQuickActionDeleteSubtitle = [tweakSettings objectForKey:@"bookmarkQuickActionDeleteSubtitle"];
bookmarkQuickActionShare = [([tweakSettings objectForKey:@"bookmarkQuickActionShare"] ?: @(NO)) boolValue];
bookmarkQuickActionShareTitle = [tweakSettings objectForKey:@"bookmarkQuickActionShareTitle"];
bookmarkQuickActionShareSubtitle = [tweakSettings objectForKey:@"bookmarkQuickActionShareSubtitle"];
bookmarkQuickActionEditHomeScreen = [([tweakSettings objectForKey:@"bookmarkQuickActionEditHomeScreen"] ?: @(YES)) boolValue];
bookmarkQuickActionEditHomeScreenTitle = [tweakSettings objectForKey:@"bookmarkQuickActionEditHomeScreenTitle"];
bookmarkQuickActionEditHomeScreenSubtitle = [tweakSettings objectForKey:@"bookmarkQuickActionEditHomeScreenSubtitle"];
// Visible in App Library (Native)
appQuickActionAddToHomeScreen = [([tweakSettings objectForKey:@"appQuickActionAddToHomeScreen"] ?: @(YES)) boolValue];
appQuickActionAddToHomeScreenTitle = [tweakSettings objectForKey:@"appQuickActionAddToHomeScreenTitle"];
appQuickActionAddToHomeScreenSubtitle = [tweakSettings objectForKey:@"appQuickActionAddToHomeScreenSubtitle"];
// Visible during downloading app (Native)
appQuickActionPrioritizeDownload = [([tweakSettings objectForKey:@"appQuickActionPrioritizeDownload"] ?: @(YES)) boolValue];
appQuickActionPrioritizeDownloadTitle = [tweakSettings objectForKey:@"appQuickActionPrioritizeDownloadTitle"];
appQuickActionPrioritizeDownloadSubtitle = [tweakSettings objectForKey:@"appQuickActionPrioritizeDownloadSubtitle"];
appQuickActionPauseDownload = [([tweakSettings objectForKey:@"appQuickActionPauseDownload"] ?: @(YES)) boolValue];
appQuickActionPauseDownloadTitle = [tweakSettings objectForKey:@"appQuickActionPauseDownloadTitle"];
appQuickActionPauseDownloadSubtitle = [tweakSettings objectForKey:@"appQuickActionPauseDownloadSubtitle"];
appQuickActionCancelDownload = [([tweakSettings objectForKey:@"appQuickActionCancelDownload"] ?: @(YES)) boolValue];
appQuickActionCancelDownloadTitle = [tweakSettings objectForKey:@"appQuickActionCancelDownloadTitle"];
appQuickActionCancelDownloadSubtitle = [tweakSettings objectForKey:@"appQuickActionCancelDownloadSubtitle"];
// visible in iPad Dock recents/suggestions (Native)
appQuickActionHide = [([tweakSettings objectForKey:@"appQuickActionHide"] ?: @(YES)) boolValue];
appQuickActionHideTitle = [tweakSettings objectForKey:@"appQuickActionHideTitle"];
appQuickActionHideSubtitle = [tweakSettings objectForKey:@"appQuickActionHideSubtitle"];
}
static void receivedNotification(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
SettingsChanged();
}
static void ShowMessage( NSString *title, NSString *message ) {
UIWindow *currentAlertWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
currentAlertWindow.windowLevel = UIWindowLevelAlert + 13;
currentAlertWindow.rootViewController = [[UIViewController alloc] init];
UIAlertController *currentAlert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) {
currentAlertWindow.hidden = YES;
}];
[currentAlert addAction:cancel];
[currentAlertWindow makeKeyAndVisible];
[currentAlertWindow.rootViewController presentViewController:currentAlert animated:YES completion:nil];
}
static void ClearDirectoryURLContents(NSURL *url) {
// this part is from https://github.com/rpetrich/CacheClearer/blob/216dd186aface6243ca94810bf9fbadc5f8c3066/Tweak.x#L25-L33
NSFileManager *fm = [NSFileManager defaultManager];
NSDirectoryEnumerator *enumerator = [fm enumeratorAtURL:url includingPropertiesForKeys:nil options:NSDirectoryEnumerationSkipsSubdirectoryDescendants errorHandler:nil];
NSURL *child;
while ((child = [enumerator nextObject])) {
[fm removeItemAtURL:child error:NULL];
}
}
%hook SBIconView
- (void)setApplicationShortcutItems:(NSArray *)arg1 {
NSString* bundleId;
if( [self respondsToSelector:@selector(applicationBundleIdentifier)] ) {
bundleId = [self applicationBundleIdentifier];
} else if( [self respondsToSelector:@selector(applicationBundleIdentifierForShortcuts)] ) {
bundleId = [self applicationBundleIdentifierForShortcuts];
}
NSString* applicationBundleID;
if( [[self icon] respondsToSelector:@selector(applicationBundleID)] ) {
applicationBundleID = [[self icon] applicationBundleID];
}
if ( enableTweak ) {
NSMutableArray *shortcutItems = [[NSMutableArray alloc] init];
LSApplicationProxy *applicationProxy = [%c(LSApplicationProxy) applicationProxyForIdentifier:applicationBundleID];
bool isInstalled = applicationProxy.isInstalled;
bool isDeletable = applicationProxy.isDeletable;
bool if_isSystem = applicationProxy.if_isSystem;
bool haveBadge = [[self icon] badgeValue];
for (SBSApplicationShortcutItem *shortcutItem in arg1) {
// Apple uses both prefixes for system shortcuts:
// - com.apple.springboardhome.application-shotcut-item - with typo "shotcut" name
// - com.apple.springboardhome.application-shortcut-item - with correct "shortcut" name
// - so let's detect both of them in one run:
if ( [shortcutItem.type hasPrefix:@"com.apple.springboardhome.application-"] ) {
if ( [shortcutItem.type hasSuffix:@"delete-app"] ) {
if ( appQuickActionDelete && [[self icon] isApplicationIcon] && !([self displayedLabelAccessoryType] == 3) ) {
if ( appQuickActionDeleteTitle.length > 0 ) {
shortcutItem.localizedTitle = appQuickActionDeleteTitle;
}
if ( appQuickActionDeleteSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = appQuickActionDeleteSubtitle;
}
[shortcutItems addObject: shortcutItem];
continue;
}
if ( bookmarkQuickActionDelete && [[self icon] isBookmarkIcon] ) {
[shortcutItems addObject: shortcutItem];
if ( bookmarkQuickActionDeleteTitle.length > 0 ) {
shortcutItem.localizedTitle = bookmarkQuickActionDeleteTitle;
}
if ( bookmarkQuickActionDeleteSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = bookmarkQuickActionDeleteSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"rearrange-icons"] ) {
if ( appQuickActionEditHomeScreen && [[self icon] isApplicationIcon] && !([self displayedLabelAccessoryType] == 3) ) {
if ( appQuickActionEditHomeScreenTitle.length > 0 ) {
shortcutItem.localizedTitle = appQuickActionEditHomeScreenTitle;
}
if ( appQuickActionEditHomeScreenSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = appQuickActionEditHomeScreenSubtitle;
}
[shortcutItems addObject: shortcutItem];
continue;
}
if ( offloadedAppQuickActionEditHomeScreen && ([self displayedLabelAccessoryType] == 3) ) {
[shortcutItems addObject: shortcutItem];
if ( offloadedAppQuickActionEditHomeScreenTitle.length > 0 ) {
shortcutItem.localizedTitle = offloadedAppQuickActionEditHomeScreenTitle;
}
if ( offloadedAppQuickActionEditHomeScreenSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = offloadedAppQuickActionEditHomeScreenSubtitle;
}
}
if ( folderQuickActionEditHomeScreen && [self isFolderIcon] ) {
[shortcutItems addObject: shortcutItem];
if ( folderQuickActionEditHomeScreenTitle.length > 0 ) {
shortcutItem.localizedTitle = folderQuickActionEditHomeScreenTitle;
}
if ( folderQuickActionEditHomeScreenSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = folderQuickActionEditHomeScreenSubtitle;
}
}
if ( iOSversion.majorVersion > 13 ) {
if ( widgetQuickActionEditHomeScreen && ( [[self icon] isWidgetIcon] || [[self icon] isWidgetStackIcon] ) ) {
[shortcutItems addObject: shortcutItem];
if ( widgetQuickActionEditHomeScreenTitle.length > 0 ) {
shortcutItem.localizedTitle = widgetQuickActionEditHomeScreenTitle;
}
if ( widgetQuickActionEditHomeScreenSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = widgetQuickActionEditHomeScreenSubtitle;
}
}
}
if ( bookmarkQuickActionEditHomeScreen && [[self icon] isBookmarkIcon] ) {
[shortcutItems addObject: shortcutItem];
if ( bookmarkQuickActionEditHomeScreenTitle.length > 0 ) {
shortcutItem.localizedTitle = bookmarkQuickActionEditHomeScreenTitle;
}
if ( bookmarkQuickActionEditHomeScreenSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = bookmarkQuickActionEditHomeScreenSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"item.share"] ) {
if ( appQuickActionShare && [[self icon] isApplicationIcon] && !([self displayedLabelAccessoryType] == 3) ) {
if ( appQuickActionShareTitle.length > 0 ) {
shortcutItem.localizedTitle = appQuickActionShareTitle;
}
if ( appQuickActionShareSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = appQuickActionShareSubtitle;
}
[shortcutItems addObject: shortcutItem];
continue;
}
if ( bookmarkQuickActionShare && [[self icon] isBookmarkIcon] ) {
[shortcutItems addObject: shortcutItem];
if ( bookmarkQuickActionShareTitle.length > 0 ) {
shortcutItem.localizedTitle = bookmarkQuickActionShareTitle;
}
if ( bookmarkQuickActionShareSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = bookmarkQuickActionShareSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"rename-folder"] ) {
if ( folderQuickActionRename ) {
[shortcutItems addObject: shortcutItem];
if ( folderQuickActionRenameTitle.length > 0 ) {
shortcutItem.localizedTitle = folderQuickActionRenameTitle;
}
if ( folderQuickActionRenameSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = folderQuickActionRenameSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"hide-folder"] ) {
if ( folderQuickActionRemove ) {
[shortcutItems addObject: shortcutItem];
if ( folderQuickActionRemoveTitle.length > 0 ) {
shortcutItem.localizedTitle = folderQuickActionRemoveTitle;
}
if ( folderQuickActionRemoveSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = folderQuickActionRemoveSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"unread-notifications"] ) {
if ( folderQuickActionUnreadNotifications ) {
[shortcutItems addObject: shortcutItem];
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"remove-app"] ) {
if ( appQuickActionDelete && [[self icon] isApplicationIcon] && !([self displayedLabelAccessoryType] == 3) ) {
if ( appQuickActionDeleteTitle.length > 0 ) {
shortcutItem.localizedTitle = appQuickActionDeleteTitle;
}
if ( appQuickActionDeleteSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = appQuickActionDeleteSubtitle;
}
[shortcutItems addObject: shortcutItem];
continue;
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"remove-widget"] ) {
if ( widgetQuickActionRemove ) {
[shortcutItems addObject: shortcutItem];
if ( widgetQuickActionRemoveTitle.length > 0 ) {
shortcutItem.localizedTitle = widgetQuickActionRemoveTitle;
}
if ( widgetQuickActionRemoveSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = widgetQuickActionRemoveSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"configure-widget"] ) {
if ( widgetQuickActionConfigure ) {
[shortcutItems addObject: shortcutItem];
if ( widgetQuickActionConfigureTitle.length > 0 ) {
shortcutItem.localizedTitle = widgetQuickActionConfigureTitle;
}
if ( widgetQuickActionConfigureSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = widgetQuickActionConfigureSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"configure-stack"] ) {
if ( widgetStackQuickActionConfigure ) {
[shortcutItems addObject: shortcutItem];
if ( widgetStackQuickActionConfigureTitle.length > 0 ) {
shortcutItem.localizedTitle = widgetStackQuickActionConfigureTitle;
}
if ( widgetStackQuickActionConfigureSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = widgetStackQuickActionConfigureSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"add-to-home-screen"] ) {
if ( appQuickActionAddToHomeScreen ) {
[shortcutItems addObject: shortcutItem];
if ( appQuickActionAddToHomeScreenTitle.length > 0 ) {
shortcutItem.localizedTitle = appQuickActionAddToHomeScreenTitle;
}
if ( appQuickActionAddToHomeScreenSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = appQuickActionAddToHomeScreenSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"prioritize-download"] ) {
if ( appQuickActionPrioritizeDownload ) {
[shortcutItems addObject: shortcutItem];
if ( appQuickActionPrioritizeDownloadTitle.length > 0 ) {
shortcutItem.localizedTitle = appQuickActionPrioritizeDownloadTitle;
}
if ( appQuickActionPrioritizeDownloadSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = appQuickActionPrioritizeDownloadSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"pause-download"] ) {
if ( appQuickActionPauseDownload ) {
[shortcutItems addObject: shortcutItem];
if ( appQuickActionPauseDownloadTitle.length > 0 ) {
shortcutItem.localizedTitle = appQuickActionPauseDownloadTitle;
}
if ( appQuickActionPauseDownloadSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = appQuickActionPauseDownloadSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"cancel-download"] ) {
if ( appQuickActionCancelDownload ) {
[shortcutItems addObject: shortcutItem];
if ( appQuickActionCancelDownloadTitle.length > 0 ) {
shortcutItem.localizedTitle = appQuickActionCancelDownloadTitle;
}
if ( appQuickActionCancelDownloadSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = appQuickActionCancelDownloadSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"hide-app"] || [shortcutItem.type hasSuffix:@"hide-app-suggestion"] ) {
if ( appQuickActionHide ) {
[shortcutItems addObject: shortcutItem];
if ( appQuickActionHideTitle.length > 0 ) {
shortcutItem.localizedTitle = appQuickActionHideTitle;
}
if ( appQuickActionHideSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = appQuickActionHideSubtitle;
}
}
continue;
}
if ( [shortcutItem.type hasSuffix:@"show-all-windows"] ) {
if ( appQuickActionShowAllWindows ) {
[shortcutItems addObject: shortcutItem];
if ( appQuickActionShowAllWindowsTitle.length > 0 ) {
shortcutItem.localizedTitle = appQuickActionShowAllWindowsTitle;
}
if ( appQuickActionShowAllWindowsSubtitle.length > 0 ) {
shortcutItem.localizedSubtitle = appQuickActionShowAllWindowsSubtitle;
}
}
continue;
}
}
bool appSpecificQuickActions = [([tweakSettings objectForKey:[NSString stringWithFormat:@"appSpecificQuickActions-%@", applicationBundleID]] ?: @(YES)) boolValue];
if ( appSpecificQuickActions && [[self icon] isApplicationIcon] ) {
[shortcutItems addObject: shortcutItem];
}
}
if ( appCustomQuickActionShareBundleID && applicationBundleID && !([self displayedLabelAccessoryType] == 3) ) {
SBSApplicationShortcutItem *appCustomQuickActionShareBundleIDItem = [%c(SBSApplicationShortcutItem) alloc];
appCustomQuickActionShareBundleIDItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.share-bundle-id";
if ( appCustomQuickActionShareBundleIDTitle.length > 0 ) {
appCustomQuickActionShareBundleIDItem.localizedTitle = appCustomQuickActionShareBundleIDTitle;
} else {
appCustomQuickActionShareBundleIDItem.localizedTitle = @"Share Bundle ID";
}
if ( appCustomQuickActionShareBundleIDSubtitle.length > 0 ) {
appCustomQuickActionShareBundleIDItem.localizedSubtitle = appCustomQuickActionShareBundleIDSubtitle;
} else {
appCustomQuickActionShareBundleIDItem.localizedSubtitle = applicationBundleID;
}
appCustomQuickActionShareBundleIDItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"square.and.arrow.up"];
[shortcutItems addObject: appCustomQuickActionShareBundleIDItem];
}
if ( appCustomQuickActionCopyBundleID && applicationBundleID && !([self displayedLabelAccessoryType] == 3) ) {
SBSApplicationShortcutItem *appCustomQuickActionCopyBundleIDItem = [%c(SBSApplicationShortcutItem) alloc];
appCustomQuickActionCopyBundleIDItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.copy-bundle-id";
if ( appCustomQuickActionCopyBundleIDTitle.length > 0 ) {
appCustomQuickActionCopyBundleIDItem.localizedTitle = appCustomQuickActionCopyBundleIDTitle;
} else {
appCustomQuickActionCopyBundleIDItem.localizedTitle = @"Copy Bundle ID";
}
if ( appCustomQuickActionCopyBundleIDSubtitle.length > 0 ) {
appCustomQuickActionCopyBundleIDItem.localizedSubtitle = appCustomQuickActionCopyBundleIDSubtitle;
} else {
appCustomQuickActionCopyBundleIDItem.localizedSubtitle = applicationBundleID;
}
appCustomQuickActionCopyBundleIDItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"doc.on.clipboard"];
[shortcutItems addObject: appCustomQuickActionCopyBundleIDItem];
}
if ( appCustomQuickActionOpenAppInFilza && applicationBundleID && !([self displayedLabelAccessoryType] == 3) ) {
SBSApplicationShortcutItem *appCustomQuickActionOpenAppInFilzaItem = [%c(SBSApplicationShortcutItem) alloc];
appCustomQuickActionOpenAppInFilzaItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.open-app-in-filza";
if ( appCustomQuickActionOpenAppInFilzaTitle.length > 0 ) {
appCustomQuickActionOpenAppInFilzaItem.localizedTitle = appCustomQuickActionOpenAppInFilzaTitle;
} else {
appCustomQuickActionOpenAppInFilzaItem.localizedTitle = @"Open App in Filza";
}
if ( appCustomQuickActionOpenAppInFilzaSubtitle.length > 0 ) {
appCustomQuickActionOpenAppInFilzaItem.localizedSubtitle = appCustomQuickActionOpenAppInFilzaSubtitle;
}
appCustomQuickActionOpenAppInFilzaItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"folder"];
[shortcutItems addObject: appCustomQuickActionOpenAppInFilzaItem];
}
if ( appCustomQuickActionClearBadge && applicationBundleID ) {
SBSApplicationShortcutItem *appCustomQuickActionClearBadgeItem = [%c(SBSApplicationShortcutItem) alloc];
appCustomQuickActionClearBadgeItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.clear-badge";
if ( appCustomQuickActionClearBadgeTitle.length > 0 ) {
appCustomQuickActionClearBadgeItem.localizedTitle = appCustomQuickActionClearBadgeTitle;
} else {
appCustomQuickActionClearBadgeItem.localizedTitle = @"Clear Badge";
}
if ( appCustomQuickActionClearBadgeSubtitle.length > 0 ) {
appCustomQuickActionClearBadgeItem.localizedSubtitle = appCustomQuickActionClearBadgeSubtitle;
}
appCustomQuickActionClearBadgeItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"app.badge"];
if ( haveBadge ) {
[shortcutItems addObject: appCustomQuickActionClearBadgeItem];
}
}
if ( appCustomQuickActionClearCache && applicationBundleID ) {
SBSApplicationShortcutItem *appCustomQuickActionClearCacheItem = [%c(SBSApplicationShortcutItem) alloc];
appCustomQuickActionClearCacheItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.clear-cache";
if ( appCustomQuickActionClearCacheTitle.length > 0 ) {
appCustomQuickActionClearCacheItem.localizedTitle = appCustomQuickActionClearCacheTitle;
} else {
appCustomQuickActionClearCacheItem.localizedTitle = @"Clear App Cache";
}
if ( appCustomQuickActionClearCacheSubtitle.length > 0 ) {
appCustomQuickActionClearCacheItem.localizedSubtitle = appCustomQuickActionClearCacheSubtitle;
}
appCustomQuickActionClearCacheItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"arrow.counterclockwise"];
if ( isDeletable && isInstalled ) {
[shortcutItems addObject: appCustomQuickActionClearCacheItem];
}
}
if ( appCustomQuickActionReset && applicationBundleID ) {
SBSApplicationShortcutItem *appCustomQuickActionResetItem = [%c(SBSApplicationShortcutItem) alloc];
appCustomQuickActionResetItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.reset-app";
if ( appCustomQuickActionResetTitle.length > 0 ) {
appCustomQuickActionResetItem.localizedTitle = appCustomQuickActionResetTitle;
} else {
appCustomQuickActionResetItem.localizedTitle = @"Reset App";
}
if ( appCustomQuickActionResetSubtitle.length > 0 ) {
appCustomQuickActionResetItem.localizedSubtitle = appCustomQuickActionResetSubtitle;
}
appCustomQuickActionResetItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"arrow.2.squarepath"];
if ( isDeletable && isInstalled ) {
[shortcutItems addObject: appCustomQuickActionResetItem];
}
}
if ( appCustomQuickActionOffload && applicationBundleID ) {
SBSApplicationShortcutItem *appCustomQuickActionOffloadItem = [%c(SBSApplicationShortcutItem) alloc];
appCustomQuickActionOffloadItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.offload-app";
NSNumber *staticDiskUsage = 0;
staticDiskUsage = applicationProxy.staticDiskUsage;
if ( appCustomQuickActionOffloadTitle.length > 0 ) {
appCustomQuickActionOffloadItem.localizedTitle = appCustomQuickActionOffloadTitle;
} else {
appCustomQuickActionOffloadItem.localizedTitle = @"Offload App";
}
if ( appCustomQuickActionOffloadSubtitle.length > 0 ) {
appCustomQuickActionOffloadItem.localizedSubtitle = appCustomQuickActionOffloadSubtitle;
} else {
appCustomQuickActionOffloadItem.localizedSubtitle = [NSByteCountFormatter stringFromByteCount:[staticDiskUsage doubleValue] countStyle:NSByteCountFormatterCountStyleDecimal];
}
appCustomQuickActionOffloadItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"icloud.and.arrow.down"];
if ( isDeletable && isInstalled ) {
[shortcutItems addObject: appCustomQuickActionOffloadItem];
}
}
if ( appCustomQuickActionOpenAppSettings && applicationBundleID ) {
SBSApplicationShortcutItem *appCustomQuickActionOpenAppSettingsItem = [%c(SBSApplicationShortcutItem) alloc];
appCustomQuickActionOpenAppSettingsItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.open-settings";
if ( appCustomQuickActionOpenAppSettingsTitle.length > 0 ) {
appCustomQuickActionOpenAppSettingsItem.localizedTitle = appCustomQuickActionOpenAppSettingsTitle;
} else {
appCustomQuickActionOpenAppSettingsItem.localizedTitle = @"Open App Settings";
}
appCustomQuickActionOpenAppSettingsItem.bundleIdentifierToLaunch = @"com.apple.Preferences";
appCustomQuickActionOpenAppSettingsItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"gear"];
if ( appCustomQuickActionOpenAppSettingsSubtitle.length > 0 ) {
appCustomQuickActionOpenAppSettingsItem.localizedSubtitle = appCustomQuickActionOpenAppSettingsSubtitle;
}
if ( isInstalled && !if_isSystem ) {
[shortcutItems addObject: appCustomQuickActionOpenAppSettingsItem];
}
}
if ( folderCustomQuickActionShareBundleID && [self isFolderIcon] ) {
SBSApplicationShortcutItem *folderCustomQuickActionShareBundleIDItem = [%c(SBSApplicationShortcutItem) alloc];
folderCustomQuickActionShareBundleIDItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.share-bundle-id";
if ( folderCustomQuickActionShareBundleIDTitle.length > 0 ) {
folderCustomQuickActionShareBundleIDItem.localizedTitle = folderCustomQuickActionShareBundleIDTitle;
} else {
folderCustomQuickActionShareBundleIDItem.localizedTitle = @"Share Bundle IDs";
}
if ( folderCustomQuickActionShareBundleIDSubtitle.length > 0 ) {
folderCustomQuickActionShareBundleIDItem.localizedSubtitle = folderCustomQuickActionShareBundleIDSubtitle;
}
folderCustomQuickActionShareBundleIDItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"square.and.arrow.up"];
[shortcutItems addObject: folderCustomQuickActionShareBundleIDItem];
}
if ( folderCustomQuickActionCopyBundleID && [self isFolderIcon] ) {
SBSApplicationShortcutItem *folderCustomQuickActionCopyBundleIDItem = [%c(SBSApplicationShortcutItem) alloc];
folderCustomQuickActionCopyBundleIDItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.copy-bundle-id";
if ( folderCustomQuickActionCopyBundleIDTitle.length > 0 ) {
folderCustomQuickActionCopyBundleIDItem.localizedTitle = folderCustomQuickActionCopyBundleIDTitle;
} else {
folderCustomQuickActionCopyBundleIDItem.localizedTitle = @"Copy Bundle IDs";
}
if ( folderCustomQuickActionCopyBundleIDSubtitle.length > 0 ) {
folderCustomQuickActionCopyBundleIDItem.localizedSubtitle = folderCustomQuickActionCopyBundleIDSubtitle;
}
folderCustomQuickActionCopyBundleIDItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"doc.on.clipboard"];
[shortcutItems addObject: folderCustomQuickActionCopyBundleIDItem];
}
if ( folderCustomQuickActionClearBadge && [self isFolderIcon] ) {
SBSApplicationShortcutItem *folderCustomQuickActionClearBadgeItem = [%c(SBSApplicationShortcutItem) alloc];
folderCustomQuickActionClearBadgeItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.clear-badge";
if ( folderCustomQuickActionClearBadgeTitle.length > 0 ) {
folderCustomQuickActionClearBadgeItem.localizedTitle = folderCustomQuickActionClearBadgeTitle;
} else {
folderCustomQuickActionClearBadgeItem.localizedTitle = @"Clear Badges";
}
if ( folderCustomQuickActionClearBadgeSubtitle.length > 0 ) {
folderCustomQuickActionClearBadgeItem.localizedSubtitle = folderCustomQuickActionClearBadgeSubtitle;
}
folderCustomQuickActionClearBadgeItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"app.badge"];
if ( haveBadge ) {
[shortcutItems addObject: folderCustomQuickActionClearBadgeItem];
}
}
if ( folderCustomQuickActionClearCache && [self isFolderIcon] ) {
SBSApplicationShortcutItem *folderCustomQuickActionClearCacheItem = [%c(SBSApplicationShortcutItem) alloc];
folderCustomQuickActionClearCacheItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.clear-cache";
if ( folderCustomQuickActionClearCacheTitle.length > 0 ) {
folderCustomQuickActionClearCacheItem.localizedTitle = folderCustomQuickActionClearCacheTitle;
} else {
folderCustomQuickActionClearCacheItem.localizedTitle = @"Clear Apps Cache";
}
if ( folderCustomQuickActionClearCacheSubtitle.length > 0 ) {
folderCustomQuickActionClearCacheItem.localizedSubtitle = folderCustomQuickActionClearCacheSubtitle;
}
folderCustomQuickActionClearCacheItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"arrow.counterclockwise"];
NSNumber *canCleanCache = 0;
for ( SBIcon *icon in [[[self folderIcon] folder] icons] ) {
LSApplicationProxy *applicationProxy = [%c(LSApplicationProxy) applicationProxyForIdentifier:[icon applicationBundleID]];
bool isInstalled = applicationProxy.isInstalled;
bool isDeletable = applicationProxy.isDeletable;
if ( isDeletable && isInstalled ) {
canCleanCache = [NSNumber numberWithFloat:([canCleanCache doubleValue] + 1)];
}
}
if ( [canCleanCache integerValue] > 0 ) {
[shortcutItems addObject: folderCustomQuickActionClearCacheItem];
}
}
if ( folderCustomQuickActionReset && [self isFolderIcon] ) {
SBSApplicationShortcutItem *folderCustomQuickActionResetItem = [%c(SBSApplicationShortcutItem) alloc];
folderCustomQuickActionResetItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.reset-app";
if ( folderCustomQuickActionResetTitle.length > 0 ) {
folderCustomQuickActionResetItem.localizedTitle = folderCustomQuickActionResetTitle;
} else {
folderCustomQuickActionResetItem.localizedTitle = @"Reset Apps";
}
if ( folderCustomQuickActionResetSubtitle.length > 0 ) {
folderCustomQuickActionResetItem.localizedSubtitle = folderCustomQuickActionResetSubtitle;
}
folderCustomQuickActionResetItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"arrow.2.squarepath"];
NSNumber *canfolderCustomQuickActionReset = 0;
for ( SBIcon *icon in [[[self folderIcon] folder] icons] ) {
LSApplicationProxy *applicationProxy = [%c(LSApplicationProxy) applicationProxyForIdentifier:[icon applicationBundleID]];
bool isInstalled = applicationProxy.isInstalled;
bool isDeletable = applicationProxy.isDeletable;
if ( isDeletable && isInstalled ) {
canfolderCustomQuickActionReset = [NSNumber numberWithFloat:([canfolderCustomQuickActionReset doubleValue] + 1)];
}
}
if ( [canfolderCustomQuickActionReset integerValue] > 0 ) {
[shortcutItems addObject: folderCustomQuickActionResetItem];
}
}
if ( folderCustomQuickActionOffload && [self isFolderIcon] ) {
SBSApplicationShortcutItem *folderCustomQuickActionOffloadItem = [%c(SBSApplicationShortcutItem) alloc];
folderCustomQuickActionOffloadItem.type = @"com.tomaszpoliszuk.springboardhome.application-shortcut-item.offload-app";
NSNumber *staticDiskUsage = 0;
for ( SBIcon *icon in [[[self folderIcon] folder] icons] ) {
LSApplicationProxy *applicationProxy = [%c(LSApplicationProxy) applicationProxyForIdentifier:[icon applicationBundleID]];
bool isInstalled = applicationProxy.isInstalled;
bool isDeletable = applicationProxy.isDeletable;
if ( isDeletable && isInstalled ) {
staticDiskUsage = [NSNumber numberWithFloat:([staticDiskUsage doubleValue] + [applicationProxy.staticDiskUsage doubleValue])];
}
}
if ( folderCustomQuickActionOffloadTitle.length > 0 ) {
folderCustomQuickActionOffloadItem.localizedTitle = folderCustomQuickActionOffloadTitle;
} else {
folderCustomQuickActionOffloadItem.localizedTitle = @"Offload Apps";
}
if ( folderCustomQuickActionOffloadSubtitle.length > 0 ) {
folderCustomQuickActionOffloadItem.localizedSubtitle = folderCustomQuickActionOffloadSubtitle;
} else {
folderCustomQuickActionOffloadItem.localizedSubtitle = [NSByteCountFormatter stringFromByteCount:[staticDiskUsage doubleValue] countStyle:NSByteCountFormatterCountStyleDecimal];
}
folderCustomQuickActionOffloadItem.icon = [[%c(SBSApplicationShortcutSystemIcon) alloc] initWithSystemImageName:@"icloud.and.arrow.down"];
if ( [staticDiskUsage integerValue] > 0 ) {
[shortcutItems addObject: folderCustomQuickActionOffloadItem];
}
}
if ( folderCustomQuickActionAppList && [self isFolderIcon] ) {
int iconsCount = 0;
for ( SBBookmarkIcon *icon in [[[self folderIcon] folder] icons] ) {
SBSApplicationShortcutItem *folderCustomQuickActionAppListItem = [%c(SBSApplicationShortcutItem) alloc];
NSString* itemID = @"";
NSString* itemType = @"";
if ( [icon isApplicationIcon] ) {
itemID = [icon applicationBundleID];
itemType = @".app.";
UIImage *appIcon = [UIImage _applicationIconImageForBundleIdentifier:itemID format:0 scale:([UIScreen mainScreen].scale)];
[folderCustomQuickActionAppListItem setIcon:[[%c(SBSApplicationShortcutCustomImageIcon) alloc] initWithImageData:UIImagePNGRepresentation(appIcon) dataType:0 isTemplate:0]];
}
if ( [icon isBookmarkIcon] ) {
itemID = [NSString stringWithFormat:@"%@", [[icon webClip] pageURL]];
itemType = @".bookmark.";
UIImage *appIcon = [[icon webClip] iconImage];
[folderCustomQuickActionAppListItem setIcon:[[%c(SBSApplicationShortcutCustomImageIcon) alloc] initWithImageData:UIImagePNGRepresentation(appIcon) dataType:0 isTemplate:0]];
}
if ( itemID.length > 0 && itemType.length > 0 ) {
iconsCount++;
NSString *itemSuffix = [itemType stringByAppendingString:itemID];
folderCustomQuickActionAppListItem.type = [@"com.tomaszpoliszuk.springboardhome.application-shortcut-item" stringByAppendingString:itemSuffix];
folderCustomQuickActionAppListItem.localizedTitle = [icon displayName];
[shortcutItems addObject: folderCustomQuickActionAppListItem];
}
if ( iconsCount >= folderCustomQuickActionAppListMax ) {
break;
}
}
}
%orig(shortcutItems);
} else {
%orig;
}
}