Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Groups Rebuild #894

Draft
wants to merge 271 commits into
base: dev
Choose a base branch
from

Conversation

mpretty-cyro
Copy link
Collaborator

@mpretty-cyro mpretty-cyro commented Aug 25, 2023

This PR is for rebuilding groups to work based on an updated architecture run via libSession-util

Note: This PR replaces #730 and depends on #883

@mpretty-cyro mpretty-cyro self-assigned this Aug 25, 2023
@mpretty-cyro mpretty-cyro marked this pull request as draft August 25, 2023 07:26
…t' into feature/groups-rebuild

# Conflicts:
#	Scripts/LintLocalizableStrings.swift
#	Session.xcodeproj/project.pbxproj
#	Session/Calls/Views & Modals/IncomingCallBanner.swift
#	Session/Meta/AppDelegate.swift
#	Session/Onboarding/Onboarding.swift
#	Session/Onboarding/SeedVC.swift
#	SessionMessagingKit/Database/Migrations/_017_DisappearingMessagesConfiguration.swift
#	SessionMessagingKit/Messages/Control Messages/LegacyConfigurationMessage.swift
#	SessionMessagingKit/SessionUtil/Config Handling/SessionUtil+Shared.swift
#	SessionMessagingKit/SessionUtil/SessionUtil.swift
#	SessionUtilitiesKit/Database/Migrations/_003_YDBToGRDBMigration.swift
#	SessionUtilitiesKit/Database/Storage.swift
#	SessionUtilitiesKit/Database/Types/Migration.swift
#	SessionUtilitiesKit/Database/Types/PagedDatabaseObserver.swift
#	_SharedTestUtilities/SynchronousStorage.swift
…t' into feature/groups-rebuild

# Conflicts:
#	Session.xcodeproj/project.pbxproj
…t' into feature/groups-rebuild

# Conflicts:
#	Session/Meta/Translations/es-ES.lproj/Localizable.strings
… into feature/groups-rebuild

# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Conversations/ConversationViewModel.swift
#	Session/Conversations/Settings/ThreadDisappearingMessagesSettingsViewModel.swift
#	Session/Conversations/Settings/ThreadSettingsViewModel.swift
#	Session/Home/Message Requests/MessageRequestsViewController.swift
#	Session/Home/Message Requests/MessageRequestsViewModel.swift
#	Session/Meta/Translations/fil.lproj/Localizable.strings
#	Session/Meta/Translations/hi.lproj/Localizable.strings
#	Session/Meta/Translations/hr.lproj/Localizable.strings
#	Session/Meta/Translations/nl.lproj/Localizable.strings
#	Session/Meta/Translations/sl.lproj/Localizable.strings
#	Session/Meta/Translations/sv-SE.lproj/Localizable.strings
#	Session/Meta/Translations/th.lproj/Localizable.strings
#	Session/Meta/Translations/vi.lproj/Localizable.strings
#	Session/Meta/Translations/zh-TW.lproj/Localizable.strings
#	Session/Settings/ConversationSettingsViewModel.swift
#	Session/Settings/HelpViewModel.swift
#	Session/Settings/NotificationContentViewModel.swift
#	Session/Settings/NotificationSettingsViewModel.swift
#	Session/Settings/NotificationSoundViewModel.swift
#	Session/Settings/PrivacySettingsViewModel.swift
#	Session/Settings/SettingsViewModel.swift
#	Session/Shared/SessionTableViewController.swift
#	SessionSnodeKit/Database/Models/SnodeReceivedMessageInfo.swift
#	SessionTests/Settings/NotificationContentViewModelSpec.swift
#	SessionUIKit/Components/TopBannerController.swift
#	SessionUtilitiesKit/Configuration.swift
Fixed the incorrect Group Namespaces
Fixed an incorrect identity generation which could create invalid accounts
Fixed an issue where adding group members would remove admins incorrectly
Finished updating the SnodeAPI to use prepared requests
Added additional properties to the Group to simplify the code
Added the roleStatus to the GroupMember for future functionality
Fixed a bug where the input field might not appear if a group becomes valid while it's open
Fixed a bug where updated groups might not get their states loaded into memory under certain conditions
Removed some duplicate code
Added the SnodeAPICache and a mock for it
Moved the current user poller into Dependencies
Got a number of the GroupUpdate messages working properly
Updated the DisplayPictureDownloadJob to support OpenGroup room images
Updated the Poller to process messages by namespace (sorted) and added support for synchronous handling of messages
Reworked the ProfileManager to be a more reusable DisplayPictureManager
Cleaned up the conversion from milliseconds to TimeInterval (which is documented as seconds) for clarity
Fixed a read/write crash due to the SnodeAPI cache setup
Fixed an issue where dependencies could incorrectly overwrite each other when based on protocols
Added logic to trigger and handle destroyed groups
Added logic to trigger and handle handle supplementary key rotations (libSession implementation is WIP)
Added logic for 'remove user and their content'
Added the ability to associate a callback to any arbitrary job
Added data support for the group description value
Added logic to handle being kicked from a group
Added logs for failed GROUP_KEYS merges (already have for other config types)
Fixed an issue where the initial key generation didn't include the initial members
Fixed a crash which could occur when creating a conversation via handling a USER_GROUPS config
Fixed an issue where manually triggering the ConfigurationSyncJob might not ever get a callback
Updated to have the latest Protobuf tweaks
Removed recognition of the LegacyConfigurationMessage
Added logic for Group Message Requests
Added a 'ManualResultJob' which allows for a way to add a dependency to a job which can be resolved separately from the job system (it's not persistent though)
Added the ability for admins to delete select messages from updated groups
Swapped 'save'/'saved' calls to be 'upsert'/'upserted' as that's the actual behaviour we expect (unique key based rather than primary key based)
Fixed a bug where the 'limitedReuse' 'drainBehaviour' could get stuck in an invalid state
Fixed a bug where job dependencies could swap queues which could theoretically result in deadlocks in some cases
@burtonemily burtonemily self-assigned this Oct 25, 2023
Added invitation statuses for updated groups
Added the invite and failed invite toasts
Added proper support for the group description
Refactored the EditClosedGroupVC and UserSelectionVC to use the SessionTableViewModel
Updated the ObservableTableSource to support forcing a refresh either before or after the database observation
Removed support for the per-thread notification sound
Added logic to handle promotion messages
Added a debounced toast for promotion failures
Added support for the 'delete_before' and 'attach_delete_before' functionality
Added in the deprecated legacy groups banner.
Cleaned up the UserListViewModel a little
Updated the 'User count' header subtitle to take the user to the 'Group Members' or 'Edit Group' screens based on admin status
Updated the sorting of the group member lists to match the requirements
Fixed the debounced group invite failure toast
Fixed an issue where some libSession errors wouldn't get propagated back into the Swift code resulting in invalid database changes
Fixed an issue where admins couldn't properly leave groups
Added the updated revoke & unrevoke endpoints when removing and adding group members
Updated the group creation to upload the provided image and set it to the group correctly
Added bolding to the control messages
Reworked the MockFunctionHandler to have different calls with inferred return types to reduce boilerplate
Fixed broken unit tests
Fixed an issue which could occur in the ObservableTableSource where it could miss the first output if it returned too quickly
Started adding DownloadDisplayPictureJob unit tests
Minor copy tweak
Started adding tests for the DisplayPictureDownloadJob
Cleaned up the Crypto singleton a bit
Moved the DisplayPictureManager encryption/decryption into Crypto methods
Started adding logic to subscribe and unsubscribe for updated group push notifications
Updated the keychain service to be injected via dependencies
Reworked the Dependencies logic to avoid a concurrent access issue
Fixed an issue where some keychain data might not be cleared in some cases
Fixed an issue where being kicked and readded to a group would make it seem to disappear ("invited" message wasn't getting created)
…essages

Added the DeveloperSettingsViewModel and dependency-controlled feature flags
Added the generic 'SessionListViewModel' to reduce duplicate code when we want to just display a selectable list of items
Added an indicator on the home screen to show when using testnet
Added group promotions behind a feature flag
Updated the PushNotificationAPI to use bulk subscribe/unsubscribe requests
Updated the 'GroupUpdateDeleteMessage' and 'GroupUpdateDeleteMemberContentMessage' to support additional behaviours
Updated the SessionCell to have better RTL support (swapped some left/right things to leading/trailing)
Updated the revoke/unrevoke endpoints to take arrays of subaccount tokens
Refactored the Bencode logic to properly support Codable types
mpretty-cyro and others added 30 commits December 18, 2024 17:38
…d-legacy-group-creation

Fixed an issue where new legacy groups would have invalid state
• Added updated member statuses
• Updated to latest libSession (includes group status changes and breaking GroupKeys change)
• Fixed an issue where starting a new conversation on a new account could result in being kicked out of the conversation after a couple of seconds
• Fixed an issue where blocking a group invite would result in the senders contact conversation reverting to a message request
• Fixed an issue where deleting all attachments before now wouldn't leave behind the "message was deleted" artifact
• Fixed an issue where deleting all attachments before now was incorrectly deleting voice messages
• Fixed an issue where deleting all attachments before now wasn't deleting quote thumbnails
• Fixed an issue where you could never delete a group after being kicked
• Fixed an issue where some updated group control messages would be dropped by linked devices
# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Calls/Call Management/SessionCallManager+Action.swift
#	Session/Calls/Call Management/SessionCallManager+CXProvider.swift
#	Session/Calls/Call Management/SessionCallManager.swift
#	Session/Calls/WebRTC/WebRTCSession.swift
#	Session/Conversations/ConversationVC+Interaction.swift
#	Session/Conversations/Settings/ThreadSettingsViewModel.swift
#	Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift
#	Session/Media Viewing & Editing/PhotoCapture.swift
#	Session/Media Viewing & Editing/PhotoLibrary.swift
#	Session/Notifications/NotificationPresenter.swift
#	Session/Notifications/PushRegistrationManager.swift
#	Session/Settings/HelpViewModel.swift
#	SessionMessagingKit/Database/Models/LinkPreview.swift
#	SessionMessagingKit/Sending & Receiving/Attachments/SignalAttachment.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+LegacyClosedGroups.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageSender+LegacyClosedGroups.swift
#	SessionNotificationServiceExtension/NotificationServiceExtension.swift
#	SessionShareExtension/ShareNavController.swift
#	SessionShareExtension/ThreadPickerVC.swift
#	SessionUtilitiesKit/Media/DataSource.swift
…accessibility-id

Add accessibility id for broken media
…-without-callkit

Fixed an issue where incoming calls would always fail without CallKit
…ture/update-crowdin-translations

[Automated] Update translations from Crowdin
…c-reentrancy

Refactor Atomic<T> to Support Reentrancy
• Added a loading indicator while config syncing is happening while sending group invitations/promotions
• Added a mechanism to trigger a libSession config change but prevent the change from enqueuing a config sync (so we can do a blocking sync)
• Fixed a couple of bugs where the disappearing message control messages could behave incorrectly in updated groups
• Fixed an issue where deleting a message which was quoted by another message wouldn't remove the quoted content until returning to the screen
• Fixed an issue where a leaving member could appear to be removed before they were actually removed
• Fixed an issue where a group member wouldn't return to the "sending" state when resending an invitation
• Fixed an issue where the current user could see group admins actions before they had been flagged as an accepted admin
• Updated to the latest Lucide version
• Updated the bin icons to use the new Lucide icon
• Fixed an issue where flagging a members messages to be deleted when kicking them wasn't using the standard message removal process
• Fixed an issue where you couldn't delete a group after it was destroyed
• Fixed an issue where being promoted to admin would fail because you weren't already an admin
• Fixed an issue where the share extension wasn't populating it's conversation list
• Fixed an issue where the share extension had a translucent header
• Fixed an issue where messages could incorrectly be considered disappearing messages (with no duration)
• Fixed an issue where non-admins couldn't locally delete messages in community conversations
• Fixed an issue where deleting Note to Self messages for all devices was incorrectly leaving an artifact
• Fixed an issue where emoji reacts added to messages which have been deleted locally would still get added to the deleted artifact
• Fixed a layout issue in groups/communities with the "this message was deleted" artifact
• Fixed an issue where highlighting and unhighlighting a "danger" action in the context menu would result in it changing to a non-danger colour
• Fixed an issue where the community poller always thought it was the initial poll
# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Calls/Views & Modals/IncomingCallBanner.swift
#	Session/Calls/WebRTC/WebRTCSession.swift
#	Session/Conversations/ConversationVC+Interaction.swift
#	Session/Conversations/ConversationVC.swift
#	Session/Conversations/ConversationViewModel.swift
#	Session/Conversations/Settings/ThreadSettingsViewModel.swift
#	Session/Home/GlobalSearch/GlobalSearchViewController.swift
#	Session/Home/HomeVC.swift
#	Session/Home/Message Requests/MessageRequestsViewModel.swift
#	Session/Meta/AppDelegate.swift
#	Session/Meta/AppEnvironment.swift
#	Session/Meta/SessionApp.swift
#	Session/Notifications/NotificationPresenter.swift
#	Session/Notifications/PushRegistrationManager.swift
#	Session/Notifications/UserNotificationsAdaptee.swift
#	Session/Onboarding/Onboarding.swift
#	Session/Open Groups/JoinOpenGroupVC.swift
#	Session/Utilities/IP2Country.swift
#	Session/Utilities/MockDataGenerator.swift
#	Session/Utilities/UIContextualAction+Utilities.swift
#	SessionMessagingKit/Calls/CallManagerProtocol.swift
#	SessionMessagingKit/Database/Migrations/_013_SessionUtilChanges.swift
#	SessionMessagingKit/Database/Migrations/_014_GenerateInitialUserConfigDumps.swift
#	SessionMessagingKit/Database/Models/ClosedGroup.swift
#	SessionMessagingKit/Database/Models/Interaction.swift
#	SessionMessagingKit/Database/Models/SessionThread.swift
#	SessionMessagingKit/Jobs/DisappearingMessagesJob.swift
#	SessionMessagingKit/Jobs/Types/GroupLeavingJob.swift
#	SessionMessagingKit/LibSession/Config Handling/LibSession+Contacts.swift
#	SessionMessagingKit/LibSession/Config Handling/LibSession+ConvoInfoVolatile.swift
#	SessionMessagingKit/LibSession/Config Handling/LibSession+Shared.swift
#	SessionMessagingKit/LibSession/Config Handling/LibSession+UserGroups.swift
#	SessionMessagingKit/LibSession/Config Handling/LibSession+UserProfile.swift
#	SessionMessagingKit/LibSession/Database/QueryInterfaceRequest+Utilities.swift
#	SessionMessagingKit/LibSession/LibSession+SessionMessagingKit.swift
#	SessionMessagingKit/Open Groups/OpenGroupManager.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+Calls.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+LegacyClosedGroups.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+MessageRequests.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+VisibleMessages.swift
#	SessionMessagingKit/Sending & Receiving/Message Handling/MessageSender+LegacyClosedGroups.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/CurrentUserPoller.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/OpenGroupPoller.swift
#	SessionMessagingKit/Sending & Receiving/Pollers/Poller.swift
#	SessionMessagingKit/Sending & Receiving/Typing Indicators/TypingIndicators.swift
#	SessionMessagingKit/Utilities/AppReadiness.swift
#	SessionMessagingKit/Utilities/Preferences.swift
#	SessionMessagingKit/Utilities/ProfileManager.swift
#	SessionMessagingKit/Utilities/SessionEnvironment.swift
#	SessionMessagingKitTests/Jobs/MessageSendJobSpec.swift
#	SessionMessagingKitTests/Open Groups/OpenGroupManagerSpec.swift
#	SessionNotificationServiceExtension/NotificationServiceExtension.swift
#	SessionShareExtension/ShareNavController.swift
#	SessionSnodeKit/LibSession/LibSession+Networking.swift
#	SessionSnodeKit/Networking/SnodeAPI.swift
#	SessionUIKit/Components/PlaceholderIcon.swift
#	SessionUIKit/Utilities/UIContextualAction+Theming.swift
#	SessionUtilitiesKit/Crypto/Crypto.swift
#	SessionUtilitiesKit/Database/Storage.swift
#	SessionUtilitiesKit/Database/Types/Migration.swift
#	SessionUtilitiesKit/Database/Utilities/Database+Utilities.swift
#	SessionUtilitiesKit/General/AppContext.swift
#	SessionUtilitiesKit/General/Atomic.swift
#	SessionUtilitiesKit/General/Caches.swift
#	SessionUtilitiesKit/General/Dependencies.swift
#	SessionUtilitiesKit/General/FileSystem.swift
#	SessionUtilitiesKit/General/Logging.swift
#	SessionUtilitiesKit/General/SNUserDefaults.swift
#	SessionUtilitiesKit/JobRunner/JobRunner.swift
#	SessionUtilitiesKit/Types/BackgroundTaskManager.swift
#	SessionUtilitiesKit/Types/KeychainStorage.swift
#	SignalUtilitiesKit/Utilities/AppSetup.swift
#	_SharedTestUtilities/Mock.swift
#	_SharedTestUtilities/MockCaches.swift
#	_SharedTestUtilities/NimbleExtensions.swift
• Added the updated light-mode warning colour
• Updated the group version warning banner to explicitly use the primary orange colour
• Fixed an incorrect colour for radio options in the modal
• Fixed an issue where non-admins would incorrectly try to remove obsolete group config hashes (which is not allowed)
• Added a unit test to validate the GroupMember sorting continues to work as expected
• Updated the AppSetup process to be simpler (no need to check if it had previously run anymore)
• Removed some state management code from the NotificationServiceExtension (no longer needed now that state is properly managed via the Dependencies)
• Fixed an issue where if you had updated another client, gotten updated groups in your config, and then update the iOS client then it wouldn't create the updated groups until a UserGroups config change occurred
• Fixed a bug where we would incorrectly try to retrieve the disappearing messages settings for V2 Groups from the UserGroups config instead of the GroupInfo one
• Fixed an issue where the updated groups poller might not get started correctly in some cases
• Fixed an issue where we could incorrectly add a "you were invited..." control message on linked devices when creating an updated group
• Fixed an issue where the "open url" modal wouldn't be dismissed when copying the url
• Fixed an issue where reactions could appear on locally deleted community messages
• Fixed an issue where the "Note to Self" conversation could be mislabelled in the share extension
• Fixed an issue where sharing a url with a preview would fail
• Fixed an issue where a quote for an attachment wouldn't show the thumbnail if the conversation was open when the quote message was received
• Fixed an issue where the background colour of the display picture could be incorrect when in a multi-avatar for a group conversation
• Fixed a crash due to our ThreadSafe code using a struct instead of a class (rendering it non thread safe)
• Fixed a crash which could occur on the home screen if the data loaded before the UI finished loading
• (Hopefully) Fixed a crash which could occur when the OS optimised async execution to run immediately within an existing database transaction (potentially resulting in re-entrant database access)
• Fixed an issue where the database read/write publishers weren't checking for a valid database state before actual query execution (only during the creation of the stream)
…ction-crashes

Fixed a number of crashes currently affecting production
…ture/update-crowdin-translations

[Automated] Update translations from Crowdin
• Added logic to trigger a full refetch when getting promoted to admin within a group
• Added a timeout to display picture uploads
• Updated the code to inject the DisplayPictureManager via dependencies
• Updated the resend invite functionality to have a blocking loading indicator as well
• Refactored some closure-based logic for display picture uploads to use Combine instead
• Refactored the SnodeReceivedMessageInfo (with a migration) so it's no longer using a weird constructed key (now have individual queryable columns for the values)
# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Home/HomeVC.swift
#	Session/Meta/AppDelegate.swift
#	Session/Meta/SessionApp.swift
#	SessionMessagingKit/Jobs/Types/UpdateProfilePictureJob.swift
#	SessionMessagingKit/Sending & Receiving/MessageSender.swift
#	SessionUtilitiesKit/JobRunner/JobRunner.swift
• Fixed an issue where "this message was deleted locally" couldn't be overwritten with "this message was deleted"
• Backported a libSession fix for the current config being incorrectly removed from the swarm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants