-
Notifications
You must be signed in to change notification settings - Fork 272
/
BHIManager.m
100 lines (96 loc) · 4.23 KB
/
BHIManager.m
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
#import "BHIManager.h"
#import "InstagramHeaders.h"
@implementation BHIManager
+ (BOOL)hideAds {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hide_ads"];
}
+ (BOOL)downloadVideos {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"dw_videos"];
}
+ (BOOL)profileImageSave {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"save_profile"];
}
+ (BOOL)removeSuggestedPost {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"no_suggested_post"];
}
+ (BOOL)showLikeCount {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"show_like_count"];
}
+ (BOOL)likeConfirmation {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"like_confirm"];
}
+ (BOOL)followConfirmation; {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"follow_confirm"];
}
+ (BOOL)copyDecription {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"copy_description"];
}
+ (BOOL)copyBio {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"copy_bio"];
}
+ (BOOL)Padlock {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"padlock"];
}
+ (BOOL)keepDeletedMessage {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"keep_deleted_message"];
}
+ (BOOL)hideLastSeen {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"remove_lastseen"];
}
+ (BOOL)noScreenShotAlert {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"remove_screenshot_alert"];
}
+ (BOOL)unlimtedReply {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"unlimited_replay"];
}
+ (BOOL)noSeenReceipt {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"no_seen_receipt"];
}
+ (void)cleanCache {
NSArray <NSURL *> *DocumentFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:[NSURL fileURLWithPath:NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true).firstObject] includingPropertiesForKeys:@[] options:NSDirectoryEnumerationSkipsHiddenFiles error:nil];
for (NSURL *file in DocumentFiles) {
if ([file.pathExtension.lowercaseString isEqualToString:@"mp4"]) {
[[NSFileManager defaultManager] removeItemAtURL:file error:nil];
}
}
NSArray <NSURL *> *TempFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:[NSURL fileURLWithPath:NSTemporaryDirectory()] includingPropertiesForKeys:@[] options:NSDirectoryEnumerationSkipsHiddenFiles error:nil];
for (NSURL *file in TempFiles) {
if ([file.pathExtension.lowercaseString isEqualToString:@"mp4"]) {
[[NSFileManager defaultManager] removeItemAtURL:file error:nil];
}
if ([file.pathExtension.lowercaseString isEqualToString:@"mov"]) {
[[NSFileManager defaultManager] removeItemAtURL:file error:nil];
}
if ([file.pathExtension.lowercaseString isEqualToString:@"tmp"]) {
[[NSFileManager defaultManager] removeItemAtURL:file error:nil];
}
if ([file hasDirectoryPath]) {
if ([BHIManager isEmpty:file]) {
[[NSFileManager defaultManager] removeItemAtURL:file error:nil];
}
}
}
}
+ (BOOL)isEmpty:(NSURL *)url {
NSArray *FolderFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:url includingPropertiesForKeys:@[] options:NSDirectoryEnumerationSkipsHiddenFiles error:nil];
if (FolderFiles.count == 0) {
return true;
} else {
return false;
}
}
+ (void)showSaveVC:(id)item {
UIActivityViewController *acVC = [[UIActivityViewController alloc] initWithActivityItems:@[item] applicationActivities:nil];
if (is_iPad()) {
acVC.popoverPresentationController.sourceView = topMostController().view;
acVC.popoverPresentationController.sourceRect = CGRectMake(topMostController().view.bounds.size.width / 2.0, topMostController().view.bounds.size.height / 2.0, 1.0, 1.0);
}
[topMostController() presentViewController:acVC animated:true completion:nil];
}
+ (NSString *)getDownloadingPersent:(float)per {
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle:NSNumberFormatterPercentStyle];
NSNumber *number = [NSNumber numberWithFloat:per];
return [numberFormatter stringFromNumber:number];
}
@end