//
//  LaunchScreenViewController.swift
//  DigiNetS
//
//  Created by Qindi on 31/08/22.
//

import UIKit
import NotificationBannerSwift
import NexilisLite

class LaunchScreenViewController: UIViewController {
    @IBOutlet weak var imageSS: UIImageView!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        if !CheckConnection.isConnectedToNetwork() {
            let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
            imageView.tintColor = .white
            let banner = FloatingNotificationBanner(title: "Check your connection".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
            banner.show()
            return
        }
        if PrefsUtil.getIconDock() != nil {
            let data = try? Data(contentsOf: URL(string: PrefsUtil.getUrlDock()!)!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
            if data != nil {
                imageSS.image = UIImage(data: data!)
            }
        }
    }

}
