message caching #326

Merged
sarah merged 6 commits from cache into trunk 2022-01-20 21:22:50 +00:00
Owner
  • message caching now caches all fetched messages, by id, localIndex, and contenthash where possible

needs:

- message caching now caches all fetched messages, by id, localIndex, and contenthash where possible needs: - https://git.openprivacy.ca/cwtch.im/libcwtch-go/pulls/64 - https://git.openprivacy.ca/cwtch.im/cwtch/pulls/424
dan added 3 commits 2022-01-20 14:28:56 +00:00
dan changed title from message caching to WIP message caching 2022-01-20 14:29:01 +00:00
dan added 1 commit 2022-01-20 18:05:18 +00:00
continuous-integration/drone/pr Build is passing Details
589bc4c36c
new lcg; cleanup
dan changed title from WIP message caching to message caching 2022-01-20 18:05:29 +00:00
Member
Drone Build Status: success https://build.openprivacy.ca/cwtch.im/cwtch-ui/489
sarah reviewed 2022-01-20 18:17:04 +00:00
sarah left a comment
Owner

formatting

formatting
@ -201,3 +207,1 @@
this.messageCache.insert(0, MessageCache(MessageMetadata(profileOnion, conversation, messageID, timestamp, senderHandle, senderImage, "", {}, false, false, isAuto), data));
this.totalMessages += 1;
}
void newMessage(int identifier, int messageID, DateTime timestamp, String senderHandle, String senderImage, bool isAuto, String data, String? contenthash, bool selectedConversation) {
Owner

why doesn't this notify listeners?

why doesn't this notify listeners?
dan marked this conversation as resolved
dan added 1 commit 2022-01-20 18:37:16 +00:00
continuous-integration/drone/pr Build is pending Details
889d398343
add notifyListen to newMessage in contact; format
sarah requested changes 2022-01-20 18:40:36 +00:00
@ -61,0 +64,4 @@
Future<Message> messageHandler(BuildContext context, String profileOnion, int conversationIdentifier,
{bool byIndex = false, int? index, bool byID = false, int? id, bool byHash = false, String? hash}) {
var malformedMetadata = MessageMetadata(profileOnion, conversationIdentifier, 0, DateTime.now(), "", "", "", <String, String>{}, false, true, false);
if (!byIndex && !byID && !byHash) {
Owner

Use an enum to have the compiler do this check

Use an enum to have the compiler do this check
dan marked this conversation as resolved
@ -61,0 +68,4 @@
EnvironmentConfig.debugLog("Error calling messageHandler: one of byIndex, byID, byHash must be set");
return Future.value(MalformedMessage(malformedMetadata));
}
if ((byID && id == null) || (byIndex && index == null) || (byHash && hash == null)) {
Owner

Use types to have the compiler enforce this coupling

Use types to have the compiler enforce this coupling
dan marked this conversation as resolved
dan added 1 commit 2022-01-20 20:58:20 +00:00
Member
Drone Build Status: success https://build.openprivacy.ca/cwtch.im/cwtch-ui/491
sarah approved these changes 2022-01-20 21:18:30 +00:00
sarah merged commit d0fecbd545 into trunk 2022-01-20 21:22:50 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cwtch.im/cwtch-ui#326
No description provided.