diff --git a/README.md b/README.md index 787f881..d0863a1 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,9 @@ To save videos: Triple tap on them and select "Save Video" ## History +#### 1.0.2 +* Fix ability to save Profile Pictures + #### 1.0.1 * Fix ability to save Poll images @@ -38,7 +41,7 @@ To save videos: Triple tap on them and select "Save Video" ## Credits -Made by Gh0stByte +Made by [Gh0stByte](http://twitter.com/Gh0stByte) Suggestion by /u/marcelre diff --git a/Tweak.xm b/Tweak.xm index bdee6ba..3660563 100644 --- a/Tweak.xm +++ b/Tweak.xm @@ -35,6 +35,10 @@ @property (assign, nonatomic) FLImageView *photoView; @end +@interface FLFullScreenPhotoViewController : UIViewController +@property (assign, nonatomic) UIImageView *imageView; +@end + %hook FLHubPhotoViewController -(void)viewDidLoad @@ -263,6 +267,62 @@ %end + +%hook FLFullScreenPhotoViewController + +-(void)viewDidLoad +{ + UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] + initWithTarget:self + action:@selector(handleLongPress:)]; + longPress.minimumPressDuration = 1.5; + [self.view addGestureRecognizer:longPress]; + %orig; +} + +%new +-(void)handleLongPress:(UILongPressGestureRecognizer *)sender +{ + UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; + + [actionSheet addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { + + // Cancel button tappped. + [self dismissViewControllerAnimated:YES completion:^{ + }]; + }]]; + + [actionSheet addAction:[UIAlertAction actionWithTitle:@"Save Image" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { + + UIImage *snapshot = self.imageView.image; + + [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^ + { + PHAssetChangeRequest *changeRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:snapshot]; + changeRequest.creationDate = [NSDate date]; + } + completionHandler:^(BOOL success, NSError *error) + { + if (success) + { + NSLog(@"successfully saved"); + } + else + { + NSLog(@"error saving to photos: %@", error); + } + }]; + + [self dismissViewControllerAnimated:YES completion:^{ + }]; + }]]; + + // Present action sheet. + [self presentViewController:actionSheet animated:YES completion:nil]; +} + +%end + // IGNORE ABOVE. SAVES IMAGES //FLAVPlayerLayerView //FLHubVideoCollection @@ -346,4 +406,4 @@ [[[UIApplication sharedApplication] keyWindow].rootViewController presentViewController:actionSheet animated:YES completion:nil]; } -%end \ No newline at end of file +%end diff --git a/control b/control index 93d6f22..ca5a009 100644 --- a/control +++ b/control @@ -1,7 +1,7 @@ Package: gg.gh0stbyte.bkstg Name: Bkstg Plus Depends: mobilesubstrate -Version: 1.0.0 +Version: 1.0.2 Architecture: iphoneos-arm Description: Save Media from Bkstg Download photos & videos using this tweak. This tweak was suggested by /u/marcelre. diff --git a/gg.gh0stbyte.bkstg_1.0.0_iphoneos-arm.deb b/gg.gh0stbyte.bkstg_1.0.0_iphoneos-arm.deb new file mode 100644 index 0000000..3632da8 Binary files /dev/null and b/gg.gh0stbyte.bkstg_1.0.0_iphoneos-arm.deb differ diff --git a/gg.gh0stbyte.bkstg_1.0.2_iphoneos-arm.deb b/gg.gh0stbyte.bkstg_1.0.2_iphoneos-arm.deb new file mode 100644 index 0000000..5dc68d2 Binary files /dev/null and b/gg.gh0stbyte.bkstg_1.0.2_iphoneos-arm.deb differ