Commit Graph

43 Commits

Author SHA1 Message Date
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 153880cf4d Fixed a few bugs and continued work on fixing unit tests
Fixed a bug where notifications might not work for messages
Fixed a bug where auto-playing audio messages wouldn't update the states correctly
Fixed a bug where a user wouldn't be able to join an open group with blinding enabled
2022-06-21 17:43:27 +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 1c575e520d Merge remote-tracking branch 'upstream/voice-calls-2' into feature/session-id-blinding-part-2
# Conflicts:
#	Podfile.lock
#	Session.xcodeproj/project.pbxproj
#	Session/Conversations/ConversationVC+Interaction.swift
#	Session/Conversations/Views & Modals/JoinOpenGroupModal.swift
#	Session/Home/HomeVC.swift
#	Session/Open Groups/JoinOpenGroupVC.swift
#	Session/Utilities/BackgroundPoller.swift
#	SessionMessagingKit/Jobs/AttachmentUploadJob.swift
#	SessionMessagingKit/Open Groups/OpenGroupAPIV2.swift
#	SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift
#	SessionNotificationServiceExtension/NotificationServiceExtension.swift
2022-04-26 13:06:12 +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 93dbc2f63c Added more OpenGroupManager unit tests 2022-03-17 17:12:19 +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 65f14cf0a1 Added more unit tests
Removed an unused endpoint
Moved 'Dependencies' into the Utilities folder (also out from being nested within 'OpenGroupAPI' since it can be broader than that)
Finished adding unit tests for the OpenGroupAPI
2022-03-08 16:16:36 +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 81f563229f Renamed FileServerAPIV2 to FileServerAPI
Updated the direct file upload/download to use the non-base64 approaches as well
Updated the attachment 'serverId' value to be a string instead of a UInt64 (future-proofing)
Updated the OnionRequest V4 response handling to avoid converting the "response body" part to a string and processing that, instead just slice the byte array (ie. stopped it from being broken from multiple conversions)
Removed the base64-based file upload/download endpoints (no use including them when they are inefficient and we don't want to use them)
2022-03-04 16:17:03 +11:00
Morgan Pretty 1c474955de File upload working, further code cleanup
Got the updated file upload working
Removed the legacy 'room' header
Consolidated a number of types between SOGS, FileServer and general requests
Updated the OnionRequestAPI to deal with a Data payload (rather than encoding it to a string and then back to data)
2022-03-04 13:33:06 +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 6936f35f2a Fixed a few issues uncovered while testing and some cleanup
Fixed an incorrect optional in RoomPollInfo
Fixed an incorrect parameter name in the ClosedGroupRequestBody
Fixed a crash due to a change in the ContactUtilities
Cleaned up the duplicate code in the OnionRequestAPI, HTTP and SnodeAPI to all use 'Data' response types
Updated the SnodeAPI to casting types to Any (made it hard to catch breaking changes with HTTP and OnionRequestAPI)
2022-03-02 13:09:45 +11:00
Morgan Pretty bdf5b3bc1b Started resolving more TODOs and fixing up unit tests
Updated the Dependencies to lazily create their fallback instances (optimisation to avoid unnecessary initialisations)
Reworked the Atomic type again to have a more consistent behaviour across types
Fixed the build issues with the unit tests (haven't fixed broken tests yet)
2022-03-02 11:24:08 +11:00
Morgan Pretty 3a75639285 Fixed a few of issues in the last commit
Fixed a couple of build issues where I missed a couple of calls to removed functions
Fixed a EXC_BAD_ACCESS issue where the 'poll' function could be called from multiple threads (which accesses and mutates variables)
Cleaned up the MessageRequestResponse handling a little
2022-03-01 17:30:35 +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 1edd500dab Updated to the latest blinding behaviour
Added a couple more dependencies for unit testing injection
Updated the MessageSender to set the sender of the message to the appropriate blinded/unblinded key
Updated the OpenGroup Message to handle verification of both blinded and unblinded messages
Updated the MessageSender to use dependency injection for it's sendToOpenGroupDestination method
Updated the JSONDecoder to support getting dependencies (for signature verification)
Fixed tests broken by updating the signing logic
2022-02-21 10:01:53 +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
Morgan Pretty 63e6cdd9ec Renamed OpenGroupAPIV2 to OpenGroupAPI
Added the inbox endpoints
2022-02-15 16:30:11 +11:00
Niels Andriesse 34bbff1ab4 Implement OpenGroupAPIV2 2021-03-24 10:54:38 +11:00
Niels Andriesse dd0baf0d97 Unify contacts APIs 2021-03-01 09:36:18 +11:00
Niels Andriesse 54e902c848 Fix various warnings 2021-01-28 15:40:45 +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 451e629605 Fix open group profile picture bug
#314 without merge conflicts
2020-12-18 11:12:07 +11:00
Niels Andriesse efe8f1c8bb Clean 2020-12-07 16:00:21 +11:00
nielsandriesse d6c115bc2a Fix module linking issue 2020-12-02 16:25:16 +11:00
nielsandriesse a87bad6603 Fix open group link previews 2020-12-01 13:39:27 +11:00
Niels Andriesse d01e732515 Debug open group messaging 2020-11-30 16:10:58 +11:00
Niels Andriesse 2d8933901d Fix open group display name handling 2020-11-30 15:44:07 +11:00
nielsandriesse 5dfd4b1965 Restructure 2020-11-25 16:15:16 +11:00
nielsandriesse 178ab7e3e2 WIP 2020-11-24 20:09:23 +11:00
nielsandriesse 262c5ebe4a Fix incorrect tag 2020-11-13 08:47:14 +11:00
nielsandriesse b88bfd1da0 Configure SessionMessagingKit 2020-11-13 08:41:54 +11:00
nielsandriesse 1c0b32af3c Fix ECKeyPair usage 2020-11-12 10:41:45 +11:00
nielsandriesse 362e2e9c03 Update SessionMessagingKit for open groups 2020-11-09 11:53:07 +11:00
Renamed from SignalServiceKit/src/Loki/API/Open Groups/PublicChatAPI.swift (Browse further)