batteria finale, waiting for approve

This commit is contained in:
delli 2026-04-29 15:48:03 +02:00
commit 945707425a
9 changed files with 1091 additions and 89 deletions

View file

@ -97,6 +97,7 @@ struct ExpandedItem {
var type: SneakContentType = .battery
var value: CGFloat = 0
var browser: BrowserType = .chromium
var autoHideDuration: TimeInterval? = nil
}
class DynamicIslandViewCoordinator: ObservableObject {
@ -413,7 +414,8 @@ class DynamicIslandViewCoordinator: ObservableObject {
status: Bool,
type: SneakContentType,
value: CGFloat = 0,
browser: BrowserType = .chromium
browser: BrowserType = .chromium,
autoHideDuration: TimeInterval? = nil
) {
Task { @MainActor in
withAnimation(.smooth) {
@ -421,6 +423,7 @@ class DynamicIslandViewCoordinator: ObservableObject {
self.expandingView.type = type
self.expandingView.value = value
self.expandingView.browser = browser
self.expandingView.autoHideDuration = autoHideDuration
}
}
}
@ -433,7 +436,7 @@ class DynamicIslandViewCoordinator: ObservableObject {
expandingViewTask?.cancel()
// Only auto-hide for battery, not for downloads (DownloadManager handles that)
if expandingView.type != .download {
let duration: TimeInterval = 3
let duration = expandingView.autoHideDuration ?? 3
expandingViewTask = Task { [weak self] in
try? await Task.sleep(for: .seconds(duration))
guard let self = self, !Task.isCancelled else { return }