Last active
May 18, 2023 02:21
-
-
Save ArsnealX/f09aea08a52dee5e4339313ad2a6c7a3 to your computer and use it in GitHub Desktop.
Dismiss captureTextFromCamera(_:)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)dismissCaptureText { | |
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Wundeclared-selector" | |
if (@available(iOS 13.0, *)) { | |
if (![UIScene respondsToSelector:@selector(_scenesIncludingInternal:)]) { | |
return; | |
} | |
NSArray *scenes = [UIScene performSelector:@selector(_scenesIncludingInternal:) withObject:@(YES)]; | |
for (UIScene *scene in scenes) { | |
if ([scene isKindOfClass:NSClassFromString(@"_UIKeyboardWindowScene")]) { | |
if (![scene respondsToSelector:@selector(windows)]) { | |
return; | |
} | |
NSArray *windows = [scene performSelector:@selector(windows)]; | |
for (UIWindow *window in windows) { | |
if ([window isKindOfClass:NSClassFromString(@"UITextEffectsWindow")]) { | |
for (UIView *view in window.subviews) { | |
if ([view isKindOfClass:NSClassFromString(@"_UITextEffectsRemoteView")]) { | |
if (![view respondsToSelector:@selector(remoteViewController)]) { | |
return; | |
} | |
UIViewController *viewController = [view performSelector:@selector(remoteViewController)]; | |
if ([viewController isKindOfClass:NSClassFromString(@"UIKeyboardCameraRemoteViewController")]) { | |
[viewController performSelector:@selector(keyboardCameraDidCancel)]; | |
} | |
} | |
} | |
} | |
} | |
break; | |
} | |
} | |
} | |
#pragma clang diagnostic pop | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment