diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 3e0728763..2de12e297 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -4986,7 +4986,9 @@ typedef enum : NSUInteger { // in the content of this view. It's easier to dismiss the // "message actions" window when the device changes orientation // than to try to ensure this works in that case. - [self dismissMenuActions]; + if (OWSWindowManager.sharedManager.isPresentingMenuActions) { + [self dismissMenuActions]; + } // Snapshot the "last visible row". NSIndexPath *_Nullable lastVisibleIndexPath = self.lastVisibleIndexPath; diff --git a/SignalMessaging/utils/OWSWindowManager.m b/SignalMessaging/utils/OWSWindowManager.m index f85485492..5f157fdf3 100644 --- a/SignalMessaging/utils/OWSWindowManager.m +++ b/SignalMessaging/utils/OWSWindowManager.m @@ -681,27 +681,60 @@ const UIWindowLevel UIWindowLevel_MessageActions(void) IMP imp1 = [self.rootWindow methodForSelector:selector1]; BOOL (*func1)(id, SEL) = (void *)imp1; BOOL isDisabled = func1(self.rootWindow, selector1); - OWSLogInfo(@"autorotation is disabled: %d", isDisabled); if (isDisabled) { - // NSString *encodedSelectorString2 = @"endDisablingInterfaceAutorotation".encodedForSelector; - NSString *encodedSelectorString2 = @"dgB1VXoFcnN9egB4WgAGdgR3cnR2UgcGAQQBBnIGegEA"; - NSString *selectorString2 = encodedSelectorString2.decodedForSelector; - if (selectorString2 == nil) { - OWSFailDebug(@"selectorString2 was unexpectedly nil"); + OWSLogInfo(@"autorotation is disabled."); + + // The remainder of this method calls: + // [[UIScrollToDismissSupport supportForScreen:UIScreen.main] finishScrollViewTransition] + // after verifying the methods/classes exist. + + // NSString *encodedKlassString = @"UIScrollToDismissSupport".encodedForSelector; + NSString *encodedKlassString = @"ZlpkdAQBfX1lAVV6BX56BQVkBwICAQQG"; + NSString *_Nullable klassString = encodedKlassString.decodedForSelector; + if (klassString == nil) { + OWSFailDebug(@"klassString was unexpectedly nil"); + return; + } + id klass = NSClassFromString(klassString); + if (klass == nil) { + OWSFailDebug(@"klass was unexpectedly nil"); return; } - SEL selector2 = NSSelectorFromString(selectorString2); - if (![self.rootWindow respondsToSelector:selector2]) { - OWSFailDebug(@"failure: doesn't respond to selector2"); + // NSString *encodedSelector2String = @"supportForScreen:".encodedForSelector; + NSString *encodedSelector2String = @"BQcCAgEEBlcBBGR0BHZ2AEs="; + NSString *_Nullable selector2String = encodedSelector2String.decodedForSelector; + if (selector2String == nil) { + OWSFailDebug(@"selector2String was unexpectedly nil"); + return; + } + SEL selector2 = NSSelectorFromString(selector2String); + if (![klass respondsToSelector:selector2]) { + OWSFailDebug(@"klass didn't respond to selector"); + return; + } + IMP imp2 = [klass methodForSelector:selector2]; + id (*func2)(id, SEL, UIScreen *) = (void *)imp2; + id dismissSupport = func2(klass, selector2, UIScreen.mainScreen); + + // NSString *encodedSelector3String = @"finishScrollViewTransition".encodedForSelector; + NSString *encodedSelector3String = @"d3oAegV5ZHQEAX19Z3p2CWUEcgAFegZ6AQA="; + NSString *_Nullable selector3String = encodedSelector3String.decodedForSelector; + if (selector3String == nil) { + OWSFailDebug(@"selector3String was unexpectedly nil"); + return; + } + SEL selector3 = NSSelectorFromString(selector3String); + if (![dismissSupport respondsToSelector:selector3]) { + OWSFailDebug(@"dismissSupport didn't respond to selector"); return; } + IMP imp3 = [dismissSupport methodForSelector:selector3]; + void (*func3)(id, SEL) = (void *)imp3; + func3(dismissSupport, selector3); - IMP imp2 = [self.rootWindow methodForSelector:selector2]; - void (*func2)(id, SEL) = (void *)imp2; - func2(self.rootWindow, selector2); - OWSLogInfo(@"re-enabling autorotation"); + OWSLogInfo(@"finished scrollView transition"); } }