mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fixing issues with search bar retaining focus b/w view controllers.
This commit is contained in:
parent
25eb0106bd
commit
abeee92223
7 changed files with 60 additions and 39 deletions
|
@ -204,13 +204,14 @@
|
|||
} else {
|
||||
[self.searchBar setShowsCancelButton:NO animated:YES];
|
||||
}
|
||||
[self.searchBar resignFirstResponder];
|
||||
}
|
||||
|
||||
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
|
||||
[self.searchBar setText:@""];
|
||||
[self.searchBar resignFirstResponder];
|
||||
appDelegate.inSearch = NO;
|
||||
appDelegate.searchQuery = nil;
|
||||
storiesCollection.inSearch = NO;
|
||||
storiesCollection.searchQuery = nil;
|
||||
[self reloadStories];
|
||||
}
|
||||
|
||||
|
@ -218,14 +219,18 @@
|
|||
[self.searchBar resignFirstResponder];
|
||||
}
|
||||
|
||||
- (BOOL)disablesAutomaticKeyboardDismissal {
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
|
||||
if ([searchText length]) {
|
||||
appDelegate.inSearch = YES;
|
||||
appDelegate.searchQuery = searchText;
|
||||
storiesCollection.inSearch = YES;
|
||||
storiesCollection.searchQuery = searchText;
|
||||
[self reloadStories];
|
||||
} else {
|
||||
appDelegate.inSearch = NO;
|
||||
appDelegate.searchQuery = nil;
|
||||
storiesCollection.inSearch = NO;
|
||||
storiesCollection.searchQuery = nil;
|
||||
[self reloadStories];
|
||||
}
|
||||
}
|
||||
|
@ -353,9 +358,14 @@
|
|||
[appDelegate.masterContainerViewController transitionToFeedDetail:NO];
|
||||
}
|
||||
|
||||
if (!appDelegate.inSearch && storiesCollection.feedPage == 1) {
|
||||
if (!storiesCollection.inSearch && storiesCollection.feedPage == 1) {
|
||||
[self.storyTitlesTable setContentOffset:CGPointMake(0, CGRectGetHeight(self.searchBar.frame))];
|
||||
}
|
||||
if (storiesCollection.inSearch && storiesCollection.searchQuery) {
|
||||
[self.searchBar setText:storiesCollection.searchQuery];
|
||||
} else {
|
||||
[self.searchBar setText:@""];
|
||||
}
|
||||
if ([self.searchBar.text length]) {
|
||||
[self.searchBar setShowsCancelButton:YES animated:YES];
|
||||
} else {
|
||||
|
@ -470,8 +480,8 @@
|
|||
if (!self.isDashboardModule) {
|
||||
[appDelegate.storyPageControl resetPages];
|
||||
}
|
||||
appDelegate.inSearch = NO;
|
||||
appDelegate.searchQuery = nil;
|
||||
storiesCollection.inSearch = NO;
|
||||
storiesCollection.searchQuery = nil;
|
||||
[self.searchBar setText:@""];
|
||||
[self.notifier hideIn:0];
|
||||
[self cancelRequests];
|
||||
|
@ -609,7 +619,7 @@
|
|||
}];
|
||||
});
|
||||
}
|
||||
if (!appDelegate.inSearch && storiesCollection.feedPage == 1) {
|
||||
if (!storiesCollection.inSearch && storiesCollection.feedPage == 1) {
|
||||
[self.storyTitlesTable setContentOffset:CGPointMake(0, CGRectGetHeight(self.searchBar.frame))];
|
||||
}
|
||||
|
||||
|
@ -652,10 +662,10 @@
|
|||
theFeedDetailURL = [NSString stringWithFormat:@"%@&read_filter=%@",
|
||||
theFeedDetailURL,
|
||||
[storiesCollection activeReadFilter]];
|
||||
if (appDelegate.inSearch && appDelegate.searchQuery) {
|
||||
if (storiesCollection.inSearch && storiesCollection.searchQuery) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:@"%@&query=%@",
|
||||
theFeedDetailURL,
|
||||
[appDelegate.searchQuery stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
[storiesCollection.searchQuery stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
[self cancelRequests];
|
||||
__weak ASIHTTPRequest *request = [self requestWithURL:theFeedDetailURL];
|
||||
|
@ -805,7 +815,7 @@
|
|||
|
||||
}
|
||||
|
||||
if (!appDelegate.inSearch && storiesCollection.feedPage == 1) {
|
||||
if (!storiesCollection.inSearch && storiesCollection.feedPage == 1) {
|
||||
[self.storyTitlesTable setContentOffset:CGPointMake(0, CGRectGetHeight(self.searchBar.frame))];
|
||||
}
|
||||
if (storiesCollection.feedPage == 1) {
|
||||
|
@ -864,10 +874,10 @@
|
|||
theFeedDetailURL = [NSString stringWithFormat:@"%@&read_filter=%@",
|
||||
theFeedDetailURL,
|
||||
[storiesCollection activeReadFilter]];
|
||||
if (appDelegate.inSearch && appDelegate.searchQuery) {
|
||||
if (storiesCollection.inSearch && storiesCollection.searchQuery) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:@"%@&query=%@",
|
||||
theFeedDetailURL,
|
||||
[appDelegate.searchQuery stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
[storiesCollection.searchQuery stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
|
||||
[self cancelRequests];
|
||||
|
@ -1407,6 +1417,7 @@
|
|||
NSDictionary *activeStory = [[storiesCollection activeFeedStories] objectAtIndex:storyIndex];
|
||||
appDelegate.activeStory = activeStory;
|
||||
[appDelegate openDashboardRiverForStory:[activeStory objectForKey:@"story_hash"] showFindingStory:NO];
|
||||
|
||||
} else {
|
||||
FeedDetailTableCell *cell = (FeedDetailTableCell*) [tableView cellForRowAtIndexPath:indexPath];
|
||||
NSInteger storyIndex = [storiesCollection indexFromLocation:indexPath.row];
|
||||
|
@ -1419,6 +1430,9 @@
|
|||
}
|
||||
[self loadStory:cell atRow:indexPath.row];
|
||||
}
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
[appDelegate.dashboardViewController.storiesModule.view endEditing:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
@class FeedsMenuViewController;
|
||||
@class FeedDetailViewController;
|
||||
@class FeedDetailMenuViewController;
|
||||
@class FeedDashboardViewController;
|
||||
@class FirstTimeUserViewController;
|
||||
@class FirstTimeUserAddSitesViewController;
|
||||
@class FirstTimeUserAddFriendsViewController;
|
||||
|
@ -70,7 +69,6 @@
|
|||
FeedsMenuViewController *feedsMenuViewController;
|
||||
FeedDetailViewController *feedDetailViewController;
|
||||
FeedDetailMenuViewController *feedDetailMenuViewController;
|
||||
FeedDashboardViewController *feedDashboardViewController;
|
||||
FriendsListViewController *friendsListViewController;
|
||||
FontSettingsViewController *fontSettingsViewController;
|
||||
|
||||
|
@ -100,8 +98,6 @@
|
|||
BOOL inFindingStoryMode;
|
||||
BOOL hasLoadedFeedDetail;
|
||||
BOOL hasQueuedReadStories;
|
||||
BOOL inSearch;
|
||||
NSString *searchQuery;
|
||||
NSString *tryFeedStoryId;
|
||||
|
||||
NSDictionary * activeStory;
|
||||
|
@ -164,7 +160,6 @@
|
|||
@property (nonatomic) IBOutlet FeedsMenuViewController *feedsMenuViewController;
|
||||
@property (nonatomic) IBOutlet FeedDetailViewController *feedDetailViewController;
|
||||
@property (nonatomic) IBOutlet FeedDetailMenuViewController *feedDetailMenuViewController;
|
||||
@property (nonatomic) IBOutlet FeedDashboardViewController *feedDashboardViewController;
|
||||
@property (nonatomic) IBOutlet FriendsListViewController *friendsListViewController;
|
||||
@property (nonatomic) IBOutlet StoryDetailViewController *storyDetailViewController;
|
||||
@property (nonatomic) IBOutlet StoryPageControl *storyPageControl;
|
||||
|
@ -248,8 +243,6 @@
|
|||
@property (nonatomic) NSOperationQueue *cacheImagesOperationQueue;
|
||||
@property (nonatomic) NSMutableDictionary *activeCachedImages;
|
||||
@property (nonatomic, readwrite) BOOL hasQueuedReadStories;
|
||||
@property (nonatomic, readwrite) BOOL inSearch;
|
||||
@property (nonatomic) NSString *searchQuery;
|
||||
|
||||
@property (nonatomic, strong) void (^backgroundCompletionHandler)(UIBackgroundFetchResult);
|
||||
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
@synthesize feedsMenuViewController;
|
||||
@synthesize feedDetailViewController;
|
||||
@synthesize feedDetailMenuViewController;
|
||||
@synthesize feedDashboardViewController;
|
||||
@synthesize friendsListViewController;
|
||||
@synthesize fontSettingsViewController;
|
||||
@synthesize storyDetailViewController;
|
||||
|
@ -155,8 +154,6 @@
|
|||
@synthesize categoryFeeds;
|
||||
@synthesize activeCachedImages;
|
||||
@synthesize hasQueuedReadStories;
|
||||
@synthesize inSearch;
|
||||
@synthesize searchQuery;
|
||||
@synthesize offlineQueue;
|
||||
@synthesize offlineCleaningQueue;
|
||||
@synthesize backgroundCompletionHandler;
|
||||
|
@ -1474,19 +1471,6 @@
|
|||
[MBProgressHUD hideHUDForView:self.storyPageControl.view animated:YES];
|
||||
}
|
||||
|
||||
- (void)navigationController:(UINavigationController *)navController
|
||||
willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
[viewController viewWillAppear:animated];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
[viewController viewDidAppear:animated];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setTitle:(NSString *)title {
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
[label setFont:[UIFont boldSystemFontOfSize:16.0]];
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#import "InteractionsModule.h"
|
||||
#import "ActivityModule.h"
|
||||
#import "FeedTableCell.h"
|
||||
#import "DashboardViewController.h"
|
||||
#import "FeedsMenuViewController.h"
|
||||
#import "FeedDetailMenuViewController.h"
|
||||
#import "FeedDetailViewController.h"
|
||||
|
@ -1116,6 +1117,10 @@ static UIFont *userLabelFont;
|
|||
if (appDelegate.hasNoSites) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
[appDelegate.dashboardViewController.storiesModule.view endEditing:YES];
|
||||
}
|
||||
|
||||
[appDelegate.storiesCollection reset];
|
||||
|
||||
|
@ -1269,6 +1274,10 @@ heightForHeaderInSection:(NSInteger)section {
|
|||
tag = [NSString stringWithFormat:@"%ld", (long)button.tag];
|
||||
}
|
||||
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
[appDelegate.dashboardViewController.storiesModule.view endEditing:YES];
|
||||
}
|
||||
|
||||
[appDelegate loadRiverFeedDetailView:appDelegate.feedDetailViewController withFolder:tag];
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
BOOL isSocialView;
|
||||
BOOL isSocialRiverView;
|
||||
BOOL transferredFromDashboard;
|
||||
BOOL inSearch;
|
||||
NSString *searchQuery;
|
||||
}
|
||||
|
||||
@property (nonatomic) NewsBlurAppDelegate *appDelegate;
|
||||
|
@ -53,6 +55,8 @@
|
|||
@property (nonatomic, readwrite) BOOL isSavedView;
|
||||
@property (nonatomic, readwrite) BOOL isReadView;
|
||||
@property (nonatomic, readwrite) BOOL transferredFromDashboard;
|
||||
@property (nonatomic, readwrite) BOOL inSearch;
|
||||
@property (nonatomic) NSString *searchQuery;
|
||||
|
||||
- (id)initForDashboard;
|
||||
- (void)reset;
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
@synthesize isSavedView;
|
||||
@synthesize isReadView;
|
||||
@synthesize transferredFromDashboard;
|
||||
|
||||
@synthesize inSearch;
|
||||
@synthesize searchQuery;
|
||||
|
||||
- (id)init {
|
||||
if (self = [super init]) {
|
||||
|
@ -82,6 +83,8 @@
|
|||
[self setFeedUserProfiles:fromCollection.activeFeedUserProfiles];
|
||||
self.activeFolderFeeds = fromCollection.activeFolderFeeds;
|
||||
self.activeClassifiers = fromCollection.activeClassifiers;
|
||||
self.inSearch = fromCollection.inSearch;
|
||||
self.searchQuery = fromCollection.searchQuery;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -202,6 +202,20 @@
|
|||
[super viewDidDisappear:animated];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
[appDelegate.feedDetailViewController.view endEditing:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
[appDelegate.feedDetailViewController.view endEditing:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue