Skip to content

Commit

Permalink
project
Browse files Browse the repository at this point in the history
  • Loading branch information
BandarHL committed Jul 12, 2023
1 parent 48ae640 commit 9581122
Show file tree
Hide file tree
Showing 42 changed files with 4,778 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
# Created by https://www.toptal.com/developers/gitignore/api/macos,theos-tweak
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,theos-tweak

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### THEOS-Tweak ###
*.deb
.debmake
_
obj
.theos
packages

# End of https://www.toptal.com/developers/gitignore/api/macos,theos-tweak

# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

35 changes: 35 additions & 0 deletions BHDownload.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// BHDownload.h
// DIYTableView
//
// Created by BandarHelal on 12/01/1442 AH.
// Copyright © 1442 BandarHelal. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@protocol BHDownloadDelegate <NSObject>
@optional
- (void)downloadProgress:(float)progress;
- (void)downloadDidFinish:(NSURL *)filePath Filename:(NSString *)fileName;
- (void)downloadDidFailureWithError:(NSError *)error;
@end

@interface BHDownload : NSObject
{
id delegate;
}
- (void)setDelegate:(id)newDelegate;
- (instancetype)init;
- (void)downloadFileWithURL:(NSURL *)url;
@property (nonatomic, strong) NSString *fileName;
@end

@interface BHDownload () <NSURLSessionDelegate, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate, NSURLSessionStreamDelegate>
@property (nonatomic, strong) NSURLSession *Session;
@end

NS_ASSUME_NONNULL_END
45 changes: 45 additions & 0 deletions BHDownload.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// BHDownload.m
// DIYTableView
//
// Created by BandarHelal on 12/01/1442 AH.
// Copyright © 1442 BandarHelal. All rights reserved.
//

#import "BHDownload.h"

@implementation BHDownload
- (instancetype)init {
self = [super init];
if (self) {
self.Session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] delegate:self delegateQueue:[NSOperationQueue mainQueue]];
}
return self;
}

- (void)downloadFileWithURL:(NSURL *)url {
if (url) {
self.fileName = url.absoluteString.lastPathComponent;
NSURLSessionDownloadTask *downloadTask = [self.Session downloadTaskWithURL:url];
[downloadTask resume];
}
}
- (void)setDelegate:(id)newDelegate {
if (newDelegate) {
delegate = newDelegate;
}
}
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite {
float prog = (float)totalBytesWritten / (float)totalBytesExpectedToWrite;
[delegate downloadProgress:prog];
}
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(nonnull NSURL *)location {
[delegate downloadDidFinish:location Filename:self.fileName];
}
- (void)URLSession:(NSURLSession *)session didBecomeInvalidWithError:(NSError *)error {
[delegate downloadDidFailureWithError:error];
}
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {
[delegate downloadDidFailureWithError:error];
}
@end
22 changes: 22 additions & 0 deletions BHIManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface BHIManager: NSObject
+ (BOOL)hideAds;
+ (BOOL)downloadVideos;
+ (BOOL)profileImageSave;
+ (BOOL)removeSuggestedPost;
+ (BOOL)showLikeCount;
+ (BOOL)likeConfirmation;
+ (BOOL)copyDecription;
+ (BOOL)Padlock;
+ (BOOL)keepDeletedMessage;
+ (BOOL)hideLastSeen;
+ (BOOL)noScreenShotAlert;
+ (BOOL)unlimtedReply;
+ (BOOL)noSeenReceipt;
+ (void)showSaveVC:(id)item;
+ (void)cleanCache;
+ (BOOL)isEmpty:(NSURL *)url;
+ (NSString *)getDownloadingPersent:(float)per;
@end
94 changes: 94 additions & 0 deletions BHIManager.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#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)copyDecription {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"copy_description"];
}
+ (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
1 change: 1 addition & 0 deletions BHInsta.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ Filter = { Bundles = ( "com.apple.springboard" ); }; }
15 changes: 15 additions & 0 deletions BHTBundle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// BHTBundle.h
// BHTwitter
//
// Created by BandarHelal on 07/08/2022.
//

#import <Foundation/Foundation.h>

@interface BHTBundle : NSObject
+ (instancetype)sharedBundle;
- (NSString *)localizedStringForKey:(NSString *)key;
- (NSURL *)pathForFile:(NSString *)fileName;
- (NSString *)BHTwitterVersion;
@end
50 changes: 50 additions & 0 deletions BHTBundle.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// BHTBundle.m
// BHTwitter
//
// Created by BandarHelal on 07/08/2022.
//

#import "BHTBundle.h"

@interface BHTBundle ()
@property (nonatomic, strong) NSBundle *mainBundle;
@end

@implementation BHTBundle
+ (instancetype)sharedBundle {
static BHTBundle *sharedBundle = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *bundlePath = [NSURL new];
if ([fileManager fileExistsAtPath:@"/Library/Application Support/BHT/BHTwitter.bundle"]) {
bundlePath = [NSURL fileURLWithPath:@"/Library/Application Support/BHT/BHTwitter.bundle"];
} else if ([fileManager fileExistsAtPath:@"/var/jb/Library/Application Support/BHT/BHTwitter.bundle"]) {
bundlePath = [NSURL fileURLWithPath:@"/var/jb/Library/Application Support/BHT/BHTwitter.bundle"];
} else {
bundlePath = [[NSBundle mainBundle] URLForResource:@"BHTwitter" withExtension:@"bundle"];
}

sharedBundle = [[self alloc] initWithBundlePath:bundlePath];
});
return sharedBundle;
}
- (instancetype)initWithBundlePath:(NSURL *)bundlePath {
if (self = [super init]) {
self.mainBundle = [NSBundle bundleWithPath:[bundlePath path]];
}

return self;
}

- (NSString *)localizedStringForKey:(NSString *)key {
return [self.mainBundle localizedStringForKey:key value:key table:nil];
}
- (NSURL *)pathForFile:(NSString *)fileName {
return [self.mainBundle URLForResource:fileName withExtension:nil];
}
- (NSString *)BHTwitterVersion {
return [self.mainBundle objectForInfoDictionaryKey:@"BHTVersion"];
}
@end
Loading

0 comments on commit 9581122

Please sign in to comment.