forked from cwtch.im/cwtch-ui
messagecache stub
This commit is contained in:
parent
b0f74ffb6d
commit
20bff8b713
|
@ -0,0 +1,26 @@
|
||||||
|
import 'dart:collection';
|
||||||
|
|
||||||
|
import 'package:cwtch/widgets/messagerow.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
int MinCacheSize = 20;
|
||||||
|
|
||||||
|
class MessageCache extends ChangeNotifier {
|
||||||
|
final String profile;
|
||||||
|
|
||||||
|
Queue<MessageRowState> cacheByIndex = Queue();
|
||||||
|
Map<int, MessageRowState> cacheById = Map();
|
||||||
|
|
||||||
|
MessageCache(this.profile) {}
|
||||||
|
|
||||||
|
// So we internall need to fetch by N (new libcwtch API)
|
||||||
|
// then double store by index and id to support both calls
|
||||||
|
// monitor activeConversation for unlimited growth and when
|
||||||
|
// change to not active convo, trigger a shrink
|
||||||
|
// bonus: dont prune cache by id messages refed in core list
|
||||||
|
|
||||||
|
GetMessageByIndex(conversationIdentifier, index);
|
||||||
|
|
||||||
|
GetMessageById(conversationIdentifier, index);
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue