mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-22 21:19:31 +01:00
Fix sharing
This commit is contained in:
parent
894bb174f2
commit
436bdeb49f
@ -86,6 +86,10 @@ import io.reactivex.Observer
|
|||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.GlobalScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
@ -728,27 +732,33 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
shareAction.setOnClickListener {
|
shareAction.setOnClickListener {
|
||||||
val sendIntent: Intent = Intent().apply {
|
GlobalScope.launch {
|
||||||
action = Intent.ACTION_SEND
|
val sendIntent: Intent = Intent().apply {
|
||||||
putExtra(
|
action = Intent.ACTION_SEND
|
||||||
Intent.EXTRA_SUBJECT,
|
putExtra(
|
||||||
String.format(
|
Intent.EXTRA_SUBJECT,
|
||||||
context.getString(R.string.nc_share_subject),
|
String.format(
|
||||||
context.getString(R.string.nc_app_name)
|
context.getString(string.nc_share_subject),
|
||||||
)
|
context.getString(string.nc_app_name)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
putExtra(
|
putExtra(
|
||||||
Intent.EXTRA_TEXT, ShareUtils.getStringForIntent(
|
Intent.EXTRA_TEXT, ShareUtils.getStringForIntent(
|
||||||
context, conversation!!.password, conversation!!
|
context, conversation!!.password, conversation!!
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type = "text/plain"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val intent = Intent.createChooser(sendIntent, context.getString(string.nc_share_link))
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
type = "text/plain"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val intent = Intent.createChooser(sendIntent, context.getString(string.nc_share_link))
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allowGuestsAction.value) {
|
if (allowGuestsAction.value) {
|
||||||
|
@ -34,8 +34,8 @@ object ShareUtils : KoinComponent {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getStringForIntent(context: Context?, password: String?, conversation: Conversation): String {
|
fun getStringForIntent(context: Context?, password: String?, conversation: Conversation): String {
|
||||||
val userEntity: UserNgEntity? = usersRepository.getActiveUser()
|
|
||||||
var shareString = ""
|
var shareString = ""
|
||||||
|
val userEntity: UserNgEntity? = usersRepository.getActiveUser()
|
||||||
if (userEntity != null && context != null) {
|
if (userEntity != null && context != null) {
|
||||||
shareString = java.lang.String.format(context.resources.getString(R.string.nc_share_text),
|
shareString = java.lang.String.format(context.resources.getString(R.string.nc_share_text),
|
||||||
userEntity.baseUrl, conversation.token)
|
userEntity.baseUrl, conversation.token)
|
||||||
@ -43,6 +43,7 @@ object ShareUtils : KoinComponent {
|
|||||||
shareString += String.format(context.resources.getString(R.string.nc_share_text_pass), password)
|
shareString += String.format(context.resources.getString(R.string.nc_share_text_pass), password)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return shareString
|
return shareString
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user