Explorar o código

properly fixed the crash where icons failed to load from the proxy

Kevin Bradley %!s(int64=5) %!d(string=hai) anos
pai
achega
11b72df7fc
Modificáronse 3 ficheiros con 46 adicións e 45 borrados
  1. 44 43
      flexinjected/Tweak.x
  2. 1 1
      flexinjected/Tweak.x.jsont
  3. 1 1
      flexinjected/compile_commands.json

+ 44 - 43
flexinjected/Tweak.x

@@ -24,7 +24,6 @@
 - (UIViewController *)topViewController;
 @end
 
-
 @implementation UIWindow (Additions)
 - (UIViewController *)visibleViewController {
     UIViewController *rootViewController = self.rootViewController;
@@ -72,7 +71,7 @@ static void sendNotification(NSString *title, NSString *message, UIImage *image)
     [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.nito.bulletinh4x/displayBulletin" object:nil userInfo:dict];
 }
 
-// The dylib constructor sets decryptedIPAPath, spawns a thread to do the app decryption, then exits.
+
 __attribute__ ((constructor)) static void FLEXInjected_main() {
     
     NSBundle *bundle = [NSBundle mainBundle];
@@ -80,48 +79,50 @@ __attribute__ ((constructor)) static void FLEXInjected_main() {
     NSDictionary *ourDict = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.nito.flexinjected.plist"];
     NSNumber *value = [ourDict objectForKey:bundleID];
     if ([value boolValue] == YES) {
-    BOOL sendAlert = true;
-    id prox = [%c(LSApplicationProxy) applicationProxyForIdentifier:bundleID];
-      UIImage *icon = nil;
-      if (prox){
-          NSLog(@"[FLEXInjected] found prox: %@", prox);
-          if ([prox isContainerized]){
-            //sendAlert = false;
-		icon = nil;
-	  } else {
-                icon = [prox tv_applicationFlatIcon];
-          }
-      } else {
-          NSString *mcsPath = @"/System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices";
-          [[NSBundle bundleWithPath:mcsPath] load];
-          prox = [%c(LSApplicationProxy) applicationProxyForIdentifier:bundleID];
-          if ([prox isContainerized]){
-            //sendAlert = false;
-	    icon = nil;
-	  } else {
-            icon = [prox tv_applicationFlatIcon];
-           }
-      }
-      if (sendAlert){
-        NSString *message = [NSString stringWithFormat:@"Injected into bundle: %@", bundleID];
-        sendNotification(@"FLEXInjected", message, icon);
-        NSLog(@"[FLEXInjected) bundle ID %@", bundleID);
-      }
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-        NSLog(@"[FLEXInjected] weouchea...");
-        NSString *p = @"/Library/Frameworks/FLEX.framework";
-        NSBundle *bundle = [NSBundle bundleWithPath:p];
-        [bundle load];
-        id flexManager = [%c(FLEXManager) sharedManager];
-        UIViewController *tvc = [[UIApplication sharedApplication] topViewController];
-        if([tvc respondsToSelector: @selector(tabBarController)]){
-            UITabBarController *tabBar = [tvc tabBarController];
-            if (tabBar) tvc = tabBar;
+        BOOL sendAlert = true;
+        id prox = [%c(LSApplicationProxy) applicationProxyForIdentifier:bundleID];
+        UIImage *icon = nil;
+        if (prox){
+            NSLog(@"[FLEXInjected] found prox: %@", prox);
+            if ([prox isContainerized]){
+                icon = nil;
+            } else {
+                if ([prox respondsToSelector:@selector(tv_applicationFlatIcon)]){
+                    icon = [prox tv_applicationFlatIcon];
+                }
+            }
+        } else { //no prox found
+            NSString *mcsPath = @"/System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices";
+            [[NSBundle bundleWithPath:mcsPath] load];
+            prox = [%c(LSApplicationProxy) applicationProxyForIdentifier:bundleID];
+            if ([prox isContainerized]){
+                icon = nil;
+            } else {
+                if ([prox respondsToSelector:@selector(tv_applicationFlatIcon)]){
+                    icon = [prox tv_applicationFlatIcon];
+                }
+            }
+        }
+        if (sendAlert){
+            NSString *message = [NSString stringWithFormat:@"Injected into bundle: %@", bundleID];
+            sendNotification(@"FLEXInjected", message, icon);
+            NSLog(@"[FLEXInjected) bundle ID %@", bundleID);
         }
-        NSLog(@"[FLEXInjected] top view controller: %@ violated...", tvc);
-        [flexManager _addTVOSGestureRecognizer:tvc];
-        [flexManager showExplorer];
-    });
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+            NSLog(@"[FLEXInjected] weouchea...");
+            NSString *p = @"/Library/Frameworks/FLEX.framework";
+            NSBundle *bundle = [NSBundle bundleWithPath:p];
+            [bundle load];
+            id flexManager = [%c(FLEXManager) sharedManager];
+            UIViewController *tvc = [[UIApplication sharedApplication] topViewController];
+            if([tvc respondsToSelector: @selector(tabBarController)]){
+                UITabBarController *tabBar = [tvc tabBarController];
+                if (tabBar) tvc = tabBar;
+            }
+            NSLog(@"[FLEXInjected] top view controller: %@ violated...", tvc);
+            [flexManager _addTVOSGestureRecognizer:tvc];
+            [flexManager showExplorer];
+        });
         
     }
 }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
flexinjected/Tweak.x.jsont


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
flexinjected/compile_commands.json