mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-28 07:51:42 +01:00
Fix demo app.
This commit is contained in:
+7
@@ -81,12 +81,18 @@ class DemoStickerKeyboardRepository(private val context: Context) : StickerKeybo
|
||||
packsFlow.value = buildPacks()
|
||||
}
|
||||
|
||||
override fun clearRecentStickers() {
|
||||
recents.clear()
|
||||
packsFlow.value = buildPacks()
|
||||
}
|
||||
|
||||
private fun buildPacks(): List<KeyboardStickerPack> {
|
||||
return buildList {
|
||||
if (recents.isNotEmpty()) {
|
||||
add(
|
||||
KeyboardStickerPack(
|
||||
id = StickerKeyboardRepository.RECENT_PACK_ID,
|
||||
packKey = null,
|
||||
title = null,
|
||||
cover = null,
|
||||
stickers = recents.toList()
|
||||
@@ -102,6 +108,7 @@ class DemoStickerKeyboardRepository(private val context: Context) : StickerKeybo
|
||||
private fun pack(id: String, title: String, @DrawableRes cover: Int): KeyboardStickerPack {
|
||||
return KeyboardStickerPack(
|
||||
id = id,
|
||||
packKey = "$id-key",
|
||||
title = title,
|
||||
cover = rasterize(cover),
|
||||
stickers = demoStickers.filter { it.packId == id }.map { stickersByName.getValue(it.name) }
|
||||
|
||||
@@ -66,12 +66,15 @@ fun MainScreen(
|
||||
MediaKeyboardAction.Backspace -> onEvent(MainScreenEvents.BackspacePressed)
|
||||
is MediaKeyboardAction.StickerSelected -> onEvent(MainScreenEvents.StickerSelected(action.sticker))
|
||||
is MediaKeyboardAction.GifSelected -> onEvent(MainScreenEvents.GifSelected(action.gif))
|
||||
// Nothing to remember the tab for, and no sticker packs to manage, view, or search.
|
||||
// Nothing to remember the tab for, and no sticker packs to manage, view, search, send or
|
||||
// remove.
|
||||
is MediaKeyboardAction.TabSelected,
|
||||
MediaKeyboardAction.StickerManagementClicked,
|
||||
MediaKeyboardAction.StickerSearchClicked,
|
||||
MediaKeyboardAction.GifSearchClicked,
|
||||
is MediaKeyboardAction.ViewStickerPackClicked -> Unit
|
||||
is MediaKeyboardAction.ViewStickerPackClicked,
|
||||
is MediaKeyboardAction.SendStickerPackClicked,
|
||||
is MediaKeyboardAction.RemoveStickerPackClicked -> Unit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user