diff --git a/Signal/src/ViewControllers/GifPicker/GifPickerLayout.swift b/Signal/src/ViewControllers/GifPicker/GifPickerLayout.swift index 2743a073e..7a6bde857 100644 --- a/Signal/src/ViewControllers/GifPicker/GifPickerLayout.swift +++ b/Signal/src/ViewControllers/GifPicker/GifPickerLayout.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// Copyright (c) 2019 Open Whisper Systems. All rights reserved. // import Foundation @@ -60,9 +60,7 @@ class GifPickerLayout: UICollectionViewLayout { // We use 2 or 3 columns, depending on the device. // 2 columns will show fewer GIFs at a time, // but use less network & be a more responsive experience. - let screenSize = UIScreen.main.bounds.size - let screenWidth = min(screenSize.width, screenSize.height) - let columnCount = UInt(max(2, screenWidth / 130)) + let columnCount = UInt(max(2, collectionView.width() / 130)) let totalViewWidth = UInt(collectionView.width()) let hTotalWhitespace = (2 * hInset) + (hSpacing * (columnCount - 1)) diff --git a/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift b/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift index 41025af38..34a595745 100644 --- a/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift +++ b/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift @@ -518,4 +518,10 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect } tryToSearch() } + + public override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + super.traitCollectionDidChange(previousTraitCollection) + + layout.invalidateLayout() + } } diff --git a/SignalMessaging/utils/OWSWindowManager.m b/SignalMessaging/utils/OWSWindowManager.m index ff8d1888d..5731de17d 100644 --- a/SignalMessaging/utils/OWSWindowManager.m +++ b/SignalMessaging/utils/OWSWindowManager.m @@ -490,7 +490,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void) OWSLogInfo(@"showing root window."); } - // By calling makeKeyAndVisible we ensure the rootViewController becomes firt responder. + // By calling makeKeyAndVisible we ensure the rootViewController becomes first responder. // In the normal case, that means the SignalViewController will call `becomeFirstResponder` // on the vc on top of its navigation stack. [self.rootWindow makeKeyAndVisible];