Commit Graph

215 Commits

Author SHA1 Message Date
Morgan Pretty 5033738994 Fixed a few issues caused by the PromiseKit refactor
Started cleaning up the TODOs
Fixed a couple of merge conflict issues
Fixed a bug with the state of attachments which failed to download

# Conflicts:
#	SessionMessagingKit/Database/Models/Attachment.swift
2022-12-07 15:59:17 +11:00
Morgan Pretty 6970ff22cc Refactored the remaining references to PromiseKit
# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Media Viewing & Editing/PhotoCapture.swift
#	SessionMessagingKit/Jobs/Types/GarbageCollectionJob.swift
#	SessionMessagingKit/Sending & Receiving/MessageSender+Convenience.swift
#	SessionMessagingKit/Utilities/Promise+Utilities.swift
#	SessionShareExtension/ShareVC.swift
#	SessionShareExtension/ThreadPickerVC.swift
#	SessionSnodeKit/OnionRequestAPI+Encryption.swift
#	SessionSnodeKit/OnionRequestAPI.swift
#	SessionUtilitiesKit/Database/Storage.swift
#	SessionUtilitiesKit/Networking/HTTP.swift
2022-12-07 15:58:53 +11:00
Morgan Pretty 8b37002d89 Removed some unneeded imports
# Conflicts:
#	SessionMessagingKit/Jobs/Types/AttachmentUploadJob.swift
#	SessionMessagingKit/Jobs/Types/MessageSendJob.swift
#	SessionShareExtension/SAEScreenLockViewController.swift
#	SessionSnodeKit/Models/SnodeBatchRequest.swift
2022-12-07 15:54:56 +11:00
Morgan Pretty 8ac6b25ced Further refactoring work
Refactored usages and removed AFNetworking
Updated the media screens to use Combine

# Conflicts:
#	Session/Closed Groups/GroupMembersViewModel.swift
#	Session/Media Viewing & Editing/GIFs/GifPickerCell.swift
#	Session/Media Viewing & Editing/GIFs/GiphyAPI.swift
#	Session/Media Viewing & Editing/PhotoCapture.swift
2022-12-07 15:54:17 +11:00
Morgan Pretty c9fdee9f24 Work on the PromiseKit refactor
# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Conversations/ConversationVC+Interaction.swift
#	Session/Home/Message Requests/MessageRequestsViewModel.swift
#	Session/Notifications/AppNotifications.swift
#	Session/Notifications/PushRegistrationManager.swift
#	Session/Notifications/SyncPushTokensJob.swift
#	Session/Notifications/UserNotificationsAdaptee.swift
#	Session/Settings/BlockedContactsViewModel.swift
#	Session/Settings/NukeDataModal.swift
#	Session/Settings/SettingsViewModel.swift
#	Session/Utilities/BackgroundPoller.swift
#	SessionMessagingKit/Database/Models/ClosedGroup.swift
#	SessionMessagingKit/File Server/FileServerAPI.swift
#	SessionMessagingKit/Open Groups/OpenGroupAPI.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+ClosedGroups.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+UnsendRequests.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageSender+ClosedGroups.swift
#	SessionMessagingKit/Sending & Receiving/MessageSender+Convenience.swift
#	SessionMessagingKit/Sending & Receiving/MessageSender.swift
#	SessionMessagingKit/Sending & Receiving/Notifications/PushNotificationAPI.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/CurrentUserPoller.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/Poller.swift
#	SessionMessagingKit/Utilities/ProfileManager.swift
#	SessionSnodeKit/Networking/SnodeAPI.swift
#	SessionSnodeKit/OnionRequestAPI.swift
#	SessionUtilitiesKit/Networking/HTTP.swift
2022-12-07 15:50:58 +11:00
Morgan Pretty f5933bdf75 Updated to the latest version of the shared util library
# Conflicts:
#	Session/Onboarding/Onboarding.swift
2022-12-07 15:08:04 +11:00
Morgan Pretty 1345e89809 Further config util logic
Removed the usage of the OWSAES256Key (using CryptoKit and raw data instead)
Removed the pre-compiled headers to speed up builds with minor changes (explicit imports instead)

# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	SessionMessagingKit/Database/Models/ClosedGroup.swift
#	SessionMessagingKit/Protos/Generated/SNProto.swift
#	SessionMessagingKit/Protos/Generated/SessionProtos.pb.swift
#	SessionMessagingKit/Protos/SessionProtos.proto
#	SessionMessagingKit/Sending & Receiving/MessageSender.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/CurrentUserPoller.swift
#	SessionMessagingKit/Utilities/ProfileManager.swift
#	SessionSnodeKit/Models/DeleteAllMessagesRequest.swift
#	SessionSnodeKit/Models/GetMessagesRequest.swift
#	SessionSnodeKit/Models/SendMessageRequest.swift
#	SessionSnodeKit/Types/SnodeAPINamespace.swift
2022-12-07 15:06:15 +11:00
Morgan Pretty edf3bde573 Started working on the integration
# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	SessionMessagingKit/Configuration.swift
#	SessionMessagingKit/Database/Migrations/_012_AddClosedGroupInfo.swift
#	SessionMessagingKit/Database/Migrations/_013_AutoDownloadAttachments.swift
#	SessionMessagingKit/Open Groups/Models/SOGSBatchRequest.swift
#	SessionSnodeKit/OnionRequestAPI.swift
#	SessionSnodeKit/SSKDependencies.swift
#	SessionTests/Conversations/Settings/ThreadDisappearingMessagesViewModelSpec.swift
#	SessionTests/Conversations/Settings/ThreadSettingsViewModelSpec.swift
#	SessionTests/Settings/NotificationContentViewModelSpec.swift
#	SessionUtilitiesKit/Networking/BatchResponse.swift
2022-12-07 14:40:03 +11:00
Morgan Pretty b834dddbe4 Fixed another minor bug, added logging and defensive coding
Fixed a bug where you couldn't set animated avatars
Added some defensive coding to prevent the JobRunner queues from adding or starting jobs that don't have id's set
Tweaked the code to be a little more explicit when inserting jobs before other jobs
2022-11-30 11:57:13 +11:00
Morgan Pretty f4d4e7d810 Fixed an issue with blinding being switched on
Fixed an issue where a user that was part of an open group before blinding was enabled wouldn't be able to access the group once blinding was switched on
Updated the code to better support errors sent from SOGS as bencoded data
2022-11-07 10:18:59 +11:00
Morgan Pretty 89df1261e3 Added a method to allow safer database inserts
Fixed an issue where the app settings were updating immediately making them seem to
Updated GRDB to version 6.1 and SQLCipher to 4.5.2
Added a method which allows for inserting into the database while omitting columns which exist in the object but not in the database (so allow for old migrations to run with less issues)
Updated all the migrations to use the migration safe insert method
Removed some ObjC support extension functions
2022-10-21 17:32:51 +11:00
Morgan Pretty d8fd3b35b4 Theming tweaks and bug fixes
Made a tweak to prevent some odd looking keyboard transitions when going to conversation settings
Updated the PagedDatabaseObserver to not call 'onChangeUnsorted' on the main thread (now we can generate the changeset on the background thread so there is less main thread work)
Fixed an issue where the most recently received message from the swarm could be removed from the swarm yet the app would still poll for it, resulting in the swarm always returning the oldest possible messages until the user sends a new one-to-one message
Fixed an issue where the initial scroll offset could be incorrect due to certain message types
Fixed an issue where the title view inside a conversation could jump when pushing to the conversation settings screen
Refactored a couple of ObjC functions to Swift as they were crashing (due to memory allocation?) hopefully this will fix it
Tweaked some DispatchQueue priorities to ensure PagedDatabaseObserver loading is prioritised
Updated buttons to use a standard convention for highlighted states
Updated the new conversation button to follow the new highlighted state convention
2022-10-14 17:09:38 +11:00
Morgan Pretty 2bc9334244 Fixed a db thread issue introduced in the last commit 2022-09-26 11:37:05 +10:00
Morgan Pretty 6099bd94d8 Updated the rest of the SnodeAPI static variables to be atomic to prevent threading crashes 2022-09-26 11:28:29 +10:00
Morgan Pretty fc860e3957 Added fixes and defensive coding for a number of crashes
Fixed a crash which could occur due to multithreaded dependency access
Fixed a crash which could occur if the 'keyWindow' wasn't set on the LandingVC in time since we were force-unwrapping
Fixed a crash which could occur due to multithreaded swarm cache access
Fixed the broken unit tests
2022-08-30 09:45:40 +10:00
ryanzhao 9c9f1e3cd3 tweak: encode and sign reaction endpoints with raw emoji 2022-08-12 10:52:35 +10:00
Ryan Zhao 91afad99d5 Merge branch 'database-refactor' into emoji-reacts 2022-08-08 10:16:07 +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
Ryan Zhao a66948812e feat: open group emoji reacts endpoints work 2022-08-01 15:45:59 +10:00
Morgan Pretty 44e7a2dfa4 Added defensive coding to prevent some crashes
Added some defensive coding to prevent path selection from being able to crash due to being empty
Fixed a crash where the MediaDetailViewController could access UI on a non-main thread
Updated the BackgroundPoller to no longer retry the users or closed group swarms and to "cancel" and return immediately if we hit 25 seconds of run time (OS will kill the process if we hit 30 seconds)
2022-07-18 17:40:32 +10:00
Morgan Pretty 3c07a2d044 Added linting for the localized strings, updated the quote & mention behaviour for the current user
Added a script and build step to error if we have localised a string in code bug don't have an entry in the localisable files
Added the logic and UI to replace the current users public key (or blinded key) with 'You' in mentions and quotes
Cleaned up some duplicate & missing localised strings
Fixed a bug where new closed groups weren't getting setup locally correctly
Updated the id truncating behaviour to always truncate from the middle
2022-07-15 18:15:28 +10:00
Morgan Pretty 5b6be3912d Fixed an edge-case crash, a couple of minor bugs and made future-proofing tweaks
Fixed a bit of the OnionRequest error handling to better send through server error messages for debugging
Fixed a bug where the initial offset could be negative if the number of messages was less than the page size resulting in a crash
Fixed a crash due to a code path which was thought to be impossible exiting but is actually possible (so just erroring)
Added the 'expire' SnodeAPI endpoint
Removed the 'openGroupServerTimestamp' property (was unused and just added confusion)
Updated the logic to always handle the 'fileId' for uploads/downloads as a string instead of casting it to an Int64
Updated the OpenGroup room parsing to support either Int or String values for image ids
2022-07-12 17:43:52 +10:00
Morgan Pretty 4afddd6fbb Fixed a number of reported bugs, some cleanup, added animated profile support
Added support for animated profile images (no ability to crop/resize)
Updated the message trimming to only remove messages if the open group has 2000 messages or more
Updated the message trimming setting to default to be on
Updated the ContextMenu to fade out the snapshot as well (looked buggy if the device had even minor lag)
Updated the ProfileManager to delete and re-download invalid avatar images (and updated the conversation screen to reload when avatars complete downloading)
Updated the message request notification logic so it will show notifications when receiving a new message request as long as the user has read all the old ones (previously the user had to accept/reject all the old ones)
Fixed a bug where the "trim open group messages" toggle was accessing UI off the main thread
Fixed a bug where the "Chats" settings screen had a close button instead of a back button
Fixed a bug where the 'viewsToMove' for the reply UI was inconsistent in some places
Fixed an issue where the ProfileManager was doing all of it's validation (and writing to disk) within the database write closure which would block database writes unnecessarily
Fixed a bug where a message request wouldn't be identified as such just because it wasn't visible in the conversations list
Fixed a bug where opening a message request notification would result in the message request being in the wrong state (also wouldn't insert the 'MessageRequestsViewController' into the hierarchy)
Fixed a bug where the avatar image wouldn't appear beside incoming closed group message in some situations cases
Removed an error log that was essentially just spam
Remove the logic to delete old profile images when calling save on a Profile (wouldn't get called if the row was modified directly and duplicates GarbageCollection logic)
Remove the logic to send a notification when calling save on a Profile (wouldn't get called if the row was modified directly)
Tweaked the message trimming description to be more accurate
Cleaned up some duplicate logic used to determine if a notification should be shown
Cleaned up some onion request logic (was passing the version info in some cases when not needed)
Moved the push notification notify API call into the PushNotificationAPI class for consistency
2022-07-08 17:53:48 +10:00
Morgan Pretty 6b9a19c761 Fixed a few more bugs and made a couple of optimisations to the GarbageCollectionJob
Added an index on Quote.authorId and added a garbage collection job to remove orphaned Profile entries
Added a few more indexes to improve the GarbageCollectionJob performance
Added some debug code to force a re-migration on next launch if the DB is invalid (only affects testers so code should be removed)
Fixed an issue where the GetSnodePool job wasn't properly blocking
Fixed an issue where a user could send the same message multiple times if they clicked the send button quickly enough
Fixed an issue where profiles might not have been getting created correctly for ClosedGroup members which have no threads/interactions
2022-07-05 16:47:12 +10:00
Morgan Pretty 34fea96db3 Fixed a bunch more bugs around push notifications and avatars
Added code to prevent the garbage collection job from auto-running more often than once every 23 hours
Fixed a bug where if the first avatar you try to add is your own, it could fail due to the folder not getting created
Fixed a bug where updating your profile would store and send an invalid profile picture url against your profile
Fixed an issue where the closed group icon wouldn't appear as the double icon when it couldn't retrieve a second profile
Fixed a bug where the device might not correctly register for push notifications in some cases
Fixed a bug where interacting with a notification when the app is in the background (but not closed) wasn't doing anything
Fixed a bug where the SyncPushTokensJob wouldn't re-run correctly in some cases if the user was already registered
Updated the profile avatar downloading logic to only download avatars if they have been updated
Updated the migration and OpenGroupManager to force Session-run open groups to always use the OpenGroupAPI.defaultServer value
2022-07-04 17:36:48 +10:00
Morgan Pretty 8cf2a57fcc Renamed GRDBStorage to Storage (no use having the prefix anymore since the old DB is deprecated) 2022-07-01 13:08:45 +10:00
Morgan Pretty 20dc74bc96 Added paging to the Home/MessageRequests screens and fix a bunch of bugs
Added a cache to the Identicon to prevent unneeded image generation
Replaced some 'withTint' calls to use the standard 'withRenderingMode' instead
Fixed a bug where the background would remain when swiping to reply
Fixed a crash which could occur with String-based settings
Fixed an issue where all messages in a thread wouldn't get marked as read when opening the thread (ie. existing behaviour)
Fixed a bug where going to the all media screen from a specific
Fixed a bug where the 'areCallsEnabled' preference wasn't getting migrated
Fixed a bug where you couldn't join any of the default open groups
Fixed a bug where it was polling for the invalid placeholder default open group
Fixed a few threading issues related to PromiseKit defaulting to run on the main thread
Updated and number of processes to run on "default" priority queues intead of "userInitiated" ones (since the docs suggest those are blocking)
Optimised the PagedDatabaseObserver to do a much more efficient count query
Updated the PagedDatabaseObserver to allow for triggering content updates when data changes outside of the paged or associated tables changes
Updated the HomeVC and MessageRequestsViewController to use paged queries
Made some optimisations to prevent unneeded database changes
2022-06-24 18:29:45 +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 428cc95ec2 Started working on fixing the broken unit tests
Updated the GRDB storage to support custom writer injection
2022-06-16 14:30:14 +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 290bce5ce0 Merge branch 'feature/session-id-blinding-part-2' into feature/database-refactor
# Conflicts:
#	Podfile
#	Podfile.lock
#	Session.xcodeproj/project.pbxproj
#	Session/Closed Groups/EditClosedGroupVC.swift
#	Session/Closed Groups/NewClosedGroupVC.swift
#	Session/Conversations/Context Menu/ContextMenuVC+Action.swift
#	Session/Conversations/Context Menu/ContextMenuVC.swift
#	Session/Conversations/ConversationMessageMapping.swift
#	Session/Conversations/ConversationSearch.swift
#	Session/Conversations/ConversationVC+Interaction.swift
#	Session/Conversations/ConversationVC.swift
#	Session/Conversations/ConversationViewItem.h
#	Session/Conversations/ConversationViewItem.m
#	Session/Conversations/ConversationViewModel.m
#	Session/Conversations/Input View/InputView.swift
#	Session/Conversations/Input View/MentionSelectionView.swift
#	Session/Conversations/LongTextViewController.swift
#	Session/Conversations/Message Cells/Content Views/LinkPreviewView.swift
#	Session/Conversations/Message Cells/MessageCell.swift
#	Session/Conversations/Message Cells/VisibleMessageCell.swift
#	Session/Conversations/Settings/OWSConversationSettingsViewController.m
#	Session/Conversations/Views & Modals/ConversationTitleView.swift
#	Session/Conversations/Views & Modals/DownloadAttachmentModal.swift
#	Session/Conversations/Views & Modals/JoinOpenGroupModal.swift
#	Session/Conversations/Views & Modals/LinkPreviewModal.swift
#	Session/Conversations/Views & Modals/MessagesTableView.swift
#	Session/Conversations/Views & Modals/URLModal.swift
#	Session/Home/GlobalSearch/GlobalSearchViewController.swift
#	Session/Home/HomeVC.swift
#	Session/Home/Message Requests/MessageRequestsViewController.swift
#	Session/Media Viewing & Editing/MediaDetailViewController.m
#	Session/Media Viewing & Editing/MediaPageViewController.swift
#	Session/Meta/AppDelegate.m
#	Session/Meta/AppDelegate.swift
#	Session/Meta/AppEnvironment.swift
#	Session/Meta/Signal-Bridging-Header.h
#	Session/Meta/Translations/en.lproj/Localizable.strings
#	Session/Meta/Translations/hi.lproj/Localizable.strings
#	Session/Meta/Translations/si.lproj/Localizable.strings
#	Session/Meta/Translations/zh-Hant.lproj/Localizable.strings
#	Session/Notifications/AppNotifications.swift
#	Session/Open Groups/JoinOpenGroupVC.swift
#	Session/Settings/NukeDataModal.swift
#	Session/Settings/SeedModal.swift
#	Session/Settings/SettingsVC.swift
#	Session/Settings/ShareLogsModal.swift
#	Session/Shared/ConversationCell.swift
#	Session/Shared/UserSelectionVC.swift
#	Session/Utilities/BackgroundPoller.swift
#	Session/Utilities/MentionUtilities.swift
#	Session/Utilities/MockDataGenerator.swift
#	SessionMessagingKit/Database/OWSPrimaryStorage.m
#	SessionMessagingKit/Database/SSKPreferences.swift
#	SessionMessagingKit/Database/Storage+Contacts.swift
#	SessionMessagingKit/Database/Storage+Jobs.swift
#	SessionMessagingKit/Database/Storage+Messaging.swift
#	SessionMessagingKit/Database/Storage+OpenGroups.swift
#	SessionMessagingKit/Database/TSDatabaseView.m
#	SessionMessagingKit/File Server/FileServerAPIV2.swift
#	SessionMessagingKit/Jobs/AttachmentDownloadJob.swift
#	SessionMessagingKit/Jobs/AttachmentUploadJob.swift
#	SessionMessagingKit/Jobs/JobQueue.swift
#	SessionMessagingKit/Jobs/MessageReceiveJob.swift
#	SessionMessagingKit/Jobs/MessageSendJob.swift
#	SessionMessagingKit/Jobs/NotifyPNServerJob.swift
#	SessionMessagingKit/Messages/Control Messages/ClosedGroupControlMessage.swift
#	SessionMessagingKit/Messages/Control Messages/ConfigurationMessage+Convenience.swift
#	SessionMessagingKit/Messages/Message+Destination.swift
#	SessionMessagingKit/Messages/Signal/TSIncomingMessage.h
#	SessionMessagingKit/Messages/Signal/TSIncomingMessage.m
#	SessionMessagingKit/Messages/Signal/TSInfoMessage.h
#	SessionMessagingKit/Messages/Signal/TSInfoMessage.m
#	SessionMessagingKit/Messages/Signal/TSInteraction.h
#	SessionMessagingKit/Messages/Signal/TSInteraction.m
#	SessionMessagingKit/Messages/Signal/TSMessage.h
#	SessionMessagingKit/Messages/Signal/TSMessage.m
#	SessionMessagingKit/Open Groups/OpenGroupAPIV2+ObjC.swift
#	SessionMessagingKit/Open Groups/OpenGroupAPIV2.swift
#	SessionMessagingKit/Open Groups/OpenGroupManagerV2.swift
#	SessionMessagingKit/Open Groups/OpenGroupMessageV2.swift
#	SessionMessagingKit/Sending & Receiving/Mentions/MentionsManager.swift
#	SessionMessagingKit/Sending & Receiving/MessageReceiver+Decryption.swift
#	SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift
#	SessionMessagingKit/Sending & Receiving/MessageReceiver.swift
#	SessionMessagingKit/Sending & Receiving/MessageSender+ClosedGroups.swift
#	SessionMessagingKit/Sending & Receiving/MessageSender+Encryption.swift
#	SessionMessagingKit/Sending & Receiving/MessageSender.swift
#	SessionMessagingKit/Sending & Receiving/Notifications/NotificationsProtocol.h
#	SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/OpenGroupPollerV2.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/Poller.swift
#	SessionMessagingKit/Storage.swift
#	SessionMessagingKit/Threads/Notification+Thread.swift
#	SessionMessagingKit/Threads/TSContactThread.h
#	SessionMessagingKit/Threads/TSContactThread.m
#	SessionMessagingKit/Threads/TSGroupModel.h
#	SessionMessagingKit/Threads/TSGroupModel.m
#	SessionMessagingKit/Threads/TSGroupThread.m
#	SessionMessagingKit/Utilities/General.swift
#	SessionNotificationServiceExtension/NSENotificationPresenter.swift
#	SessionNotificationServiceExtension/NotificationServiceExtension.swift
#	SessionSnodeKit/OnionRequestAPI+Encryption.swift
#	SessionSnodeKit/OnionRequestAPI.swift
#	SessionSnodeKit/SnodeAPI.swift
#	SessionSnodeKit/SnodeMessage.swift
#	SessionSnodeKit/Storage+SnodeAPI.swift
#	SessionSnodeKit/Storage.swift
#	SessionUtilitiesKit/General/Array+Utilities.swift
#	SessionUtilitiesKit/General/Dictionary+Utilities.swift
#	SessionUtilitiesKit/General/SNUserDefaults.swift
#	SessionUtilitiesKit/General/Set+Utilities.swift
#	SessionUtilitiesKit/Meta/SessionUtilitiesKit.h
#	SessionUtilitiesKit/Utilities/Optional+Utilities.swift
#	SessionUtilitiesKit/Utilities/Sodium+Conversion.swift
#	SignalUtilitiesKit/Configuration.swift
#	SignalUtilitiesKit/Database/Migrations/OpenGroupServerIdLookupMigration.swift
#	SignalUtilitiesKit/Messaging/FullTextSearcher.swift
#	SignalUtilitiesKit/Messaging/Sending & Receiving/MessageSender+Convenience.swift
#	SignalUtilitiesKit/Profile Pictures/Identicon+ObjC.swift
#	SignalUtilitiesKit/To Do/OWSProfileManager.m
#	SignalUtilitiesKit/Utilities/NoopNotificationsManager.swift
#	SignalUtilitiesKit/Utilities/UIView+OWS.swift
2022-06-08 14:29:51 +10:00
Morgan Pretty af073657a2 Cleaned up received message handling and a few bugs with duplicate message handling
Updated the YDB to GRDB migrations to include some progress when importing swarms & interactions (ie. the slow parts we can't properly show progress for)
Changed the MessageReceiveJob into a MessageHandlingJob (when receiving a message we now parse and store everything immediately to avoid a number of weird edge-cases)
Fixed a bug where the Poller would drop a Snode when returning from the background because it's last request would generally time out
Fixed a few bugs with invalid attachments
Added the ability to retry downloading a failed attachment
Added back the search results limit
2022-06-03 15:47:16 +10:00
Morgan Pretty 07d1d8acee Merge branch 'dev' into feature/session-id-blinding-part-2
# Conflicts:
#	Podfile
#	Podfile.lock
#	Session/Calls/Views & Modals/CallVideoView.swift
#	Session/Utilities/BackgroundPoller.swift
#	SessionSnodeKit/SnodeAPI.swift
2022-06-02 15:41:28 +10:00
Morgan Pretty 9216506847 Merge branch 'dev' into feature/session-id-blinding-part-2
# Conflicts:
#	Session/Calls/Views & Modals/CallVideoView.swift
#	Session/Meta/Translations/de.lproj/Localizable.strings
#	Session/Meta/Translations/es.lproj/Localizable.strings
#	Session/Meta/Translations/fi.lproj/Localizable.strings
#	Session/Meta/Translations/fr.lproj/Localizable.strings
#	Session/Meta/Translations/hr.lproj/Localizable.strings
#	Session/Meta/Translations/it.lproj/Localizable.strings
#	Session/Meta/Translations/ja.lproj/Localizable.strings
#	Session/Meta/Translations/nl.lproj/Localizable.strings
#	Session/Meta/Translations/pl.lproj/Localizable.strings
#	Session/Meta/Translations/pt_BR.lproj/Localizable.strings
#	Session/Meta/Translations/ru.lproj/Localizable.strings
#	Session/Meta/Translations/si.lproj/Localizable.strings
#	Session/Meta/Translations/sk.lproj/Localizable.strings
#	Session/Meta/Translations/zh-Hant.lproj/Localizable.strings
#	Session/Meta/Translations/zh_CN.lproj/Localizable.strings
#	Session/Utilities/BackgroundPoller.swift
#	SessionSnodeKit/OnionRequestAPI.swift
#	SessionSnodeKit/SnodeAPI.swift
2022-06-02 14:41:08 +10:00
Morgan Pretty 59696f7d2c Removed all the old Storage classes and YapDB extensions
Removed the AppUpdateNag code (unused)
Removed the Mantle dependency
2022-06-01 17:41:20 +10:00
Morgan Pretty 18d833f152 Optimised the home screen query (~50% speed improvement)
Updated to the latest version of GRDB
Renamed some variables for clarity
Updated the "seed viewed" banner on the HomeVC to be driven by a database setting to be consistent with other UI changes
2022-06-01 16:50:21 +10:00
Morgan Pretty 8ff542405c Finished of the Conversation screen and JobQueue concurrency
Updated the migrations to indicate progress (Potential to base progress for the "processing" sections on the file size of the legacy database)
Updated the JobRunner to properly support concurrent queues for sending/receiving (other queues are still serial)
Added the typing indicator logic into the ConversationVC
Put code into SUKLegacy for connecting to the YDB database
Fixed a couple of minor UI bugs with the GalleryRailView
Updated the media gallery selection screen to use the appropriate system theme colouring (was painful to randomly swap from dark mode to like for one screen...)
Added an alert for when the database migration fails
Deleted the legacy migrations (manually applying any unapplied changes as part of the YDB to GRDB migration process)
2022-05-31 17:41:02 +10:00
Morgan Pretty 26c7a5022a Added a simple migration progress indicator and animation (need timing tweaks)
Cleaned up the creation of the GRDBStorage instance
Fixed an issue where the launch screen wasn't setting it's background colour based on the system setting
Renamed the GRDBStorageError to StorageError (in preparation of legacy 'Storage' relocation)
Consolidated the two Environment classes (in Swift)
Refactored the AppSetup class to Swift
2022-05-30 13:04:26 +10:00
Morgan Pretty 3514ed4f50 Updated the JobRunner to have multiple job queues (needs more testing)
Added a backoff to the Poller retry
Updated the "blocking" behaviour of the JobRunner
Tweaked the Job dependency handling to better handle orphaned dependencies
Fixed an issue where the Conversation screen wasn't observing database changes
2022-05-28 17:25:38 +10:00
Ryan Zhao 987db2f7ab fix an edge case which may cause old messages coming back 2022-05-26 13:43:44 +10:00
ryanzhao b54de30d5c potentially fix path rebuilding issue 2022-05-25 11:04:54 +10:00
Morgan Pretty c500d4c6ca Fixed a few bugs, resolved a number of TODOs and deleted more unused code
Fixed a couple of bugs with search term highlighting (updated the logic to make the highlighted content follow similar logic to what terms would have actually matched)
Fixed a bug where info messages in search results weren't rendering correctly
Shifted some duplicate query code for global search into variables
Fixed a small bug where sending attachments could incorrectly result in the mentions UI being visible
Fixed a bug where quote content was appearing incorrectly
Consolidated the ShareExtension Item and the ConversationCell.ViewModel into one type (with a more-limited query) to remove duplicate code
Added back a missing asset (deleted a long time ago)
2022-05-23 17:16:14 +10:00
Morgan Pretty 9ada8b84e0 Removed a bunch of legacy code
Renamed the 'Legacy' classes to have their library prefix (avoid confusion)
Removed the legacy Objective C Thread code (pulled only the NSCoding stuff into the 'SMKLegacy' type)
2022-05-21 12:25:10 +10:00
ryanzhao ecb9140969 send closed group message to default namespace as well during hardfork 19.0 2022-05-13 15:28:17 +10:00
Morgan Pretty 3f062c044c Added back the majority of the ConversationVC interactions
Removed some more legacy code
Added back logic similar to the pre-processing de-duping logic (was resulting in "unsent" messages reappearing)
Added a number of updated view files
2022-05-12 17:28:27 +10:00
ryanzhao a337123cbb only update the harkfork version when it is increasing 2022-05-10 14:25:14 +10:00
Ryan Zhao 2a18c8e9c9 Merge branch 'dev' into authentication-1 2022-05-09 16:58:05 +10:00
Morgan Pretty b541666ef0 Got the ability to send message working again and other tweaks
Tested and fixed a couple of issues with the disappearingMessages job
Added a simple dependency system for jobs (primarily for the AttachmentUploadJob, but will likely be others later)
Setup the AttachmentUploadJob again (looks like there are cases which use it)
Prevented a possible infinite job deferral loop from causing the app to crash (the loop is still technically possible but the app will continue to run now)
Updated the interactions unique constraints based on testing and discussions around how the serverHash works
Deleted the legacy ReadReceipt handling (now managed via the 'interaction.wasRead' flag and 'SendReadReceiptsJob')
Deleted the unused SSKIncrementingIdFinder
2022-05-06 12:44:26 +10:00
ryanzhao dac3f10dd1 tweaks on closed group polling logic 2022-05-06 10:37:53 +10:00
ryanzhao b8ec4a8c7a exclude namespace in parameters if polling for 0 with no authentication 2022-05-06 09:18:13 +10:00
ryanzhao 782d51c1d6 minor change on hardfork version check 2022-05-04 16:43:22 +10:00
ryanzhao 372e87e70f minor fix 2022-05-04 16:36:15 +10:00
ryanzhao 7cc887267f fix retrieve from default inbox 2022-05-04 16:12:45 +10:00
ryanzhao e540497724 update last hash persistence 2022-05-04 11:47:09 +10:00
ryanzhao 4224a1fa3c tweaks for sending message to snode 2022-05-04 10:34:35 +10:00
ryanzhao 15b954dbd6 persist hardfork info 2022-05-04 10:14:15 +10:00
Morgan Pretty 32304ae5dd Cleared out some of the legacy serialisation logic, further UI binding
Refactored the SignalApp class to Swift
Fixed a horizontal alignment issue in the ConversationTitleView
Fixed an issue where expiration timer update messages weren't migrated or rendering correctly
Fixed an issue where expiring messages weren't migrated correctly
Fixed an issue where closed groups which had been left were causing migration failures (due to data incorrectly being assumed to be required)
Shifted the Legacy Attachment types into the 'SMKLegacy' namespace
Moved all of the NSCoding logic for the TSMessage
2022-05-03 17:14:56 +10:00
ryanzhao 38523230cb update namespace 2022-05-03 09:18:53 +10:00
Ryan Zhao 9c535dcb1b update namespace number 2022-05-02 16:54:36 +10:00
Ryan Zhao 034f2ecc22 send messages with authentication 2022-05-02 13:51:50 +10:00
Ryan Zhao 0b0f0a3787 retrieve messages authenticated for 1-1 chats 2022-05-02 11:35:48 +10:00
Ryan Zhao f9bb1517a1 fix an issue where closed groups stop to be updated part 1 2022-04-28 15:38:30 +10:00
Morgan Pretty 3baeb981d9 Further work on the JobRunner
Moved the JobRunner into SessionUtilitiesKit so it can be used by SessionSnodeKit
Exposed a 'sharedLokiProject' value on UserDefaults to remove the hard-coded group name used everywhere
Added "blocking" job support for 'OnLaunch' and 'OnActive' jobs to the JobRunner (will retry until it succeeds)
Added the UpdateProfilePicture and RetrieveDefaultOpenGroupRooms jobs
2022-04-27 10:48:54 +10:00
Morgan Pretty 94742c80ec Further work on the JobRunner
Fixed an issue where the hash retrieved when fetching messages from the service node might not be the latest one
Updated the MessageReceiveJob to batch process messages (on failure only the failed messages will retry)
2022-04-26 17:31:50 +10:00
Morgan Pretty 11231599db Further work on migrations and message pipeline refactoring
Refactored the AppDelegate from Objective C to Swift
Updated the HomeVC to use GRDB
Refactored a number of the Job types to be driven via GRDB and the new JobRunner
Fixed a bug where the LinkPreviewView wouldn't render correctly in dark mode
2022-04-21 16:42:35 +10:00
Morgan Pretty 4380f1975c Further work on the DB refactoring
Added the rest of the interaction structure to the database (testing some migration logic now - still needs to be finalised)
Updated the YDBToGRDB migrations to wrap their inserts in autorelease pools (helps memory slightly, unfortunately it's caching the YDB data which uses the most memory but we have opted for speed over RAM at the moment)
Updated the MockDataGenerator so it should now "chunk" the code generation (crazy large figures were previously resulting in excessive memory usage)
2022-04-08 16:56:33 +10:00
Morgan Pretty cf66edb723 Further work on SessionMessagingKit migrations
Added migrations for contacts and started working through thread migration (have contact and closed group threads migrating)
Deprecated usage of ECKeyPair in the migrations (want to be able to remove Curve25519Kit in the future)
2022-04-06 15:43:26 +10:00
Morgan Pretty 4ee4b3ffb3 Started adding migration logic for contacts
Updated the getUserHexEncodedPublicKey to take an optional db value so we can retrieve it during the initial migration
2022-04-04 13:18:14 +10:00
Morgan Pretty 410f37f0d5 Updated the SnodeSet table name to match the type
Shifted all GRDB Snode convenience methods to be extensions on Snode (instead of SnodeSet) for consistency
2022-04-04 09:52:48 +10:00
Morgan Pretty 63db2a4e3d Updated the 'SwarmSnode' to use the 'port_https' key instead of the 'port' key (deprecated) 2022-04-04 09:33:12 +10:00
Morgan Pretty a1b4554cdb Migrated the SessionSnodeKit from YapDatabase to GRDB
Changed the min OS version to iOS 13.0 (support for 'Identifiable')
Removed the alternate approaches to fetching the userKeyPair and userPublicKeyHexString (no consistently routed through the caching method)
Migrated the 'OWSIdentityManager' logic to use the new 'Identity' type
Added the 'Setting' table and got the pattern working fairly nicely (unfortunately there isn't a good way to avoid key collision without proper enums)
Updated the SessionSnodeKit to migration it's data from YDB to GRDB
Updated the SessionSnodeKit to use GRDB throughout it's logic
2022-04-01 17:22:45 +11:00
Morgan Pretty e65682ae9b Merge branch 'dev' into feature/database-refactor
# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Backups/OWSBackup.m
#	Session/Backups/OWSBackupImportJob.m
#	SessionSnodeKit/SnodeAPI.swift
2022-03-31 12:09:04 +11:00
Morgan Pretty 529e416dd1 Started work on GRDB logic and migrations
Setup a migration pattern
Setup the database configuration and security
Started defining the database schema
Started working on the migrations for SessionSnodeKit
2022-03-31 11:47:09 +11:00
Morgan Pretty 5ca227434b Merge branch 'dev' into feature/session-id-blinding-part-2
# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Utilities/BackgroundPoller.swift
#	SessionMessagingKit/Database/Storage+OpenGroups.swift
#	SessionMessagingKit/Messages/Control Messages/ConfigurationMessage+Convenience.swift
#	SessionMessagingKit/Open Groups/OpenGroupAPIV2.swift
#	SessionMessagingKit/Open Groups/OpenGroupManagerV2.swift
#	SessionMessagingKit/Sending & Receiving/MessageSender.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/OpenGroupPollerV2.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/Poller.swift
#	SessionMessagingKit/Storage.swift
#	SessionMessagingKit/Utilities/General.swift
#	SessionSnodeKit/SnodeAPI.swift
#	SessionUtilitiesKit/General/Atomic.swift
2022-03-29 09:15:32 +11:00
Morgan Pretty b90904ebbd Updated the code to only update the last message hash once the MessageReceiveJobs have been created 2022-03-22 14:09:47 +11:00
Ryan Zhao 6bc0177bd4 fix path building crash 2022-03-17 10:13:00 +11:00
Morgan Pretty cb27da48b7 Updated the code to handle a clock out of sync error (different error code from v2 & v3) 2022-03-15 16:51:10 +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 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 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 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 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 eb927c36a9 Started cleaning up some of the SOGS and Onion Requests structure
Cleaned up the OnionRequestAPI so we don't need the LegacyOnionRequestAPI
Added requests for the user endpoints
Added deprecated flags to the legacy endpoints and functions
Added some logic to start handling the new poll (batch) response
Started adding unit tests for the OpenGroupAPI functions
2022-02-15 13:55:59 +11:00
Morgan Pretty c90f346d6a Further SOGS V4 integration work
Added in the v4 onion requests logic
Added in the new pin/unpin APIs
Split up additional legacy methods to try and simplify the refactoring
Added a number of TODOs around usage of legacy request methods
2022-02-14 14:07:45 +11:00
Morgan Pretty 4f3900771e More work on getting SOGS V4 integrated
Updated the MessageSendJob to support V4 messages (V2 messages will be upgraded to V4 if they get re-encoded)
Renamed the Message+Destination from 'openGroup' & 'openGroupV2' to 'legacyOpenGroup' and 'openGroup'
Started plugging in more of the V4 APIs
Renamed a number of the V2 APIs to start with 'legacy'
2022-02-11 16:48:16 +11:00
Morgan Pretty 2284375fc0 Started work on updated SOGS support
Split the OpenGroupAPIV2 into separate files
Started working on the new auth and blinded-id approaches (new auth working with un-blinded id suggesting blinded-id code is incorrect)
Updated the SOGS request/response types to use Codable
Updated the SOGS Request type to use enums instead of strings for keys (to reduce likelihood of typos breaking things)
Updated SessionMessagingKit to use Codable and JSONEncoder/JSONDecoder instead of the legacy JSONSerialization
Cleaned up some naming conventions in the SessionMessagingKit (calling a URLRequest body 'parameters' is very confusing...)
Removed the custom TSRequest class (just using standard URLRequest everywhere instead)
Added a number of extension functions to enable some more functional-coding styles
Added extensions to Sodium methods to allow scalar multiplication and the ability to hash providing a salt and a personalisation value (both needed for new SOGS auth)
Fixed an issue where the legacy auth for SOGS could crash due to threading issues (multiple threads accessing the same variable)
Fixed an issue where if you were in two rooms in a single SOGS and deleted one of them, the other room would stop getting updates as the server public key was getting removed
2022-02-10 11:17:41 +11:00
Morgan Pretty 394b0646a3 Updated the code to support additional session id prefixes 2022-02-08 16:37:01 +11:00
Morgan Pretty 03fb5cbeeb Cleanup and tweaks
Fixed some compilation issues.
Removed an unused dependency.
Cleaned up the Podfile to minimise duplication.
Pointed at an oxen fork of SignalCoreKit instead of a personal one.
2022-01-25 12:05:45 +11:00
Ryan Zhao 5f6da0739e delete message on storage server 2021-08-03 10:26:18 +10:00
Ryan Zhao e8f0d0d124 WIP: delete from storage server 2021-08-02 17:07:29 +10:00
Ryan Zhao c68350f3d8 store hash value for outgoing messages 2021-08-02 14:49:34 +10:00
Niels Andriesse 1a237557ff Add documentation 2021-07-29 10:19:24 +10:00
Niels Andriesse 140f07df96 Disable authenticated retrieval for now 2021-07-27 10:38:58 +10:00
Niels Andriesse 2360af5993 Implement authenticated message retrieval 2021-07-26 09:50:40 +10:00
Niels Andriesse 81820c0013 Remove unnecessary check 2021-07-23 14:10:44 +10:00
Niels Andriesse 8a29469eb5 Handle incorrect clock setting 2021-07-23 13:42:13 +10:00
Niels Andriesse 41fe33525c Don't unnecessarily open sync transactions 2021-07-22 13:07:51 +10:00
Niels Andriesse 498f5a73b0 Don't unnecessarily open sync transactions 2021-07-22 12:59:31 +10:00
Niels Andriesse e84fc1aa04 Include destination info in error messages 2021-07-15 09:47:03 +10:00