Implement methods in Utils to open link and ignore ActivityNotFoundException
Jean-BaptisteC opened this issue · comments
Actually in app, we open link without ignore crash ActivityNotFoundException.
I have added fix here a4755cc to ignore ActivityNotFoundException and don't generate crash when devices have not mail app or store app
I suggest to create 2 methods in utils:
- Method to open link in customTabsIntent and ignore ActivityNotFoundException -> example here (this method is used to open each link in app)
- Method to open start activity and ActivityNotFoundException -> example here (this method was only used to open mail app with mail address)
Hello Jean, I am looking for my first good contribution. So, it will great, if I can contribute to this issue.
I am thinking of solving the issue by this approach.
These are the two methods I created as mentioned in the original issue.
Please let me know, in which file should I put these methods?
fun customTabIntentWithoutException(view: View, string: String) {
try {
customTabsIntent.launchUrl(
view.context,
Uri.parse(string)
)
} catch (e: ActivityNotFoundException) {
}
}
fun startActivityWithoutException(intent: Intent) {
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
}
}
Waiting for your feedback. Thank you.
Code looks good, you can add methods in CommonExtensions.kt
Please wait, i want push PR #276 before because, i have doing somes changes about this
Ok
PR is merge, you can push your changes
Be careful here
Same here with settings