diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt
index 758710ce0..73d6d052d 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt
@@ -6,6 +6,8 @@
*/
package com.nextcloud.talk.ui.dialog
+import android.content.Intent
+import android.net.Uri
import android.os.Bundle
import android.text.TextUtils
import android.view.View
@@ -30,10 +32,10 @@ import com.nextcloud.talk.models.json.generic.GenericOverall
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.users.UserManager
import com.nextcloud.talk.utils.ApiUtils
-import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID
-import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import com.nextcloud.talk.utils.CapabilitiesUtil
import com.nextcloud.talk.utils.SpreedFeatures
+import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID
+import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
@@ -123,6 +125,9 @@ class ConversationsListBottomDialog(
binding.conversationOperationRename.visibility = setVisibleIf(
conversation.isNameEditable(currentUser)
)
+ binding.conversationLinkShare.visibility = setVisibleIf(
+ conversation.name != context.getString(R.string.note_to_self)
+ )
binding.conversationOperationDelete.visibility = setVisibleIf(
canModerate
@@ -161,6 +166,11 @@ class ConversationsListBottomDialog(
markConversationAsUnread()
}
+ binding.conversationLinkShare.setOnClickListener {
+ shareConversationLink()
+ dismiss()
+ }
+
binding.conversationOperationRename.setOnClickListener {
renameConversation()
}
@@ -174,6 +184,35 @@ class ConversationsListBottomDialog(
}
}
+ private fun shareConversationLink() {
+ val activeAccountUrl = currentUser.baseUrl
+ val roomToken = conversation.token
+
+ val uriToShareConversation = Uri.parse(activeAccountUrl)
+ .buildUpon()
+ .appendPath("index.php")
+ .appendPath("call")
+ .appendPath(roomToken)
+ .build()
+
+ val shareConversationLink = String.format(
+ context.getString(
+ R.string.share_link_to_conversation,
+ conversation.name,
+ uriToShareConversation.toString()
+ )
+ )
+
+ val sendIntent: Intent = Intent().apply {
+ action = Intent.ACTION_SEND
+ putExtra(Intent.EXTRA_TEXT, shareConversationLink)
+ type = "text/plain"
+ }
+
+ val shareIntent = Intent.createChooser(sendIntent, null)
+ context.startActivity(shareIntent)
+ }
+
private fun addConversationToFavorites() {
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.API_V4, ApiUtils.API_V1))
ncApi.addConversationToFavorites(
diff --git a/app/src/main/java/com/nextcloud/talk/utils/ShareUtils.kt b/app/src/main/java/com/nextcloud/talk/utils/ShareUtils.kt
index 689095f05..594b12eae 100644
--- a/app/src/main/java/com/nextcloud/talk/utils/ShareUtils.kt
+++ b/app/src/main/java/com/nextcloud/talk/utils/ShareUtils.kt
@@ -14,7 +14,8 @@ import com.nextcloud.talk.models.domain.ConversationModel
object ShareUtils {
fun getStringForIntent(context: Context, user: User, conversation: ConversationModel?): String {
return String.format(
- context.resources.getString(R.string.nc_share_text),
+ context.resources.getString(R.string.nc_share_link_text),
+ conversation?.name,
user.baseUrl,
conversation?.token
)
diff --git a/app/src/main/res/layout/dialog_conversation_operations.xml b/app/src/main/res/layout/dialog_conversation_operations.xml
index 8d23a7628..ca39b3191 100644
--- a/app/src/main/res/layout/dialog_conversation_operations.xml
+++ b/app/src/main/res/layout/dialog_conversation_operations.xml
@@ -165,6 +165,36 @@
android:textSize="@dimen/bottom_sheet_text_size" />
+
+
+
+
+
+
+
Conversation name
Create conversation
Add emojis
- Join the conversation at %1$s/index.php/call/%2$s
%1$s invitation
\nPassword: %1$s
+ Join the conversation %1$s at %2$s/index.php/call/%3$s
Push-to-talk
With microphone disabled, click&hold to use Push-to-talk
@@ -435,6 +435,7 @@ How to translate with transifex:
Resend invitations
Invitations were sent out again.
Invitations were not send due to an error.
+ Share link
Send message
@@ -785,4 +786,6 @@ How to translate with transifex:
Edit Icon
Failed to fetch pending invitations
Edited by %1$s
+ Join conversation %1$s at %2$s
+ Note to self