//
//  AcaMateApp.swift
//  AcaMate
//
//  Created by Sean Kim on 11/26/24.
//

import SwiftUI
import Combine

import KakaoSDKCommon
import KakaoSDKAuth

@main
struct AcaMateApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    var cancellables: Set<AnyCancellable> = []
    @StateObject var appVM = AppViewModel()
    
    init() {
        printLog("APP INIT")
    }
    
    var body: some Scene {
        WindowGroup {
            NavigationView()
                .onOpenURL { url in
                    if (AuthApi.isKakaoTalkLoginUrl(url)) {
                        _ = AuthController.handleOpenUrl(url: url)
                    }
                }
                .environmentObject(self.appVM)
        }
    }
}
