//
//  iPhotoSyncMacApp.swift
//  iPhotoSyncMac
//
//  Created by Jiang Wei on 2021/9/8.
//

import SwiftUI

@main
struct iPhotoSyncMacApp: App {
    
    @ObservedObject private var data:SyncModel = SyncModel()
    
    var body: some Scene {
        WindowGroup {
//            let _ = SyncService.shared.enableService()
//            let _ = DataCenter.shared.datasource = data
//            ConnectionView(data: data.service)
            ConnectionView(data: $data.service)
//            MainView(saveDictory: data.syncFolder)
                .frame(minWidth: 400, idealWidth: 400, maxWidth: /*@START_MENU_TOKEN@*/.infinity/*@END_MENU_TOKEN@*/, minHeight: 300, idealHeight: 300, maxHeight: /*@START_MENU_TOKEN@*/.infinity/*@END_MENU_TOKEN@*/, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
                .onAppear(perform: {
                    DataCenter.shared.datasource = data
                    SyncService.shared.enableService()
                })
                .onDisappear(perform: {
                    SyncService.shared.disableService()
                })
        }
    }
}
