-
Notifications
You must be signed in to change notification settings - Fork 210
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
Refactor downloads deep linking #2447
Conversation
Generated by 🚫 Danger |
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.
Great work putting the effort into making sure they are tested.
app/src/androidTest/java/au/com/shiftyjelly/pocketcasts/TestActivity.kt
Outdated
Show resolved
Hide resolved
data object DownloadsDeepLink : DeepLink { | ||
override fun toIntent(context: Context) = context.launcherIntent | ||
.setAction(ACTION_OPEN_DOWNLOADS) | ||
} |
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.
Just an idea, but how about including the action name in the object as they are linked?
data object DownloadsDeepLink : DeepLink { | |
override fun toIntent(context: Context) = context.launcherIntent | |
.setAction(ACTION_OPEN_DOWNLOADS) | |
} | |
data object DownloadsDeepLink : DeepLink { | |
override fun action() = "INTENT_OPEN_APP_DOWNLOADING" | |
override fun toIntent(context: Context) = context.launcherIntent | |
.setAction(action()) | |
} |
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.
I think I get the intention but it doesn't work well in my opinion. Some deep links are data classes and not data objects so action()
cannot be invoked on them without instantiation. In that case adapters that create non-object deep links cannot access actions.
I could move all actions to objects and to companion objects for some better organization if you think it's worth 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.
No worries, thanks for considering it.
...services/deeplink/src/main/kotlin/au/com/shiftyjelly/pocketcasts/deeplink/DeepLinkFactory.kt
Outdated
Show resolved
Hide resolved
…ocketcasts/deeplink/DeepLinkFactory.kt Co-authored-by: Philip Simpson <[email protected]>
…tivity.kt Co-authored-by: Philip Simpson <[email protected]>
Description
Note
This will be a series of PRs that move deep linking to a separate module that can be tested. The goal is to fix #2405 but I don't want to do it blindly without having tests in order to not introduce regressions to deep linking.
This PR migrates deep linking of downloads to the new module.
Testing Instructions
Checklist
If this is a user-facing change, I have added an entry in CHANGELOG.md./gradlew spotlessApply
to automatically apply formatting/linting)All strings that need to be localized are inmodules/services/localization/src/main/res/values/strings.xml
Any jetpack compose components I added or changed are covered by compose previewsI have updated (or requested that someone edit) the spreadsheet to reflect any new or changed analytics.