Skip to content

Commit

Permalink
Update DarockBiliApp.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsMEMZ authored Nov 23, 2023
1 parent 9a3e27c commit a5e7471
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions DarockBili Watch App/DarockBiliApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ struct DarockBili_Watch_AppApp: App {
timer.invalidate()
}
}

WKInterfaceDevice.current().isBatteryMonitoringEnabled = true
}
.overlay {
VStack {
Expand Down Expand Up @@ -198,10 +196,12 @@ struct DarockBili_Watch_AppApp: App {
.onChange(of: scenePhase) { value in
switch value {
case .background:
screenTimeCaculateTimer?.invalidate()
//screenTimeCaculateTimer?.invalidate()
break
case .inactive:
break
case .active:
WKInterfaceDevice.current().isBatteryMonitoringEnabled = true
if screenTimeCaculateTimer == nil {
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { timer in
screenTimeCaculateTimer = timer
Expand All @@ -211,7 +211,7 @@ struct DarockBili_Watch_AppApp: App {
UserDefaults.standard.set(UserDefaults.standard.integer(forKey: "ScreenTime\(dateStr)") + 1, forKey: "ScreenTime\(dateStr)")
}
} else {
screenTimeCaculateTimer!.fire()
//screenTimeCaculateTimer!.fire()
}
@unknown default:
break
Expand Down

0 comments on commit a5e7471

Please sign in to comment.