mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Use the share intent subject besides the text
When sharing a text, some applications also set the subject field in the share intent. For instance, when sharing a video with NewPipe, the title of the video is put in the subject of the intent. This change makes use of the subject field when providing the shared text.
This commit is contained in:
@@ -55,14 +55,19 @@ class ComposeActivityModule {
|
||||
@Provides
|
||||
@Named("text")
|
||||
fun provideSharedText(activity: ComposeActivity): String {
|
||||
return activity.intent.extras?.getString(Intent.EXTRA_TEXT)
|
||||
var subject = activity.intent.getStringExtra(Intent.EXTRA_SUBJECT) ?: "";
|
||||
if (subject != "") {
|
||||
subject += "\n"
|
||||
}
|
||||
|
||||
return subject + (activity.intent.extras?.getString(Intent.EXTRA_TEXT)
|
||||
?: activity.intent.extras?.getString("sms_body")
|
||||
?: activity.intent?.decodedDataString()
|
||||
?.substringAfter('?') // Query string
|
||||
?.split(',')
|
||||
?.firstOrNull { param -> param.startsWith("body") }
|
||||
?.substringAfter('=')
|
||||
?: ""
|
||||
?: "")
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -88,4 +93,4 @@ class ComposeActivityModule {
|
||||
return data
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user