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

fix: Treat user as nullable #1454

Merged
merged 1 commit into from
Jun 14, 2024
Merged

fix: Treat user as nullable #1454

merged 1 commit into from
Jun 14, 2024

Conversation

PhilippeWeidmann
Copy link
Member

For some legacy reasons account.user is forced unwrap this can lead to crashes.
This PR aims to reduce the number (not yet to 0) of places where user is not safely accessed.

In an ideal world without data races, when the user is nil the account shouldn't be connected but this not (yet) the case.

Copy link

sonarcloud bot commented Jun 14, 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

Copy link

Found 56 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/Attachments/AttachmentsManager.swift:63:62: warning: Protocol 'AttachmentsManageable' conformance is redundant
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:278:8: warning: Struct 'OnboardingView_Previews' is unused
Mail/Views/SplitView.swift:67:36: warning: Property 'featureFlagsManageable' is unused
Mail/Views/SplitView.swift:333: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 List/UpdateVersionAlertView.swift:31:86: warning: Property 'hasDismissedUpdateVersionView' is unused
Mail/Views/Thread List/UpdateVersionView.swift:29:18: warning: Property 'isShowingUpdateAlert' 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:143:8: warning: Struct 'MessageHeaderSummaryView_Previews' is unused
Mail/Views/Thread/Message/MessageView.swift:148: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/Recipient.swift:33:9: warning: Property 'from' is unused
MailCore/Models/Recipient.swift:36:9: warning: Property 'bcc' 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

@valentinperignon valentinperignon merged commit db057a9 into master Jun 14, 2024
9 checks passed
@valentinperignon valentinperignon deleted the handle-nil-user branch June 14, 2024 12:57
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