diff --git a/CHANGELOG.md b/CHANGELOG.md
index c5e474f7ce2..1646ed913d8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -49,6 +49,7 @@ ownCloud admins and users.
* Enhancement - Edit a space member: [#4724](https://github.com/owncloud/android/issues/4724)
* Enhancement - Remove a space member: [#4725](https://github.com/owncloud/android/issues/4725)
* Enhancement - Workflow to build APK: [#4751](https://github.com/owncloud/android/pull/4751)
+* Enhancement - Copy permanent link of a space: [#4758](https://github.com/owncloud/android/issues/4758)
* Enhancement - Workflow to check Conventional Commits: [#4759](https://github.com/owncloud/android/pull/4759)
* Enhancement - QA Content Provider: [#4776](https://github.com/owncloud/android/pull/4776)
@@ -133,6 +134,14 @@ ownCloud admins and users.
https://github.com/owncloud/android/pull/4751
+* Enhancement - Copy permanent link of a space: [#4758](https://github.com/owncloud/android/issues/4758)
+
+ A new option to copy and share the permanent link of a space has been added next
+ to the space header in the members section.
+
+ https://github.com/owncloud/android/issues/4758
+ https://github.com/owncloud/android/pull/4778
+
* Enhancement - Workflow to check Conventional Commits: [#4759](https://github.com/owncloud/android/pull/4759)
A new workflow has been added to check that commit names in a PR fits the
diff --git a/changelog/unreleased/4778 b/changelog/unreleased/4778
new file mode 100644
index 00000000000..a2e4981efdd
--- /dev/null
+++ b/changelog/unreleased/4778
@@ -0,0 +1,6 @@
+Enhancement: Copy permanent link of a space
+
+A new option to copy and share the permanent link of a space has been added next to the space header in the members section.
+
+https://github.com/owncloud/android/issues/4758
+https://github.com/owncloud/android/pull/4778
diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/releasenotes/ReleaseNotesViewModel.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/releasenotes/ReleaseNotesViewModel.kt
index 275a722c2ab..895f722d47c 100644
--- a/owncloudApp/src/main/java/com/owncloud/android/presentation/releasenotes/ReleaseNotesViewModel.kt
+++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/releasenotes/ReleaseNotesViewModel.kt
@@ -53,6 +53,11 @@ class ReleaseNotesViewModel(
subtitle = R.string.release_notes_4_8_0_subtitle_set_emoji_as_space_image,
type = ReleaseNoteType.ENHANCEMENT
),
+ ReleaseNote(
+ title = R.string.release_notes_4_8_0_title_spaces_permanent_links,
+ subtitle = R.string.release_notes_4_8_0_subtitle_spaces_permanent_links,
+ type = ReleaseNoteType.ENHANCEMENT
+ ),
ReleaseNote(
title = R.string.release_notes_bugfixes_title,
subtitle = R.string.release_notes_bugfixes_subtitle,
diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/members/SpaceMembersActivity.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/members/SpaceMembersActivity.kt
index 959c0b9e618..a10fa2cada5 100644
--- a/owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/members/SpaceMembersActivity.kt
+++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/members/SpaceMembersActivity.kt
@@ -20,6 +20,8 @@
package com.owncloud.android.presentation.spaces.members
+import android.accounts.AccountManager
+import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
@@ -29,6 +31,7 @@ import com.owncloud.android.databinding.MembersActivityBinding
import com.owncloud.android.domain.roles.model.OCRole
import com.owncloud.android.domain.spaces.model.OCSpace
import com.owncloud.android.domain.spaces.model.SpaceMember
+import com.owncloud.android.presentation.common.ShareSheetHelper
import com.owncloud.android.ui.activity.FileActivity
import com.owncloud.android.utils.DisplayUtils
@@ -62,6 +65,10 @@ class SpaceMembersActivity: FileActivity(), SpaceMembersFragment.SpaceMemberFrag
quota.getRelative().toString())
}
}
+
+ permanentLinkButton.setOnClickListener {
+ copyOrSendPermanentLink(currentSpace.webUrl, currentSpace.name)
+ }
}
supportFragmentManager.transaction {
@@ -92,9 +99,32 @@ class SpaceMembersActivity: FileActivity(), SpaceMembersFragment.SpaceMemberFrag
}
}
+ private fun copyOrSendPermanentLink(permanentLink: String?, spaceName: String) {
+ permanentLink?.let {
+ val displayName = AccountManager.get(this).getUserData(account, KEY_DISPLAY_NAME)
+
+ val intentToSharePermanentLink = Intent(Intent.ACTION_SEND).apply {
+ type = TYPE_PLAIN
+ putExtra(Intent.EXTRA_TEXT, it)
+ putExtra(Intent.EXTRA_SUBJECT, getString(R.string.subject_user_shared_with_you, displayName, spaceName))
+ }
+
+ val shareSheetIntent = ShareSheetHelper().getShareSheetIntent(
+ intent = intentToSharePermanentLink,
+ context = this,
+ title = R.string.activity_chooser_title,
+ packagesToExclude = arrayOf(packageName)
+ )
+ startActivity(shareSheetIntent)
+ }
+ }
+
companion object {
private const val TAG_SPACE_MEMBERS_FRAGMENT = "SPACE_MEMBERS_FRAGMENT"
private const val TAG_ADD_MEMBER_FRAGMENT ="ADD_MEMBER_FRAGMENT"
+ private const val TYPE_PLAIN = "text/plain"
+ private const val KEY_DISPLAY_NAME = "oc_display_name"
+
const val EXTRA_SPACE = "EXTRA_SPACE"
}
diff --git a/owncloudApp/src/main/res/layout/members_activity.xml b/owncloudApp/src/main/res/layout/members_activity.xml
index d3dab222dc5..9507a3893ff 100644
--- a/owncloudApp/src/main/res/layout/members_activity.xml
+++ b/owncloudApp/src/main/res/layout/members_activity.xml
@@ -44,7 +44,7 @@
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/permanent_link_button"/>
+
+
Infinite Scale users with right permissions can now set an emoji as space image
Space membership
Infinite Scale users can see all members of a space and manage them with right permissions
+ Permanent links for spaces
+ Infinite Scale users can now get a permanent link for a space and share it with other members
+
Open in web
Open in %1$s (web)
@@ -835,6 +838,7 @@
Expiration date
Remove member %1$s
Edit member %1$s
+ Get permanent link
Create a shortcut
URL