Skip to content

Refactored networking#500

Open
mpretty-cyro wants to merge 86 commits intosession-foundation:devfrom
mpretty-cyro:feature/refactored-networking
Open

Refactored networking#500
mpretty-cyro wants to merge 86 commits intosession-foundation:devfrom
mpretty-cyro:feature/refactored-networking

Conversation

@mpretty-cyro
Copy link
Collaborator

@mpretty-cyro mpretty-cyro commented Aug 8, 2025

  • Integrated refactored libSession networking
  • Fixed a couple of issues with the libSession build script
  • Fixed a crash which could occur when using the storage publisher functions

Note: This is based on #501

@mpretty-cyro mpretty-cyro self-assigned this Aug 8, 2025
@mpretty-cyro mpretty-cyro added bug Something isn't working enhancement New feature or request Jira This ticket is being tracked in Jira labels Aug 8, 2025
@mpretty-cyro mpretty-cyro force-pushed the feature/refactored-networking branch from 9f39a5c to f4f479b Compare August 8, 2025 03:22
• Started work on integrating refactored libSession networking
• Fixed a couple of issues with the libSession build script
• Fixed some duplicate content in Logging
• Fixed broken service node batch requests
• Fixed a crash which could occur when using the storage publisher functions
@mpretty-cyro mpretty-cyro force-pushed the feature/refactored-networking branch from 05ffd72 to cb6b5aa Compare August 20, 2025 00:24
• Added some convenience functions
• Removed the database requirement to get some AuthenticationMethods
• Cleaned up the AppDelegate setup process a bit
• Updated the LibSessionNetwork to be an actor (no more cache + singleton)
• Updated LibSessionNetwork to support async/await (also supports Combine, but that is now deprecated)
• Updated network observation to use async/await
• Refactored IP2Country to be an actor and use async/await
• Refactored the pollers to use async/await
• Refactored the getSessionId API call to use async/await
• Refactored the AppSetup and database migrations to be async/await
…etworking

# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	SessionNetworkingKit/PushNotification/PushNotificationAPI.swift
• Disabled dependency observation in iOS 15 to avoid version-specific crashes
• Cleaned up some logic in the async/await tools
…etworking

# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Meta/SessionApp.swift
…etworking

# Conflicts:
#	Scripts/build_libSession_util.sh
#	Session.xcodeproj/project.pbxproj
#	Session.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	Session/Calls/Call Management/SessionCall.swift
#	Session/Calls/Call Management/SessionCallManager.swift
#	Session/Calls/WebRTC/WebRTCSession.swift
#	Session/Conversations/ConversationVC+Interaction.swift
#	Session/Conversations/Settings/ThreadDisappearingMessagesSettingsViewModel.swift
#	Session/Conversations/Settings/ThreadSettingsViewModel.swift
#	Session/Home/HomeVC.swift
#	Session/Home/New Conversation/NewMessageScreen.swift
#	Session/Media Viewing & Editing/MessageInfoScreen.swift
#	Session/Meta/AppDelegate.swift
#	Session/Meta/SessionApp.swift
#	Session/Meta/Settings.bundle/ThirdPartyLicenses.plist
#	Session/Notifications/PushRegistrationManager.swift
#	Session/Notifications/SyncPushTokensJob.swift
#	Session/Onboarding/DisplayNameScreen.swift
#	Session/Onboarding/LoadingScreen.swift
#	Session/Onboarding/Onboarding.swift
#	Session/Onboarding/PNModeScreen.swift
#	Session/Open Groups/OpenGroupSuggestionGrid.swift
#	Session/Settings/DeveloperSettings/DeveloperSettingsProViewModel.swift
#	Session/Settings/DeveloperSettings/DeveloperSettingsViewModel+Testing.swift
#	Session/Settings/DeveloperSettings/DeveloperSettingsViewModel.swift
#	Session/Settings/NukeDataModal.swift
#	Session/Settings/SettingsViewModel.swift
#	Session/Utilities/BackgroundPoller.swift
#	Session/Utilities/IP2Country.swift
#	SessionMessagingKit/Configuration.swift
#	SessionMessagingKit/Crypto/Crypto+SessionMessagingKit.swift
#	SessionMessagingKit/Database/Migrations/_027_SessionUtilChanges.swift
#	SessionMessagingKit/Database/Migrations/_036_GroupsRebuildChanges.swift
#	SessionMessagingKit/Database/Models/ClosedGroup.swift
#	SessionMessagingKit/Database/Models/Interaction.swift
#	SessionMessagingKit/Database/Models/LinkPreview.swift
#	SessionMessagingKit/Database/Models/SessionThread.swift
#	SessionMessagingKit/Jobs/AttachmentDownloadJob.swift
#	SessionMessagingKit/Jobs/CheckForAppUpdatesJob.swift
#	SessionMessagingKit/Jobs/ConfigMessageReceiveJob.swift
#	SessionMessagingKit/Jobs/ConfigurationSyncJob.swift
#	SessionMessagingKit/Jobs/DisappearingMessagesJob.swift
#	SessionMessagingKit/Jobs/DisplayPictureDownloadJob.swift
#	SessionMessagingKit/Jobs/ExpirationUpdateJob.swift
#	SessionMessagingKit/Jobs/GetExpirationJob.swift
#	SessionMessagingKit/Jobs/GroupInviteMemberJob.swift
#	SessionMessagingKit/Jobs/GroupLeavingJob.swift
#	SessionMessagingKit/Jobs/GroupPromoteMemberJob.swift
#	SessionMessagingKit/Jobs/MessageSendJob.swift
#	SessionMessagingKit/Jobs/ProcessPendingGroupMemberRemovalsJob.swift
#	SessionMessagingKit/Jobs/RetrieveDefaultOpenGroupRoomsJob.swift
#	SessionMessagingKit/Jobs/SendReadReceiptsJob.swift
#	SessionMessagingKit/LibSession/Config Handling/LibSession+UserGroups.swift
#	SessionMessagingKit/LibSession/LibSession+SessionMessagingKit.swift
#	SessionMessagingKit/Open Groups/OpenGroupManager.swift
#	SessionMessagingKit/Sending & Receiving/AttachmentUploader.swift
#	SessionMessagingKit/Sending & Receiving/Errors/MessageReceiverError.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+Calls.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+Groups.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+UnsendRequests.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageSender+Groups.swift
#	SessionMessagingKit/Sending & Receiving/MessageReceiver.swift
#	SessionMessagingKit/Sending & Receiving/MessageSender.swift
#	SessionMessagingKit/Sending & Receiving/Notifications/PushNotificationAPI+SessionMessagingKit.swift
#	SessionMessagingKit/Sending & Receiving/Notifications/Types/NotificationContent.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/CommunityPoller.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/CurrentUserPoller.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/GroupPoller.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/PollerType.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/SwarmPoller.swift
#	SessionMessagingKit/Types/MessageViewModel+DeletionActions.swift
#	SessionMessagingKit/Utilities/AttachmentManager.swift
#	SessionMessagingKit/Utilities/Authentication+SessionMessagingKit.swift
#	SessionMessagingKit/Utilities/DisplayPictureManager.swift
#	SessionMessagingKit/Utilities/ExtensionHelper.swift
#	SessionMessagingKit/Utilities/ObservableKey+SessionMessagingKit.swift
#	SessionMessagingKit/Utilities/SNProtoEnvelope+Conversion.swift
#	SessionMessagingKit/Utilities/SessionProState.swift
#	SessionMessagingKitTests/Crypto/CryptoSMKSpec.swift
#	SessionMessagingKitTests/Database/Models/MessageDeduplicationSpec.swift
#	SessionMessagingKitTests/Jobs/DisplayPictureDownloadJobSpec.swift
#	SessionMessagingKitTests/Jobs/MessageSendJobSpec.swift
#	SessionMessagingKitTests/Jobs/RetrieveDefaultOpenGroupRoomsJobSpec.swift
#	SessionMessagingKitTests/LibSession/LibSessionGroupInfoSpec.swift
#	SessionMessagingKitTests/LibSession/LibSessionGroupMembersSpec.swift
#	SessionMessagingKitTests/LibSession/LibSessionSpec.swift
#	SessionMessagingKitTests/Open Groups/CommunityManagerSpec.swift
#	SessionMessagingKitTests/Open Groups/Crypto/CryptoOpenGroupSpec.swift
#	SessionMessagingKitTests/Sending & Receiving/MessageReceiverGroupsSpec.swift
#	SessionMessagingKitTests/Sending & Receiving/MessageSenderGroupsSpec.swift
#	SessionMessagingKitTests/Sending & Receiving/MessageSenderSpec.swift
#	SessionMessagingKitTests/Sending & Receiving/Notifications/NotificationsManagerSpec.swift
#	SessionMessagingKitTests/Sending & Receiving/Pollers/CommunityPollerManagerSpec.swift
#	SessionMessagingKitTests/Types/GlobalSearchSpec.swift
#	SessionMessagingKitTests/Utilities/ExtensionHelperSpec.swift
#	SessionMessagingKitTests/_TestUtilities/MockCommunityPollerCache.swift
#	SessionMessagingKitTests/_TestUtilities/MockExtensionHelper.swift
#	SessionMessagingKitTests/_TestUtilities/MockGroupPollerCache.swift
#	SessionMessagingKitTests/_TestUtilities/MockImageDataManager.swift
#	SessionMessagingKitTests/_TestUtilities/MockLibSessionCache.swift
#	SessionMessagingKitTests/_TestUtilities/MockNotificationsManager.swift
#	SessionMessagingKitTests/_TestUtilities/MockPoller.swift
#	SessionMessagingKitTests/_TestUtilities/MockSwarmPoller.swift
#	SessionMessagingKitTests/_TestUtilities/Mocked+SMK.swift
#	SessionNetworkingKit/FileServer/FileServer.swift
#	SessionNetworkingKit/FileServer/FileServerAPI.swift
#	SessionNetworkingKit/LibSession/LibSession+Networking.swift
#	SessionNetworkingKit/SOGS/SOGSAPI.swift
#	SessionNetworkingKit/SessionNetwork/SessionNetworkAPI.swift
#	SessionNetworkingKit/StorageServer/SnodeAPI.swift
#	SessionNetworkingKit/Types/Destination.swift
#	SessionNetworkingKit/Types/Network.swift
#	SessionNetworkingKit/Types/PreparedRequest+Sending.swift
#	SessionNetworkingKit/Types/PreparedRequest.swift
#	SessionNetworkingKit/Types/SwarmDrainer.swift
#	SessionNetworkingKitTests/SOGS/Crypto/CryptoSOGSAPISpec.swift
#	SessionNetworkingKitTests/SOGS/SOGSAPISpec.swift
#	SessionNetworkingKitTests/Types/DestinationSpec.swift
#	SessionNetworkingKitTests/Types/PreparedRequestSendingSpec.swift
#	SessionNetworkingKitTests/_TestUtilities/MockNetwork.swift
#	SessionNetworkingKitTests/_TestUtilities/MockSnodeAPICache.swift
#	SessionNetworkingKitTests/_TestUtilities/Mocked+SNK.swift
#	SessionNotificationServiceExtension/NotificationServiceExtension.swift
#	SessionShareExtension/ShareNavController.swift
#	SessionShareExtension/ThreadPickerVC.swift
#	SessionTests/Conversations/Settings/ThreadDisappearingMessagesViewModelSpec.swift
#	SessionTests/Conversations/Settings/ThreadNotificationSettingsViewModelSpec.swift
#	SessionTests/Conversations/Settings/ThreadSettingsViewModelSpec.swift
#	SessionTests/Database/DatabaseSpec.swift
#	SessionTests/Onboarding/OnboardingSpec.swift
#	SessionTests/Settings/NotificationContentViewModelSpec.swift
#	SessionUIKit/Components/Modals & Toast/ConfirmationModal.swift
#	SessionUIKit/Components/RadioButton.swift
#	SessionUIKit/Screens/Settings/SessionNetworkScreen/SessionNetworkScreen+Models.swift
#	SessionUtilitiesKit/Database/Models/Job.swift
#	SessionUtilitiesKit/Database/Models/JobDependencies.swift
#	SessionUtilitiesKit/Database/Storage.swift
#	SessionUtilitiesKit/Dependency Injection/Dependencies.swift
#	SessionUtilitiesKit/General/Feature.swift
#	SessionUtilitiesKit/JobRunner/JobRunner.swift
#	SessionUtilitiesKit/Media/DataSource.swift
#	SessionUtilitiesKit/Types/FileManager.swift
#	SessionUtilitiesKitTests/Database/Models/IdentitySpec.swift
#	SessionUtilitiesKitTests/General/GeneralCacheSpec.swift
#	SessionUtilitiesKitTests/JobRunner/JobRunnerSpec.swift
#	SessionUtilitiesKitTests/_TestUtilities/MockAppContext.swift
#	SessionUtilitiesKitTests/_TestUtilities/MockCrypto.swift
#	SessionUtilitiesKitTests/_TestUtilities/MockFileManager.swift
#	SessionUtilitiesKitTests/_TestUtilities/MockGeneralCache.swift
#	SessionUtilitiesKitTests/_TestUtilities/MockJobRunner.swift
#	SessionUtilitiesKitTests/_TestUtilities/MockKeychain.swift
#	SessionUtilitiesKitTests/_TestUtilities/MockUserDefaults.swift
#	SessionUtilitiesKitTests/_TestUtilities/Mocked+SUK.swift
#	SignalUtilitiesKit/Utilities/AppSetup.swift
#	TestUtilities/ArgumentDescribing.swift
#	TestUtilities/MockError.swift
#	TestUtilities/MockFallbackRegistry.swift
#	TestUtilities/MockFunction.swift
#	TestUtilities/MockFunctionBuilder.swift
#	TestUtilities/MockFunctionHandler.swift
#	TestUtilities/MockHandler.swift
#	TestUtilities/Mockable.swift
#	TestUtilities/Mocked.swift
#	TestUtilities/Nimble/NimbleFailureReporter.swift
#	TestUtilities/Nimble/NimbleVerification.swift
#	TestUtilities/RecordedCall.swift
#	TestUtilities/TestFailureReporter.swift
#	TestUtilities/Utilities/Async+Utilities.swift
#	TestUtilities/Utilities/Collection+Utilities.swift
#	_SharedTestUtilities/FixtureBase.swift
#	_SharedTestUtilities/SynchronousStorage.swift
#	_SharedTestUtilities/TestDependencies.swift
• Updated AppReadiness to be an actor
• Updated a bunch of network calls to be async/await
• Cleaned up some duplicate code in ProfilePictureView
• Fixed build issues
• Added in some network resilience tests
• Added in code to try to subscribe for PNs when auto-approving a group via PN
• Cleaned up some bridging logic for the libsession network
• Removed code related to an unused 'caption' value
• Removed some deprecated notification actions
• Refactor remaining Combine network calls to use async/await
• Refactored the BackgroundPoller logic to use a TaskGroup to manage it's logic and timeout (instead of a `DispatchSourceTimer`)
• Fixed an issue where onboarding could hang when there is no account
• Fixed an issue where the database wrapper wouldn't report that it was readyForUse if there were no migrations
• Fixed an issue where the local network permission would incorrectly try to be set when there was no account
• Updated the code to use the new streaming-based upload/download interface
• Updated code to use file-to-file decryption for stream-based decryption
• Fixed an issue where extracting the `fileId` from a url could incorrectly contain fragment information
• Fixed an issue where the SyncPushTokensJob would run excessively on simulator builds (where it's not supported)
• Added the network resilience tests
• Cleaned up some code
• Fixed broken unit tests
• Fixed an issue where some migrations would try to get the network offset time before it could possibly be retrieved
• Fixed a crash when exporting the database
• Fixed a crash when uploading files (unbalanced pointer release)
• Updated the code to use libSession to parse and generate FileServer and SOGS download urls
• Fixed what should be a bug with pending reactions (but can't see an impact of the fix...?)
• Fixed a streaming download & upload memory crashes
@mpretty-cyro mpretty-cyro changed the title [WIP] Refactored networking Refactored networking Feb 26, 2026
@mpretty-cyro mpretty-cyro marked this pull request as ready for review February 26, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request Jira This ticket is being tracked in Jira

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant