Skip to content

edit tags#16672

Open
tobiasKaminsky wants to merge 3 commits intomasterfrom
editTags
Open

edit tags#16672
tobiasKaminsky wants to merge 3 commits intomasterfrom
editTags

Conversation

@tobiasKaminsky
Copy link
Copy Markdown
Member

Disclaimer: Claude AI

@github-actions
Copy link
Copy Markdown

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16672.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

private val currentAccountProvider: CurrentAccountProvider
) : ViewModel() {

sealed interface TagUiState {
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.

Please add sealed interface in com.nextcloud.ui.tags.model

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What do you mean? Shall I extract it and move to com.nextcloud.ui.tags.model as a new file/interface?

Copy link
Copy Markdown
Collaborator

@alperozturk96 alperozturk96 Apr 14, 2026

Choose a reason for hiding this comment

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

Yes please.

My folder structure idea:

ui
ui/tags
ui/tags/adapter
ui/tags/model
ui/tags/model/tagUiState
ui/tags/util -> if exists
ui/tags/tagsFragment
ui/tags/tagsViewModel

Thus we don't have huge model package or huge viewModels package every feature have same inner structure and all inner classes, interfaces etc only responsible for that feature.

Since this is a new feature lets follow this structure make sense?

e.g. not well structured (OCFileUtils only related with file listing feature but BuildHelper project scope util so its right place for it)

Screenshot 2026-04-14 at 10 06 39

my suggestion (see notifications package in future everything related with notification will be under ui/notification package)

Screenshot 2026-04-14 at 10 08 14

viewModelScope.launch(Dispatchers.IO) {
try {
val client = clientFactory.createNextcloudClient(currentAccountProvider.user)
val result = PutTagRemoteOperation(tag.id, fileId).execute(client)
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.

Better to create repository for TagManagementViewModel e.g. TagManagementRepository and handle network call there and inject inside ViewModel instead of doing network call directly inside the ViewModel.

You can check AssistantViewModel as an example.

}
}
} catch (e: ClientFactory.CreationException) {
// ignore
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.

Always log errors.

val nextcloudClient = clientFactory.createNextcloudClient(currentAccountProvider.user)
val createResult = CreateTagRemoteOperation(name).execute(nextcloudClient)

if (createResult.isSuccess) {
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.

Apply fail fast princible instead of nested ifs.

.show(fragmentManager, "actions");
}

private void refreshTagChips(Context context) {
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.

FileDetailFragment already 900+ lines of code. Let's not make it more harder to maintain. Please create a new Kotlin class and pass reference and handle the refresh tag chips there.

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
@github-actions
Copy link
Copy Markdown

Codacy

SpotBugs

CategoryBaseNew
Bad practice3535
Correctness6969
Dodgy code227227
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness3434
Performance4242
Security1616
Total433433

@github-actions
Copy link
Copy Markdown

APK file: https://github.com/nextcloud/android/actions/runs/24389201000/artifacts/6423672148
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@github-actions
Copy link
Copy Markdown

blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants