wip
This commit is contained in:
parent
32e42f8506
commit
87642a5a10
|
@ -7,6 +7,7 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
07D2570A3091519439B47A6A /* Chat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9B95CF9DA11FCEE44990A0 /* Chat.swift */; };
|
||||
08CAF17FA202CF3CB760D93C /* Pods_NotificationService.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B7A5555D807EE78C95217FD /* Pods_NotificationService.framework */; };
|
||||
1767C5109B06AA6FDCD990E6 /* AimErrors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 404FB187FD6CB3DD41DAC820 /* AimErrors.swift */; };
|
||||
1C8760F8FB99C27D0C3A6ED1 /* RegistrationScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82D4382FFF3D97C4E1D7727C /* RegistrationScreen.swift */; };
|
||||
|
@ -86,6 +87,7 @@
|
|||
38720923251EDE07001837EB /* MLXEPSlashMeHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 38720921251EDE07001837EB /* MLXEPSlashMeHandler.m */; };
|
||||
389E298C25E901CA009A5268 /* MLAudioRecoderManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 389E298925E901CA009A5268 /* MLAudioRecoderManager.m */; };
|
||||
389E298D25E901CA009A5268 /* MLAudioRecoderManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 389E298B25E901CA009A5268 /* MLAudioRecoderManager.h */; };
|
||||
3BBDABE6BF04654E4D73FE94 /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8DEED95641012F70DC22087 /* Account.swift */; };
|
||||
3D06A515281FFCC000DDAE90 /* NotificationDebugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D06A514281FFCC000DDAE90 /* NotificationDebugging.swift */; };
|
||||
3D27D956290B0BB60014748B /* AddContactMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D27D955290B0BB60014748B /* AddContactMenu.swift */; };
|
||||
3D27D958290B0BC80014748B /* ContactRequestsMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D27D957290B0BC80014748B /* ContactRequestsMenu.swift */; };
|
||||
|
@ -131,7 +133,7 @@
|
|||
54E594BE2523C34B00E4172B /* MLPubSub.m in Sources */ = {isa = PBXBuildFile; fileRef = 54E594BC2523C34A00E4172B /* MLPubSub.m */; };
|
||||
54F0B81928231691003664BD /* WelcomeLogIn.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54F0B81828231690003664BD /* WelcomeLogIn.swift */; };
|
||||
54F0B81C282316F5003664BD /* RegisterAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54F0B81B282316F5003664BD /* RegisterAccount.swift */; };
|
||||
598A717356906687AD101542 /* MonalWrapperModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 282FE922A600668B10016B4C /* MonalWrapperModels.swift */; };
|
||||
5C2B6A5C14F38F315ECC3F5E /* ScenarioLogIn.swift in Sources */ = {isa = PBXBuildFile; fileRef = C02B964344F7E01D60E660D7 /* ScenarioLogIn.swift */; };
|
||||
6E9488F6997650B805476F25 /* Pods_another_im.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F29121F912380F72CCE51747 /* Pods_another_im.framework */; };
|
||||
7D40218FEAB3BA882811A682 /* Pods_Monal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C40963CED187B2F1B4B88F7 /* Pods_Monal.framework */; };
|
||||
7E1C0AC72CEF68C000B8FEC0 /* MainTabScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E1C0AC62CEF68C000B8FEC0 /* MainTabScreen.swift */; };
|
||||
|
@ -283,6 +285,7 @@
|
|||
D09B51F62C7F30DD008D725B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 26B2A4BA1B73061400272E63 /* Images.xcassets */; };
|
||||
D0FA79B12C7E5C7400216D2A /* ServerDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0FA79B02C7E5C7400216D2A /* ServerDetails.swift */; };
|
||||
D7E74AF213445E39318BC648 /* Pods_MonalUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29250DA62DD2322383585B2B /* Pods_MonalUITests.framework */; };
|
||||
DEDA22BC3DBA90E586F6B7CE /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 405F76B4AD0B916C50352D23 /* Message.swift */; };
|
||||
E89DD32525C6626400925F62 /* MLFileTransferDataCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E89DD32025C6626300925F62 /* MLFileTransferDataCell.m */; };
|
||||
E89DD32625C6626400925F62 /* MLFileTransferVideoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E89DD32125C6626300925F62 /* MLFileTransferVideoCell.m */; };
|
||||
E89DD32725C6626400925F62 /* MLFileTransferFileViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E89DD32225C6626300925F62 /* MLFileTransferFileViewController.m */; };
|
||||
|
@ -290,6 +293,7 @@
|
|||
E8CF9CC726249640001A1952 /* MLSettingsAboutViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8CF9CC026249640001A1952 /* MLSettingsAboutViewController.m */; };
|
||||
E8DED06225388BE8003167FF /* MLSearchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DED06125388BE8003167FF /* MLSearchViewController.m */; };
|
||||
F9C277F46F5157194744C491 /* Pods_shareSheet.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8F1488206B764014DD7EC92A /* Pods_shareSheet.framework */; };
|
||||
FB2F7FAE1616F093C3E3B7E3 /* Contact.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4345AD68A77CBACCCA9FA1D /* Contact.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
|
@ -576,11 +580,11 @@
|
|||
26FC619524EB6C270094C302 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = external/en.lproj/iosShare.strings; sourceTree = "<group>"; };
|
||||
26FE3BC91C61A6C3003CC230 /* MLResizingTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLResizingTextView.h; sourceTree = "<group>"; };
|
||||
26FE3BCA1C61A6C3003CC230 /* MLResizingTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MLResizingTextView.m; sourceTree = "<group>"; };
|
||||
282FE922A600668B10016B4C /* MonalWrapperModels.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = MonalWrapperModels.swift; sourceTree = "<group>"; };
|
||||
29250DA62DD2322383585B2B /* Pods_MonalUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MonalUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
2B7A5555D807EE78C95217FD /* Pods_NotificationService.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NotificationService.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2C59BAF969550DFAC27E5F2B /* Pods_MonalXMPPUnitTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MonalXMPPUnitTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2C9B95CF9DA11FCEE44990A0 /* Chat.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Chat.swift; sourceTree = "<group>"; };
|
||||
2D8673A73C41D0B1697FE97D /* LoginScreen.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = LoginScreen.swift; sourceTree = "<group>"; };
|
||||
2E5021A8D40FCC591D952104 /* Pods-NotificaionService.alpha-ios.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificaionService.alpha-ios.xcconfig"; path = "Target Support Files/Pods-NotificaionService/Pods-NotificaionService.alpha-ios.xcconfig"; sourceTree = "<group>"; };
|
||||
32CA4F630368D1EE00C91783 /* MonalSourceCodePrefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MonalSourceCodePrefix.pch; sourceTree = "<group>"; };
|
||||
|
@ -607,6 +611,7 @@
|
|||
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>"; };
|
||||
404FB187FD6CB3DD41DAC820 /* AimErrors.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AimErrors.swift; sourceTree = "<group>"; };
|
||||
405F76B4AD0B916C50352D23 /* Message.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Message.swift; 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>"; };
|
||||
4862C3A0242FB4F709B8F3FF /* Pods-MonalXMPPUnitTests.beta.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MonalXMPPUnitTests.beta.xcconfig"; path = "Target Support Files/Pods-MonalXMPPUnitTests/Pods-MonalXMPPUnitTests.beta.xcconfig"; sourceTree = "<group>"; };
|
||||
4A614910EEF29D66DD4B37E3 /* Pods-NotificaionService.adhoc.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificaionService.adhoc.xcconfig"; path = "Target Support Files/Pods-NotificaionService/Pods-NotificaionService.adhoc.xcconfig"; sourceTree = "<group>"; };
|
||||
|
@ -779,6 +784,7 @@
|
|||
B8155E63F8DE80FF36D0B3B7 /* Pods-NotificationService.adhoc.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.adhoc.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.adhoc.xcconfig"; sourceTree = "<group>"; };
|
||||
BC9E05245CF07072A35AE126 /* Pods-another.im.alpha.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-another.im.alpha.xcconfig"; path = "Target Support Files/Pods-another.im/Pods-another.im.alpha.xcconfig"; sourceTree = "<group>"; };
|
||||
BFA9EFD7A8064201C81F52CF /* Pods-Monal.alpha.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Monal.alpha.xcconfig"; path = "Target Support Files/Pods-Monal/Pods-Monal.alpha.xcconfig"; sourceTree = "<group>"; };
|
||||
C02B964344F7E01D60E660D7 /* ScenarioLogIn.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ScenarioLogIn.swift; sourceTree = "<group>"; };
|
||||
C10490482612ED2F0054AC9E /* MLEmoji.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MLEmoji.swift; sourceTree = "<group>"; };
|
||||
C10490E22612F3D00054AC9E /* MLCrypto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MLCrypto.swift; sourceTree = "<group>"; };
|
||||
C10490EA2612F3E00054AC9E /* EncryptedPayload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptedPayload.swift; sourceTree = "<group>"; };
|
||||
|
@ -906,6 +912,8 @@
|
|||
C1F5C7A72775DA000001F295 /* MLContactSoftwareVersionInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MLContactSoftwareVersionInfo.h; sourceTree = "<group>"; };
|
||||
C1F5C7A82775DA000001F295 /* MLContactSoftwareVersionInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MLContactSoftwareVersionInfo.m; sourceTree = "<group>"; };
|
||||
C1F5C7AB2777621B0001F295 /* ContactResources.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactResources.swift; sourceTree = "<group>"; };
|
||||
C4345AD68A77CBACCCA9FA1D /* Contact.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Contact.swift; sourceTree = "<group>"; };
|
||||
C8DEED95641012F70DC22087 /* Account.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Account.swift; sourceTree = "<group>"; };
|
||||
CCF3CF336EBAA5802383370F /* WelcomeScreen.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = WelcomeScreen.swift; sourceTree = "<group>"; };
|
||||
D02192F22C89BB3800202A59 /* BlockedUsers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlockedUsers.swift; sourceTree = "<group>"; };
|
||||
D0FA79B02C7E5C7400216D2A /* ServerDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerDetails.swift; sourceTree = "<group>"; };
|
||||
|
@ -1443,7 +1451,7 @@
|
|||
name = tools;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
|
||||
29B97314FDCFA39411CA2CEA = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8414ADF92A7ABAC900EFFCCC /* Packages */,
|
||||
|
@ -1571,7 +1579,8 @@
|
|||
children = (
|
||||
7E6AF38E2CEB9110004328B5 /* MonalXmppWrapper.swift */,
|
||||
404FB187FD6CB3DD41DAC820 /* AimErrors.swift */,
|
||||
282FE922A600668B10016B4C /* MonalWrapperModels.swift */,
|
||||
E23C31EA05858AFC0AB43D06 /* Scenaries */,
|
||||
8C5F2E42A69F9A7B93A20F78 /* Models */,
|
||||
);
|
||||
path = XMPP;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1765,6 +1774,18 @@
|
|||
path = WebRTC;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8C5F2E42A69F9A7B93A20F78 /* Models */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C8DEED95641012F70DC22087 /* Account.swift */,
|
||||
C4345AD68A77CBACCCA9FA1D /* Contact.swift */,
|
||||
2C9B95CF9DA11FCEE44990A0 /* Chat.swift */,
|
||||
405F76B4AD0B916C50352D23 /* Message.swift */,
|
||||
);
|
||||
name = Models;
|
||||
path = Models;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C1049187261301530054AC9E /* MonalXMPPUnitTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -1831,6 +1852,15 @@
|
|||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E23C31EA05858AFC0AB43D06 /* Scenaries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C02B964344F7E01D60E660D7 /* ScenarioLogIn.swift */,
|
||||
);
|
||||
name = Scenaries;
|
||||
path = Scenaries;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EA534340732BF66B533E4C0B /* Generated */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -2144,7 +2174,7 @@
|
|||
eu,
|
||||
"es-AR",
|
||||
);
|
||||
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
|
||||
mainGroup = 29B97314FDCFA39411CA2CEA;
|
||||
packageReferences = (
|
||||
C1F5C7AD2777638B0001F295 /* XCRemoteSwiftPackageReference "swift-collections" */,
|
||||
841898A82957712000FEC77D /* XCRemoteSwiftPackageReference "ViewExtractor" */,
|
||||
|
@ -2755,7 +2785,11 @@
|
|||
C11E557980B75AA90738EC9C /* LoginScreen.swift in Sources */,
|
||||
1C8760F8FB99C27D0C3A6ED1 /* RegistrationScreen.swift in Sources */,
|
||||
1767C5109B06AA6FDCD990E6 /* AimErrors.swift in Sources */,
|
||||
598A717356906687AD101542 /* MonalWrapperModels.swift in Sources */,
|
||||
3BBDABE6BF04654E4D73FE94 /* Account.swift in Sources */,
|
||||
FB2F7FAE1616F093C3E3B7E3 /* Contact.swift in Sources */,
|
||||
07D2570A3091519439B47A6A /* Chat.swift in Sources */,
|
||||
DEDA22BC3DBA90E586F6B7CE /* Message.swift in Sources */,
|
||||
5C2B6A5C14F38F315ECC3F5E /* ScenarioLogIn.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
33
Monal/another.im/XMPP/Models/Account.swift
Normal file
33
Monal/another.im/XMPP/Models/Account.swift
Normal file
|
@ -0,0 +1,33 @@
|
|||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
struct Account: Identifiable {
|
||||
let id: Int
|
||||
let local: String
|
||||
let domain: String
|
||||
let resource: String
|
||||
let isEnabled: Bool
|
||||
|
||||
var jid: String {
|
||||
"\(local)@\(domain)"
|
||||
}
|
||||
|
||||
init?(_ dict: NSDictionary) {
|
||||
guard let id = dict.value(forKey: "account_id") as? Int else { return nil }
|
||||
guard let local = dict.value(forKey: "username") as? String else { return nil }
|
||||
guard let domain = dict.value(forKey: "domain") as? String else { return nil }
|
||||
guard let resource = dict.value(forKey: "resource") as? String else { return nil }
|
||||
guard let isEnabled = dict.value(forKey: "enabled") as? Bool else { return nil }
|
||||
|
||||
self.id = id
|
||||
self.local = local
|
||||
self.domain = domain
|
||||
self.resource = resource
|
||||
self.isEnabled = isEnabled
|
||||
}
|
||||
}
|
||||
|
||||
extension Account: UniversalInputSelectionElement {
|
||||
var icon: Image? { nil }
|
||||
var text: String? { jid }
|
||||
}
|
27
Monal/another.im/XMPP/Models/Chat.swift
Normal file
27
Monal/another.im/XMPP/Models/Chat.swift
Normal file
|
@ -0,0 +1,27 @@
|
|||
import Foundation
|
||||
import monalxmpp
|
||||
|
||||
struct Chat: Identifiable {
|
||||
let accountId: Int
|
||||
let participantJid: String
|
||||
let participantName: String?
|
||||
|
||||
var id: String {
|
||||
"\(accountId)_\(participantJid)"
|
||||
}
|
||||
|
||||
var name: String {
|
||||
if let participantName, !participantName.isEmpty {
|
||||
return participantName
|
||||
} else {
|
||||
return participantJid
|
||||
}
|
||||
}
|
||||
|
||||
init?(_ obj: MLContact) {
|
||||
guard let accId = obj.accountID as? Int else { return nil }
|
||||
accountId = accId
|
||||
participantJid = obj.contactJid
|
||||
participantName = obj.nickName
|
||||
}
|
||||
}
|
16
Monal/another.im/XMPP/Models/Contact.swift
Normal file
16
Monal/another.im/XMPP/Models/Contact.swift
Normal file
|
@ -0,0 +1,16 @@
|
|||
import Foundation
|
||||
import monalxmpp
|
||||
|
||||
struct Contact: Identifiable {
|
||||
let ownerId: Int
|
||||
let contactJid: String
|
||||
let name: String?
|
||||
|
||||
var id: String { contactJid }
|
||||
|
||||
init?(_ obj: MLContact) {
|
||||
ownerId = obj.accountID.intValue
|
||||
contactJid = obj.contactJid
|
||||
name = obj.nickName.isEmpty ? nil : obj.nickName
|
||||
}
|
||||
}
|
29
Monal/another.im/XMPP/Models/Message.swift
Normal file
29
Monal/another.im/XMPP/Models/Message.swift
Normal file
|
@ -0,0 +1,29 @@
|
|||
import Foundation
|
||||
import monalxmpp
|
||||
|
||||
struct Message: Identifiable {
|
||||
let accountId: Int
|
||||
let participantJid: String
|
||||
let dbId: Int
|
||||
let stanzaId: String
|
||||
let timestamp: Date
|
||||
let body: String
|
||||
let isInbound: Bool
|
||||
let encrypted: Bool
|
||||
|
||||
var id: String {
|
||||
"\(accountId)|\(dbId)"
|
||||
}
|
||||
|
||||
init?(_ obj: MLMessage) {
|
||||
guard let accId = obj.accountID as? Int, let dbId = obj.messageDBId as? Int else { return nil }
|
||||
accountId = accId
|
||||
participantJid = obj.participantJid
|
||||
self.dbId = dbId
|
||||
stanzaId = obj.stanzaId
|
||||
timestamp = obj.timestamp
|
||||
body = obj.messageText
|
||||
isInbound = obj.inbound
|
||||
encrypted = obj.encrypted
|
||||
}
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
import Foundation
|
||||
import monalxmpp
|
||||
import SwiftUI
|
||||
|
||||
// MARK: - Account
|
||||
enum AccountsAvailability {
|
||||
case noAccounts
|
||||
case allDisabled
|
||||
case someEnabled
|
||||
}
|
||||
|
||||
struct Account: Identifiable {
|
||||
let id: Int
|
||||
let local: String
|
||||
let domain: String
|
||||
let resource: String
|
||||
let isEnabled: Bool
|
||||
|
||||
var jid: String {
|
||||
"\(local)@\(domain)"
|
||||
}
|
||||
|
||||
init?(_ dict: NSDictionary) {
|
||||
guard let id = dict.value(forKey: "account_id") as? Int else { return nil }
|
||||
guard let local = dict.value(forKey: "username") as? String else { return nil }
|
||||
guard let domain = dict.value(forKey: "domain") as? String else { return nil }
|
||||
guard let resource = dict.value(forKey: "resource") as? String else { return nil }
|
||||
guard let isEnabled = dict.value(forKey: "enabled") as? Bool else { return nil }
|
||||
|
||||
self.id = id
|
||||
self.local = local
|
||||
self.domain = domain
|
||||
self.resource = resource
|
||||
self.isEnabled = isEnabled
|
||||
}
|
||||
}
|
||||
|
||||
extension Account: UniversalInputSelectionElement {
|
||||
var icon: Image? { nil }
|
||||
var text: String? { jid }
|
||||
}
|
||||
|
||||
// MARK: - Contact
|
||||
struct Contact: Identifiable {
|
||||
let ownerId: Int
|
||||
let contactJid: String
|
||||
let name: String?
|
||||
|
||||
var id: String { contactJid }
|
||||
|
||||
init?(_ obj: MLContact) {
|
||||
ownerId = obj.accountID.intValue
|
||||
contactJid = obj.contactJid
|
||||
name = obj.nickName.isEmpty ? nil : obj.nickName
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Chat
|
||||
struct Chat: Identifiable {
|
||||
let accountId: Int
|
||||
let participantJid: String
|
||||
let participantName: String?
|
||||
|
||||
var id: String {
|
||||
"\(accountId)_\(participantJid)"
|
||||
}
|
||||
|
||||
var name: String {
|
||||
if let participantName, !participantName.isEmpty {
|
||||
return participantName
|
||||
} else {
|
||||
return participantJid
|
||||
}
|
||||
}
|
||||
|
||||
init?(_ obj: MLContact) {
|
||||
guard let accId = obj.accountID as? Int else { return nil }
|
||||
accountId = accId
|
||||
participantJid = obj.contactJid
|
||||
participantName = obj.nickName
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Message
|
||||
struct Message: Identifiable {
|
||||
let accountId: Int
|
||||
let participantJid: String
|
||||
let dbId: Int
|
||||
let stanzaId: String
|
||||
let timestamp: Date
|
||||
let body: String
|
||||
let isInbound: Bool
|
||||
let encrypted: Bool
|
||||
|
||||
var id: String {
|
||||
"\(accountId)|\(dbId)"
|
||||
}
|
||||
|
||||
init?(_ obj: MLMessage) {
|
||||
guard let accId = obj.accountID as? Int, let dbId = obj.messageDBId as? Int else { return nil }
|
||||
accountId = accId
|
||||
participantJid = obj.participantJid
|
||||
self.dbId = dbId
|
||||
stanzaId = obj.stanzaId
|
||||
timestamp = obj.timestamp
|
||||
body = obj.messageText
|
||||
isInbound = obj.inbound
|
||||
encrypted = obj.encrypted
|
||||
}
|
||||
}
|
|
@ -1,6 +1,12 @@
|
|||
import Foundation
|
||||
import monalxmpp
|
||||
|
||||
enum AccountsAvailability {
|
||||
case noAccounts
|
||||
case allDisabled
|
||||
case someEnabled
|
||||
}
|
||||
|
||||
final class MonalXmppWrapper: ObservableObject {
|
||||
@Published private(set) var accountsAvailability: AccountsAvailability = .noAccounts
|
||||
@Published private(set) var accounts: [Account] = []
|
||||
|
@ -260,7 +266,9 @@ final class MonalChatWrapper: ObservableObject {
|
|||
acc.setMAMQueryMostRecentFor(monalContact, before: lastStanzaId) { [weak self] msgs, _ in
|
||||
self?.mamRequestInProgress = false
|
||||
if !(msgs ?? []).isEmpty {
|
||||
self?.refreshMessages()
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.refreshMessages()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1
Monal/another.im/XMPP/Scenaries/ScenarioLogIn.swift
Normal file
1
Monal/another.im/XMPP/Scenaries/ScenarioLogIn.swift
Normal file
|
@ -0,0 +1 @@
|
|||
import Foundation
|
Loading…
Reference in a new issue