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

Refactor downloads deep linking #2447

Merged
merged 7 commits into from
Jul 8, 2024
Merged

Refactor downloads deep linking #2447

merged 7 commits into from
Jul 8, 2024

Conversation

MiSikora
Copy link
Contributor

@MiSikora MiSikora commented Jul 5, 2024

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

  1. Start downloading some episodes.
  2. While download notification is showing tap on it.
  3. The downloads page should open.

Checklist

  • If this is a user-facing change, I have added an entry in CHANGELOG.md
  • Ensure the linter passes (./gradlew spotlessApply to automatically apply formatting/linting)
  • I have considered whether it makes sense to add tests for my changes
  • All strings that need to be localized are in modules/services/localization/src/main/res/values/strings.xml
  • Any jetpack compose components I added or changed are covered by compose previews
  • I have updated (or requested that someone edit) the spreadsheet to reflect any new or changed analytics.

@MiSikora MiSikora added the tech debt A maintenance change label Jul 5, 2024
@MiSikora MiSikora added this to the 7.68 milestone Jul 5, 2024
@MiSikora MiSikora requested a review from a team as a code owner July 5, 2024 06:49
@MiSikora MiSikora requested review from geekygecko and removed request for a team July 5, 2024 06:49
@dangermattic
Copy link
Collaborator

dangermattic commented Jul 5, 2024

1 Warning
⚠️ Class DownloadsAdapter is missing tests, but unit-tests-exemption label was set to ignore this.

Generated by 🚫 Danger

Copy link
Member

@geekygecko geekygecko left a 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.

Comment on lines +15 to +18
data object DownloadsDeepLink : DeepLink {
override fun toIntent(context: Context) = context.launcherIntent
.setAction(ACTION_OPEN_DOWNLOADS)
}
Copy link
Member

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?

Suggested change
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())
}

Copy link
Contributor Author

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?

Copy link
Member

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.

MiSikora and others added 2 commits July 8, 2024 13:22
…ocketcasts/deeplink/DeepLinkFactory.kt

Co-authored-by: Philip Simpson <[email protected]>
@MiSikora MiSikora merged commit ecaff0b into main Jul 8, 2024
14 checks passed
@MiSikora MiSikora deleted the task/downloads-deep-linking branch July 8, 2024 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

App doesn't handle direct episode links with timestamps
3 participants