android: sharing of files with plain text (#3011)
This commit is contained in:
parent
4793173465
commit
c7f1af8742
@ -141,7 +141,12 @@ fun processExternalIntent(intent: Intent?) {
|
|||||||
when {
|
when {
|
||||||
intent.type == "text/plain" -> {
|
intent.type == "text/plain" -> {
|
||||||
val text = intent.getStringExtra(Intent.EXTRA_TEXT)
|
val text = intent.getStringExtra(Intent.EXTRA_TEXT)
|
||||||
if (text != null) {
|
val uri = intent.getParcelableExtra<Parcelable>(Intent.EXTRA_STREAM) as? Uri
|
||||||
|
if (uri != null) {
|
||||||
|
// Shared file that contains plain text, like `*.log` file
|
||||||
|
chatModel.sharedContent.value = SharedContent.File(text ?: "", uri.toURI())
|
||||||
|
} else if (text != null) {
|
||||||
|
// Shared just a text
|
||||||
chatModel.sharedContent.value = SharedContent.Text(text)
|
chatModel.sharedContent.value = SharedContent.Text(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user