Skip to content

Commit

Permalink
Append "View" to OmemoKeys views
Browse files Browse the repository at this point in the history
This is in preparation for adding view models for each of these views,
with a consistent naming scheme.
  • Loading branch information
matthewrfennell authored and tmolitor-stud-tu committed Aug 15, 2024
1 parent e609261 commit 6d080c7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Monal/Classes/ContactDetails.swift
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ struct ContactDetails: View {
#if !DISABLE_OMEMO
if !HelperTools.isContactBlacklisted(forEncryption:contact.obj) && !contact.isSelfChat {
if !contact.isGroup || contact.mucType == "group" {
NavigationLink(destination: LazyClosureView(OmemoKeys(contact: contact))) {
NavigationLink(destination: LazyClosureView(OmemoKeysView(contact: contact))) {
Text("Encryption Keys")
}
}
Expand Down
22 changes: 11 additions & 11 deletions Monal/Classes/OmemoKeys.swift → Monal/Classes/OmemoKeysView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import OrderedCollections

struct OmemoKeysEntry: View {
struct OmemoKeysEntryView: View {
private let contactJid: String

@State private var trustLevel: NSNumber
Expand Down Expand Up @@ -195,7 +195,7 @@ struct OmemoKeysEntry: View {
}
}

struct OmemoKeysForContact: View {
struct OmemoKeysForContactView: View {
@State private var deviceIds: OrderedSet<NSNumber>
@State private var showDeleteKeyAlert = false
@State private var selectedDeviceForDeletion : NSNumber
Expand All @@ -212,7 +212,7 @@ struct OmemoKeysForContact: View {
self.ownKeys = (account.connectionProperties.identity.jid == contact.obj.contactJid)
self.contactJid = contact.obj.contactJid
self.account = account
self.deviceIds = OmemoKeysForContact.knownDevices(account: self.account, jid: self.contactJid)
self.deviceIds = OmemoKeysForContactView.knownDevices(account: self.account, jid: self.contactJid)
self.selectedDeviceForDeletion = -1
}

Expand All @@ -221,7 +221,7 @@ struct OmemoKeysForContact: View {
}

private func refreshKnownDevices() -> Void {
self.deviceIds = OmemoKeysForContact.knownDevices(account: self.account, jid: self.contactJid)
self.deviceIds = OmemoKeysForContactView.knownDevices(account: self.account, jid: self.contactJid)
}

func deleteButton(deviceId: NSNumber) -> some View {
Expand Down Expand Up @@ -252,7 +252,7 @@ struct OmemoKeysForContact: View {
ForEach(self.deviceIds, id: \.self) { deviceId in
HStack {
ZStack(alignment: .topLeading) {
OmemoKeysEntry(account: self.account, contactJid: self.contactJid, deviceId: deviceId, isOwnDevice: (ownKeys && deviceId == self.deviceId))
OmemoKeysEntryView(account: self.account, contactJid: self.contactJid, deviceId: deviceId, isOwnDevice: (ownKeys && deviceId == self.deviceId))
if(ownKeys == true) {
if(deviceId != self.deviceId) {
deleteButton(deviceId: deviceId)
Expand All @@ -271,7 +271,7 @@ struct OmemoKeysForContact: View {
}
}

struct OmemoKeysForChat: View {
struct OmemoKeysForChatView: View {
private var viewContact: ObservableKVOWrapper<MLContact>? // store initial contact with which the view was initialized for refreshs...
private var account: xmpp?

Expand Down Expand Up @@ -353,12 +353,12 @@ struct OmemoKeysForChat: View {
Section(header:helpDescription) {
if (self.contacts.count == 1) {
ForEach(self.contacts, id: \.self.obj) { contact in
OmemoKeysForContact(contact: contact, account: self.account!)
OmemoKeysForContactView(contact: contact, account: self.account!)
}
} else {
ForEach(self.contacts, id: \.self.obj) { contact in
DisclosureGroup(content: {
OmemoKeysForContact(contact: contact, account: self.account!)
OmemoKeysForContactView(contact: contact, account: self.account!)
}, label: {
HStack {
Text("Keys of \(contact.obj.contactJid)")
Expand Down Expand Up @@ -416,7 +416,7 @@ struct OmemoKeysForChat: View {
}
}

struct OmemoKeys: View {
struct OmemoKeysView: View {
private var viewContact: ObservableKVOWrapper<MLContact>?
private var account: xmpp?
@State private var contacts: OrderedSet<ObservableKVOWrapper<MLContact>>
Expand All @@ -429,7 +429,7 @@ struct OmemoKeys: View {

var body: some View {
if self.account != nil && !self.contacts.isEmpty {
OmemoKeysForChat(contact: viewContact)
OmemoKeysForChatView(contact: viewContact)
} else if self.contacts.isEmpty {
ContentUnavailableShimView("No Contacts", systemImage: "person.2.slash", description: Text("Cannot display keys as there are no contacts to display keys for."))
} else if self.account == nil {
Expand All @@ -441,6 +441,6 @@ struct OmemoKeys: View {
struct OmemoKeys_Previews: PreviewProvider {
static var previews: some View {
// TODO some dummy views, requires a dummy xmpp obj
OmemoKeys(contact:nil);
OmemoKeysView(contact:nil);
}
}
4 changes: 2 additions & 2 deletions Monal/Classes/SwiftuiHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,9 @@ class SwiftuiInterface : NSObject {
func makeOwnOmemoKeyView(_ ownContact: MLContact?) -> UIViewController {
let host = UIHostingController(rootView:AnyView(EmptyView()))
if(ownContact == nil) {
host.rootView = AnyView(OmemoKeys(contact: nil))
host.rootView = AnyView(OmemoKeysView(contact: nil))
} else {
host.rootView = AnyView(OmemoKeys(contact: ObservableKVOWrapper<MLContact>(ownContact!)))
host.rootView = AnyView(OmemoKeysView(contact: ObservableKVOWrapper<MLContact>(ownContact!)))
}
return host
}
Expand Down
8 changes: 4 additions & 4 deletions Monal/Monal.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
3D65B791272350F0005A30F4 /* SwiftuiHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D65B790272350F0005A30F4 /* SwiftuiHelpers.swift */; };
3D7D352328626CB80042C5E5 /* LoadingOverlay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D7D352228626CB80042C5E5 /* LoadingOverlay.swift */; };
3D85E587282AE523006F5B3A /* OmemoQrCodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D85E586282AE523006F5B3A /* OmemoQrCodeView.swift */; };
3DC5035C2822F5220064C8A7 /* OmemoKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DC5035B2822F5220064C8A7 /* OmemoKeys.swift */; };
3DC5035C2822F5220064C8A7 /* OmemoKeysView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DC5035B2822F5220064C8A7 /* OmemoKeysView.swift */; };
43A92B80C8CD5E04074B5A3E /* Pods_MonalXMPPUnitTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C59BAF969550DFAC27E5F2B /* Pods_MonalXMPPUnitTests.framework */; };
540A3FAD24D674BD0008965D /* MLSQLite.m in Sources */ = {isa = PBXBuildFile; fileRef = 540A3FAC24D674BD0008965D /* MLSQLite.m */; };
540BD0D224D8D1F40087A743 /* IPC.h in Headers */ = {isa = PBXBuildFile; fileRef = 540BD0D124D8D1F20087A743 /* IPC.h */; };
Expand Down Expand Up @@ -518,7 +518,7 @@
3D7D352228626CB80042C5E5 /* LoadingOverlay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingOverlay.swift; sourceTree = "<group>"; };
3D85E586282AE523006F5B3A /* OmemoQrCodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OmemoQrCodeView.swift; sourceTree = "<group>"; };
3D88BB76295BB6DC00FB30BA /* CreateGroupMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateGroupMenu.swift; sourceTree = "<group>"; };
3DC5035B2822F5220064C8A7 /* OmemoKeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OmemoKeys.swift; sourceTree = "<group>"; };
3DC5035B2822F5220064C8A7 /* OmemoKeysView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OmemoKeysView.swift; sourceTree = "<group>"; };
3EB7A7084FA9A8F68A3D251C /* Pods-MonalXMPPUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MonalXMPPUnitTests.debug.xcconfig"; path = "Target Support Files/Pods-MonalXMPPUnitTests/Pods-MonalXMPPUnitTests.debug.xcconfig"; sourceTree = "<group>"; };
4049F81F60EA5B7A57A4E9C6 /* Pods-NotificationService.beta.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.beta.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.beta.xcconfig"; sourceTree = "<group>"; };
43FFAD161EF5A0B1CB149814 /* Pods-shareSheet.alpha-ios.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-shareSheet.alpha-ios.xcconfig"; path = "Target Support Files/Pods-shareSheet/Pods-shareSheet.alpha-ios.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1112,7 +1112,7 @@
children = (
C1F5C7AB2777621B0001F295 /* ContactResources.swift */,
3D85E586282AE523006F5B3A /* OmemoQrCodeView.swift */,
3DC5035B2822F5220064C8A7 /* OmemoKeys.swift */,
3DC5035B2822F5220064C8A7 /* OmemoKeysView.swift */,
3D65B78C27234B74005A30F4 /* ContactDetails.swift */,
3D5A91412842B4AE008CE57E /* MemberList.swift */,
C18967C62B81F61B0073C7C5 /* ChannelMemberList.swift */,
Expand Down Expand Up @@ -2098,7 +2098,7 @@
84FC375928981A5600634E3E /* PasswordMigration.swift in Sources */,
E89DD32625C6626400925F62 /* MLFileTransferVideoCell.m in Sources */,
26E3ED871FEC0CB7008ABDA5 /* MLServerDetails.m in Sources */,
3DC5035C2822F5220064C8A7 /* OmemoKeys.swift in Sources */,
3DC5035C2822F5220064C8A7 /* OmemoKeysView.swift in Sources */,
262797AF178A577300B85D94 /* MLContactCell.m in Sources */,
2696EED21791245A00BC54B8 /* chatViewController.m in Sources */,
C12436142434AB5D00B8F074 /* MLAttributedLabel.m in Sources */,
Expand Down

0 comments on commit 6d080c7

Please sign in to comment.