Skip to content

Commit 2e678be

Browse files
[BW] Update copyright year (#258)
1 parent fa64df2 commit 2e678be

File tree

305 files changed

+3826
-3828
lines changed

Some content is hidden

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

305 files changed

+3826
-3828
lines changed

DemoAppSwiftUI/AppDelegate.swift

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright © 2022 Stream.io Inc. All rights reserved.
2+
// Copyright © 2023 Stream.io Inc. All rights reserved.
33
//
44

55
import Sentry
@@ -9,18 +9,18 @@ import SwiftUI
99
import UIKit
1010

1111
class AppDelegate: NSObject, UIApplicationDelegate {
12-
12+
1313
var streamChat: StreamChat?
14-
14+
1515
var chatClient: ChatClient = {
1616
var config = ChatClientConfig(apiKey: .init(apiKeyString))
1717
config.isLocalStorageEnabled = true
1818
config.applicationGroupIdentifier = applicationGroupIdentifier
19-
19+
2020
let client = ChatClient(config: config)
2121
return client
2222
}()
23-
23+
2424
func application(
2525
_ application: UIApplication,
2626
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
@@ -29,57 +29,57 @@ class AppDelegate: NSObject, UIApplicationDelegate {
2929
//Customizations, uncomment to customize.
3030
var colors = ColorPalette()
3131
colors.tintColor = Color(.streamBlue)
32-
32+
3333
var fonts = Fonts()
3434
fonts.footnoteBold = Font.footnote
35-
35+
3636
let images = Images()
3737
images.reactionLoveBig = UIImage(systemName: "heart.fill")!
38-
38+
3939
let appearance = Appearance(colors: colors, images: images, fonts: fonts)
40-
40+
4141
let channelNamer: ChatChannelNamer = { channel, currentUserId in
4242
"This is our custom name: \(channel.name ?? "no name")"
4343
}
4444
let utils = Utils(channelNamer: channelNamer)
45-
45+
4646
streamChat = StreamChat(chatClient: chatClient, appearance: appearance, utils: utils)
47-
47+
4848
*/
49-
49+
5050
/*
5151
let messageTypeResolver = CustomMessageTypeResolver()
5252
let utils = Utils(messageTypeResolver: messageTypeResolver)
53-
53+
5454
streamChat = StreamChat(chatClient: chatClient, utils: utils)
5555
*/
56-
56+
5757
#if RELEASE
5858
// We're tracking Crash Reports / Issues from the Demo App to keep improving the SDK
5959
SentrySDK.start { options in
6060
options.dsn = "https://[email protected]/6395489"
6161
options.tracesSampleRate = 1.0
6262
}
6363
#endif
64-
64+
6565
let utils = Utils(
6666
messageListConfig: MessageListConfig(dateIndicatorPlacement: .messageList)
6767
)
6868
streamChat = StreamChat(chatClient: chatClient, utils: utils)
69-
69+
7070
DispatchQueue.main.asyncAfter(deadline: .now() + 2.5) {
7171
withAnimation {
7272
if AppState.shared.userState == .launchAnimation {
7373
AppState.shared.userState = .notLoggedIn
7474
}
7575
}
7676
}
77-
77+
7878
UNUserNotificationCenter.current().delegate = NotificationsHandler.shared
79-
79+
8080
return true
8181
}
82-
82+
8383
func application(
8484
_ application: UIApplication,
8585
configurationForConnecting connectingSceneSession: UISceneSession,
@@ -89,7 +89,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
8989
sceneConfig.delegateClass = SceneDelegate.self
9090
return sceneConfig
9191
}
92-
92+
9393
func application(
9494
_ application: UIApplication,
9595
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data

DemoAppSwiftUI/CreateGroupView.swift

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
//
2-
// Copyright © 2022 Stream.io Inc. All rights reserved.
2+
// Copyright © 2023 Stream.io Inc. All rights reserved.
33
//
44

55
import StreamChat
66
import StreamChatSwiftUI
77
import SwiftUI
88

99
struct CreateGroupView: View, KeyboardReadable {
10-
10+
1111
@Injected(\.fonts) var fonts
1212
@Injected(\.colors) var colors
13-
13+
1414
@StateObject var viewModel = CreateGroupViewModel()
15-
15+
1616
@Binding var isNewChatShown: Bool
17-
17+
1818
@State private var keyboardShown = false
19-
19+
2020
var body: some View {
2121
VStack(spacing: 0) {
2222
SearchBar(text: $viewModel.searchText)
2323
.padding(.vertical, !viewModel.selectedUsers.isEmpty ? 0 : 16)
24-
24+
2525
ScrollView(.horizontal) {
2626
HStack(spacing: 16) {
2727
ForEach(viewModel.selectedUsers) { user in
@@ -33,7 +33,7 @@ struct CreateGroupView: View, KeyboardReadable {
3333
}
3434
.padding(.all, !viewModel.selectedUsers.isEmpty ? 16 : 0)
3535
}
36-
36+
3737
UsersHeaderView()
3838
List(viewModel.chatUsers) { user in
3939
Button {
@@ -76,21 +76,21 @@ struct CreateGroupView: View, KeyboardReadable {
7676
}
7777

7878
struct SelectedUserGroupView: View {
79-
79+
8080
@Injected(\.fonts) var fonts
81-
81+
8282
private let avatarSize: CGFloat = 50
83-
83+
8484
@StateObject var viewModel: CreateGroupViewModel
8585
var user: ChatUser
86-
86+
8787
var body: some View {
8888
VStack {
8989
MessageAvatarView(
9090
avatarURL: user.imageURL,
9191
size: CGSize(width: avatarSize, height: avatarSize)
9292
)
93-
93+
9494
Text(user.name ?? user.id)
9595
.lineLimit(1)
9696
.font(fonts.footnote)
@@ -106,7 +106,7 @@ struct SelectedUserGroupView: View {
106106
Circle()
107107
.fill(Color.white)
108108
.frame(width: 16, height: 16)
109-
109+
110110
Image(systemName: "xmark.circle.fill")
111111
.foregroundColor(Color.black.opacity(0.8))
112112
}
@@ -120,16 +120,16 @@ struct SelectedUserGroupView: View {
120120
}
121121

122122
struct SearchBar: View {
123-
123+
124124
@Injected(\.colors) var colors
125-
125+
126126
@Binding var text: String
127-
127+
128128
@State private var isEditing = false
129-
129+
130130
var body: some View {
131131
HStack {
132-
132+
133133
TextField("Search ...", text: $text)
134134
.padding(7)
135135
.padding(.horizontal, 25)
@@ -141,11 +141,11 @@ struct SearchBar: View {
141141
.foregroundColor(.gray)
142142
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
143143
.padding(.leading, 8)
144-
144+
145145
if isEditing {
146146
Button(action: {
147147
self.text = ""
148-
148+
149149
}) {
150150
Image(systemName: "multiply.circle.fill")
151151
.foregroundColor(.gray)
@@ -158,12 +158,12 @@ struct SearchBar: View {
158158
.onTapGesture {
159159
self.isEditing = true
160160
}
161-
161+
162162
if isEditing {
163163
Button(action: {
164164
self.isEditing = false
165165
self.text = ""
166-
166+
167167
// Dismiss the keyboard
168168
UIApplication.shared.sendAction(
169169
#selector(UIResponder.resignFirstResponder),

DemoAppSwiftUI/CreateGroupViewModel.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
//
2-
// Copyright © 2022 Stream.io Inc. All rights reserved.
2+
// Copyright © 2023 Stream.io Inc. All rights reserved.
33
//
44

55
import StreamChat
66
import StreamChatSwiftUI
77
import SwiftUI
88

99
class CreateGroupViewModel: ObservableObject, ChatUserSearchControllerDelegate {
10-
10+
1111
@Injected(\.chatClient) var chatClient
12-
12+
1313
var channelController: ChatChannelController!
14-
14+
1515
@Published var searchText = "" {
1616
didSet {
1717
searchUsers(with: searchText)
@@ -24,21 +24,21 @@ class CreateGroupViewModel: ObservableObject, ChatUserSearchControllerDelegate {
2424
@Published var groupName = ""
2525
@Published var showGroupConversation = false
2626
@Published var errorShown = false
27-
27+
2828
private lazy var searchController: ChatUserSearchController = chatClient.userSearchController()
2929
private let lastSeenDateFormatter = DateUtils.timeAgo
30-
30+
3131
init() {
3232
chatUsers = searchController.userArray
3333
searchController.delegate = self
3434
// Empty initial search to get all users
3535
searchUsers(with: nil)
3636
}
37-
37+
3838
var canCreateGroup: Bool {
3939
!selectedUsers.isEmpty && !groupName.isEmpty
4040
}
41-
41+
4242
func userTapped(_ user: ChatUser) {
4343
if selectedUsers.contains(user) {
4444
selectedUsers.removeAll { selected in
@@ -48,7 +48,7 @@ class CreateGroupViewModel: ObservableObject, ChatUserSearchControllerDelegate {
4848
selectedUsers.append(user)
4949
}
5050
}
51-
51+
5252
func onlineInfo(for user: ChatUser) -> String {
5353
if user.isOnline {
5454
return "Online"
@@ -59,11 +59,11 @@ class CreateGroupViewModel: ObservableObject, ChatUserSearchControllerDelegate {
5959
return "Offline"
6060
}
6161
}
62-
62+
6363
func isSelected(user: ChatUser) -> Bool {
6464
selectedUsers.contains(user)
6565
}
66-
66+
6767
func showChannelView() {
6868
do {
6969
channelController = try chatClient.channelController(
@@ -81,23 +81,23 @@ class CreateGroupViewModel: ObservableObject, ChatUserSearchControllerDelegate {
8181
self?.showGroupConversation = true
8282
}
8383
}
84-
84+
8585
} catch {
8686
errorShown = true
8787
}
8888
}
89-
89+
9090
// MARK: - ChatUserSearchControllerDelegate
91-
91+
9292
func controller(
9393
_ controller: ChatUserSearchController,
9494
didChangeUsers changes: [ListChange<ChatUser>]
9595
) {
9696
chatUsers = controller.userArray
9797
}
98-
98+
9999
// MARK: - private
100-
100+
101101
private func searchUsers(with term: String?) {
102102
state = .loading
103103
searchController.search(term: term) { [weak self] error in

DemoAppSwiftUI/CustomAttachment.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
//
2-
// Copyright © 2022 Stream.io Inc. All rights reserved.
2+
// Copyright © 2023 Stream.io Inc. All rights reserved.
33
//
44

55
import StreamChat
66
import StreamChatSwiftUI
77
import SwiftUI
88

99
class CustomMessageResolver: MessageTypeResolving {
10-
10+
1111
func hasCustomAttachment(message: ChatMessage) -> Bool {
1212
let messageComponents = message.text.components(separatedBy: CharacterSet.whitespacesAndNewlines)
1313
return !messageComponents.filter { component in
1414
isValidEmail(component)
1515
}
1616
.isEmpty
1717
}
18-
18+
1919
private func isValidEmail(_ email: String) -> Bool {
2020
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
21-
21+
2222
let emailPred = NSPredicate(format: "SELF MATCHES %@", emailRegEx)
2323
return emailPred.evaluate(with: email)
2424
}
2525
}
2626

2727
struct CustomAttachmentView: View {
28-
28+
2929
let message: ChatMessage
3030
let width: CGFloat
3131
let isFirst: Bool
32-
32+
3333
var body: some View {
3434
HStack {
3535
Image(systemName: "envelope")
@@ -44,10 +44,10 @@ struct CustomAttachmentView: View {
4444
struct CustomMessageTextView: View {
4545
@Injected(\.colors) var colors
4646
@Injected(\.fonts) var fonts
47-
47+
4848
var message: ChatMessage
4949
var isFirst: Bool
50-
50+
5151
public var body: some View {
5252
Text(message.text)
5353
.padding()

0 commit comments

Comments
 (0)