mirror of
https://github.com/ninxsoft/Mist.git
synced 2025-05-25 12:34:58 -04:00
Initial commit
This commit is contained in:
parent
9197011230
commit
2ed311a818
184 changed files with 8052 additions and 2 deletions
45
Mist/MistApp.swift
Normal file
45
Mist/MistApp.swift
Normal file
|
@ -0,0 +1,45 @@
|
|||
//
|
||||
// MistApp.swift
|
||||
// Mist
|
||||
//
|
||||
// Created by Nindi Gill on 13/6/2022.
|
||||
//
|
||||
|
||||
import Sparkle
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct MistApp: App {
|
||||
// swiftlint:disable:next weak_delegate
|
||||
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate: AppDelegate
|
||||
@StateObject var sparkleUpdater: SparkleUpdater = SparkleUpdater()
|
||||
@State private var refreshing: Bool = false
|
||||
@State private var downloadInProgress: Bool = false
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView(refreshing: $refreshing, downloadInProgress: $downloadInProgress)
|
||||
.onReceive(NotificationCenter.default.publisher(for: NSApplication.willUpdateNotification)) { _ in
|
||||
hideZoomButton()
|
||||
}
|
||||
}
|
||||
.commands {
|
||||
AppCommands(sparkleUpdater: sparkleUpdater, refreshing: $refreshing, downloadInProgress: $downloadInProgress)
|
||||
}
|
||||
Settings {
|
||||
SettingsView(sparkleUpdater: sparkleUpdater)
|
||||
}
|
||||
}
|
||||
|
||||
func hideZoomButton() {
|
||||
|
||||
for window in NSApplication.shared.windows {
|
||||
|
||||
guard let button: NSButton = window.standardWindowButton(NSWindow.ButtonType.zoomButton) else {
|
||||
continue
|
||||
}
|
||||
|
||||
button.isEnabled = false
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue