Skip to content

Commit ef4338f

Browse files
committed
fix: disable idle timer only on macOS
1 parent 6c468bb commit ef4338f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Sushitrain/ContentView.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,16 @@ private struct LoadingView: View {
281281
.frame(maxWidth: 320)
282282
}
283283
}
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-
}
284+
#if os(iOS)
285+
.onAppear {
286+
Log.info("Asserting idle timer disable")
287+
UIApplication.shared.isIdleTimerDisabled = true
288+
}
289+
.onDisappear {
290+
Log.info("Deasserting idle timer disable")
291+
UIApplication.shared.isIdleTimerDisabled = false
292+
}
293+
#endif
292294
}
293295
}
294296

0 commit comments

Comments
 (0)