-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed email links not opening email client
- Loading branch information
1 parent
347ed83
commit 7694230
Showing
3 changed files
with
21 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,10 +61,24 @@ class ActivityLauncher( | |
@ColorInt toolbarColor: Int, | ||
openAdjacentIfSuitable: Boolean = true, | ||
): Boolean { | ||
return when (repository.linkOpener.value) { | ||
LinkOpener.CUSTOM_TAB -> openLinkInCustomTab(link, toolbarColor, openAdjacentIfSuitable) | ||
LinkOpener.DEFAULT_BROWSER -> openLinkInBrowser(link, openAdjacentIfSuitable) | ||
if (link.isBlank()) { | ||
return false | ||
} | ||
return if (link.startsWith("mailto:")) { | ||
openEmailClient(link) | ||
} else { | ||
when (repository.linkOpener.value) { | ||
LinkOpener.CUSTOM_TAB -> openLinkInCustomTab(link, toolbarColor, openAdjacentIfSuitable) | ||
LinkOpener.DEFAULT_BROWSER -> openLinkInBrowser(link, openAdjacentIfSuitable) | ||
} | ||
} | ||
} | ||
|
||
private fun openEmailClient(link: String): Boolean { | ||
// example link: mailto:[email protected]?subject=subject | ||
val intent = Intent(Intent.ACTION_SENDTO, Uri.parse(link)) | ||
|
||
return startActivity(openAdjacentIfSuitable = true, intent = intent) | ||
} | ||
|
||
/** | ||
|