Commit Graph

40 Commits

Author SHA1 Message Date
Morgan Pretty 201c59fd2b Updated the logic for the background fetch timeout
Updated the logic for the background fetch timeout to happen in the AppDelegate and be based on a system property to avoid a few edge-cases
Removed the ID Blinding error handling 'e' suffix (as it's not actually part of the error)
2022-08-09 15:18:57 +10:00
Morgan Pretty 1224e539ea Reduced unneeded DB write operations and fixed a few minor UI bugs
Updated the database to better support the application getting suspended (0xdead10cc crash)
Updated the SOGS message handling to delete messages based on a new 'deleted' flag instead of 'data' being null
Updated the code to prevent the typing indicator from needing a DB write block as frequently
Updated the code to stop any pending jobs when entering the background (in an attempt to prevent the database suspension from causing issues)
Removed the duplicate 'Capabilities.Capability' type (updated 'Capability.Variant' to work in the same way)
Fixed a bug where a number of icons (inc. the "download document" icon) were the wrong colour in dark mode
Fixed a bug where the '@You' highlight could incorrectly have it's width reduced in some cases (had protection to prevent it being larger than the line, but that is a valid case)
Fixed a bug where the JobRunner was starting the background (which could lead to trying to access the database once it had been suspended)
Updated to the latest version of GRDB
Added some logic to the BackgroundPoller process to try and stop processing if the timeout is triggered (will catch some cases but others will end up logging a bunch of "Database is suspended" errors)
Added in some protection to prevent future deferral loops in the JobRunner
2022-08-05 17:10:01 +10:00
Morgan Pretty c022f7cda2 Added an exponential back-off to polling open groups when they fail to poll 2022-07-28 18:26:22 +10:00
Morgan Pretty ae4999c3a7 Fixed a couple of crashes and a couple of other bugs
Fixed a crash due to database re-entrancy
Fixed an issue where interacting with a push notification wouldn't open the conversation in some cases
Added code to prevent a user from being able to start a DM with a blinded id
Updated some open group polling logs to be clearer
2022-07-28 15:36:56 +10:00
Morgan Pretty aed1b73185 Fixed a few additional issues uncovered
Added a explicit "timeout" error to make debugging a little easier
Added code to prevent the AttachmentUploadJob from continuing to try to upload if it's associated interaction has been deleted
Updated the getDefaultRoomsIfNeeded to make an unauthenticated sequence all to get both capabilities and rooms (so we will know if the server is blinded and retrieve the room images using blinded auth)
Fixed a bug where the notification badge wouldn't get cleared when removing data from a device
Fixed a bug where adding an open group could start with an invalid 'infoUpdates' value resulting in invalid data getting retrieved
Fixed a bug where under certain circumstances the PagedDatabaseObserver was filtering out updates (noticeable when restoring a device, would happen if the currentCount of content was smaller than the pageSize)
2022-07-26 11:36:32 +10:00
Morgan Pretty 76f7e4e246 Fixed a number of bugs, added in logic to handle id blinding being enabled and migrated session SOGS IPs to domains
Added logic to handle the case when ID blinded gets switched on server-side and the app already has open groups with cached capabilities
Added logic to migrate users from using HTTP and IP-based session open groups to use the HTTPS domain name url instead
Fixed a bug with the PushNotificationAPI update registration response structure
Fixed some broken unit tests (and a bug which was introduced in an earlier optimisation)
Fixed a bug where trusting a contact (to download their messages) wouldn't trigger the message UI to update
Fixed a bug where tapping a push notification wasn't opening the associated thread when the app isn't running in the background
2022-06-28 17:53:03 +10:00
Morgan Pretty a998cadbb7 Fixed the broken unit tests
Fixed a few bugs uncovered by the unit tests
2022-06-22 14:27:34 +10:00
Morgan Pretty eeccfb47d5 Fixed all of the build errors from merge, migrated Call logic, started idBlinding migration and bug fixes
Fixed some broken file paths
Fixed a couple of bugs with closed groups
Fixed a few migration issues
Fixed a bug with the ProfilePictureView in open groups (was including the open parenthesis in the initials)
Migrated the Id Blinding changes to work with GRDB
Migrated the call logic to work with GRDB
Updated the code to work the with hard fork changes
2022-06-09 18:37:44 +10:00
Morgan Pretty dad264c239 Included a fix for duplicate open groups and added unit tests for it 2022-03-21 14:29:46 +11:00
Morgan Pretty b1684f6b23 More unit tests, fixed a few issues uncovered by testing
Updated the OpenGroupManager to support injecting the cache for better unit testing
Updated the MessageReceiver to support Dependencies being passed as a parameter for visible message and storage purposes
Added a debugDescription to the OpenGroup for more accurate unit testing
Fixed an issue where the poll function would include the inbox and outbox endpoints even when the server was not blinded
Fixed some test compilation time issues
Fixed a bug where the OpenGroupAPI Room was using 'description' as a parameter name (used by Swift for other purposes)
Fixed a bug where then OpenGroup was incorrectly using the system 'description'  property in one place
Renamed the parseV2OpenGroup to parseOpenGroup for consistency
2022-03-16 15:55:56 +11:00
Morgan Pretty f9c2655df4 Finalised the OpenGroupAPI and more tests
Fixed an issue where messages where signed incorrectly when blinding wasn't enabled on a SOGS
Fixed an issue where a single invalid message would result in all messages in that request being dropped
Updated the final legacy endpoint (ban and delete all messages)
Moved the OpenGroupManager poller values into the 'Cache' (so they are thread safe)
Started adding unit tests for the OpenGroupManager
Removed some redundant parameters from the 'Request' type
2022-03-15 15:19:23 +11:00
Morgan Pretty 3e0ccaea4c Merge branch 'dev' into feature/session-id-blinding-part-2
# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Utilities/MentionUtilities.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/OpenGroupPollerV2.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/Poller.swift
#	SignalUtilitiesKit/Messaging/Sending & Receiving/MessageSender+Convenience.swift
2022-03-09 09:49:23 +11:00
Morgan Pretty 17a9e510c5 Further work on unit tests (and a couple of bug fixes found when testing)
Removed a couple remaining TODOs
Added 'standardUserDefaults' to the 'Dependencies' type
Tweaked the OpenGroupAPI to only update the 'lastOpen' timestamp if it successfully polls
Refactored a couple of methods in the ConversationViewItem into swift so we can clean up the OpenGroupAPI more
Updated the OpenGroupAPI so it no longer has static variables for state (shifted to the OpenGroupManager and made them instance variables)
Fixed an encoding issue with the Capabilities.Capability
2022-03-07 17:43:30 +11:00
Morgan Pretty f9468219d9 Code cleanup and database transaction tweaks
Updated the OpenGroupManager to be a bit more thread safe
Updated the OpenGroupManager "isModOrAdmin" check to better support the various keys of the current user
Fixed some blinding code to use an existing transaction rather than create it's own ones
Removed the Legacy API calls, handling and types
2022-03-04 18:02:38 +11:00
Morgan Pretty 8ca00ca578 Fixed a number of bugs, resolved some TODOs and tested the outbox APIs
Updated the join open group method to retrieve the capabilities as part of the initial request
Updated the OpenGroupManager to require a transaction to be passed to the various 'handler' methods (allowing for everything to be processed within a single transaction)
Fixed a few issues where we weren't storing the timestamp for open group messages and DMs which could result in duplicate messages
Fixed an issue where we were setting the timestamp value for messages sent to an open group without converting it to be milliseconds to be consistent with other messages
Fixed an issue where the BatchRequestInfo could incorrectly flag it's response as failing to parse even though the type was optional
Fixed a bug where the open group would re-fetch all messages every other time
Fixed a bug where the long press context menu wouldn't appear after failing to delete a message
Fixed a bug where joining an open group would trigger the join behaviour and APIs twice
2022-03-03 17:46:35 +11:00
Morgan Pretty 8a7db1d48f Started adding logic for the outbox endpoint
Moved the BlindedIdMapping retrieval logic to ContactUtilities so it's reusable
Added the 'outbox' endpoints (need testing as they aren't deployed to test yet)
2022-03-02 14:44:56 +11:00
Morgan Pretty cc2a077a6c Started working on `MessageRequestResponse` handling for SOGS message requests
Pointing Curve25519 to use a fork that exposes an XEd25519 conversion method
Fixed an issue where I had broken all message sending due to the SnodeAPI casting Onion responses to `Any`
2022-02-25 17:48:09 +11:00
Morgan Pretty dbead5e3c8 Got the '/inbox' APIs and encryption/decryption/validation working
Added a few types to make the code more readable
Added the inbox request to the polling
Added a couple of properties to the TSContactThread to indicate the originating open group to support SOGS DMs
Added code to store the latest message id for an open group inbox
Added a bunch of documentation from the API docs into the OpenGroupAPI (and associated models)
Updated the OpenGroupAPI to match the latest docs
Fixed the incorrect structure of the SendDirectMessageRequest
Fixed an incorrect inbox endpoint path
Tweaked the batch response handling so it wouldn't fail to parse all responses if a single one failed
Renamed IdPrefix to SessionId.Prefix and cleaned up the type to be more readable & self-documenting
2022-02-25 11:59:29 +11:00
Morgan Pretty faa8918cd4 Replaced the remaining non-file legacy methods with their non-legacy equivalents
Updated the OpenGroup polling to run on a non-main thread
Updated the TSGroupModel to store moderatorIds as well as the adminIds (new endpoint is only going to give diffs)
Updated the BatchRequest to support json, base64 encoded strings and raw bytes for it's body
Replaced the 'lastMessageServerID' methods with 'OpenGroupSequenceNumber' methods (since we have swapped the property over)
Added an alert when banning fails (previously it would fail silently)
Fixed a bug where sent blinded messages were appearing as incoming messages
Fixed a bug where the OpenGroup infoUpdates wasn't getting decoded correctly
Fixed an issue where the ConversationVC wouldn't become the first responder again after the ban alerts disappeared
Fixed an issue where I'd incorrectly used the message 'seqNo' in place of the message server id
Fixed an issue where open group messages were setting their `sentTimestamp` to seconds instead of milliseconds for incoming messages
2022-02-24 10:39:22 +11:00
Morgan Pretty ef09d4d5aa Additional encryption work on id blinding
Got the updated blinding logic working (at least when authenticating a request - still need to deal with message signing and verification)
Storing the server capabilities in the database now so we can correctly blind requests based on them
Renamed the remaining 'v2' functions and classes to just be 'OpenGroup' since there isn't a 'V2' anymore
Cleaned up a few TODOs and functions
2022-02-17 18:33:23 +11:00
Morgan Pretty b655882cbd Started resolving TODOs
Added some new properties to the OpenGroupV2
Moved a number of methods and variables from OpenGroupAPI to OpenGroupManager (anything doing actual logic)
Moved the message signing into the OpenGroupAPI (since that's the only place it happens)
Renamed remaining old model classes to start with 'Legacy' to make clean up easier
Updated the OpenGroupAPI poll method to use the same logic as it previously did to determine if it should retrieve recent messages or messages since the last one
2022-02-16 10:31:08 +11:00
Morgan Pretty 8cc9caa0fd Renamed the OpenGroupPollerV2 and OpenGroupManagerV2 2022-02-15 16:44:10 +11:00
Niels Andriesse d742fc1548 Delete V1 OGS & file server 2021-05-04 15:46:48 +10:00
Niels Andriesse 82690259b2 Clean protobuf 2021-03-02 13:12:24 +11:00
Niels Andriesse dd0baf0d97 Unify contacts APIs 2021-03-01 09:36:18 +11:00
nielsandriesse 268971af9a Update protobuf 2021-02-24 13:20:50 +11:00
nielsandriesse 5d74bf1cca Fix promise deallocations 2021-02-24 11:12:57 +11:00
Niels Andriesse afd7a5a3dc Fix open group message syncing 2021-01-25 16:48:14 +11:00
Niels Andriesse 18c646987a Implement banning 2021-01-21 14:49:50 +11:00
Niels Andriesse 3e5baca72d Fix open group message deletion 2021-01-21 11:27:52 +11:00
Niels Andriesse efe8f1c8bb Clean 2020-12-07 16:00:21 +11:00
Niels Andriesse eafff041df Debug open group background polling 2020-12-07 11:45:56 +11:00
Niels Andriesse 438bbccdfa Fix background polling 2020-12-07 11:21:24 +11:00
nielsandriesse e8661cf4d7 Debug 2020-12-01 15:44:33 +11:00
nielsandriesse a87bad6603 Fix open group link previews 2020-12-01 13:39:27 +11:00
nielsandriesse 5f2ec37db7 Fix message duplication bug 2020-12-01 11:40:37 +11:00
nielsandriesse b49e50ff19 Clean up OpenGroupPoller 2020-12-01 09:43:49 +11:00
Niels Andriesse 8564c650a5 Parse open group attachments 2020-11-30 12:00:26 +11:00
Niels Andriesse b621bdc69a Partially fix open groups 2020-11-30 11:00:28 +11:00
nielsandriesse 5dfd4b1965 Restructure 2020-11-25 16:15:16 +11:00
Renamed from SignalUtilitiesKit/Messaging/Sending & Receiving/OpenGroupPoller.swift (Browse further)