mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Merge pull request #448 from macanoclothing-blip/file_tray_hud
new file tray hud
This commit is contained in:
commit
1d53bbac13
4 changed files with 88 additions and 7 deletions
|
|
@ -454,12 +454,12 @@
|
|||
AUTOMATION_APPLE_EVENTS = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = DynamicIsland/DynamicIsland.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 12;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"DynamicIsland/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = 9Y64TRM77N;
|
||||
DEVELOPMENT_TEAM = RPC964BP8A;
|
||||
ENABLE_APP_SANDBOX = NO;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
|
|
@ -526,13 +526,13 @@
|
|||
AUTOMATION_APPLE_EVENTS = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = DynamicIsland/DynamicIsland.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 12;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"DynamicIsland/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=macosx*]" = 9Y64TRM77N;
|
||||
"DEVELOPMENT_TEAM[sdk=macosx*]" = RPC964BP8A;
|
||||
ENABLE_APP_SANDBOX = NO;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ struct ContentView: View {
|
|||
@ObservedObject var extensionNotchExperienceManager = ExtensionNotchExperienceManager.shared
|
||||
@ObservedObject var localSendService = LocalSendService.shared
|
||||
@State private var downloadManager = DownloadManager.shared
|
||||
@ObservedObject var shelfState = ShelfStateViewModel.shared
|
||||
|
||||
@Default(.enableStatsFeature) var enableStatsFeature
|
||||
@Default(.showCpuGraph) var showCpuGraph
|
||||
|
|
@ -774,6 +775,8 @@ struct ContentView: View {
|
|||
return false
|
||||
case .extensionPayload:
|
||||
return false
|
||||
case .shelf:
|
||||
return false
|
||||
}
|
||||
}()
|
||||
let canShowMusicDuringExpansion = !coordinator.expandingView.show
|
||||
|
|
@ -849,6 +852,9 @@ struct ContentView: View {
|
|||
layout: layout,
|
||||
isHovering: isHovering
|
||||
)
|
||||
} else if !coordinator.expandingView.show && vm.notchState == .closed && !shelfState.isEmpty && !vm.hideOnClosed && !lockScreenManager.isLocked && !enableMinimalisticUI {
|
||||
ShelfInlineLiveActivity()
|
||||
.transition(.opacity.animation(.smooth(duration: 0.25)))
|
||||
} else if !coordinator.expandingView.show && vm.notchState == .closed && (!musicManager.isPlaying && musicManager.isPlayerIdle) && Defaults[.showNotHumanFace] && !vm.hideOnClosed {
|
||||
DynamicIslandFaceAnimation().animation(.interactiveSpring, value: musicManager.isPlayerIdle)
|
||||
} else if vm.notchState == .open {
|
||||
|
|
@ -1192,6 +1198,11 @@ struct ContentView: View {
|
|||
return .extensionPayload(extensionPayload)
|
||||
}
|
||||
|
||||
// Shelf: show file count as lowest-priority secondary
|
||||
if !shelfState.isEmpty && !lockScreenManager.isLocked && !enableMinimalisticUI {
|
||||
return .shelf(count: shelfState.items.count)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -1212,6 +1223,8 @@ struct ContentView: View {
|
|||
case .extensionPayload(let payload):
|
||||
let maxWidth = baseWidth + centerBaseWidth * 0.6
|
||||
return ExtensionLayoutMetrics.trailingWidth(for: payload, baseWidth: baseWidth, maxWidth: maxWidth)
|
||||
case .shelf:
|
||||
return baseWidth
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1314,6 +1327,10 @@ struct ContentView: View {
|
|||
accent: payload.descriptor.accentColor.swiftUIColor,
|
||||
size: badgeSize
|
||||
)
|
||||
case .shelf:
|
||||
Image(systemName: "tray.and.arrow.down.fill")
|
||||
.font(.system(size: badgeSize * 0.50, weight: .semibold))
|
||||
.foregroundStyle(.white)
|
||||
}
|
||||
}
|
||||
.frame(width: badgeSize, height: badgeSize)
|
||||
|
|
@ -1372,6 +1389,14 @@ struct ContentView: View {
|
|||
spectrumView(forceSpectrum: true, trailingInset: 6)
|
||||
case .extensionPayload(let payload):
|
||||
ExtensionMusicWingView(payload: payload, notchHeight: notchHeight, trailingWidth: trailingWidth)
|
||||
case .shelf(let count):
|
||||
// File count badge: bold white number, like a minimal pill
|
||||
Text("\(count)")
|
||||
.font(.system(.callout, design: .rounded, weight: .bold))
|
||||
.foregroundStyle(.white)
|
||||
.contentTransition(.numericText(countsDown: false))
|
||||
.animation(.smooth(duration: 0.3), value: count)
|
||||
.frame(alignment: .center)
|
||||
case .none:
|
||||
spectrumView(
|
||||
forceSpectrum: false,
|
||||
|
|
@ -2474,6 +2499,7 @@ private enum MusicSecondaryLiveActivity: Equatable {
|
|||
case focus(FocusModeType)
|
||||
case capsLock(showLabel: Bool)
|
||||
case extensionPayload(ExtensionLiveActivityPayload)
|
||||
case shelf(count: Int)
|
||||
|
||||
var id: String {
|
||||
switch self {
|
||||
|
|
@ -2489,6 +2515,8 @@ private enum MusicSecondaryLiveActivity: Equatable {
|
|||
return showLabel ? "caps-lock-label" : "caps-lock-icon"
|
||||
case .extensionPayload(let payload):
|
||||
return "extension-\(payload.id)"
|
||||
case .shelf(let count):
|
||||
return "shelf-\(count)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5622,9 +5622,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Amazon Music" : {
|
||||
|
||||
},
|
||||
"Animation" : {
|
||||
"extractionState" : "stale",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Atoll (DynamicIsland)
|
||||
* Copyright (C) 2024-2026 Atoll Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import SwiftUI
|
||||
|
||||
/// Standalone inline HUD shown in the closed Dynamic Island when the
|
||||
/// File Tray (Shelf) has items and no higher-priority live activity is active.
|
||||
///
|
||||
/// Layout mirrors the battery inline HUD:
|
||||
/// [tray icon] ─── [ notch ] ─── [bold green count]
|
||||
struct ShelfInlineLiveActivity: View {
|
||||
@EnvironmentObject var vm: DynamicIslandViewModel
|
||||
@ObservedObject private var shelfState = ShelfStateViewModel.shared
|
||||
|
||||
private let sideWidth: CGFloat = 24
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 0) {
|
||||
|
||||
// LEFT of notch — tray icon (white, same style as the screenshot)
|
||||
Image(systemName: "tray.fill")
|
||||
.font(.system(size: 13, weight: .medium))
|
||||
.foregroundStyle(.white)
|
||||
.frame(width: sideWidth, alignment: .leading)
|
||||
|
||||
// Physical notch / pill space
|
||||
Rectangle()
|
||||
.fill(Color.black)
|
||||
.frame(width: vm.closedNotchSize.width)
|
||||
|
||||
// RIGHT of notch — file count in white
|
||||
Text("\(shelfState.items.count)")
|
||||
.font(.system(.callout, design: .rounded, weight: .bold))
|
||||
.foregroundStyle(.white)
|
||||
.contentTransition(.numericText(countsDown: false))
|
||||
.animation(.smooth(duration: 0.3), value: shelfState.items.count)
|
||||
.frame(width: sideWidth, alignment: .trailing)
|
||||
}
|
||||
.frame(height: vm.effectiveClosedNotchHeight, alignment: .center)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue