Pretty URL for conversation link
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
Родитель
9f356a67aa
Коммит
acd0b92b6c
|
@ -206,12 +206,14 @@ class ConversationInfoActivity :
|
|||
if (ConversationUtils.isNoteToSelfConversation(conversation)) {
|
||||
binding.shareConversationButton.visibility = GONE
|
||||
}
|
||||
val canGeneratePrettyURL = CapabilitiesUtil.canGeneratePrettyURL(conversationUser)
|
||||
binding.shareConversationButton.setOnClickListener {
|
||||
ShareUtils.shareConversationLink(
|
||||
this,
|
||||
conversationUser.baseUrl,
|
||||
conversation?.token,
|
||||
conversation?.name
|
||||
conversation?.name,
|
||||
canGeneratePrettyURL
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,10 @@ data class CoreCapability(
|
|||
@JsonField(name = ["reference-api"])
|
||||
var referenceApi: String?,
|
||||
@JsonField(name = ["reference-regex"])
|
||||
var referenceRegex: String?
|
||||
var referenceRegex: String?,
|
||||
@JsonField(name = ["mod-rewrite-working"])
|
||||
var modRewriteWorking: Boolean?
|
||||
) : Parcelable {
|
||||
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
|
||||
constructor() : this(null, null, null, null)
|
||||
constructor() : this(null, null, null, null, null)
|
||||
}
|
||||
|
|
|
@ -166,7 +166,14 @@ class ConversationsListBottomDialog(
|
|||
}
|
||||
|
||||
binding.conversationLinkShare.setOnClickListener {
|
||||
ShareUtils.shareConversationLink(activity, currentUser.baseUrl, conversation.token, conversation.name)
|
||||
val canGeneratePrettyURL = CapabilitiesUtil.canGeneratePrettyURL(currentUser)
|
||||
ShareUtils.shareConversationLink(
|
||||
activity,
|
||||
currentUser.baseUrl,
|
||||
conversation.token,
|
||||
conversation.name,
|
||||
canGeneratePrettyURL
|
||||
)
|
||||
dismiss()
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,10 @@ object CapabilitiesUtil {
|
|||
user.capabilities?.coreCapability?.referenceApi == "true"
|
||||
}
|
||||
|
||||
fun canGeneratePrettyURL(user: User): Boolean {
|
||||
return user.capabilities?.coreCapability?.modRewriteWorking == true
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
//region SpreedCapabilities
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
package com.nextcloud.talk.utils
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
|
@ -13,17 +14,29 @@ import com.nextcloud.talk.R
|
|||
|
||||
object ShareUtils {
|
||||
|
||||
fun shareConversationLink(context: Activity, baseUrl: String?, roomToken: String?, conversationName: String?) {
|
||||
@SuppressLint("StringFormatMatches")
|
||||
fun shareConversationLink(
|
||||
context: Activity,
|
||||
baseUrl: String?,
|
||||
roomToken: String?,
|
||||
conversationName: String?,
|
||||
canGeneratePrettyURL: Boolean
|
||||
) {
|
||||
if (baseUrl.isNullOrBlank() || roomToken.isNullOrBlank() || conversationName.isNullOrBlank()) {
|
||||
return
|
||||
}
|
||||
|
||||
val uriToShareConversation = Uri.parse(baseUrl)
|
||||
val uriBuilder = Uri.parse(baseUrl)
|
||||
.buildUpon()
|
||||
.appendPath("index.php")
|
||||
.appendPath("call")
|
||||
.appendPath(roomToken)
|
||||
.build()
|
||||
|
||||
if (!canGeneratePrettyURL) {
|
||||
uriBuilder.appendPath("index.php")
|
||||
}
|
||||
|
||||
uriBuilder.appendPath("call")
|
||||
uriBuilder.appendPath(roomToken)
|
||||
|
||||
val uriToShareConversation = uriBuilder.build()
|
||||
|
||||
val shareConversationLink = String.format(
|
||||
context.getString(
|
||||
|
|
Загрузка…
Ссылка в новой задаче