Compare commits
2 Commits
cbe81861a5
...
5e0ce8f098
Author | SHA1 | Date | |
---|---|---|---|
5e0ce8f098 | |||
9fc5989bd4 |
@ -85,4 +85,7 @@ class Sticker with _$Sticker {
|
||||
.toList(),
|
||||
suggests,
|
||||
);
|
||||
|
||||
/// True, if the sticker is backed by an image with MIME type image/*.
|
||||
bool get isImage => mediaType.startsWith('image/');
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ class AddContactBloc extends Bloc<AddContactEvent, AddContactState> {
|
||||
}
|
||||
}
|
||||
|
||||
assert(result.conversation != null, 'RequestedConversationEvent must contain a not null conversation');
|
||||
GetIt.I.get<ConversationBloc>().add(
|
||||
RequestedConversationEvent(
|
||||
result.conversation!.jid,
|
||||
|
@ -31,6 +31,8 @@ class StickersBloc extends Bloc<StickersEvent, StickersState> {
|
||||
final map = <StickerKey, Sticker>{};
|
||||
for (final pack in event.stickerPacks) {
|
||||
for (final sticker in pack.stickers) {
|
||||
if (!sticker.isImage) continue;
|
||||
|
||||
map[StickerKey(pack.id, sticker.hashKey)] = sticker;
|
||||
}
|
||||
}
|
||||
@ -92,6 +94,8 @@ class StickersBloc extends Bloc<StickersEvent, StickersState> {
|
||||
if (result is StickerPackImportSuccessEvent) {
|
||||
final sm = Map<StickerKey, Sticker>.from(state.stickerMap);
|
||||
for (final sticker in result.stickerPack.stickers) {
|
||||
if (!sticker.isImage) continue;
|
||||
|
||||
sm[StickerKey(result.stickerPack.id, sticker.hashKey)] = sticker;
|
||||
}
|
||||
emit(
|
||||
@ -128,6 +132,8 @@ class StickersBloc extends Bloc<StickersEvent, StickersState> {
|
||||
Future<void> _onStickerPackAdded(StickerPackAddedEvent event, Emitter<StickersState> emit) async {
|
||||
final sm = Map<StickerKey, Sticker>.from(state.stickerMap);
|
||||
for (final sticker in event.stickerPack.stickers) {
|
||||
if (!sticker.isImage) continue;
|
||||
|
||||
sm[StickerKey(event.stickerPack.id, sticker.hashKey)] = sticker;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user