|
4 | 4 |
|
5 | 5 | import StreamChat |
6 | 6 | import StreamChatSwiftUI |
7 | | -import UIKit |
8 | 7 | import SwiftUI |
| 8 | +import UIKit |
9 | 9 |
|
10 | 10 | class AppDelegate: NSObject, UIApplicationDelegate { |
11 | 11 |
|
12 | 12 | var streamChat: StreamChat? |
13 | 13 |
|
14 | 14 | var chatClient: ChatClient = { |
15 | 15 | var config = ChatClientConfig(apiKey: .init(apiKeyString)) |
16 | | - //config.isLocalStorageEnabled = true |
| 16 | + // config.isLocalStorageEnabled = true |
17 | 17 | config.applicationGroupIdentifier = applicationGroupIdentifier |
18 | | - |
| 18 | + |
19 | 19 | let client = ChatClient(config: config) |
20 | 20 | return client |
21 | 21 | }() |
22 | 22 |
|
23 | | - func application(_ application: UIApplication, |
24 | | - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { |
| 23 | + func application( |
| 24 | + _ application: UIApplication, |
| 25 | + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil |
| 26 | + ) -> Bool { |
25 | 27 | /* |
26 | | - //Customizations, uncomment to customize. |
27 | | - var colors = ColorPalette() |
28 | | - colors.tintColor = Color(.streamBlue) |
29 | | - |
30 | | - var fonts = Fonts() |
31 | | - fonts.footnoteBold = Font.footnote |
32 | | - |
33 | | - let images = Images() |
34 | | - images.reactionLoveBig = UIImage(systemName: "heart.fill")! |
35 | | - |
36 | | - let appearance = Appearance(colors: colors, images: images, fonts: fonts) |
37 | | - |
38 | | - let channelNamer: ChatChannelNamer = { channel, currentUserId in |
39 | | - "This is our custom name: \(channel.name ?? "no name")" |
40 | | - } |
41 | | - let utils = Utils(channelNamer: channelNamer) |
| 28 | + //Customizations, uncomment to customize. |
| 29 | + var colors = ColorPalette() |
| 30 | + colors.tintColor = Color(.streamBlue) |
42 | 31 |
|
43 | | - streamChat = StreamChat(chatClient: chatClient, appearance: appearance, utils: utils) |
44 | | - |
45 | | - */ |
| 32 | + var fonts = Fonts() |
| 33 | + fonts.footnoteBold = Font.footnote |
| 34 | + |
| 35 | + let images = Images() |
| 36 | + images.reactionLoveBig = UIImage(systemName: "heart.fill")! |
| 37 | + |
| 38 | + let appearance = Appearance(colors: colors, images: images, fonts: fonts) |
| 39 | + |
| 40 | + let channelNamer: ChatChannelNamer = { channel, currentUserId in |
| 41 | + "This is our custom name: \(channel.name ?? "no name")" |
| 42 | + } |
| 43 | + let utils = Utils(channelNamer: channelNamer) |
| 44 | + |
| 45 | + streamChat = StreamChat(chatClient: chatClient, appearance: appearance, utils: utils) |
| 46 | + |
| 47 | + */ |
46 | 48 |
|
47 | 49 | /* |
48 | | - let messageTypeResolver = CustomMessageTypeResolver() |
49 | | - let utils = Utils(messageTypeResolver: messageTypeResolver) |
| 50 | + let messageTypeResolver = CustomMessageTypeResolver() |
| 51 | + let utils = Utils(messageTypeResolver: messageTypeResolver) |
50 | 52 |
|
51 | | - streamChat = StreamChat(chatClient: chatClient, utils: utils) |
52 | | - */ |
| 53 | + streamChat = StreamChat(chatClient: chatClient, utils: utils) |
| 54 | + */ |
53 | 55 |
|
54 | 56 | streamChat = StreamChat(chatClient: chatClient) |
55 | 57 |
|
56 | 58 | DispatchQueue.main.asyncAfter(deadline: .now() + 2.5) { |
57 | 59 | withAnimation { |
58 | 60 | AppState.shared.userState = .notLoggedIn |
59 | | - } |
| 61 | + } |
60 | 62 | } |
61 | 63 |
|
62 | 64 | return true |
63 | 65 | } |
64 | 66 |
|
65 | | - func application(_ application: UIApplication, |
66 | | - configurationForConnecting connectingSceneSession: UISceneSession, |
67 | | - options: UIScene.ConnectionOptions) -> UISceneConfiguration { |
| 67 | + func application( |
| 68 | + _ application: UIApplication, |
| 69 | + configurationForConnecting connectingSceneSession: UISceneSession, |
| 70 | + options: UIScene.ConnectionOptions |
| 71 | + ) -> UISceneConfiguration { |
68 | 72 | let sceneConfig = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role) |
69 | 73 | sceneConfig.delegateClass = SceneDelegate.self |
70 | 74 | return sceneConfig |
71 | 75 | } |
72 | | - |
73 | 76 | } |
74 | 77 |
|
75 | 78 | extension UIColor { |
76 | 79 | static let streamBlue = UIColor(red: 0, green: 108.0 / 255.0, blue: 255.0 / 255.0, alpha: 1) |
77 | 80 | } |
78 | | - |
|
0 commit comments