-
Notifications
You must be signed in to change notification settings - Fork 50
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
Plugin utils #214
Plugin utils #214
Conversation
@@ -110,6 +110,8 @@ object RIBs { | |||
|
|||
override fun handleNonFatalWarning(warningMessage: String, throwable: Throwable?) {} | |||
|
|||
override fun handleDebugMessage(format: String, vararg args: Any) {} | |||
override fun handleDebugMessage(format: String, vararg args: Any) { | |||
Log.d(TAG, format.format(args)) |
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.
maybe let's add default implementation for handleNonFatalWarning
as well?
import com.badoo.ribs.core.Rib | ||
|
||
abstract class DebugControls<T : Rib>( | ||
override val label: String, |
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.
do we need DebugControls
class? maybe we can create a label parameter in AbstractDebugControls
?
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.
Yep, to disallow overriding the other parameters in the parent, which can only be done by the host class.
import com.badoo.ribs.core.plugin.ViewLifecycleAware | ||
|
||
@SuppressWarnings("LongParameterList") | ||
abstract class AbstractDebugControls<T : Rib> internal constructor( |
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.
maybe it would be better to define an interface for debug controls and use composition to build it instead of inheriting from AbstractDebugControls
?
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.
Different params are needed for the two use-cases (represented as child classes), but under the hood it's common functionality, and they need to work together. I don't see how an interface would help here, since they're plugins, we don't interact with them from the outside.
@@ -63,8 +63,10 @@ dependencies { | |||
implementation deps.external.mviCoreAndroid | |||
implementation deps.external.rxrelay2 | |||
implementation deps.external.rxandroid2 | |||
implementation deps.external.leakCanary // use debugImplementation in real life apps |
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.
maybe let's use debugImplemenatation in sandbox as well to showcase how to configure it?
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.
|
||
implementation project(":libraries:rib-base") | ||
implementation project(":libraries:rib-debug-utils") |
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.
maybe we should include debug utils only for debug build? I think we can create a class that will provide debug plugins in debug source set and no plugins in release source set
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.
private var viewGroupForChildren: (() -> ViewGroup)? = null, | ||
private var growthDirection: GrowthDirection? = null, | ||
private val nodeAware: NodeAware = NodeAwareImpl(), | ||
private val ribAware: RibAware<T> = RibAwareImpl() |
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.
looks like it is unused? do we need Rib generic type for this class?
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's there for children to trigger workflow operations.
See SwitcherDebugControls
which uses it.
No description provided.