mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-22 13:09:46 +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.disposables.Disposable
|
||||
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.ThreadMode
|
||||
import org.koin.android.ext.android.inject
|
||||
@ -728,27 +732,33 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
}
|
||||
|
||||
shareAction.setOnClickListener {
|
||||
val sendIntent: Intent = Intent().apply {
|
||||
action = Intent.ACTION_SEND
|
||||
putExtra(
|
||||
Intent.EXTRA_SUBJECT,
|
||||
String.format(
|
||||
context.getString(R.string.nc_share_subject),
|
||||
context.getString(R.string.nc_app_name)
|
||||
)
|
||||
)
|
||||
GlobalScope.launch {
|
||||
val sendIntent: Intent = Intent().apply {
|
||||
action = Intent.ACTION_SEND
|
||||
putExtra(
|
||||
Intent.EXTRA_SUBJECT,
|
||||
String.format(
|
||||
context.getString(string.nc_share_subject),
|
||||
context.getString(string.nc_app_name)
|
||||
)
|
||||
)
|
||||
|
||||
putExtra(
|
||||
Intent.EXTRA_TEXT, ShareUtils.getStringForIntent(
|
||||
context, conversation!!.password, conversation!!
|
||||
)
|
||||
)
|
||||
putExtra(
|
||||
Intent.EXTRA_TEXT, ShareUtils.getStringForIntent(
|
||||
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) {
|
||||
|
@ -34,8 +34,8 @@ object ShareUtils : KoinComponent {
|
||||
|
||||
@JvmStatic
|
||||
fun getStringForIntent(context: Context?, password: String?, conversation: Conversation): String {
|
||||
val userEntity: UserNgEntity? = usersRepository.getActiveUser()
|
||||
var shareString = ""
|
||||
val userEntity: UserNgEntity? = usersRepository.getActiveUser()
|
||||
if (userEntity != null && context != null) {
|
||||
shareString = java.lang.String.format(context.resources.getString(R.string.nc_share_text),
|
||||
userEntity.baseUrl, conversation.token)
|
||||
@ -43,6 +43,7 @@ object ShareUtils : KoinComponent {
|
||||
shareString += String.format(context.resources.getString(R.string.nc_share_text_pass), password)
|
||||
}
|
||||
}
|
||||
|
||||
return shareString
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user