Skip to content

Commit 259acc2

Browse files
authored
Download Video & Photo from story & message
Download Video & Photo from story & message
1 parent 32c5a78 commit 259acc2

31 files changed

+1601
-0
lines changed

Makefile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
GO_EASY_ON_ME = 1
2+
include $(THEOS)/makefiles/common.mk
3+
4+
TWEAK_NAME = alfiras
5+
alfiras_FILES = Tweak.xm UIAlert+Blocks.m
6+
alfiras_FRAMEWORKS = AVFoundation
7+
alfiras_EXTRA_FRAMEWORKS += cephei
8+
alfiras_LIBRARIES = rocketbootstrap
9+
10+
include $(THEOS_MAKE_PATH)/tweak.mk
11+
12+
after-install::
13+
install.exec "killall -9 com.toyopagroup.picaboo"
14+
SUBPROJECTS += alfiras
15+
include $(THEOS_MAKE_PATH)/aggregate.mk

Tweak.xm

+185
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
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

UIAlert+Blocks.h

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
10+
#import <UIKit/UIKit.h>
11+
12+
@interface UIAlertView (Blocks)
13+
14+
- (void)showWithCompletion:(void(^)(UIAlertView *alertView, NSInteger buttonIndex))completion;
15+
16+
@end

UIAlert+Blocks.m

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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 <objc/runtime.h>
10+
11+
@interface INAlertWrapper : NSObject
12+
13+
@property (copy) void(^completionBlock)(UIAlertView *alertView, NSInteger buttonIndex);
14+
15+
@end
16+
17+
@implementation INAlertWrapper
18+
19+
#pragma mark - UIAlertViewDelegate
20+
21+
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
22+
{
23+
if (self.completionBlock) {
24+
self.completionBlock(alertView, buttonIndex);
25+
}
26+
}
27+
28+
- (void)alertViewCancel:(UIAlertView *)alertView
29+
{
30+
if (self.completionBlock) {
31+
self.completionBlock(alertView, alertView.cancelButtonIndex);
32+
}
33+
}
34+
35+
@end
36+
37+
38+
static const char kINAlertWrapper;
39+
40+
@implementation UIAlertView (Blocks)
41+
42+
- (void)showWithCompletion:(void (^)(UIAlertView *, NSInteger))completion
43+
{
44+
INAlertWrapper *wrapper = [INAlertWrapper new];
45+
wrapper.completionBlock = completion;
46+
self.delegate = wrapper;
47+
48+
objc_setAssociatedObject(self, &kINAlertWrapper, wrapper, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
49+
50+
[self show];
51+
}
52+
@end

alfiras.plist

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ Filter = { Bundles = ( "com.toyopagroup.picaboo" ); }; }

0 commit comments

Comments
 (0)