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

Add support for activity scoped navigation request handlers #125

Merged
merged 1 commit into from
Jun 29, 2020

Conversation

deepueg
Copy link
Contributor

@deepueg deepueg commented Jun 26, 2020

This gives more flexibility for applications that follows a complex UI design

Copy link
Member

@asharpbflat asharpbflat left a comment

Choose a reason for hiding this comment

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

👍 Looking good!

Copy link
Member

@friederbluemle friederbluemle left a comment

Choose a reason for hiding this comment

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

I only did some basic checks locally, but looks good to merge 👍

@@ -9,6 +9,8 @@
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import com.ern.api.impl.navigation.NavigationRouteHandler;
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, so this creates a dependency from .core to .navigation. I'm pretty sure we already have several other such references, and there's already a circular dependency between these two packages.
No action item right now, but we need to remember for "Version 2.0" to rethink the package/dependency structure we're using here. Java package constraints can also be enforced through unit test via tools like JDepend. Something we can consider eventually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very good find, this was an oversight. There shouldn't be this dependency. But I agree, looking at how this is being used we may no longer need a core package as this was initially kept for backward compatibility but no one is actually using it.

I will fix the dependency now. Thanks.

*/
boolean mUseActivityScopedNavigation;


Copy link
Member

Choose a reason for hiding this comment

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

Double blank line here

* When true: {@link com.ern.api.impl.navigation.ReactNavigationViewModel} will be created with activity scope instead of fragment scope.
* The activity will then delegate the navigation requests to the corresponding fragments via {@link com.ern.api.impl.navigation.NavigationRouteHandler} implementation.
* The {@link ElectrodeBaseActivityDelegate} will take the current instance of the {@link Fragment} that is loaded inside {@link LaunchConfig#getFragmentContainerId()}. Assumption is that this fragment implements {@link NavigationRouteHandler}
* Pass {@link RouteHandlerProvider} If you would like to provide your own implementation of providing the fragment instance, valid only if #value is true.
Copy link
Member

Choose a reason for hiding this comment

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

No real action here, but a todo for an eventual cleanup: You probably noticed that these five lines are a one-to-one copy+paste from lines 97-101.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed.

@deepueg deepueg force-pushed the add-nav-support-activity-scope branch from ef6e29d to dccac98 Compare June 29, 2020 13:44
This gives more flexibility for applications that follows a complex UI design
@deepueg deepueg force-pushed the add-nav-support-activity-scope branch from dccac98 to 5b0e5ab Compare June 29, 2020 13:49
@deepueg deepueg requested a review from friederbluemle June 29, 2020 13:51
Copy link
Member

@friederbluemle friederbluemle left a comment

Choose a reason for hiding this comment

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

The imports look a lot cleaner now. Nice! 👍

I assume you tested all possible scenarios locally? I'm sure you also have the best knowledge how this change will affect the public API and what needs to be done in terms of versioning. I already approved, nothing blocking from my side!

mRouteHandlerProvider = routeHandlerProvider;
}

public interface RouteHandlerProvider<T extends Fragment & NavigationRouteHandler> {
Copy link
Member

Choose a reason for hiding this comment

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

I just learned something new. Fascinating 🤯

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, its pretty neat to have this at compile time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The imports look a lot cleaner now. Nice! 👍

I assume you tested all possible scenarios locally? I'm sure you also have the best knowledge how this change will affect the public API and what needs to be done in terms of versioning. I already approved, nothing blocking from my side!

Yes, this change does not really impact any existing APIs. It's adding a new delegate and will only be available for those who add this explicitly. Validated for backward compatibility.

@deepueg deepueg merged commit 0928967 into electrode-io:master Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants