Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Closes #8122: Do not redirect to market app if app is already installed #8126

Merged
merged 1 commit into from
Aug 17, 2020

Conversation

rocketsroger
Copy link
Contributor


Pull Request checklist

  • Quality: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry or does not need one
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features

After merge

  • Milestone: Make sure issues closed by this pull request are added to the milestone of the version currently in development.
  • Breaking Changes: If this is a breaking change, please push a draft PR on Reference Browser to address the breaking issues.

@rocketsroger rocketsroger added the 🕵️‍♀️ needs review PRs that need to be reviewed label Aug 14, 2020
@Amejia481 Amejia481 self-requested a review August 17, 2020 14:46
@Amejia481 Amejia481 self-assigned this Aug 17, 2020
Copy link
Contributor

@Amejia481 Amejia481 left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines 177 to 184
private fun isPackageInstalled(packageName: String): Boolean {
return try {
context.packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES)
true
} catch (e: PackageManager.NameNotFoundException) {
false
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe can share this logic as an extension function as we are doing the same on other components see

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll check if there's a good way to share this. Thanks,

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the extension function. Unfortunately support-ktx depends on support-utils causing a circular dependency so I couldn't replace the Browsers.kt call.

*
* @param packageName The name of the package to check for.
*/
fun PackageManager.isPackageInstalled(packageName: String, flags: Int): Boolean {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Can we add a test for this :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll add it. Thanks

@rocketsroger
Copy link
Contributor Author

bors r=Amejia481

@bors
Copy link

bors bot commented Aug 17, 2020

Build succeeded:

@bors bors bot merged commit b90cb95 into mozilla-mobile:master Aug 17, 2020
@rocketsroger rocketsroger deleted the AC_8122 branch August 17, 2020 16:57
@rocketsroger rocketsroger removed the 🕵️‍♀️ needs review PRs that need to be reviewed label Aug 17, 2020
@silvanfischer
Copy link

@rocketsroger Is it possible that this change introduced the regression: mozilla-mobile/fenix#14843?

@rocketsroger
Copy link
Contributor Author

@rocketsroger Is it possible that this change introduced the regression: mozilla-mobile/fenix#14843?

I don't think so. If anything it should help with the problem. I'll self assign and look into the other issue when I have a chance. Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants