@@ -14,16 +14,7 @@ struct MainView: View {
1414 var body : some View {
1515 switch appState. startupState {
1616 case . notStarted:
17- VStack ( spacing: 10 ) {
18- ProgressView ( ) . progressViewStyle ( . circular)
19- if !appState. isMigratedToNewDatabase {
20- // We are likely migrating now
21- Text ( " Upgrading the database. This may take a few minutes, depending on how many files you have. Please do not close the app until this is finished. " )
22- . foregroundStyle ( . secondary)
23- . multilineTextAlignment ( . center)
24- . frame ( maxWidth: 320 )
25- }
26- }
17+ LoadingView ( appState: appState)
2718 case . error( let e) :
2819 ContentUnavailableView ( " Cannot start the app " , systemImage: " exclamationmark.triangle.fill " , description: Text ( e) )
2920 case . started:
@@ -274,6 +265,33 @@ private struct ContentView: View {
274265 }
275266}
276267
268+ private struct LoadingView : View {
269+ @ObservedObject var appState : AppState
270+
271+ var body : some View {
272+ VStack ( spacing: 10 ) {
273+ ProgressView ( ) . progressViewStyle ( . circular)
274+ if !appState. isMigratedToNewDatabase {
275+ // We are likely migrating now
276+ Text (
277+ " Upgrading the database. This may take a few minutes, depending on how many files you have. Please do not close the app until this is finished. "
278+ )
279+ . foregroundStyle ( . secondary)
280+ . multilineTextAlignment ( . center)
281+ . frame ( maxWidth: 320 )
282+ }
283+ }
284+ . onAppear {
285+ Log . info ( " Asserting idle timer disable " )
286+ UIApplication . shared. isIdleTimerDisabled = true
287+ }
288+ . onDisappear {
289+ Log . info ( " Deasserting idle timer disable " )
290+ UIApplication . shared. isIdleTimerDisabled = false
291+ }
292+ }
293+ }
294+
277295private struct StartOrSearchView : View {
278296 @ObservedObject var appState : AppState
279297 @Binding var route : Route ?
0 commit comments