#1530 (search bar unreachable)

- Fixed the search field not remaining visible on iPhone.
- Added a 1 second delay while typing before performing the search.
- Fixed field scrolling away when searching.
This commit is contained in:
David Sinclair 2021-08-20 19:47:06 -07:00
parent b109acf473
commit 37552d1f5c
3 changed files with 11 additions and 10 deletions

View file

@ -284,14 +284,14 @@ typedef NS_ENUM(NSUInteger, MarkReadShowMenu)
if (![searchText isEqualToString:storiesCollection.savedSearchQuery]) { if (![searchText isEqualToString:storiesCollection.savedSearchQuery]) {
storiesCollection.savedSearchQuery = nil; storiesCollection.savedSearchQuery = nil;
} }
[self reloadStories];
} else { } else {
storiesCollection.inSearch = NO; storiesCollection.inSearch = NO;
storiesCollection.searchQuery = nil; storiesCollection.searchQuery = nil;
storiesCollection.savedSearchQuery = nil; storiesCollection.savedSearchQuery = nil;
[self reloadStories];
} }
[FeedDetailViewController cancelPreviousPerformRequestsWithTarget:self selector:@selector(reloadStories) object:nil];
[self performSelector:@selector(reloadStories) withObject:nil afterDelay:1.0];
} }
- (void)preferredContentSizeChanged:(NSNotification *)aNotification { - (void)preferredContentSizeChanged:(NSNotification *)aNotification {
@ -430,7 +430,7 @@ typedef NS_ENUM(NSUInteger, MarkReadShowMenu)
[self.notifier setNeedsLayout]; [self.notifier setNeedsLayout];
[appDelegate hideShareView:YES]; [appDelegate hideShareView:YES];
if (!!storiesCollection.inSearch && storiesCollection.feedPage == 1) { if (!storiesCollection.inSearch && storiesCollection.feedPage == 1) {
[self.storyTitlesTable setContentOffset:CGPointMake(0, CGRectGetHeight(self.searchBar.frame))]; [self.storyTitlesTable setContentOffset:CGPointMake(0, CGRectGetHeight(self.searchBar.frame))];
} }
if (storiesCollection.inSearch && storiesCollection.searchQuery) { if (storiesCollection.inSearch && storiesCollection.searchQuery) {
@ -796,7 +796,7 @@ typedef NS_ENUM(NSUInteger, MarkReadShowMenu)
}]; }];
}); });
} }
if (!!storiesCollection.inSearch && storiesCollection.feedPage == 1) { if (!storiesCollection.inSearch && storiesCollection.feedPage == 1) {
[self.storyTitlesTable setContentOffset:CGPointMake(0, CGRectGetHeight(self.searchBar.frame))]; [self.storyTitlesTable setContentOffset:CGPointMake(0, CGRectGetHeight(self.searchBar.frame))];
} }
@ -986,7 +986,7 @@ typedef NS_ENUM(NSUInteger, MarkReadShowMenu)
[storyTitlesTable scrollRectToVisible:CGRectMake(0, 0, CGRectGetHeight(self.searchBar.frame), 1) animated:YES]; [storyTitlesTable scrollRectToVisible:CGRectMake(0, 0, CGRectGetHeight(self.searchBar.frame), 1) animated:YES];
} }
if (!!storiesCollection.inSearch && storiesCollection.feedPage == 1) { if (!storiesCollection.inSearch && storiesCollection.feedPage == 1) {
[self.storyTitlesTable setContentOffset:CGPointMake(0, CGRectGetHeight(self.searchBar.frame))]; [self.storyTitlesTable setContentOffset:CGPointMake(0, CGRectGetHeight(self.searchBar.frame))];
} }
if (storiesCollection.feedPage == 1) { if (storiesCollection.feedPage == 1) {

View file

@ -1882,9 +1882,9 @@
431B857215A131B200DCE497 /* Feed-Detail */ = { 431B857215A131B200DCE497 /* Feed-Detail */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
170E3CD624F8AB0D009CE819 /* FeedDetailViewController.swift */,
FF4D9074265BE13500792DB3 /* FeedDetailObjCViewController.h */, FF4D9074265BE13500792DB3 /* FeedDetailObjCViewController.h */,
FF4D9073265BE13500792DB3 /* FeedDetailObjCViewController.m */, FF4D9073265BE13500792DB3 /* FeedDetailObjCViewController.m */,
170E3CD624F8AB0D009CE819 /* FeedDetailViewController.swift */,
7843F50311EEB1A000675F64 /* FeedDetailTableCell.h */, 7843F50311EEB1A000675F64 /* FeedDetailTableCell.h */,
7843F50411EEB1A000675F64 /* FeedDetailTableCell.m */, 7843F50411EEB1A000675F64 /* FeedDetailTableCell.m */,
FF2D8CE214893BBF00057B80 /* MoveSiteViewController.h */, FF2D8CE214893BBF00057B80 /* MoveSiteViewController.h */,

View file

@ -335,11 +335,11 @@
<objects> <objects>
<viewController storyboardIdentifier="FeedDetailViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="gfj-2g-i9p" customClass="FeedDetailViewController" customModule="NewsBlur" customModuleProvider="target" sceneMemberID="viewController"> <viewController storyboardIdentifier="FeedDetailViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="gfj-2g-i9p" customClass="FeedDetailViewController" customModule="NewsBlur" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Qlc-Qa-4j4"> <view key="view" contentMode="scaleToFill" id="Qlc-Qa-4j4">
<rect key="frame" x="0.0" y="0.0" width="375" height="834"/> <rect key="frame" x="0.0" y="0.0" width="375" height="784"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" restorationIdentifier="FeedDetailTable" showsHorizontalScrollIndicator="NO" bouncesZoom="NO" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="HYy-Wb-YEm"> <tableView clipsSubviews="YES" contentMode="scaleToFill" restorationIdentifier="FeedDetailTable" showsHorizontalScrollIndicator="NO" bouncesZoom="NO" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="HYy-Wb-YEm">
<rect key="frame" x="0.0" y="0.0" width="375" height="834"/> <rect key="frame" x="0.0" y="0.0" width="375" height="784"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> <inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
<connections> <connections>
@ -348,7 +348,7 @@
</connections> </connections>
</tableView> </tableView>
<view hidden="YES" opaque="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZLP-oU-XR7"> <view hidden="YES" opaque="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZLP-oU-XR7">
<rect key="frame" x="0.0" y="274.5" width="375" height="181"/> <rect key="frame" x="0.0" y="224.5" width="375" height="181"/>
<subviews> <subviews>
<imageView userInteractionEnabled="NO" alpha="0.40000000596046448" contentMode="scaleToFill" image="big_world.png" translatesAutoresizingMaskIntoConstraints="NO" id="Lzk-2I-zT1"> <imageView userInteractionEnabled="NO" alpha="0.40000000596046448" contentMode="scaleToFill" image="big_world.png" translatesAutoresizingMaskIntoConstraints="NO" id="Lzk-2I-zT1">
<rect key="frame" x="155.5" y="24" width="64" height="64"/> <rect key="frame" x="155.5" y="24" width="64" height="64"/>
@ -387,6 +387,7 @@
<constraint firstItem="ZLP-oU-XR7" firstAttribute="leading" secondItem="Qlc-Qa-4j4" secondAttribute="leading" id="zG5-2m-YKf"/> <constraint firstItem="ZLP-oU-XR7" firstAttribute="leading" secondItem="Qlc-Qa-4j4" secondAttribute="leading" id="zG5-2m-YKf"/>
</constraints> </constraints>
</view> </view>
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
<navigationItem key="navigationItem" id="vc8-hL-CKx"/> <navigationItem key="navigationItem" id="vc8-hL-CKx"/>
<connections> <connections>
<outlet property="messageLabel" destination="ugt-jY-ACR" id="KxV-ws-Fjm"/> <outlet property="messageLabel" destination="ugt-jY-ACR" id="KxV-ws-Fjm"/>