Skip to content

Commit 1cd8546

Browse files
Release 0.1.3
1 parent 67b8c50 commit 1cd8546

File tree

70 files changed

+2116
-1013
lines changed

Some content is hidden

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

70 files changed

+2116
-1013
lines changed

Sources/QuickBloxData/Source/Remote/RemoteDataSource.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ private actor Chat {
8686

8787
func send(_ message: QBChatMessage) async {
8888
guard let id = dialog.id, id == message.dialogID else { return }
89-
if dialog.type != .private {
89+
if dialog.type != .private, dialog.isJoined() == false {
9090
await subscribe()
9191
}
9292
do {
93-
try await Task.wait(second: 0.3)
93+
try await Task.wait(second: 1.3)
9494
try Task.checkCancellation()
9595
message.dateSent = Date()
9696
try await dialog.send(message)
@@ -583,7 +583,7 @@ extension RemoteDataSource {
583583
.newLine
584584
}
585585

586-
let photo = dto.photo == "" ? nil : dto.photo
586+
let photo = dto.photo == "null" ? "null" : dto.photo
587587
if dialog.photo != photo {
588588
dialog.photo = photo
589589

Sources/QuickBloxDomain/UseCase/Dialog/UpdateDialog.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ where DialogItem == Repo.DialogEntityItem, UserItem == Repo.UsersEntityItem {
2626

2727
public func execute() async throws {
2828
do {
29-
_ = try await repo.update(dialogInRemote: dialog, users: users)
29+
let _ = try await repo.update(dialogInRemote: dialog, users: users)
3030
} catch {
3131
throw error
3232
}

Sources/QuickBloxUIKit/QuickBloxUIKit.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,21 @@ let imageCache = ImageCache.shared
8484

8585
//FIXME: add dialogsView screen
8686
@ViewBuilder
87-
public func dialogsView() -> some View {
87+
public func dialogsView(onExit: (() -> Void)? = nil) -> some View {
8888
DialogsView(dialogsList: DialogsList(dialogsRepo: RepositoriesFabric.dialogs),
8989
content: { dialogsList in
9090
DialogsListView(dialogsList: dialogsList,
9191
content: DialogsRowBuilder.defaultRow)
9292
}, detailContent: { item, isPresented in
93-
DialogView(viewModel: DialogViewModel(dialog: item), isDialogPresented: isPresented)
93+
if item.type == .group {
94+
GroupDialogView(viewModel: DialogViewModel(dialog: item), isDialogPresented: isPresented)
95+
} else if item.type == .private {
96+
PrivateDialogView(viewModel: DialogViewModel(dialog: item), isDialogPresented: isPresented)
97+
}
9498
}, selectTypeContent: { onClose in
9599
DialogTypeView(onClose: onClose)
100+
}, onBack: {
101+
onExit?()
96102
}).onAppear {
97103
syncData()
98104
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
//
2+
// Localizable.strings
3+
// QuickBloxUIKit
4+
//
5+
// Created by Injoit on 18.07.2023.
6+
// Copyright © 2023 QuickBlox. All rights reserved.
7+
//
8+
9+
"dialog.items.empty" = "You don’t have any dialogs.";
10+
"dialog.members.empty" = "You don’t have any users.";
11+
"dialog.messages.empty" = "You don’t have any messages.";
12+
"dialog.type.private" = "Private";
13+
"dialog.type.group" = "Group";
14+
"dialog.type.public" = "Public";
15+
"dialog.typing.one" = " is typing...";
16+
"dialog.typing.two" = " are typing...";
17+
"dialog.typing.four" = " and 2 others are typing...";
18+
"dialog.name.hint" = "Use alphanumeric characters and spaces in a range from 3 to 60. Cannot contain more than one space in a row.";
19+
"dialog.name.create" = "Create";
20+
"dialog.name.next" = "Next";
21+
"dialog.name.search" = "Search";
22+
"dialog.name.cancel" = "Cancel";
23+
"dialog.info.edit" = "Edit";
24+
"dialog.info.members" = "Members";
25+
"dialog.info.notification" = "Notification";
26+
"dialog.info.searchInDialog" = "Search in dialog";
27+
"dialog.info.leaveDialog" = "Leave dialog";
28+
"dialog.info.you" = " (You)";
29+
"dialog.info.admin" = "Admin";
30+
"dialog.action.typeMessage" = "Type message";
31+
32+
"screen.title.dialogs" = "Dialogs";
33+
"screen.title.dialog" = "Dialog";
34+
"screen.title.dialogType" = "Dialog type";
35+
"screen.title.newDialog" = "New Dialog";
36+
"screen.title.createDialog" = "Create Dialog";
37+
"screen.title.addMembers" = "Add Members";
38+
"screen.title.dialogInformation" = "Dialog information";
39+
40+
"alert.actions.add" = "Add";
41+
"alert.actions.dialogName" = "Dialog name";
42+
"alert.actions.enterName" = "Enter name";
43+
"alert.actions.changeImage" = "Change image";
44+
"alert.actions.changeDialogName" = "Change dialog name";
45+
"alert.actions.photo" = "Photo";
46+
"alert.actions.removePhoto" = "Remove photo";
47+
"alert.actions.camera" = "Camera";
48+
"alert.actions.gallery" = "Gallery";
49+
"alert.actions.file" = "File";
50+
"alert.actions.remove" = "Remove";
51+
"alert.actions.cancel" = "Cancel";
52+
"alert.actions.ok" = "Ok";
53+
"alert.message.removeUser" = "Are you sure you want to remove ";
54+
"alert.message.questionMark" = "?";
55+
"alert.message.errorValidation" = "Error Validation";
56+
"alert.message.addUser" = "Are you sure you want to add ";
57+
"alert.message.toDialog" = " to this dialog?";
58+
59+
"attachment.maxSize.title" = "The uploaded file exceeds maximum file size (10MB)";
60+
"attachment.maxSize.hint" = "Please select a smaller attachment.";
61+
"attachment.title.file" = "file";
62+
"attachment.title.gif" = "GIF";

Sources/QuickBloxUIKit/ScreenFabric.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,25 @@ public extension ScreenFabric {
3737
settings: settings)
3838
}
3939
}
40+
41+
// Creating the screen for remove participants from a dialogue.
42+
public extension ScreenFabric {
43+
func members<T: DialogEntity>(
44+
to entity: T,
45+
settings: MembersScreenSettings
46+
= QuickBloxUIKit.settings.membersScreen
47+
) -> some View {
48+
let model = MembersDialogViewModel(dialog: Dialog(entity))
49+
return membersView(model: model,
50+
settings:settings)
51+
}
52+
53+
func membersView<T: MembersDialogProtocol>(
54+
model: T,
55+
settings: MembersScreenSettings
56+
= QuickBloxUIKit.settings.membersScreen
57+
) -> some View {
58+
return RemoveMembersView(viewModel: model,
59+
settings: settings)
60+
}
61+
}

Sources/QuickBloxUIKit/SwiftUIView/Dialog/AddMembers/AddMembersViewModifier.swift

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import SwiftUI
1010

1111
struct AddMembersHeaderToolbarContent: ToolbarContent {
1212

13-
private var header = QuickBloxUIKit.settings.addMembersScreen.header
13+
private var settings = QuickBloxUIKit.settings.addMembersScreen.header
1414

1515
let onDismiss: () -> Void
1616

@@ -24,19 +24,23 @@ struct AddMembersHeaderToolbarContent: ToolbarContent {
2424
Button {
2525
onDismiss()
2626
} label: {
27-
if let title = header.leftButton.title {
27+
if let title = settings.leftButton.title {
2828
Text(title)
29-
.foregroundColor(header.leftButton.color)
29+
.foregroundColor(settings.leftButton.color)
3030
} else {
31-
header.leftButton.image.tint(header.leftButton.color)
31+
settings.leftButton.image
32+
.resizable()
33+
.scaleEffect(settings.leftButton.scale)
34+
.tint(settings.leftButton.color)
35+
.padding(settings.leftButton.padding)
3236
}
3337
}
3438
}
3539
}
3640
}
3741

3842
public struct AddMembersHeader: ViewModifier {
39-
private var header = QuickBloxUIKit.settings.addMembersScreen.header
43+
private var settings = QuickBloxUIKit.settings.addMembersScreen.header
4044

4145
let onDismiss: () -> Void
4246

@@ -49,9 +53,10 @@ public struct AddMembersHeader: ViewModifier {
4953
content.toolbar {
5054
AddMembersHeaderToolbarContent(onDismiss: onDismiss)
5155
}
52-
.navigationTitle(header.title.text)
53-
.navigationBarTitleDisplayMode(header.displayMode)
56+
.navigationTitle(settings.title.text)
57+
.navigationBarTitleDisplayMode(settings.displayMode)
5458
.navigationBarBackButtonHidden(true)
59+
.navigationBarHidden(settings.isHidden)
5560
}
5661
}
5762

Sources/QuickBloxUIKit/SwiftUIView/Dialog/DialogInfo/DialogInfoViewModifier.swift

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ struct DialogInfoHeaderToolbarContent: ToolbarContent {
3636
if let title = settings.leftButton.title {
3737
Text(title).foregroundColor(settings.leftButton.color.opacity(disabled == true ? settings.opacity : 1.0))
3838
} else {
39-
settings.leftButton.image.tint(settings.leftButton.color.opacity(disabled == true ? settings.opacity : 1.0))
39+
settings.leftButton.image
40+
.resizable()
41+
.scaleEffect(settings.leftButton.scale)
42+
.tint(settings.leftButton.color.opacity(disabled == true ? settings.opacity : 1.0))
43+
.padding(settings.leftButton.padding)
4044
}
4145
}.disabled(disabled)
4246
}
@@ -48,7 +52,11 @@ struct DialogInfoHeaderToolbarContent: ToolbarContent {
4852
if let title = settings.rightButton.title {
4953
Text(title).foregroundColor(settings.rightButton.color.opacity(disabled == true ? settings.opacity : 1.0))
5054
} else {
51-
settings.rightButton.image.tint(settings.rightButton.color.opacity(disabled == true ? settings.opacity : 1.0))
55+
settings.rightButton.image
56+
.resizable()
57+
.scaleEffect(settings.rightButton.scale)
58+
.tint(settings.rightButton.color.opacity(disabled == true ? settings.opacity : 1.0))
59+
.padding(settings.rightButton.padding)
5260
}
5361
}.disabled(disabled)
5462
}
@@ -81,6 +89,7 @@ public struct DialogInfoHeader: ViewModifier {
8189
.navigationTitle(settings.title.text)
8290
.navigationBarTitleDisplayMode(settings.displayMode)
8391
.navigationBarBackButtonHidden(true)
92+
.navigationBarHidden(settings.isHidden)
8493
}
8594
}
8695

@@ -109,7 +118,7 @@ public struct InfoDialogAvatar<Item: DialogEntity>: View {
109118
} else {
110119
AvatarView(image: avatar ?? dialog.placeholder,
111120
height: settings.height,
112-
isShow: settings.isShow)
121+
isHidden: settings.isHidden)
113122
.task {
114123
do { avatar = try await dialog.avatar } catch { prettyLog(error) }
115124
}
@@ -210,7 +219,7 @@ public struct EditDialogAlert: ViewModifier {
210219
@Binding var isValidDialogName: Bool
211220

212221
let isExistingImage: Bool
213-
let isShowFiles: Bool
222+
let isHiddenFiles: Bool
214223

215224
@Binding var isEdit: Bool
216225

@@ -247,7 +256,7 @@ public struct EditDialogAlert: ViewModifier {
247256
})
248257
.mediaAlert(isAlertPresented: $isMediaAlertPresented,
249258
isExistingImage: isExistingImage,
250-
isShowFiles: isShowFiles,
259+
isHiddenFiles: isHiddenFiles,
251260
mediaTypes: [UTType.image.identifier],
252261
onRemoveImage: {
253262
onRemoveImage()
@@ -301,7 +310,7 @@ extension View {
301310
dialogName: Binding<String>,
302311
isValidDialogName: Binding<Bool>,
303312
isExistingImage: Bool,
304-
isShowFiles: Bool,
313+
isHiddenFiles: Bool,
305314
isEdit: Binding<Bool>,
306315
onRemoveImage: @escaping () -> Void,
307316
onGetAttachment: @escaping (_ attachmentAsset: AttachmentAsset) -> Void,
@@ -311,7 +320,7 @@ extension View {
311320
dialogName: dialogName,
312321
isValidDialogName: isValidDialogName,
313322
isExistingImage: isExistingImage,
314-
isShowFiles: isShowFiles,
323+
isHiddenFiles: isHiddenFiles,
315324
isEdit: isEdit,
316325
onRemoveImage: onRemoveImage,
317326
onGetAttachment: onGetAttachment,

Sources/QuickBloxUIKit/SwiftUIView/Dialog/DialogInfo/GroupDialogInfoView.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public struct GroupDialogInfoView<ViewModel: DialogInfoProtocol>: View {
5353
dialogName: $viewModel.dialogName,
5454
isValidDialogName: $viewModel.isValidDialogName,
5555
isExistingImage: viewModel.isExistingImage,
56-
isShowFiles: false,
56+
isHiddenFiles: settings.editDialogAlert.isHiddenFiles,
5757
isEdit: $isEdit,
5858
onRemoveImage: {
5959
viewModel.removeExistingImage()
@@ -84,9 +84,7 @@ public struct GroupDialogInfoView<ViewModel: DialogInfoProtocol>: View {
8484
}, disabled: isEdit))
8585

8686
NavigationLink(isActive: $membersPresented) {
87-
if let dialog = viewModel.dialog as? Dialog {
88-
RemoveMembersView(viewModel: MembersDialogViewModel(dialog: dialog))
89-
}
87+
Fabric.screen.members(to: viewModel.dialog)
9088
} label: {
9189
EmptyView()
9290
}

Sources/QuickBloxUIKit/SwiftUIView/Dialog/DialogInfo/GroupDialogNonEditInfoViewViewModifier.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ struct GroupDialogNonEditInfoHeaderToolbarContent: ToolbarContent {
2525
if let title = settings.leftButton.title {
2626
Text(title).foregroundColor(settings.leftButton.color)
2727
} else {
28-
settings.leftButton.image.tint(settings.leftButton.color)
28+
settings.leftButton.image
29+
.resizable()
30+
.scaleEffect(settings.leftButton.scale)
31+
.tint(settings.leftButton.color)
32+
.padding(settings.leftButton.padding)
2933
}
3034
}
3135
}
@@ -49,5 +53,6 @@ public struct GroupDialogNonEditInfoHeader: ViewModifier {
4953
.navigationTitle(settings.title.text)
5054
.navigationBarTitleDisplayMode(settings.displayMode)
5155
.navigationBarBackButtonHidden(true)
56+
.navigationBarHidden(settings.isHidden)
5257
}
5358
}

Sources/QuickBloxUIKit/SwiftUIView/Dialog/DialogInfo/PrivateDialogInfoViewModifier.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ struct PrivateDialogInfoHeaderToolbarContent: ToolbarContent {
2525
if let title = settings.leftButton.title {
2626
Text(title).foregroundColor(settings.leftButton.color)
2727
} else {
28-
settings.leftButton.image.tint(settings.leftButton.color)
28+
settings.leftButton.image
29+
.resizable()
30+
.scaleEffect(settings.leftButton.scale)
31+
.tint(settings.leftButton.color)
32+
.padding(settings.leftButton.padding)
2933
}
3034
}
3135
}
@@ -49,5 +53,6 @@ public struct PrivateDialogInfoHeader: ViewModifier {
4953
.navigationTitle(settings.title.text)
5054
.navigationBarTitleDisplayMode(settings.displayMode)
5155
.navigationBarBackButtonHidden(true)
56+
.navigationBarHidden(settings.isHidden)
5257
}
5358
}

0 commit comments

Comments
 (0)