feat: backend баннеров

This commit is contained in:
Jganenokk
2026-07-26 17:37:46 +07:00
parent ac951ea80a
commit b3f4418890
7 changed files with 640 additions and 0 deletions
+19
View File
@@ -70,6 +70,25 @@ class AnimojiModule {
return list.length <= 6 ? list : list.sublist(0, 6);
}
Animoji? cached(int id) => _byId[id];
Future<Animoji?> fetchById(int id) async {
final known = _byId[id];
if (known != null) return known;
final map = await _api.sendRequestMap(Opcode.assetsGetByIds, {
'type': 'ANIMOJI',
'ids': [id],
});
final list = map?['animojis'];
if (list is! List) return null;
for (final e in list) {
if (e is! Map) continue;
final animoji = Animoji.fromMap(e);
if (animoji != null) _byId[animoji.id] = animoji;
}
return _byId[id];
}
Future<void> ensureLoaded() {
return _loading ??= _load().catchError((Object e) {
_loading = null;