Conversation
|
blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed. |
|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16672.apk |
| ) | ||
| } | ||
| } else { | ||
| _uiState.update { TagUiState.Error("Failed to load tags") } |
There was a problem hiding this comment.
Please add hardcoded strings in xml.
| private val currentAccountProvider: CurrentAccountProvider | ||
| ) : ViewModel() { | ||
|
|
||
| sealed interface TagUiState { |
There was a problem hiding this comment.
Please add sealed interface in com.nextcloud.ui.tags.model
| import com.owncloud.android.R | ||
| import com.owncloud.android.lib.resources.tags.Tag | ||
|
|
||
| class TagListAdapter(private val onTagChecked: (Tag, Boolean) -> Unit, private val onCreateTag: (String) -> Unit) : |
There was a problem hiding this comment.
Please move adapter inside com.nextcloud.ui.tags.adapter
| } | ||
| } | ||
|
|
||
| inner class TagViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { |
There was a problem hiding this comment.
Please move inner classes inside com.nextcloud.ui.tags.adapter.viewholder and make it class.
| object Loading : TagUiState | ||
| data class Loaded(val allTags: List<Tag>, val assignedTagIds: Set<String>, val query: String = "") : TagUiState | ||
|
|
||
| data class Error(val message: String) : TagUiState |
There was a problem hiding this comment.
Instead of using String directly we can use Int that represents translated strings.
| viewModelScope.launch(Dispatchers.IO) { | ||
| try { | ||
| val client = clientFactory.createNextcloudClient(currentAccountProvider.user) | ||
| val result = PutTagRemoteOperation(tag.id, fileId).execute(client) |
There was a problem hiding this comment.
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 |
| val nextcloudClient = clientFactory.createNextcloudClient(currentAccountProvider.user) | ||
| val createResult = CreateTagRemoteOperation(name).execute(nextcloudClient) | ||
|
|
||
| if (createResult.isSuccess) { |
There was a problem hiding this comment.
Apply fail fast princible instead of nested ifs.
| .show(fragmentManager, "actions"); | ||
| } | ||
|
|
||
| private void refreshTagChips(Context context) { |
There was a problem hiding this comment.
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.

Disclaimer: Claude AI