forked from cwtch.im/cwtch-ui
new lcg; cleanup
This commit is contained in:
parent
793b6e2e1a
commit
589bc4c36c
|
@ -1 +1 @@
|
|||
2022-01-19-16-16-v1.5.4-11-g84d451f
|
||||
2022-01-20-12-53-v1.5.4-14-g6865ec1
|
|
@ -1 +1 @@
|
|||
2022-01-19-21-15-v1.5.4-11-g84d451f
|
||||
2022-01-20-17-53-v1.5.4-14-g6865ec1
|
|
@ -21,7 +21,6 @@ class ContactInfoState extends ChangeNotifier {
|
|||
late Map<String, GlobalKey<MessageRowState>> keys;
|
||||
int _newMarker = 0;
|
||||
DateTime _newMarkerClearAt = DateTime.now();
|
||||
//late List<MessageInfo?> messageCache;
|
||||
late MessageCache messageCache;
|
||||
|
||||
// todo: a nicer way to model contacts, groups and other "entities"
|
||||
|
@ -56,7 +55,6 @@ class ContactInfoState extends ChangeNotifier {
|
|||
this._lastMessageTime = lastMessageTime == null ? DateTime.fromMillisecondsSinceEpoch(0) : lastMessageTime;
|
||||
this._server = server;
|
||||
this._archived = archived;
|
||||
//this.messageCache = List.empty(growable: true);
|
||||
this.messageCache = new MessageCache();
|
||||
keys = Map<String, GlobalKey<MessageRowState>>();
|
||||
}
|
||||
|
@ -66,6 +64,7 @@ class ContactInfoState extends ChangeNotifier {
|
|||
String get savePeerHistory => this._savePeerHistory;
|
||||
|
||||
String? get acnCircuit => this._acnCircuit;
|
||||
|
||||
set acnCircuit(String? acnCircuit) {
|
||||
this._acnCircuit = acnCircuit;
|
||||
notifyListeners();
|
||||
|
@ -92,6 +91,7 @@ class ContactInfoState extends ChangeNotifier {
|
|||
}
|
||||
|
||||
bool get isGroup => this._isGroup;
|
||||
|
||||
set isGroup(bool newVal) {
|
||||
this._isGroup = newVal;
|
||||
notifyListeners();
|
||||
|
@ -112,12 +112,14 @@ class ContactInfoState extends ChangeNotifier {
|
|||
}
|
||||
|
||||
String get status => this._status;
|
||||
|
||||
set status(String newVal) {
|
||||
this._status = newVal;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
int get unreadMessages => this._unreadMessages;
|
||||
|
||||
set unreadMessages(int newVal) {
|
||||
// don't reset newMarker position when unreadMessages is being cleared
|
||||
if (newVal > 0) {
|
||||
|
@ -151,18 +153,21 @@ class ContactInfoState extends ChangeNotifier {
|
|||
}
|
||||
|
||||
int get totalMessages => this._totalMessages;
|
||||
|
||||
set totalMessages(int newVal) {
|
||||
this._totalMessages = newVal;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
String get imagePath => this._imagePath;
|
||||
|
||||
set imagePath(String newVal) {
|
||||
this._imagePath = newVal;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
DateTime get lastMessageTime => this._lastMessageTime;
|
||||
|
||||
set lastMessageTime(DateTime newVal) {
|
||||
this._lastMessageTime = newVal;
|
||||
notifyListeners();
|
||||
|
@ -217,11 +222,6 @@ class ContactInfoState extends ChangeNotifier {
|
|||
}
|
||||
}
|
||||
|
||||
void bumpMessageCache() {
|
||||
this.messageCache.bumpMessageCache();
|
||||
this.totalMessages += 1;
|
||||
}
|
||||
|
||||
void ackCache(int messageID) {
|
||||
this.messageCache.ackCache(messageID);
|
||||
notifyListeners();
|
||||
|
|
|
@ -51,11 +51,6 @@ class MessageCache {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO inserting nulls travel down list causing fails for all
|
||||
void bumpMessageCache() {
|
||||
this.cacheByIndex.insert(0, null);
|
||||
}
|
||||
|
||||
void ackCache(int messageID) {
|
||||
cache[messageID]?.metadata.ackd = true;
|
||||
}
|
||||
|
|
|
@ -227,9 +227,9 @@ class _MessageViewState extends State<MessageView> {
|
|||
Future.delayed(const Duration(milliseconds: 80), () {
|
||||
var profile = Provider.of<ContactInfoState>(context, listen: false).profileOnion;
|
||||
var identifier = Provider.of<ContactInfoState>(context, listen: false).identifier;
|
||||
//Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(Provider.of<ContactInfoState>(context, listen: false).identifier)?.bumpMessageCache();
|
||||
fetchAndCacheMessageInfo(context, profile, identifier, byIndex: true, index: 0);
|
||||
Provider.of<ContactInfoState>(context, listen: false).newMarker++;
|
||||
Provider.of<ContactInfoState>(context, listen: false).totalMessages += 1;
|
||||
// Resort the contact list...
|
||||
Provider.of<ProfileInfoState>(context, listen: false).contactList.updateLastMessageTime(Provider.of<ContactInfoState>(context, listen: false).identifier, DateTime.now());
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue