Removed unnecessary parameters from callbacks

This commit is contained in:
Abdelilah El Aissaoui 2022-04-02 00:36:09 +02:00
parent 5ab529e22b
commit 457d604575
3 changed files with 12 additions and 13 deletions

View File

@ -32,9 +32,8 @@ fun logContextMenu(
label = "Cherry-pick commit", label = "Cherry-pick commit",
onClick = onCherryPickCommit onClick = onCherryPickCommit
), ),
ContextMenuItem( ContextMenuItem(
label = "Reset current branch to this commit", label = "Reset current branch to this commit",
onClick = onResetBranch onClick = onResetBranch
) ),
) )

View File

@ -54,6 +54,7 @@ import app.viewmodels.LogStatus
import app.viewmodels.LogViewModel import app.viewmodels.LogViewModel
import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import openDirectoryDialog
import org.eclipse.jgit.lib.Ref import org.eclipse.jgit.lib.Ref
import org.eclipse.jgit.lib.RepositoryState import org.eclipse.jgit.lib.RepositoryState
import org.eclipse.jgit.revwalk.RevCommit import org.eclipse.jgit.revwalk.RevCommit
@ -339,9 +340,8 @@ fun MessagesList(
resetBranch = { onShowLogDialog(LogDialog.ResetBranch(graphNode)) }, resetBranch = { onShowLogDialog(LogDialog.ResetBranch(graphNode)) },
onMergeBranch = { ref -> onShowLogDialog(LogDialog.MergeBranch(ref)) }, onMergeBranch = { ref -> onShowLogDialog(LogDialog.MergeBranch(ref)) },
onRebaseBranch = { ref -> onShowLogDialog(LogDialog.RebaseBranch(ref)) }, onRebaseBranch = { ref -> onShowLogDialog(LogDialog.RebaseBranch(ref)) },
onRevCommitSelected = { onRevCommitSelected = { logViewModel.selectLogLine(graphNode) },
logViewModel.selectLogLine(graphNode) )
})
} }
} }
} }
@ -609,10 +609,10 @@ fun CommitLine(
matchesSearchFilter: Boolean?, matchesSearchFilter: Boolean?,
showCreateNewBranch: () -> Unit, showCreateNewBranch: () -> Unit,
showCreateNewTag: () -> Unit, showCreateNewTag: () -> Unit,
resetBranch: (GraphNode) -> Unit, resetBranch: () -> Unit,
onMergeBranch: (Ref) -> Unit, onMergeBranch: (Ref) -> Unit,
onRebaseBranch: (Ref) -> Unit, onRebaseBranch: (Ref) -> Unit,
onRevCommitSelected: (GraphNode) -> Unit, onRevCommitSelected: () -> Unit,
) { ) {
ContextMenuArea( ContextMenuArea(
items = { items = {
@ -622,13 +622,13 @@ fun CommitLine(
onCreateNewTag = showCreateNewTag, onCreateNewTag = showCreateNewTag,
onRevertCommit = { logViewModel.revertCommit(graphNode) }, onRevertCommit = { logViewModel.revertCommit(graphNode) },
onCherryPickCommit = { logViewModel.cherrypickCommit(graphNode) }, onCherryPickCommit = { logViewModel.cherrypickCommit(graphNode) },
onResetBranch = { resetBranch(graphNode) }, onResetBranch = { resetBranch() },
) )
}, },
) { ) {
Box( Box(
modifier = Modifier.clickable { modifier = Modifier.clickable {
onRevCommitSelected(graphNode) onRevCommitSelected()
}.padding(start = graphWidth) }.padding(start = graphWidth)
.height(40.dp) .height(40.dp)
) { ) {

View File

@ -263,14 +263,14 @@ class LogViewModel @Inject constructor(
suspend fun selectPreviousFilterCommit() { suspend fun selectPreviousFilterCommit() {
val logSearchFilterResultsValue = logSearchFilterResults.value val logSearchFilterResultsValue = logSearchFilterResults.value
if(logSearchFilterResultsValue !is LogSearch.SearchResults) { if (logSearchFilterResultsValue !is LogSearch.SearchResults) {
return return
} }
val index = logSearchFilterResultsValue.index val index = logSearchFilterResultsValue.index
val commits = logSearchFilterResultsValue.commits val commits = logSearchFilterResultsValue.commits
if(index == NONE_MATCHING_INDEX || index == FIRST_INDEX) if (index == NONE_MATCHING_INDEX || index == FIRST_INDEX)
return return
val newIndex = index - 1 val newIndex = index - 1
@ -283,7 +283,7 @@ class LogViewModel @Inject constructor(
suspend fun selectNextFilterCommit() { suspend fun selectNextFilterCommit() {
val logSearchFilterResultsValue = logSearchFilterResults.value val logSearchFilterResultsValue = logSearchFilterResults.value
if(logSearchFilterResultsValue !is LogSearch.SearchResults) { if (logSearchFilterResultsValue !is LogSearch.SearchResults) {
return return
} }
@ -291,7 +291,7 @@ class LogViewModel @Inject constructor(
val commits = logSearchFilterResultsValue.commits val commits = logSearchFilterResultsValue.commits
val totalCount = logSearchFilterResultsValue.totalCount val totalCount = logSearchFilterResultsValue.totalCount
if(index == NONE_MATCHING_INDEX || index == totalCount) if (index == NONE_MATCHING_INDEX || index == totalCount)
return return
val newIndex = index + 1 val newIndex = index + 1