Skip to content

Commit a883df9

Browse files
committed
feat: implement remove tags method
1 parent 7ffbae5 commit a883df9

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

app/src/main/java/to/bitkit/ui/screens/wallets/send/SendAndReviewScreen.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ fun SendAndReviewScreen(
5858
onBack: () -> Unit,
5959
onEvent: (SendEvent) -> Unit,
6060
onClickAddTag: () -> Unit,
61+
onClickTag: (String) -> Unit,
6162
) {
6263
Column(
6364
modifier = Modifier.fillMaxSize()
@@ -98,7 +99,7 @@ fun SendAndReviewScreen(
9899
text = tagText,
99100
isSelected = false,
100101
displayIconClose = true,
101-
onClick = { }, //TODO IMPLEMENT IN OTHER PR
102+
onClick = { onClickTag(tagText) },
102103
)
103104
}
104105
}
@@ -324,6 +325,7 @@ private fun SendAndReviewPreview() {
324325
onBack = {},
325326
onEvent = {},
326327
onClickAddTag = {},
328+
onClickTag = {},
327329
)
328330
}
329331
}
@@ -355,6 +357,7 @@ private fun SendAndReviewPreview2() {
355357
onBack = {},
356358
onEvent = {},
357359
onClickAddTag = {},
360+
onClickTag = {},
358361
)
359362
}
360363
}

app/src/main/java/to/bitkit/ui/screens/wallets/send/SendOptionsView.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ fun SendOptionsView(
106106
uiState = uiState,
107107
onBack = { navController.popBackStack() },
108108
onEvent = { appViewModel.setSendEvent(it) },
109-
onClickAddTag = { navController.navigate(SendRoute.AddTag) }
109+
onClickAddTag = { navController.navigate(SendRoute.AddTag) },
110+
onClickTag = { tag -> appViewModel.removeTag(tag) }
110111
)
111112
}
112113
composable<SendRoute.AddTag> {

app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ class AppViewModel @Inject constructor(
109109
}
110110
}
111111

112+
fun removeTag(tag: String) {
113+
_sendUiState.update {
114+
it.copy(
115+
selectedTags = it.selectedTags.filterNot { tagItem -> tagItem == tag }
116+
)
117+
}
118+
}
119+
112120
private var scan: Scanner? = null
113121

114122
init {

0 commit comments

Comments
 (0)