mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-07 22:50:53 +03:00
Fix #888 Implement share card.
This commit is contained in:
@@ -35,6 +35,11 @@ class WebAppInterface(private val mContext: MainActivity) {
|
||||
fun beginOAuthFlow() {
|
||||
mContext.beginOAuthFlow();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun shareUrl(url: String) {
|
||||
mContext.shareUrl(url)
|
||||
}
|
||||
}
|
||||
|
||||
class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||
@@ -94,6 +99,14 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||
})
|
||||
}
|
||||
|
||||
fun shareUrl(url: String) {
|
||||
val shareIntent = Intent()
|
||||
shareIntent.action = Intent.ACTION_SEND
|
||||
shareIntent.type = "text/plain"
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, url);
|
||||
startActivity(Intent.createChooser(shareIntent, ""))
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
Reference in New Issue
Block a user