Skip to content

Commit d889190

Browse files
0.1.4 (#8)
* update gitignore * 0.1.4
1 parent 872daab commit d889190

File tree

50 files changed

+666
-181
lines changed

Some content is hidden

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

50 files changed

+666
-181
lines changed

.gitignore

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,57 @@
11
# Xcode
2-
.DS_Store
3-
build/
2+
# Files created by Xcode
43
*.pbxuser
5-
!default.pbxuser
4+
*.xcuserstate
5+
*.xcworkspace/
6+
7+
# Swift Package Manager
8+
# Build products
9+
.build/
10+
11+
# Package Manager Dependencies
12+
# It's generally not a good idea to commit the entire 'Packages' directory
13+
# since it can be regenerated from the Package.swift manifest
14+
# Comment the following line if you want to include it in version control
15+
Packages/
16+
17+
# Swift Package Manager Version
18+
# The current active version of the Swift Package Manager
19+
# Comment the following line if you want to include it in version control
20+
.pswiftpm
21+
.swiftpm/xcode/xcuserdata
22+
23+
# Miscellaneous
24+
# Temporary files
25+
*~
26+
.DS_Store
27+
*.swp
28+
*.tmp
29+
*~
30+
.idea/
631
*.mode1v3
7-
!default.mode1v3
832
*.mode2v3
9-
!default.mode2v3
1033
*.perspectivev3
11-
!default.perspectivev3
12-
!default.xcworkspace
13-
xcuserdata
14-
profile
34+
*.xccheckout
1535
*.moved-aside
16-
DerivedData
17-
.idea/
18-
Pods/
36+
*.xcuserstate
37+
*.xcscmblueprint
38+
*.xcscheme
39+
40+
# macOS
41+
# Build folder
42+
build/
43+
44+
# iOS
45+
# Xcode build folder
46+
DerivedData/
47+
48+
# Carthage
49+
# Carthage builds
1950
Carthage/Build/
20-
Podfile.lock
21-
# Obj-C/Swift specific
22-
*.hmap
23-
# App packaging
24-
*.ipa
25-
*.dSYM.zip
26-
*.dSYM
27-
# Playgrounds
28-
timeline.xctimeline
29-
playground.xcworkspace
51+
52+
# SPM-generated
53+
.Package.resolved
54+
.build/
55+
56+
# Integration Tests Config
57+
Config.swift

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 0 additions & 7 deletions
This file was deleted.

Package.resolved

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ let package = Package(
1616
targets: ["QuickBloxUIKit", "QuickBloxData", "QuickBloxDomain"]),
1717
],
1818
dependencies: [
19-
.package(url: "https://github.com/QuickBlox/ios-quickblox-sdk", .upToNextMajor(from: "2.19.0"))
19+
.package(url: "https://github.com/QuickBlox/ios-quickblox-sdk", .upToNextMajor(from: "2.19.0")),
20+
.package(url: "https://github.com/QuickBlox/ios-ai-answer-assistant.git", .upToNextMajor(from: "1.0.0"))
2021
],
2122
targets: [
2223
.target(
@@ -27,12 +28,14 @@ let package = Package(
2728
.target(
2829
name: "QuickBloxData",
2930
dependencies: ["QuickBloxDomain",
30-
"QuickBloxLog",
31-
.product(name: "Quickblox",
32-
package: "ios-quickblox-sdk")]),
31+
"QuickBloxLog"]),
3332
.target(
3433
name: "QuickBloxDomain",
35-
dependencies: ["QuickBloxLog"]),
34+
dependencies: ["QuickBloxLog",
35+
.product(name: "Quickblox",
36+
package: "ios-quickblox-sdk"),
37+
.product(name: "QBAIAnswerAssistant",
38+
package: "ios-ai-answer-assistant")]),
3639
.target(
3740
name: "QuickBloxLog",
3841
dependencies: []),

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
<div align="center">
2+
3+
<p>
4+
<a href="https://discord.gg/Yc56F9KG"><img src="https://img.shields.io/discord/1042743094833065985?color=5865F2&logo=discord&logoColor=white&label=QuickBlox%20Discord%20server&style=for-the-badge" alt="Discord server" /></a>
5+
</p>
6+
7+
</div>
8+
19
# Overview
210

311
The QuickBlox UIKit for iOS is a comprehensive user interface kit specifically designed for building chat applications. It provides a collection of pre-built components, modules, and utilities that simplify the process of creating chat applications.

Sources/QuickBloxData/Source/Remote/RemoteDataSource.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,10 @@ extension RemoteDataSource {
855855
return RemoteUsersDTO(users: users,
856856
pagination: tuple.pagination)
857857
} catch let nsError as NSError {
858+
if nsError.code == 404 {
859+
return RemoteUsersDTO(users: [],
860+
pagination: dto.pagination)
861+
}
858862
throw try nsError.convertToRemoteException()
859863
} catch {
860864
throw DataSourceException.unexpected(error.localizedDescription)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// AssistAnswerByOpenAIAPI.swift
3+
// QuickBloxUIKit
4+
//
5+
// Created by Injoit on 04.08.2023.
6+
// Copyright © 2023 QuickBlox. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import QBAIAnswerAssistant
11+
12+
public protocol AssistAnswerByOpenAIProtocol {
13+
func execute() async throws -> String
14+
}
15+
16+
public class AssistAnswerByOpenAIAPI: AssistAnswerByOpenAIProtocol {
17+
private let apiKey: String
18+
private let content: [any MessageEntity]
19+
20+
public init(_ apiKey: String, content: [any MessageEntity]) {
21+
self.apiKey = apiKey
22+
self.content = content
23+
}
24+
25+
public func execute() async throws -> String {
26+
let messages: [Message] = content.compactMap { message in
27+
if message.isOwnedByCurrentUser {
28+
return OwnerMessage(message.text)
29+
} else {
30+
return OpponentMessage(message.text)
31+
}
32+
}
33+
return try await QBAIAnswerAssistant.openAIAnswer(to: messages,
34+
secret: apiKey)
35+
}
36+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// AssistAnswerByOpenAIProxyServer.swift
3+
// QuickBloxUIKit
4+
//
5+
// Created by Injoit on 04.08.2023.
6+
// Copyright © 2023 QuickBlox. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import Quickblox
11+
import QBAIAnswerAssistant
12+
13+
public class AssistAnswerByOpenAIProxyServer: AssistAnswerByOpenAIProtocol {
14+
private let serverURLPath: String
15+
private let content: [any MessageEntity]
16+
17+
public init(_ serverURLPath: String, content: [any MessageEntity]) {
18+
self.serverURLPath = serverURLPath
19+
self.content = content
20+
}
21+
22+
public func execute() async throws -> String {
23+
guard let qbToken = QBSession.current.sessionDetails?.token else {
24+
throw RepositoryException.unauthorised()
25+
}
26+
27+
let messages: [Message] = content.compactMap { message in
28+
if message.isOwnedByCurrentUser {
29+
return OwnerMessage(message.text)
30+
} else {
31+
return OpponentMessage(message.text)
32+
}
33+
}
34+
return try await QBAIAnswerAssistant.openAIAnswer(to: messages,
35+
qbToken: qbToken,
36+
proxy: serverURLPath)
37+
}
38+
}

Sources/QuickBloxUIKit/QuickBloxUIKit.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var previewAware: Bool {
3535
}
3636

3737
public var settings: ScreensProtocol = ScreenSettings(Theme())
38+
public var feature: Feature = Feature()
3839

3940
class Sync {
4041
var state: AnyPublisher<SyncState, Never> {
@@ -85,7 +86,7 @@ let imageCache = ImageCache.shared
8586
//FIXME: add dialogsView screen
8687
@ViewBuilder
8788
public func dialogsView(onExit: (() -> Void)? = nil) -> some View {
88-
DialogsView(dialogsList: DialogsList(dialogsRepo: RepositoriesFabric.dialogs),
89+
DialogsView(dialogsList: DialogsViewModel(dialogsRepo: RepositoriesFabric.dialogs),
8990
content: { dialogsList in
9091
DialogsListView(dialogsList: dialogsList,
9192
content: DialogsRowBuilder.defaultRow)

0 commit comments

Comments
 (0)