|
| 1 | +// Developer : Azozz ALFiras |
| 2 | +// Source Code : github.com/AzozzALFiras/ALFiras |
| 3 | +// Thanks for help : Elias Sfeir |
| 4 | +// Twitter : @eliassfeir1 |
| 5 | +// Download Video & Photo from story & message |
| 6 | +// snapchat |
| 7 | + |
| 8 | + |
| 9 | +#import <UIKit/UIKit.h> |
| 10 | +#import <Social/SLComposeViewController.h> |
| 11 | +#import <Social/SLServiceTypes.h> |
| 12 | +#import "UIAlert+Blocks.h" |
| 13 | +#import <QuartzCore/QuartzCore.h> |
| 14 | +#import <Cephei/HBPreferences.h> |
| 15 | +#import <AVFoundation/AVFoundation.h> |
| 16 | + |
| 17 | +extern NSString *const HBPreferencesDidChangeNotification; |
| 18 | + |
| 19 | +HBPreferences *preferences; |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +static BOOL enable; |
| 25 | +%ctor |
| 26 | +{ |
| 27 | + |
| 28 | + // Name Header tweak |
| 29 | + preferences = [[HBPreferences alloc] initWithIdentifier:@"com.i1iraqi.ALFiras"]; |
| 30 | + |
| 31 | + [preferences registerBool:&enable default:NO forKey:@"enable"]; |
| 32 | +} |
| 33 | + |
| 34 | +@interface SCOperaPageViewController : UIViewController |
| 35 | +-(id)shareableMedia; |
| 36 | +-(void)loadView; |
| 37 | +-(NSArray*)shareableMedias; |
| 38 | +-(void)viewDidAppear:(BOOL)arg1; |
| 39 | +-(void)stop; |
| 40 | +-(id)configuration; |
| 41 | +@end |
| 42 | + |
| 43 | +@interface SCOperaConfiguration |
| 44 | +-(id)remoteVideoPropertiesProvider; |
| 45 | +@end |
| 46 | + |
| 47 | +@interface SCDiscoverVideoCatalogService |
| 48 | +-(NSMutableDictionary *)videoCatalogMap; |
| 49 | +@end |
| 50 | + |
| 51 | + |
| 52 | +@interface SCDiscoverVideoCatalog |
| 53 | +-(id)videoURLs; |
| 54 | +@end |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +@interface SCOperaShareableMedia : SCOperaPageViewController |
| 59 | +{ |
| 60 | + UIImage *_image; |
| 61 | +} |
| 62 | +@property NSInteger mediaType; |
| 63 | +-(id)image; |
| 64 | +-(id)videoURL; |
| 65 | +-(id)videoAsset; |
| 66 | +@end |
| 67 | + |
| 68 | + |
| 69 | +@interface SettingsViewController : UIViewController |
| 70 | +{ |
| 71 | + UITableView *_tableView; |
| 72 | +} |
| 73 | +-(void)didBecomeActive; |
| 74 | +-(void)reloadTableOnMainThread; |
| 75 | +-(void)loadView; |
| 76 | +@end |
| 77 | + |
| 78 | +@interface SCOperaViewController |
| 79 | +-(id)shareableMedias; |
| 80 | +@end |
| 81 | + |
| 82 | + |
| 83 | +UIButton *button1; |
| 84 | + |
| 85 | +%hook SCOperaPageViewController |
| 86 | +-(void)autoAdvanceTimerDidFire{ |
| 87 | + |
| 88 | +} |
| 89 | +-(void)viewDidAppear:(BOOL)arg1{ |
| 90 | + %orig; |
| 91 | +if(enable){ |
| 92 | + double screenHeight = [[UIScreen mainScreen] bounds].size.height; |
| 93 | + |
| 94 | +// button Tweak |
| 95 | + |
| 96 | + button1 = [UIButton buttonWithType:UIButtonTypeContactAdd]; |
| 97 | +[button1 addTarget:self |
| 98 | + action:@selector(didPressSave:) |
| 99 | + forControlEvents:UIControlEventTouchUpInside]; |
| 100 | +[button1 setTitle:@"" forState:UIControlStateNormal]; |
| 101 | + |
| 102 | +// iPhone 5/5S/SE |
| 103 | + if (screenHeight == 568) { |
| 104 | + NSLog(@"iPhone 5/5S/SE"); |
| 105 | + button1.center = CGPointMake(300 , 500); |
| 106 | +}else if (screenHeight == 667) { |
| 107 | + |
| 108 | +// iPhone 6/7 |
| 109 | + button1.center = CGPointMake(350 , 635); |
| 110 | + } else if(screenHeight == 736){ |
| 111 | + |
| 112 | +// iPhone 8 and Up |
| 113 | + button1.center = CGPointMake(370 ,700); |
| 114 | + }else{ |
| 115 | + button1.center = CGPointMake(320 ,665); |
| 116 | + } |
| 117 | + |
| 118 | +[self.view addSubview:button1]; |
| 119 | + |
| 120 | +}else{ |
| 121 | + %orig; |
| 122 | +} |
| 123 | +} |
| 124 | +%new |
| 125 | +-(void)didPressSave:(UIButton*)button{ |
| 126 | + |
| 127 | +[self stop]; |
| 128 | +NSArray* test = [self shareableMedias]; |
| 129 | + |
| 130 | +if(test.count == 1){ |
| 131 | +id test1 = [test firstObject]; |
| 132 | + |
| 133 | +UIImage *test2 = [test1 image]; |
| 134 | + |
| 135 | +NSString * message = @"Check this Photo !"; |
| 136 | + |
| 137 | + |
| 138 | +NSArray * shareItems = @[message, test2]; |
| 139 | + |
| 140 | +UIActivityViewController * avc = [[ UIActivityViewController alloc] initWithActivityItems:shareItems applicationActivities:nil]; |
| 141 | + |
| 142 | +[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:avc animated:YES completion:NULL]; |
| 143 | +[avc setCompletionWithItemsHandler:^(NSString *activityType,BOOL completed, NSArray *returnedItems, NSError *activityError){ |
| 144 | + |
| 145 | +}]; |
| 146 | +}else if(test.count >= 2){ |
| 147 | + |
| 148 | + id video = [test objectAtIndex:1]; |
| 149 | + |
| 150 | + id asset = [video videoAsset]; |
| 151 | + |
| 152 | + NSURL *videoURL = [asset URL]; |
| 153 | +if(videoURL){ |
| 154 | + |
| 155 | + NSArray * shareItems = @[videoURL]; |
| 156 | + |
| 157 | +UIActivityViewController * avc = [[ UIActivityViewController alloc] initWithActivityItems:shareItems applicationActivities:nil]; |
| 158 | + |
| 159 | +[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:avc animated:YES completion:NULL]; |
| 160 | +[avc setCompletionWithItemsHandler:^(NSString *activityType,BOOL completed, NSArray *returnedItems, NSError *activityError){ |
| 161 | + |
| 162 | +}]; |
| 163 | + |
| 164 | +}else{ |
| 165 | + |
| 166 | + |
| 167 | +id stockVideo = [test objectAtIndex:1]; |
| 168 | +NSURL *stockVideoURL = [stockVideo videoURL]; |
| 169 | + |
| 170 | + |
| 171 | + NSArray * shareItems = @[stockVideoURL]; |
| 172 | + |
| 173 | +UIActivityViewController * avc = [[ UIActivityViewController alloc] initWithActivityItems:shareItems applicationActivities:nil]; |
| 174 | + |
| 175 | +[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:avc animated:YES completion:NULL]; |
| 176 | +[avc setCompletionWithItemsHandler:^(NSString *activityType,BOOL completed, NSArray *returnedItems, NSError *activityError){ |
| 177 | + |
| 178 | +}]; |
| 179 | + |
| 180 | + |
| 181 | +} |
| 182 | +} |
| 183 | + |
| 184 | +} |
| 185 | +%end |
0 commit comments