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

refactor: Remove BackgroundRealm for MailCoreRealmAccessor #1414

Merged
merged 11 commits into from
May 7, 2024

Conversation

adrien-coye
Copy link
Contributor

@adrien-coye adrien-coye commented May 3, 2024

Substitute BackgroundRealm for Transactionable as no longer make sense.

Should be merged after #1413

@adrien-coye adrien-coye changed the title refactor: Remove BackgroundRealm refactor: Remove BackgroundRealm for MailCoreRealmAccessor May 6, 2024
@adrien-coye adrien-coye changed the base branch from migrateSuddenTerminationCode to master May 6, 2024 06:25
Copy link

github-actions bot commented May 6, 2024

Found 52 unused code occurences

Expand
Mail/Helpers/MailTargetAssembly.swift:57:7: warning: Class 'MailTargetAssembly' is unused
Mail/Helpers/RichTextEditor.swift:268:10: warning: Function 'moveCursorToEnd(completion:)' is unused
Mail/Helpers/RichTextEditor.swift:272:10: warning: Function 'addBold(completion:)' is unused
Mail/Helpers/RichTextEditor.swift:280:10: warning: Function 'removeList(completion:)' is unused
Mail/MailApp.swift:28:17: warning: Property 'dependencyInjectionHook' is unused
Mail/Utils/IntentViewable.swift:24:9: warning: Property 'resolvedIntent' is unused
Mail/Utils/IntentViewable.swift:25:10: warning: Function 'initFromIntent()' is unused
Mail/Views/AI Writer/Prompt/AIEngineOptionButton.swift:31:18: warning: Property 'isShowingAIEngineChoice' is assigned, but never used
Mail/Views/Menu Drawer/FolderListViewModel.swift:35:17: warning: Property 'foldersObservationToken' is assigned, but never used
Mail/Views/New Message/Attachments/AttachmentsManager.swift:28:21: warning: Protocol 'AttachmentsManageable' is redundant as it's never used as an existential type
Mail/Views/New Message/Attachments/AttachmentsManager.swift:63:62: warning: Protocol 'AttachmentsManageable' conformance is redundant
Mail/Views/New Message/Attachments/AttachmentsManager.swift:63:62: warning: Protocol 'AttachmentsManageable' conformance is redundant
Mail/Views/New Message/ComposeMessageIntentView.swift:43:9: warning: Property 'htmlAttachments' is assigned, but never used
Mail/Views/New Message/Recipients/RecipientChip.swift:34:21: warning: Property 'focusedField' is assigned, but never used
Mail/Views/New Message/Select Mailbox/SelectComposeMailboxView.swift:32:18: warning: Property 'composeMessageIntent' is assigned, but never used
Mail/Views/Onboarding/OnboardingView.swift:350:8: warning: Struct 'OnboardingView_Previews' is unused
Mail/Views/Onboarding/SlideView.swift:117:8: warning: Struct 'SlideView_Previews' is unused
Mail/Views/SplitView.swift:334:51: warning: Parameter 'notification' is unused
Mail/Views/Switch User/AccountListView.swift:39:17: warning: Property 'mailboxObservationToken' is assigned, but never used
Mail/Views/Thread List/FlushFolderView.swift:41:18: warning: Property 'flushAlert' is assigned, but never used
Mail/Views/Thread List/ThreadListHeader.swift:36:17: warning: Property 'folderObservation' is assigned, but never used
Mail/Views/Thread/Message/Attachment/AttachmentsView.swift:30:24: warning: Property 'showDocumentPicker' is unused
Mail/Views/Thread/Message/Calendar/CalendarAttendeeAvatarView.swift:29:17: warning: Property 'hasChoice' is unused
Mail/Views/Thread/Message/MessageBodyView.swift:36:18: warning: Property 'displayContentBlockedActionView' is assigned, but never used
Mail/Views/Thread/Message/MessageHeader/MessageHeaderSummaryView.swift:140:8: warning: Struct 'MessageHeaderSummaryView_Previews' is unused
Mail/Views/Thread/Message/MessageView.swift:157:8: warning: Struct 'MessageView_Previews' is unused
Mail/Views/Thread/OpenThreadIntentView.swift:41:13: warning: Property 'threadObservation' is assigned, but never used
MailAppIntentsExtension/MailAppIntentsExtension.swift:24:17: warning: Property 'dependencyInjectionHook' is unused
MailAppIntentsExtension/MailAppIntentsTargetAssembly.swift:22:7: warning: Class 'MailAppIntentsTargetAssembly' is unused
MailAppIntentsExtension/MailSetFocusFilterIntent.swift:27:16: warning: Property 'description' is unused
MailCore/API/MailApiFetcher/MailApiFetcher+AI.swift:25:18: warning: Function 'authenticatedAIRequest(_:method:parameters:)' is unused
MailCore/API/MailError.swift:98:9: warning: Property 'httpStatus' is assigned, but never used
MailCore/Cache/MailboxManager/MailboxManager.swift:28:28: warning: Property 'snackbarPresenter' is unused
MailCore/Models/AI/AIMessage.swift:30:9: warning: Property 'recipient' is assigned, but never used
MailCore/Models/Contact/CommonContact.swift:36:17: warning: Function 'from(contactConfiguration:)' is unused
MailCore/Models/Draft.swift:184:29: warning: Parameter 'isOffline' is unused
MailCore/Models/Message.swift:413:9: warning: Parameter 'safeDisplay' is unused
MailCore/Models/Request Body/NewContact.swift:23:13: warning: Property 'value' is assigned, but never used
MailCore/Models/Request Body/NewContact.swift:24:13: warning: Property 'type' is unused
MailCore/Models/Request Body/NewContact.swift:27:9: warning: Property 'firstname' is assigned, but never used
MailCore/Models/Request Body/NewContact.swift:28:9: warning: Property 'lastname' is assigned, but never used
MailCore/Models/Request Body/NewContact.swift:29:9: warning: Property 'emails' is assigned, but never used
MailCore/Models/Request Body/NewContact.swift:30:9: warning: Property 'addressbookId' is assigned, but never used
MailCore/Models/Request Body/NewFolder.swift:22:9: warning: Property 'name' is assigned, but never used
MailCore/Models/Request Body/NewFolder.swift:23:9: warning: Property 'path' is assigned, but never used
MailCore/Utils/IdentifiableURLs.swift:30:8: warning: Struct 'IdentifiableURLComponents' is unused
MailCore/Utils/SnackBar/IKSnackBar+Extension.swift:60:9: warning: Parameter 'anchor' is unused
MailNotificationServiceExtension/NotificationService.swift:31:17: warning: Property 'dependencyInjectionHook' is unused
MailNotificationServiceExtension/NotificationServiceAssembly.swift:27:7: warning: Class 'NotificationServiceTargetAssembly' is unused
MailShareExtension/MailShareExtensionTargetAssembly.swift:22:7: warning: Class 'MailShareExtensionTargetAssembly' is unused
MailShareExtension/Proxy/URLOpener.swift:24:9: warning: Property 'extensionContext' is assigned, but never used
MailShareExtension/ShareViewController.swift:29:17: warning: Property 'dependencyInjectionHook' is unused

Copy link
Member

@PhilippeWeidmann PhilippeWeidmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a general comment, now errors are throwed at an upper level. From the code I read they could also be shown to the user which I don't think we want.
Before we used try? realm.write so the errors were ignored. As a good middle ground, maybe we could catch and send to sentry.

@adrien-coye
Copy link
Contributor Author

adrien-coye commented May 6, 2024

@PhilippeWeidmann Sure I'll match the old pattern.

My idea was all (DB write) errors should bubble up as they are critical. Silently fail on a write error is probably not ideal.

@PhilippeWeidmann
Copy link
Member

I'm see the idea but I don't think this is good UX, the user doesn't care / doesn't know what is a db write error. If we bubble up errors they have to be correctly translated and have a meaningful message.

@adrien-coye adrien-coye force-pushed the removeBackgroundRealm branch 7 times, most recently from 16a7d64 to 0dbac2a Compare May 6, 2024 11:50
Copy link

sonarcloud bot commented May 6, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@adrien-coye adrien-coye merged commit bbe4d51 into master May 7, 2024
7 checks passed
@adrien-coye adrien-coye deleted the removeBackgroundRealm branch May 7, 2024 07:30
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.

None yet

2 participants