@@ -18,6 +18,27 @@ + (NSString *)getStringPref:(NSString *)key {
1818 return [[NSUserDefaults standardUserDefaults ] stringForKey: key];
1919}
2020
21+ // MARK: Misc
22+
23+ + (NSString *)IGVersionString {
24+ return [[[NSBundle mainBundle ] infoDictionary ] objectForKey: @" CFBundleShortVersionString" ];
25+ };
26+ + (BOOL )isNotch {
27+ return [[[UIApplication sharedApplication ] keyWindow ] safeAreaInsets ].bottom > 0 ;
28+ };
29+
30+ + (BOOL )existingLongPressGestureRecognizerForView : (UIView *)view {
31+ NSArray *allRecognizers = view.gestureRecognizers ;
32+
33+ for (UIGestureRecognizer *recognizer in allRecognizers) {
34+ if ([[recognizer class ] isSubclassOfClass: [UILongPressGestureRecognizer class ]]) {
35+ return YES ;
36+ }
37+ }
38+
39+ return NO ;
40+ }
41+
2142+ (_Bool )liquidGlassEnabledBool : (_Bool )fallback {
2243 BOOL setting = [SCIUtils getBoolPref: @" liquid_glass_surfaces" ];
2344 return setting ? true : fallback;
@@ -72,7 +93,7 @@ + (void)cleanCache {
7293
7394}
7495
75- // Displaying View Controllers
96+ // MARK: Display View Controllers
7697+ (void )showQuickLookVC : (NSArray <id> *)items {
7798 QLPreviewController *previewController = [[QLPreviewController alloc ] init ];
7899 QuickLookDelegate *quickLookDelegate = [[QuickLookDelegate alloc ] initWithPreviewItemURLs: items];
@@ -97,12 +118,12 @@ + (void)showSettingsVC:(UIWindow *)window {
97118 [rootController presentViewController: navigationController animated: YES completion: nil ];
98119}
99120
100- // Colours
121+ // MARK: Colours
101122+ (UIColor *)SCIColor_Primary {
102123 return [UIColor colorWithRed: 0 /255.0 green: 152 /255.0 blue: 254 /255.0 alpha: 1 ];
103124};
104125
105- // Errors
126+ // MARK: Errors
106127+ (NSError *)errorWithDescription : (NSString *)errorDesc {
107128 return [self errorWithDescription: errorDesc code: 1 ];
108129}
@@ -125,7 +146,7 @@ + (JGProgressHUD *)showErrorHUDWithDescription:(NSString *)errorDesc dismissAfte
125146 return hud;
126147}
127148
128- // Media
149+ // MARK: Media
129150+ (NSURL *)getPhotoUrl : (IGPhoto *)photo {
130151 if (!photo) return nil ;
131152
@@ -167,7 +188,7 @@ + (NSURL *)getVideoUrlForMedia:(IGMedia *)media {
167188 return [SCIUtils getVideoUrl: video];
168189}
169190
170- // View Controllers
191+ // MARK: View Controller Helpers
171192+ (UIViewController *)viewControllerForView : (UIView *)view {
172193 NSString *viewDelegate = @" viewDelegate" ;
173194 if ([view respondsToSelector: NSSelectorFromString (viewDelegate)]) {
@@ -191,26 +212,9 @@ + (UIViewController *)nearestViewControllerForView:(UIView *)view {
191212}
192213
193214// Functions
194- + (NSString *)IGVersionString {
195- return [[[NSBundle mainBundle ] infoDictionary ] objectForKey: @" CFBundleShortVersionString" ];
196- };
197- + (BOOL )isNotch {
198- return [[[UIApplication sharedApplication ] keyWindow ] safeAreaInsets ].bottom > 0 ;
199- };
200-
201- + (BOOL )existingLongPressGestureRecognizerForView : (UIView *)view {
202- NSArray *allRecognizers = view.gestureRecognizers ;
203215
204- for (UIGestureRecognizer *recognizer in allRecognizers) {
205- if ([[recognizer class ] isSubclassOfClass: [UILongPressGestureRecognizer class ]]) {
206- return YES ;
207- }
208- }
209-
210- return NO ;
211- }
212216
213- // Alerts
217+ // MARK: Alerts
214218+ (BOOL )showConfirmation : (void (^)(void ))okHandler title : (NSString *)title {
215219 UIAlertController* alert = [UIAlertController alertControllerWithTitle: title message: @" Are you sure?" preferredStyle: UIAlertControllerStyleAlert];
216220 [alert addAction: [UIAlertAction actionWithTitle: @" Yes" style: UIAlertActionStyleDefault handler: ^(UIAlertAction * _Nonnull action) {
@@ -253,7 +257,7 @@ + (void)showRestartConfirmation {
253257 [topMostController () presentViewController: alert animated: YES completion: nil ];
254258};
255259
256- // Toasts
260+ // MARK: Toasts
257261+ (void )showToastForDuration : (double )duration title : (NSString *)title {
258262 [SCIUtils showToastForDuration: duration title: title subtitle: nil ];
259263}
@@ -282,7 +286,7 @@ + (void)showToastForDuration:(double)duration title:(NSString *)title subtitle:(
282286 [toastPresenter showAlertWithViewModel: model isAnimated: true animationDuration: duration presentationPriority: 0 tapActionBlock: nil presentedHandler: nil dismissedHandler: nil ];
283287}
284288
285- // Math
289+ // MARK: Math
286290+ (NSUInteger )decimalPlacesInDouble : (double )value {
287291 NSNumberFormatter *formatter = [[NSNumberFormatter alloc ] init ];
288292 [formatter setNumberStyle: NSNumberFormatterDecimalStyle];
0 commit comments