share conversation link

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-02-11 16:23:42 +01:00
parent 76451c1649
commit bec19428e0
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B

View file

@ -33,6 +33,13 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import org.parceler.Parcels
import javax.inject.Inject
import androidx.core.content.ContextCompat.startActivity
import android.content.Intent
import androidx.core.content.ContextCompat
import com.nextcloud.talk.utils.ShareUtils
import com.nextcloud.talk.utils.database.user.UserUtils
import kotlinx.android.synthetic.main.activity_take_picture.*
@AutoInjector(NextcloudTalkApplication::class)
class ConversationOperationDialog(
@ -50,6 +57,10 @@ class ConversationOperationDialog(
@JvmField
var ncApi: NcApi? = null
@Inject
@JvmField
var userUtils: UserUtils? = null
init {
NextcloudTalkApplication.sharedApplication?.componentApplication?.inject(this)
}
@ -198,7 +209,27 @@ class ConversationOperationDialog(
}
binding.conversationOperationShareLink.setOnClickListener {
// TODO share by intent
val sendIntent: Intent = Intent().apply {
action = Intent.ACTION_SEND
type = "text/plain"
putExtra(
Intent.EXTRA_SUBJECT,
String.format(
activity.resources.getString(R.string.nc_share_subject),
activity.resources.getString(R.string.nc_app_product_name)
)
)
// password should not be shared!!
putExtra(
Intent.EXTRA_TEXT,
ShareUtils.getStringForIntent(activity, null, userUtils, conversation)
)
}
val shareIntent = Intent.createChooser(sendIntent, null)
activity.startActivity(shareIntent)
dismiss()
}
}