Skip to content

Commit

Permalink
refactor: some changes in prepareOptionsMenu structure in text preview
Browse files Browse the repository at this point in the history
  • Loading branch information
joragua committed Oct 2, 2024
1 parent fd93bfc commit 339ef62
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,12 @@ class PreviewTextFragment : FileFragment() {

override fun onPrepareOptionsMenu(menu: Menu) {
mContainerActivity.storageManager?.let {
val safeFile = file
val accountName = it.account.name
collectLatestLifecycleFlow(previewTextViewModel.getCurrentFile()) { currentFile ->
if (currentFile != null) {
previewTextViewModel.filterMenuOptions(currentFile, accountName)
}
}
previewTextViewModel.filterMenuOptions(safeFile,accountName)

collectLatestLifecycleFlow(previewTextViewModel.menuOptions) { menuOptions ->
val hasWritePermission = file.hasWritePermission
val hasWritePermission = safeFile.hasWritePermission
menu.filterMenuOptions(menuOptions, hasWritePermission)
}
}
Expand Down

0 comments on commit 339ef62

Please sign in to comment.