Skip to content

Commit

Permalink
makeToast
Browse files Browse the repository at this point in the history
  • Loading branch information
yanue committed Oct 14, 2023
1 parent d245ac1 commit 6ac55b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
17 changes: 9 additions & 8 deletions V2rayU/ToastWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@

import Cocoa

var toastWindowCtrl = ToastWindowController()
var toastWindow = ToastWindowController()

func makeToast(message: String, displayDuration: Double? = 2) {
func makeToast(message: String, displayDuration: Double? = 3) {
print("makeToast", message)
toastWindowCtrl.close()
toastWindowCtrl = ToastWindowController()
toastWindowCtrl.message = message
toastWindowCtrl.showWindow(nil)
toastWindowCtrl.becomeFirstResponder()
toastWindowCtrl.fadeInHud(displayDuration)
toastWindow.close()
toastWindow = ToastWindowController()
toastWindow.message = message
toastWindow.showWindow(Any.self)
toastWindow.fadeInHud(displayDuration)

NSApp.activate(ignoringOtherApps: true)
}

func alertDialog(title: String, message: String) -> Bool {
Expand Down
1 change: 1 addition & 0 deletions V2rayU/V2rayLaunch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ class V2rayLaunch: NSObject {
return true
} else {
NSLog("Start v2ray-core failed.")
makeToast(message: "Start v2ray-core failed.")
return false
}
}
Expand Down

0 comments on commit 6ac55b8

Please sign in to comment.