From 2f5e32a193ea8f6823b9eb99c6972ca065ac4d64 Mon Sep 17 00:00:00 2001 From: Matthew Fennell Date: Tue, 6 Aug 2024 19:53:53 +0100 Subject: [PATCH] Remove unnecessary calls to .obj on MLContact We must explicitly cast MLContact.account to type xmpp?, as Swift struggles to infer this by itself. --- Monal/Classes/ChannelMemberList.swift | 2 +- Monal/Classes/ContactDetails.swift | 2 +- Monal/Classes/EditGroupSubject.swift | 2 +- Monal/Classes/MemberList.swift | 2 +- Monal/Classes/OmemoKeys.swift | 2 +- Monal/Classes/OmemoQrCodeView.swift | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Monal/Classes/ChannelMemberList.swift b/Monal/Classes/ChannelMemberList.swift index ff2f132d8..2509e56c4 100644 --- a/Monal/Classes/ChannelMemberList.swift +++ b/Monal/Classes/ChannelMemberList.swift @@ -15,7 +15,7 @@ struct ChannelMemberList: View { @State private var participants: OrderedDictionary init(mucContact: ObservableKVOWrapper) { - account = mucContact.obj.account! as xmpp + account = (mucContact.account as xmpp?)! _channel = StateObject(wrappedValue:mucContact) _ownAffiliation = State(wrappedValue:"none") _participants = State(wrappedValue:OrderedDictionary()) diff --git a/Monal/Classes/ContactDetails.swift b/Monal/Classes/ContactDetails.swift index 407021037..588177e82 100644 --- a/Monal/Classes/ContactDetails.swift +++ b/Monal/Classes/ContactDetails.swift @@ -35,7 +35,7 @@ struct ContactDetails: View { init(delegate: SheetDismisserProtocol, contact: ObservableKVOWrapper) { self.delegate = delegate _contact = StateObject(wrappedValue: contact) - self.account = contact.obj.account! + self.account = (contact.account as xmpp?)! } private func updateRoleAndAffiliation() { diff --git a/Monal/Classes/EditGroupSubject.swift b/Monal/Classes/EditGroupSubject.swift index c017ed114..779151164 100644 --- a/Monal/Classes/EditGroupSubject.swift +++ b/Monal/Classes/EditGroupSubject.swift @@ -19,7 +19,7 @@ struct EditGroupSubject: View { _subject = State(wrappedValue: contact.obj.groupSubject) _contact = StateObject(wrappedValue: contact) - self.account = contact.obj.account! as xmpp + self.account = (contact.account as xmpp?)! } var body: some View { diff --git a/Monal/Classes/MemberList.swift b/Monal/Classes/MemberList.swift index d1d1ca18f..9303242c2 100644 --- a/Monal/Classes/MemberList.swift +++ b/Monal/Classes/MemberList.swift @@ -30,7 +30,7 @@ struct MemberList: View { @StateObject private var overlay = LoadingOverlayState() init(mucContact: ObservableKVOWrapper) { - account = mucContact.obj.account! as xmpp + account = (mucContact.account as xmpp?)! _muc = StateObject(wrappedValue:mucContact) _ownAffiliation = State(wrappedValue:"none") _memberList = State(wrappedValue:OrderedSet>()) diff --git a/Monal/Classes/OmemoKeys.swift b/Monal/Classes/OmemoKeys.swift index 7157c3f8d..54413a30c 100644 --- a/Monal/Classes/OmemoKeys.swift +++ b/Monal/Classes/OmemoKeys.swift @@ -292,7 +292,7 @@ struct OmemoKeysForChat: View { self.viewContact = contact if let contact = contact { - if let account = contact.obj.account { + if let account = contact.account as xmpp? { self.account = account } } diff --git a/Monal/Classes/OmemoQrCodeView.swift b/Monal/Classes/OmemoQrCodeView.swift index c41028635..012403af9 100644 --- a/Monal/Classes/OmemoQrCodeView.swift +++ b/Monal/Classes/OmemoQrCodeView.swift @@ -30,7 +30,7 @@ struct OmemoQrCodeView: View { init(contact: ObservableKVOWrapper) { self.jid = contact.obj.contactJid - if let account = contact.obj.account { + if let account = contact.account as xmpp? { let devices = Array(account.omemo.knownDevices(forAddressName: self.jid)) var keyList = "" var prefix = "?"