From 99cfa6439555cb74fd8cd9a99f67b239d0e96efe Mon Sep 17 00:00:00 2001 From: Yann Locatelli Date: Mon, 20 Nov 2023 12:20:41 +0100 Subject: [PATCH] :children_crossing: (LekaUpdater): Disable turning screen off during update --- .../Sources/ViewModel/UpdateStatusViewModel.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Apps/LekaUpdater/Sources/ViewModel/UpdateStatusViewModel.swift b/Apps/LekaUpdater/Sources/ViewModel/UpdateStatusViewModel.swift index f843d51c36..50d2a4bb24 100644 --- a/Apps/LekaUpdater/Sources/ViewModel/UpdateStatusViewModel.swift +++ b/Apps/LekaUpdater/Sources/ViewModel/UpdateStatusViewModel.swift @@ -5,6 +5,7 @@ import Combine import Foundation import LocalizationKit +import SwiftUI class UpdateStatusViewModel: ObservableObject { @@ -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 { @@ -122,7 +124,13 @@ class UpdateStatusViewModel: ObservableObject { } public func startUpdate() { + UIApplication.shared.isIdleTimerDisabled = true + updateProcessController.startUpdate() } + private func onUpdateEnded() { + UIApplication.shared.isIdleTimerDisabled = false + } + }