From 74496828836aed0d9f3084a585ed9945f3fb88ff Mon Sep 17 00:00:00 2001 From: straight-tamago Date: Fri, 26 Jan 2024 16:32:38 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=B5=E3=81=81=E3=81=84=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Resources/Info.plist | 2 +- TDDumpDecrypted.m | 2 +- TDFileManagerViewController.m | 44 +++++++++++++++++++++++++++++++---- TDUtils.h | 7 +++++- TDUtils.m | 9 +------ 5 files changed, 49 insertions(+), 15 deletions(-) diff --git a/Resources/Info.plist b/Resources/Info.plist index 1e74c78..cd171b3 100644 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -18,7 +18,7 @@ CFBundleSignature ???? CFBundleVersion - 1.1 + 1.2 LSRequiresIPhoneOS LSSupportsOpeningDocumentsInPlace diff --git a/TDDumpDecrypted.m b/TDDumpDecrypted.m index c10a460..7c73726 100644 --- a/TDDumpDecrypted.m +++ b/TDDumpDecrypted.m @@ -553,7 +553,7 @@ int find_off_cryptid(const char *filePath) { } -(NSString *)IPAPath { - return [NSString stringWithFormat:@"%@/%@_%@_decrypted.ipa", [self docPath], self.appName, self.appVersion]; + return [NSString stringWithFormat:@"%@/%@_%@_decrypted.tipa", [self docPath], self.appName, self.appVersion]; } -(void) createIPAFile:(pid_t)pid { diff --git a/TDFileManagerViewController.m b/TDFileManagerViewController.m index 46bdac5..8d0161d 100644 --- a/TDFileManagerViewController.m +++ b/TDFileManagerViewController.m @@ -1,5 +1,7 @@ #import "TDFileManagerViewController.h" #import "TDUtils.h" +#import "LSApplicationProxy+AltList.h" +#import @implementation TDFileManagerViewController @@ -83,15 +85,49 @@ return swipeActions; } +UIWindow *kw2 = NULL; +UIAlertController *doneController2 = NULL; + - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *file = self.fileList[indexPath.row]; NSString *path = [docPath() stringByAppendingPathComponent:file]; - NSURL *url = [NSURL fileURLWithPath:path]; - UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[url] applicationActivities:nil]; - [self presentViewController:activityViewController animated:YES completion:nil]; + doneController2 = [UIAlertController alertControllerWithTitle:file message:[NSString stringWithFormat:@"Location:\n%@", path] preferredStyle:UIAlertControllerStyleAlert]; - [tableView deselectRowAtIndexPath:indexPath animated:YES]; + UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Ok", @"Ok") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { + [kw2 removeFromSuperview]; + kw2.hidden = YES; + }]; + [doneController2 addAction:okAction]; + + UIAlertAction *openAction = [UIAlertAction actionWithTitle:@"Share IPA with Airdrop" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { + NSString *filePath = path; + NSDictionary* airdropDictionary; + NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/Sharing.framework"]; + [bundle load]; + + NSString *suf = @"/System/Library/PrivateFrameworks/SharingUI.framework"; + if ([[NSFileManager defaultManager] fileExistsAtPath:suf]){ + NSBundle *sharingUI = [NSBundle bundleWithPath:suf]; + [sharingUI load]; + } + + NSURL *url = [NSURL fileURLWithPath:filePath]; + + id sharingView = [[objc_getClass("SFAirDropSharingViewControllerTV") alloc] initWithSharingItems:@[url]]; + [sharingView setCompletionHandler:^(NSError *error) { + NSString *sender = airdropDictionary[@"sender"]; + if (sender) { + id defaultWorkspace = [objc_getClass("LSApplicationWorkspace") defaultWorkspace]; + [defaultWorkspace performSelector:@selector(openApplicationWithBundleID:) withObject:(id)sender]; + } + }]; + + [self presentViewController:sharingView animated:true completion:nil]; + }]; + [doneController2 addAction:openAction]; + + [self presentViewController:doneController2 animated:YES completion:nil]; } @end \ No newline at end of file diff --git a/TDUtils.h b/TDUtils.h index 0d4ab96..9feb906 100644 --- a/TDUtils.h +++ b/TDUtils.h @@ -42,4 +42,9 @@ NSArray *decryptedFileList(void); NSString *docPath(void); void fetchLatestTrollDecryptVersion(void (^completionHandler)(NSString *version)); void github_fetchLatedVersion(NSString *repo, void (^completionHandler)(NSString *latestVersion)); -NSString *trollDecryptVersion(void); \ No newline at end of file +NSString *trollDecryptVersion(void); + +@interface SFAirDropSharingViewControllerTV : UIViewController +-(id)initWithSharingItems:(id)arg1; +-(void)setCompletionHandler:(void (^)(NSError *error))arg1; +@end \ No newline at end of file diff --git a/TDUtils.m b/TDUtils.m index 5e0bcd7..ce6c1e0 100644 --- a/TDUtils.m +++ b/TDUtils.m @@ -3,13 +3,6 @@ #import "LSApplicationProxy+AltList.h" #import -@interface SFAirDropSharingViewControllerTV : UIViewController --(id)initWithSharingItems:(id)arg1; --(void)setCompletionHandler:(void (^)(NSError *error))arg1; -@end - - - UIWindow *alertWindow = NULL; UIWindow *kw = NULL; UIViewController *root = NULL; @@ -402,7 +395,7 @@ void github_fetchLatedVersion(NSString *repo, void (^completionHandler)(NSString } void fetchLatestTrollDecryptVersion(void (^completionHandler)(NSString *version)) { - github_fetchLatedVersion(@"donato-fiore/TrollDecrypt", completionHandler); + github_fetchLatedVersion(@"straight-tamago/TrollDecrypt-tvOS", completionHandler); } NSString *trollDecryptVersion(void) {