-
Notifications
You must be signed in to change notification settings - Fork 36
Adding support to use a View Controller for the empty view. #303
Conversation
etoledom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ScoutHarris - this is a great addition, thank you!
I have a question that I wrote as a code comment about having two different defaults.
Apart of that, I noticed a small issue with the position of the view when it refreshes. It reappears under the keyboard.
It also seems to disappear when the search bar is cleared.
Maybe we can call [self centerEmptyView]; as soon as we add the emptyViewController?
And one small detail: When the search is cancelled, it looks like the empty controller disappear and then appears again in the lower position. Is it possible to make it slide down the same way it slide up when the keyboard appears?
This is not life or death but a "nice to have". 😁
| The default empty view controller. When `emptyViewControllerForMediaPickerController:` is not implemented, | ||
| use this property to style the message. | ||
| */ | ||
| @property (nonatomic, strong, readonly, nonnull) UIViewController *defaultEmptyViewController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to have both a defaultEmptyView and a defaultEmptyViewController?
Probably we should just have one default that will be displayed if non of the related delegates method are implemented. Does it make sense?
Not sure which would be the best option, but I'd vote for the simplest of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @etoledom . Good point...
So, WPNavigationMediaPickerViewController needs access to defaultEmptyViewController, so I added a method definition. I also removed defaultEmptyViewController as a public property, and changed it to use defaultEmptyView.
…ltEmptyViewController` use `defaultEmptyView` instead of creating its own. Add `defaultEmptyViewController` accessor since `WPNavigationMediaPickerViewController` needs it.
…e issue where it was appearing under the keyboard when it refreshed.
|
Hey @etoledom . Thanks for the timely review and helpful feedback! Some comments in response -
Adding
It was not being re-added, it was just re-centering immediately. So I added an
I'm not seeing this. If you still do, can you provide more information? (device, iOS version, anything else helpful) Otherwise, it's ready for another review! |
etoledom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ScoutHarris - nice fixes! 🎉
- The animation when dismissing the keyboard is perfect!
- The position of the empty view controller content also got fixed 🎉
- The empty controller doesn't disappear any more :]
I saw a new small issue:
It happens when I get the no-results message and then I clear the search text. The empty view keeps showing the no-results message (with the last string I used to search), but it should show the initial empty message (that one with the Photos provided by pexel). Here is a gif showing it:
About the defaultEmptyViewController, I see what you mean by WPNavigationMediaPickerViewController needs access to it.
What if WPNavigationMediaPickerViewController returns nil if the method is not implemented bit the delegate, and WPMediaPickerViewController handles nil in the same way than respondsToSelector == NO?
I was experimenting a bit with that idea but I got the feeling that handling nil might make everything more complicated. You can decide if it's worth it.
My concern is that by having both defaults seems like one of them will never be used, so we should default just to one.
|
Hey @etoledom ! More responses:
Well that was weird. I could only get it to happen on a first run on a device. Successive runs worked fine. Good catch! It was actually a problem on the WP-iOS side, and has been fixed (wordpress-mobile/WordPress-iOS@efb1be0). Regarding the
I was actually trying not to mix
I do see your point. But "one of them will never be used" isn't exactly accurate - it will be one or the other. However, looking into the future, after the NoResultsView replacement is complete in WordPress-iOS, |
etoledom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was actually a problem on the WP-iOS side, and has been fixed
That issue is fixed now, great work!
- The animation issue when dismissing the keyboard seems to have reappeared, but as we talked internally let's merge this and fix the animation separately.


Ref #wordpress-mobile/WordPress-iOS#9504
This adds the ability to use a
ViewControllerfor theemptyViewstate, instead of just aUIView. Specifically because we are transitioning fromWPNoResultsViewtoNoResultsViewControllerinWordPress-iOS.To test:
Hey @etoledom - it looks like you might be familiar with the
emptyViewlogic. Would you mind taking a look at this? Thanks!!