Exemple #1
0
 def run(self, arguments, options):
     if options.classNameRegex and options.view:
         print("Do not set both the --name and --view flags")
     elif options.view:
         self.findOwningViewController(options.view)
     else:
         output = vcHelpers.viewControllerRecursiveDescription(
             "(id)[[[UIApplication sharedApplication] keyWindow] rootViewController]"
         )
         searchString = (options.classNameRegex
                         if options.classNameRegex else arguments[0])
         printMatchesInViewOutputStringAndCopyFirstToClipboard(
             searchString, output)
Exemple #2
0
    def run(self, arguments, options):
        isMac = runtimeHelpers.isMacintoshArch()

        if arguments[0] == "__keyWindow_rootVC_dynamic__":
            if fb.evaluateBooleanExpression(
                    "[UIViewController respondsToSelector:@selector(_printHierarchy)]"
            ):
                print(fb.describeObject("[UIViewController _printHierarchy]"))
                return

            arguments[
                0] = "(id)[(id)[[UIApplication sharedApplication] keyWindow] rootViewController]"  # noqa B950
            if isMac:
                arguments[
                    0] = "(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentViewController]"  # noqa B950

        print(vcHelpers.viewControllerRecursiveDescription(arguments[0]))