This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
var (
|
||||
guardOnce sync.Once
|
||||
guardViolation func(string)
|
||||
guardViolation func(kind, reason string)
|
||||
guardStop chan struct{}
|
||||
suppressMu sync.Mutex
|
||||
suppressViolationsUntil time.Time
|
||||
@@ -36,8 +36,8 @@ func violationsSuppressed() bool {
|
||||
return time.Now().Before(suppressViolationsUntil)
|
||||
}
|
||||
|
||||
// Start giám sát môi trường macOS — vi phạm thì gọi onViolation (đa màn hình).
|
||||
func Start(onViolation func(reason string)) {
|
||||
// Start giám sát môi trường macOS — vi phạm thì gọi onViolation(kind, reason).
|
||||
func Start(onViolation func(kind, reason string)) {
|
||||
guardOnce.Do(func() {
|
||||
if onViolation == nil {
|
||||
return
|
||||
@@ -46,7 +46,7 @@ func Start(onViolation func(reason string)) {
|
||||
guardStop = make(chan struct{})
|
||||
|
||||
if screenshot.NumActiveDisplays() > 1 {
|
||||
onViolation("Phát hiện nhiều hơn 1 màn hình. Vui lòng chỉ dùng một màn hình khi chạy Simple Care.")
|
||||
onViolation("multi_monitor", "Phát hiện nhiều hơn 1 màn hình. Vui lòng chỉ dùng một màn hình khi chạy Simple Care.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ func checkEnvironment() {
|
||||
return
|
||||
}
|
||||
if n := screenshot.NumActiveDisplays(); n > 1 {
|
||||
guardViolation("Phát hiện nhiều hơn 1 màn hình. Vui lòng rút/bật tắt màn hình phụ.")
|
||||
guardViolation("multi_monitor", "Phát hiện nhiều hơn 1 màn hình. Vui lòng rút/bật tắt màn hình phụ.")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user