Skip to content

Commit 5fbbcd6

Browse files
authored
Merge pull request #4778 from owncloud/feature/copy_permanent_link_of_a_space
[FEATURE REQUEST] Copy permanent link of a space
2 parents 16e8e82 + 6c8da8c commit 5fbbcd6

6 files changed

Lines changed: 70 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ ownCloud admins and users.
4949
* Enhancement - Edit a space member: [#4724](https://github.com/owncloud/android/issues/4724)
5050
* Enhancement - Remove a space member: [#4725](https://github.com/owncloud/android/issues/4725)
5151
* Enhancement - Workflow to build APK: [#4751](https://github.com/owncloud/android/pull/4751)
52+
* Enhancement - Copy permanent link of a space: [#4758](https://github.com/owncloud/android/issues/4758)
5253
* Enhancement - Workflow to check Conventional Commits: [#4759](https://github.com/owncloud/android/pull/4759)
5354
* Enhancement - QA Content Provider: [#4776](https://github.com/owncloud/android/pull/4776)
5455

@@ -133,6 +134,14 @@ ownCloud admins and users.
133134

134135
https://github.com/owncloud/android/pull/4751
135136

137+
* Enhancement - Copy permanent link of a space: [#4758](https://github.com/owncloud/android/issues/4758)
138+
139+
A new option to copy and share the permanent link of a space has been added next
140+
to the space header in the members section.
141+
142+
https://github.com/owncloud/android/issues/4758
143+
https://github.com/owncloud/android/pull/4778
144+
136145
* Enhancement - Workflow to check Conventional Commits: [#4759](https://github.com/owncloud/android/pull/4759)
137146

138147
A new workflow has been added to check that commit names in a PR fits the

changelog/unreleased/4778

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Enhancement: Copy permanent link of a space
2+
3+
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.
4+
5+
https://github.com/owncloud/android/issues/4758
6+
https://github.com/owncloud/android/pull/4778

owncloudApp/src/main/java/com/owncloud/android/presentation/releasenotes/ReleaseNotesViewModel.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ class ReleaseNotesViewModel(
5353
subtitle = R.string.release_notes_4_8_0_subtitle_set_emoji_as_space_image,
5454
type = ReleaseNoteType.ENHANCEMENT
5555
),
56+
ReleaseNote(
57+
title = R.string.release_notes_4_8_0_title_spaces_permanent_links,
58+
subtitle = R.string.release_notes_4_8_0_subtitle_spaces_permanent_links,
59+
type = ReleaseNoteType.ENHANCEMENT
60+
),
5661
ReleaseNote(
5762
title = R.string.release_notes_bugfixes_title,
5863
subtitle = R.string.release_notes_bugfixes_subtitle,

owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/members/SpaceMembersActivity.kt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
package com.owncloud.android.presentation.spaces.members
2222

23+
import android.accounts.AccountManager
24+
import android.content.Intent
2325
import android.os.Bundle
2426
import android.view.Menu
2527
import android.view.MenuItem
@@ -29,6 +31,7 @@ import com.owncloud.android.databinding.MembersActivityBinding
2931
import com.owncloud.android.domain.roles.model.OCRole
3032
import com.owncloud.android.domain.spaces.model.OCSpace
3133
import com.owncloud.android.domain.spaces.model.SpaceMember
34+
import com.owncloud.android.presentation.common.ShareSheetHelper
3235
import com.owncloud.android.ui.activity.FileActivity
3336
import com.owncloud.android.utils.DisplayUtils
3437

@@ -62,6 +65,10 @@ class SpaceMembersActivity: FileActivity(), SpaceMembersFragment.SpaceMemberFrag
6265
quota.getRelative().toString())
6366
}
6467
}
68+
69+
permanentLinkButton.setOnClickListener {
70+
copyOrSendPermanentLink(currentSpace.webUrl, currentSpace.name)
71+
}
6572
}
6673

6774
supportFragmentManager.transaction {
@@ -92,9 +99,32 @@ class SpaceMembersActivity: FileActivity(), SpaceMembersFragment.SpaceMemberFrag
9299
}
93100
}
94101

102+
private fun copyOrSendPermanentLink(permanentLink: String?, spaceName: String) {
103+
permanentLink?.let {
104+
val displayName = AccountManager.get(this).getUserData(account, KEY_DISPLAY_NAME)
105+
106+
val intentToSharePermanentLink = Intent(Intent.ACTION_SEND).apply {
107+
type = TYPE_PLAIN
108+
putExtra(Intent.EXTRA_TEXT, it)
109+
putExtra(Intent.EXTRA_SUBJECT, getString(R.string.subject_user_shared_with_you, displayName, spaceName))
110+
}
111+
112+
val shareSheetIntent = ShareSheetHelper().getShareSheetIntent(
113+
intent = intentToSharePermanentLink,
114+
context = this,
115+
title = R.string.activity_chooser_title,
116+
packagesToExclude = arrayOf(packageName)
117+
)
118+
startActivity(shareSheetIntent)
119+
}
120+
}
121+
95122
companion object {
96123
private const val TAG_SPACE_MEMBERS_FRAGMENT = "SPACE_MEMBERS_FRAGMENT"
97124
private const val TAG_ADD_MEMBER_FRAGMENT ="ADD_MEMBER_FRAGMENT"
125+
private const val TYPE_PLAIN = "text/plain"
126+
private const val KEY_DISPLAY_NAME = "oc_display_name"
127+
98128
const val EXTRA_SPACE = "EXTRA_SPACE"
99129
}
100130

owncloudApp/src/main/res/layout/members_activity.xml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
<TextView
4646
android:id="@+id/item_name"
47-
android:layout_width="wrap_content"
47+
android:layout_width="0dp"
4848
android:layout_height="wrap_content"
4949
android:layout_marginEnd="@dimen/standard_half_margin"
5050
android:layout_marginStart="@dimen/standard_half_margin"
@@ -54,7 +54,8 @@
5454
android:textColor="@color/black"
5555
android:textSize="16sp"
5656
app:layout_constraintStart_toEndOf="@id/item_icon"
57-
app:layout_constraintTop_toTopOf="parent"/>
57+
app:layout_constraintTop_toTopOf="parent"
58+
app:layout_constraintEnd_toStartOf="@id/permanent_link_button"/>
5859

5960
<TextView
6061
android:id="@+id/item_size"
@@ -67,6 +68,19 @@
6768
app:layout_constraintStart_toEndOf="@id/item_icon"
6869
app:layout_constraintTop_toBottomOf="@id/item_name"/>
6970

71+
<ImageButton
72+
android:id="@+id/permanent_link_button"
73+
android:layout_width="40dp"
74+
android:layout_height="40dp"
75+
android:layout_marginTop="@dimen/standard_quarter_margin"
76+
android:padding="@dimen/standard_half_padding"
77+
android:src="@drawable/copy_link"
78+
android:scaleType="centerCrop"
79+
android:background="@color/transparent"
80+
android:contentDescription="@string/content_description_permanent_link_button"
81+
app:layout_constraintEnd_toEndOf="parent"
82+
app:layout_constraintTop_toTopOf="parent"/>
83+
7084
</androidx.constraintlayout.widget.ConstraintLayout>
7185

7286
<FrameLayout

owncloudApp/src/main/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,9 @@
745745
<string name="release_notes_4_8_0_subtitle_set_emoji_as_space_image">Infinite Scale users with right permissions can now set an emoji as space image</string>
746746
<string name="release_notes_4_8_0_title_space_membership">Space membership</string>
747747
<string name="release_notes_4_8_0_subtitle_space_membership">Infinite Scale users can see all members of a space and manage them with right permissions</string>
748+
<string name="release_notes_4_8_0_title_spaces_permanent_links">Permanent links for spaces</string>
749+
<string name="release_notes_4_8_0_subtitle_spaces_permanent_links">Infinite Scale users can now get a permanent link for a space and share it with other members</string>
750+
748751
<!-- Open in web -->
749752
<string name="ic_action_open_in_web">Open in web</string>
750753
<string name="ic_action_open_with_web">Open in %1$s (web)</string>
@@ -835,6 +838,7 @@
835838
<string name="content_description_expiration_date_switch">Expiration date</string>
836839
<string name="content_description_remove_member_button">Remove member %1$s</string>
837840
<string name="content_description_edit_member_button">Edit member %1$s</string>
841+
<string name="content_description_permanent_link_button">Get permanent link</string>
838842

839843
<string name="create_shortcut_dialog_title">Create a shortcut</string>
840844
<string name="create_shortcut_dialog_url">URL</string>

0 commit comments

Comments
 (0)