Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25491] : iOS Ti.UI.SearchBar not slide down when set visible a view on top #9622

Merged
merged 16 commits into from Nov 28, 2017

Conversation

vijaysingh-axway
Copy link
Contributor

@build build added the ios label Nov 21, 2017
@build
Copy link
Contributor

build commented Nov 21, 2017

Fails
🚫

🔬 There are library changes, but no changes to the unit tests. That's OK as long as you're refactoring existing code, but will require an admin to merge this PR. Please see README.md#unit-tests for docs on unit testing.

Messages
📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS

Copy link
Collaborator

@hansemannn hansemannn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few review comments that should be addressed before continuing.

if ([proxy isKindOfClass:[TiWindowProxy class]]) {
searchControllerPresenter = [proxy windowHoldingController];
} else {
searchControllerPresenter = [[TiApp app] controller];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you ensure this does not get released before closing the window?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed it is just used to push the controller and every time before presenting controller it is calculated again.

viewController = [[TiApp app] controller];
BOOL shouldAnimate = YES;
if ([TiUtils isIOS9OrGreater]) {
shouldAnimate = NO;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not BOOL shouldAnimate = ![TiUtils isIOS9OrGreater]; ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Done.

@@ -2328,7 +2372,7 @@ - (void)initSearchController:(id)sender
searchController = [[[UISearchController alloc] initWithSearchResultsController:resultViewController] retain];
searchController.delegate = self;
searchController.searchResultsUpdater = self;
searchController.hidesNavigationBarDuringPresentation = NO;
searchController.hidesNavigationBarDuringPresentation = YES;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to prevent that breaking change, I am pretty sure people will complain later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is default behaviour. Though we can expose this property. Will continue to look in same.

#if IS_XCODE_9
if ([TiUtils isIOS11OrGreater]) {
topMargin += self.safeAreaInsets.top;
tableview.frame = CGRectMake(0, self.safeAreaInsets.top, tableview.frame.size.width, tableview.frame.size.height - self.safeAreaInsets.top);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should that always be done? I thought only when having the extendSafeArea property set?

#endif
UIView *searchSuperView = [searchController.view superview];
if (!searchSuperView) {
return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When can that happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need of this as
if (![searchController isActive]) {
return;
}
is already checking for same. So removed.

searchController.view.frame = CGRectMake(convertedOrigin.x, topMargin, self.frame.size.width, self.frame.size.height);
dimmingView.frame = CGRectMake(searchController.view.frame.origin.x, searchController.view.frame.origin.y, self.frame.size.width, self.frame.size.height);

float width = [searchField view].frame.size.width;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use CoreGraphics types, e.g. CGFloat.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

resultSuperview.frame = CGRectMake(0, view.frame.origin.y + searchController.searchBar.frame.size.height, self.frame.size.width, self.frame.size.height);
resultViewController.tableView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);

} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line, please lint everything.

@@ -1809,7 +1857,7 @@ - (void)initSearhController
resultViewController = [[UITableViewController alloc] init];
resultViewController.tableView = [self searchTableView];
searchController = [[[UISearchController alloc] initWithSearchResultsController:resultViewController] retain];
searchController.hidesNavigationBarDuringPresentation = NO;
searchController.hidesNavigationBarDuringPresentation = YES;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, try to prevent or we need to explicitly mark that in the docs.

#if IS_XCODE_9
if ([TiUtils isIOS11OrGreater]) {
tableview.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel save with this. What if the table is not positioned full screen? And what about orientation changes? Please add tests for those scenarios.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Table's contentOffset should be managed rather table view frame. Otherwise view below to tableview will get visible. So managed contentOffset rather frame.

BOOL shouldAnimate = YES;
if ([TiUtils isIOS9OrGreater]) {
shouldAnimate = NO;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before, please refactor the assignment to be less if-based.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@mukherjee2 mukherjee2 self-requested a review November 28, 2017 00:14
Copy link
Contributor

@mukherjee2 mukherjee2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed FR with this environment:
Node Version: 8.9.1
NPM Version: 5.5.1
Mac OS: 10.13.1
Appc CLI: 7.0.0-master.48
Appc CLI NPM: 4.2.11-4
Titanium SDK version: 7.0.0 locally built from this PR
Appcelerator Studio vers 4.10.0
Xcode 9.1/iOS 11.1 iPhone 7 Plus

I tried both test cases that were in the ticket, and the view above the searcher did appear.

@mukherjee2
Copy link
Contributor

@vijaysingh-axway unit tests appear to be failing. Can you please look into those? I'll merge once tests pass.

@build build added the ios label Nov 28, 2017
@vijaysingh-axway
Copy link
Contributor Author

vijaysingh-axway commented Nov 28, 2017

@mukherjee2, Unit test failure issue fixed.
I hope you would have verified Test cases mentioned in tickets TIMOB-25528 and TIMOB-25532, which I have mentioned in comment. Thanks!

@build build added the ios label Nov 28, 2017
@@ -2741,9 +2741,9 @@ - (void)presentSearchController:(UISearchController *)controller
proxy = [proxy parent];
}
if ([proxy isKindOfClass:[TiWindowProxy class]]) {
searchControllerPresenter = [proxy windowHoldingController];
searchControllerPresenter = [[proxy windowHoldingController] retain];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it did need to retain? :-) Please also run the static analyser to ensure there are no static leaks.

@eric34 eric34 merged commit 239473a into tidev:master Nov 28, 2017
@build build added the ios label Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants