Skip to content

Commit

Permalink
🚸 (LekaUpdater): Disable turning screen off during update
Browse files Browse the repository at this point in the history
  • Loading branch information
YannLocatelli committed Nov 20, 2023
1 parent 8b0ac08 commit 99cfa64
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import Combine
import Foundation
import LocalizationKit
import SwiftUI

class UpdateStatusViewModel: ObservableObject {

Expand Down Expand Up @@ -88,6 +89,7 @@ class UpdateStatusViewModel: ObservableObject {
self.errorDescription = String(l10n.update.error.unknownErrorDescription.characters)
self.errorInstructions = String(l10n.update.error.unknownErrorInstructions.characters)
}
self.onUpdateEnded()
}
} receiveValue: { state in
switch state {
Expand Down Expand Up @@ -122,7 +124,13 @@ class UpdateStatusViewModel: ObservableObject {
}

public func startUpdate() {
UIApplication.shared.isIdleTimerDisabled = true

updateProcessController.startUpdate()
}

private func onUpdateEnded() {
UIApplication.shared.isIdleTimerDisabled = false
}

}

0 comments on commit 99cfa64

Please sign in to comment.