Skip to content

Commit 725d7fc

Browse files
Merge pull request #4 from QuickBlox/release/0.1.2
Release QuickBlox UIKit 0.1.2
2 parents e5d60c6 + 8856111 commit 725d7fc

File tree

60 files changed

+1266
-566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1266
-566
lines changed

.DS_Store

-10 KB
Binary file not shown.

Sources/.DS_Store

-8 KB
Binary file not shown.

Sources/QuickBloxData/.DS_Store

-8 KB
Binary file not shown.

Sources/QuickBloxData/DTO/Dialog/RemoteDialogDTO.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public struct RemoteDialogDTO: Equatable {
1515
var type: DialogType = .private
1616
var name = ""
1717
var participantsIds: [String] = []
18+
var toDeleteIds: [String] = []
19+
var toAddIds: [String] = []
1820
var photo = ""
1921
var ownerId = ""
2022
var isOwnedByCurrentUser = false

Sources/QuickBloxData/Event/RemoteEvent.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public enum RemoteEvent {
1616
case history(_ messages: RemoteMessagesDTO)
1717
case read( _ messageID: String, dialogID: String)
1818
case delivered( _ messageID: String, dialogID: String)
19+
case typing( _ userID: UInt, dialogID: String)
20+
case stopTyping( _ userID: UInt, dialogID: String)
1921

2022
init(_ message: RemoteMessageDTO) {
2123
if message.type == .event {

Sources/QuickBloxData/Repository/DialogsRepository.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ extension DialogsRepository: DialogsRepositoryProtocol {
4545
return .read(messageID, dialogID: dialogID)
4646
case .delivered(let messageID, let dialogID):
4747
return .delivered(messageID, dialogID: dialogID)
48+
case .typing(let userID,let dialogID):
49+
return .typing(userID, dialogID: dialogID)
50+
case .stopTyping(let userID,let dialogID):
51+
return .stopTyping(userID, dialogID: dialogID)
4852
}
4953
}
5054
.eraseToAnyPublisher()
@@ -182,6 +186,30 @@ extension DialogsRepository: DialogsRepositoryProtocol {
182186
throw try error.repositoryException
183187
}
184188
}
189+
190+
public func subscribeToObserveTyping(dialog dialogId: String) async throws {
191+
do {
192+
try await remote.subscribeToObserveTyping(dialog: dialogId)
193+
} catch {
194+
throw try error.repositoryException
195+
}
196+
}
197+
198+
public func sendTyping(dialogInRemote dialogId: String) async throws {
199+
do {
200+
try await remote.sendTyping(dialog: dialogId)
201+
} catch {
202+
throw try error.repositoryException
203+
}
204+
}
205+
206+
public func sendStopTyping(dialogInRemote dialogId: String) async throws {
207+
do {
208+
try await remote.sendStopTyping(dialog: dialogId)
209+
} catch {
210+
throw try error.repositoryException
211+
}
212+
}
185213
}
186214

187215
private extension RemoteDialogDTO {

Sources/QuickBloxData/Repository/MessagesRepository.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ extension Message {
117117
isOwnedByCurrentUser = value.isOwnedByCurrentUser
118118
deliveredIds = value.deliveredIds
119119
readIds = value.readIds
120-
isRead = value.isReaded
121120
isDelivered = value.isDelivered
122-
type = value.type
121+
isRead = value.isReaded
123122
eventType = value.eventType
123+
type = value.type
124124
if let info = value.fileInfo {
125125
fileInfo = FileInfo(id: info.id,
126126
ext: info.ext,
-6 KB
Binary file not shown.

Sources/QuickBloxData/Source/Entity/Dialog.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@ public struct Dialog: DialogEntity {
5858
}
5959
}
6060

61+
public extension Dialog {
62+
init<T: DialogEntity>(_ value: T) {
63+
self.init(id: value.id,
64+
type: value.type,
65+
name: value.name,
66+
participantsIds: value.participantsIds,
67+
photo: value.photo,
68+
ownerId: value.ownerId,
69+
createdAt: value.createdAt,
70+
updatedAt: value.updatedAt,
71+
lastMessage: LastMessage(value.lastMessage),
72+
messages: value.messages.map{ Message($0) },
73+
unreadMessagesCount: value.unreadMessagesCount)
74+
isOwnedByCurrentUser = value.isOwnedByCurrentUser
75+
}
76+
}
77+
6178
public struct LastMessage: LastMessageEntity {
6279
public var id: String = ""
6380

@@ -81,3 +98,13 @@ public struct LastMessage: LastMessageEntity {
8198
self.dialogId = dialogId
8299
}
83100
}
101+
102+
public extension LastMessage {
103+
init<T: LastMessageEntity>(_ value: T) {
104+
self.init(id: value.id,
105+
text: value.text,
106+
dateSent: value.dateSent,
107+
userId: value.userId,
108+
dialogId: value.dialogId)
109+
}
110+
}

Sources/QuickBloxData/Source/Entity/File.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ public struct FileInfo: FileInfoEntity {
4747
}
4848
}
4949

50+
public extension FileInfo {
51+
init<T: FileInfoEntity>(_ value: T) {
52+
self.init(id: value.id,
53+
ext: value.ext,
54+
name: value.name,
55+
path: FilePath(value.path))
56+
}
57+
}
58+
5059
public struct FilePath: FilePathEntity {
5160
public var remote = ""
5261
public var local = ""
@@ -61,3 +70,9 @@ public struct FilePath: FilePathEntity {
6170

6271
public init() {}
6372
}
73+
74+
public extension FilePath {
75+
init<T: FilePathEntity>(_ value: T) {
76+
self.init(remote: value.remote, local: value.local)
77+
}
78+
}

0 commit comments

Comments
 (0)