-
Notifications
You must be signed in to change notification settings - Fork 130
Expand file tree
/
Copy pathAppDelegate.swift
More file actions
50 lines (37 loc) · 1.72 KB
/
AppDelegate.swift
File metadata and controls
50 lines (37 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// AppDelegate.swift
// ChatApp
//
// Created by Florian Marcu on 8/18/23.
// Copyright © 2023 Instamobile. All rights reserved.
//
import Firebase
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Configure the UI
let config = ChatUIConfiguration()
config.configureUI()
FirebaseApp.configure()
let threadsDataSource = ATCGenericLocalHeteroDataSource(items: ATCChatMockStore.threads)
// HEY THERE, user. read the next few lines below
// Helper file to access remote data for a user
let remoteData = ATCRemoteData()
// Checks if user's firestore actually has channels setup
remoteData.getChannels()
// For testing, set this to a usr from 0-4 and run it to your simulator
// Then, set it to any other user and run it to your phone. THEN-> see my comment in ATCChatMockStore.swift
let user = 2
// If both devices have a different user active, AND the chat thread is available, you can msg live
// Window setup
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = ChatHostViewController(uiConfig: config,
threadsDataSource: threadsDataSource,
viewer: ATCChatMockStore.users[user])
print("currentUser: \(ATCChatMockStore.users[user].debugDescription)")
window?.makeKeyAndVisible()
return true
}
}