Skip to content

[FEATURE REQUEST] Create a link over a space #4794

Open
joragua wants to merge 8 commits intomasterfrom
feature/create_a_link_over_a_space
Open

[FEATURE REQUEST] Create a link over a space #4794
joragua wants to merge 8 commits intomasterfrom
feature/create_a_link_over_a_space

Conversation

@joragua
Copy link
Copy Markdown
Collaborator

@joragua joragua commented Mar 5, 2026

Related Issues

App: #4753

  • Add changelog files for the fixed issues in folder changelog/unreleased. More info here
  • Add feature to Release Notes in ReleaseNotesViewModel.kt creating a new ReleaseNote() with String resources (if required)

EXTRA: Some content descriptions have been refactored (removed redundant button) in order to avoid repetitions in Talkback. These strings are related to the Cancel and Create buttons, displayed in some dialogs:

Cancel -> Set password dialog, create space dialog and set icon dialog
Create -> Create space dialog


QA

@joragua joragua self-assigned this Mar 5, 2026
@joragua joragua force-pushed the feature/create_a_link_over_a_space branch from 1d538ec to 4c0e841 Compare March 5, 2026 10:46
@joragua joragua linked an issue Mar 5, 2026 that may be closed by this pull request
11 tasks
@joragua joragua force-pushed the feature/create_a_link_over_a_space branch 4 times, most recently from e746700 to dab471c Compare March 5, 2026 11:07
@joragua joragua force-pushed the feature/create_a_link_over_a_space branch 6 times, most recently from d6efcfa to 3f3ec03 Compare March 25, 2026 08:49
@joragua joragua force-pushed the feature/create_a_link_over_a_space branch 2 times, most recently from cefab52 to 73259d0 Compare March 25, 2026 16:34
@joragua joragua force-pushed the feature/create_a_link_over_a_space branch from 73259d0 to e3a9230 Compare March 26, 2026 07:48
@joragua joragua marked this pull request as ready for review March 26, 2026 09:24
@joragua joragua requested a review from jesmrec March 26, 2026 09:24
Copy link
Copy Markdown
Collaborator

@jesmrec jesmrec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @joragua 💯 !!! some comments and questions on my side.

setPasswordSwitch.isVisible = !isPasswordEnforced
setPasswordSwitch.isChecked = hasPassword
}
binding.createPublicLinkButton.isEnabled = isPasswordEnforced && hasPassword || !isPasswordEnforced
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would happen if !isPasswordEnforced and permission is not selected yet? OTOH, shouldn't parentheses be necessary?. Not the same:

binding.createPublicLinkButton.isEnabled = (isPasswordEnforced && hasPassword) || !isPasswordEnforced

binding.createPublicLinkButton.isEnabled = isPasswordEnforced && (hasPassword || !isPasswordEnforced)

i guess the first one is the correct, the one you wanted... and probably the one that kotlin will take. Just in case.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That code is wrapped in selectedPermission?.let{ } block, so the logic doesn't apply when the permission is not selected. Anyway, I'll add parentheses in the condition to make it clearer. The final version:

binding.createPublicLinkButton.isEnabled = (isPasswordEnforced && hasPassword) || !isPasswordEnforced

}
binding.createPublicLinkButton.isEnabled = isPasswordEnforced && hasPassword || !isPasswordEnforced

binding.createPublicLinkButton.setOnClickListener {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: since the "set listeners" (this and the following ones) are inside of the collectLatestLifecycleFlow , are they registered in every state change?

}

private fun checkPasswordEnforced(selectedPermission: OCLinkType) {
isPasswordEnforced = when (selectedPermission) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this kind of decision, aren't a ViewModel responsibility, instead of the fragment?


private val spaceLinksViewModel: SpaceLinksViewModel by activityViewModel {
parametersOf(
requireArguments().getString(ARG_ACCOUNT_NAME),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed requireArguments().getString(ARG_ACCOUNT_NAME) to be called several times through the class. Couldn't be refactored to be read only once or similar?

canEditPublicLinkRadioButton.isChecked = false
secretFileDropPublicLinkRadioButton.isChecked = false
selectedRadioButton.isChecked = true
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About this block: you set all the permissions to false and then, the selected one to true. Why that? is it required to reset all the buttons before setting a new value?

EDIT: after checking the correspondent layout, i noticed you use three individual RadioButton . Would it be better to use a RadioGroup that will make all options exclusive? https://developer.android.com/reference/android/widget/RadioGroup

android:id="@+id/options_title"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_centerVertical="true"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is not useful in a ConstraintLayout

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed! 👍🏻

android:background="@android:color/darker_gray"
android:alpha="0.5"/>

</LinearLayout>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<TextView
android:id="@+id/password_policy_min_characters_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a TextView if the content is an icon? same for all below ⬇️

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, they should be ImageView elements... Thanks! Changed 😄

android:layout_width="match_parent"
android:layout_height="wrap_content"/>

</LinearLayout>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be repetition there (one LinearLayout for every policy, just changing ids) . Is there any way to refactor, for example, using includes somehow ? or the different ids in every Layout makes it not posible?

import com.owncloud.android.lib.resources.Service

interface LinksService: Service {
fun addLink(spaceId: String, displayName: String, type: String, expirationDate: String?, password: String?): RemoteOperationResult<Unit>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: could the type be OCLinkType instead of String?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Create a link over a space

3 participants