Skip to content

Commit

Permalink
Remove unnecessary calls to .obj on MLContact
Browse files Browse the repository at this point in the history
We must explicitly cast MLContact.account to type xmpp?, as Swift
struggles to infer this by itself.
  • Loading branch information
matthewrfennell authored and tmolitor-stud-tu committed Aug 15, 2024
1 parent 6092aae commit 2f5e32a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Monal/Classes/ChannelMemberList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct ChannelMemberList: View {
@State private var participants: OrderedDictionary<String, String>

init(mucContact: ObservableKVOWrapper<MLContact>) {
account = mucContact.obj.account! as xmpp
account = (mucContact.account as xmpp?)!
_channel = StateObject(wrappedValue:mucContact)
_ownAffiliation = State(wrappedValue:"none")
_participants = State(wrappedValue:OrderedDictionary<String, String>())
Expand Down
2 changes: 1 addition & 1 deletion Monal/Classes/ContactDetails.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct ContactDetails: View {
init(delegate: SheetDismisserProtocol, contact: ObservableKVOWrapper<MLContact>) {
self.delegate = delegate
_contact = StateObject(wrappedValue: contact)
self.account = contact.obj.account!
self.account = (contact.account as xmpp?)!
}

private func updateRoleAndAffiliation() {
Expand Down
2 changes: 1 addition & 1 deletion Monal/Classes/EditGroupSubject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Monal/Classes/MemberList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct MemberList: View {
@StateObject private var overlay = LoadingOverlayState()

init(mucContact: ObservableKVOWrapper<MLContact>) {
account = mucContact.obj.account! as xmpp
account = (mucContact.account as xmpp?)!
_muc = StateObject(wrappedValue:mucContact)
_ownAffiliation = State(wrappedValue:"none")
_memberList = State(wrappedValue:OrderedSet<ObservableKVOWrapper<MLContact>>())
Expand Down
2 changes: 1 addition & 1 deletion Monal/Classes/OmemoKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion Monal/Classes/OmemoQrCodeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct OmemoQrCodeView: View {
init(contact: ObservableKVOWrapper<MLContact>)
{
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 = "?"
Expand Down

0 comments on commit 2f5e32a

Please sign in to comment.