Refreshing tabs after sign in #133
Replies: 8 comments 18 replies
|
Perhaps you can do something like this in the SceneController, similar to the Demo app. extension SceneController: NavigatorDelegate {
func handle(proposal: VisitProposal, from navigator: Navigator) -> ProposalResult {
switch proposal.viewController {
case RefreshViewController.pathConfigurationIdentifier:
tabBarController.load(HotwireTab.all)
return .accept
default:
return .accept
}
}
} |
|
I encountered the same issue last week and had similar thoughts. I was trying to present the Sign In/Up screens in a modal view, with the success path set to the root path, which caused various issues. I tried your idea of refreshing each tab, but my solution wasn’t as elegant as yours, and I didn’t want hacky code in my project. Instead, I considered solving this in the browser by updating HTML fragments with sign-in content. One thing Hotwire Native needs is examples of authentication. |
|
One approach I'm experimenting with is configuring tabs dynamically via a bridge a bridge component. I don't have anything abstract to share just yet. But until then, @williamkennedy's solution works really well - especially because there's already a 90% complete working version in the demo app. |
|
What if we made We could write something like: tabBarController.navigatorsByTab.values.forEach { navigator in
navigator.reload()
} |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@mark-kraemer did you ever come up with a solution for this? I'm facing the exact same issue. This is my first time working with Swift, so I have no idea how to implement @williamkennedy 's suggestion |
|
A little late to the party, sharing our implementation of the general idea: http://github.com/tildeio/hotwire-native-dynamic-tab-bar/ |
|
The |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I really appreciate the improvements the team has been putting out. Tabs are so much easier now that the
HotwireTabBarControllerexists. I followed the video that @joemasilotti just posted. My app uses devise and theHotwireTabBarControllerwill visit each of the tabs so that they are preloaded when a user clicks on a tab. But all the tabs require authentication to access. Since the tab bar controller loads them immediately all tabs are redirected to the devise sign in page. Is there a way to refresh them after the user signs into one of the tabs?One idea I had was to use a routing decision handler with a simple query param (
?login=success) and then trigger a refresh of the tabs. But thenavigator.rootViewControlleris aUINavigationControllerand not theHotwireTabBarController. Is there a better way to go about this?All reactions