mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Completely working
This commit is contained in:
parent
911ed0da21
commit
6a2d74777f
1 changed files with 36 additions and 7 deletions
|
|
@ -478,6 +478,31 @@ struct ContentView: View {
|
||||||
.padding(.top, 40)
|
.padding(.top, 40)
|
||||||
Spacer()
|
Spacer()
|
||||||
} else {
|
} else {
|
||||||
|
let musicPairingEligible = vm.notchState == .closed
|
||||||
|
&& (musicManager.isPlaying || !musicManager.isPlayerIdle)
|
||||||
|
&& coordinator.musicLiveActivityEnabled
|
||||||
|
&& !vm.hideOnClosed
|
||||||
|
&& !lockScreenManager.isLocked
|
||||||
|
let musicSecondary = resolveMusicSecondaryLiveActivity()
|
||||||
|
let expansionMatchesSecondary: Bool = {
|
||||||
|
guard let musicSecondary else { return false }
|
||||||
|
switch musicSecondary {
|
||||||
|
case .timer:
|
||||||
|
return coordinator.expandingView.type == .timer
|
||||||
|
case .reminder:
|
||||||
|
return coordinator.expandingView.type == .reminder
|
||||||
|
case .recording:
|
||||||
|
return coordinator.expandingView.type == .recording
|
||||||
|
case .focus:
|
||||||
|
return coordinator.expandingView.type == .doNotDisturb
|
||||||
|
case .capsLock, .coolFace:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
let canShowMusicDuringExpansion = !coordinator.expandingView.show
|
||||||
|
|| coordinator.expandingView.type == .music
|
||||||
|
|| expansionMatchesSecondary
|
||||||
|
|
||||||
if coordinator.expandingView.type == .battery && coordinator.expandingView.show && vm.notchState == .closed && Defaults[.showPowerStatusNotifications] {
|
if coordinator.expandingView.type == .battery && coordinator.expandingView.show && vm.notchState == .closed && Defaults[.showPowerStatusNotifications] {
|
||||||
HStack(spacing: 0) {
|
HStack(spacing: 0) {
|
||||||
HStack {
|
HStack {
|
||||||
|
|
@ -512,13 +537,13 @@ struct ContentView: View {
|
||||||
} else if vm.notchState == .closed && capsLockManager.isCapsLockActive && Defaults[.enableCapsLockIndicator] && !vm.hideOnClosed && !lockScreenManager.isLocked {
|
} else if vm.notchState == .closed && capsLockManager.isCapsLockActive && Defaults[.enableCapsLockIndicator] && !vm.hideOnClosed && !lockScreenManager.isLocked {
|
||||||
InlineHUD(type: .constant(.capsLock), value: .constant(1.0), icon: .constant(""), hoverAnimation: $isHovering, gestureProgress: $gestureProgress)
|
InlineHUD(type: .constant(.capsLock), value: .constant(1.0), icon: .constant(""), hoverAnimation: $isHovering, gestureProgress: $gestureProgress)
|
||||||
.transition(.move(edge: .trailing).combined(with: .opacity))
|
.transition(.move(edge: .trailing).combined(with: .opacity))
|
||||||
} else if (!coordinator.expandingView.show || coordinator.expandingView.type == .music) && vm.notchState == .closed && (musicManager.isPlaying || !musicManager.isPlayerIdle) && coordinator.musicLiveActivityEnabled && !vm.hideOnClosed && !lockScreenManager.isLocked {
|
} else if canShowMusicDuringExpansion && musicPairingEligible {
|
||||||
MusicLiveActivity()
|
MusicLiveActivity(secondary: musicSecondary)
|
||||||
} else if (!coordinator.expandingView.show || coordinator.expandingView.type == .timer) && vm.notchState == .closed && timerManager.isTimerActive && coordinator.timerLiveActivityEnabled && !vm.hideOnClosed {
|
} else if (!coordinator.expandingView.show || coordinator.expandingView.type == .timer) && vm.notchState == .closed && timerManager.isTimerActive && coordinator.timerLiveActivityEnabled && !vm.hideOnClosed {
|
||||||
TimerLiveActivity()
|
TimerLiveActivity()
|
||||||
} else if (!coordinator.expandingView.show || coordinator.expandingView.type == .reminder) && vm.notchState == .closed && reminderManager.isActive && enableReminderLiveActivity && !vm.hideOnClosed {
|
} else if (!coordinator.expandingView.show || coordinator.expandingView.type == .reminder) && vm.notchState == .closed && reminderManager.isActive && enableReminderLiveActivity && !vm.hideOnClosed {
|
||||||
ReminderLiveActivity()
|
ReminderLiveActivity()
|
||||||
} else if (!coordinator.expandingView.show || coordinator.expandingView.type == .recording) && vm.notchState == .closed && (recordingManager.isRecording || !recordingManager.isRecorderIdle) && Defaults[.enableScreenRecordingDetection] && !vm.hideOnClosed {
|
} else if (!coordinator.expandingView.show || coordinator.expandingView.type == .recording) && vm.notchState == .closed && (recordingManager.isRecording || !recordingManager.isRecorderIdle) && Defaults[.enableScreenRecordingDetection] && !vm.hideOnClosed && !musicPairingEligible {
|
||||||
RecordingLiveActivity()
|
RecordingLiveActivity()
|
||||||
} else if (!coordinator.expandingView.show || coordinator.expandingView.type == .download) && vm.notchState == .closed && downloadManager.isDownloading && Defaults[.enableDownloadListener] && !vm.hideOnClosed {
|
} else if (!coordinator.expandingView.show || coordinator.expandingView.type == .download) && vm.notchState == .closed && downloadManager.isDownloading && Defaults[.enableDownloadListener] && !vm.hideOnClosed {
|
||||||
DownloadLiveActivity()
|
DownloadLiveActivity()
|
||||||
|
|
@ -687,8 +712,8 @@ struct ContentView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
func MusicLiveActivity() -> some View {
|
private func MusicLiveActivity(secondary preResolvedSecondary: MusicSecondaryLiveActivity? = nil) -> some View {
|
||||||
let secondary = resolveMusicSecondaryLiveActivity()
|
let secondary = preResolvedSecondary ?? resolveMusicSecondaryLiveActivity()
|
||||||
let notchContentHeight = max(0, vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12))
|
let notchContentHeight = max(0, vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12))
|
||||||
let wingBaseWidth = max(0, vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12) + gestureProgress / 2)
|
let wingBaseWidth = max(0, vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12) + gestureProgress / 2)
|
||||||
let rawCenterBaseWidth = vm.closedNotchSize.width + (isHovering ? 8 : 0)
|
let rawCenterBaseWidth = vm.closedNotchSize.width + (isHovering ? 8 : 0)
|
||||||
|
|
@ -874,8 +899,12 @@ struct ContentView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func recordingRightWingWidth(baseWidth: CGFloat) -> CGFloat {
|
private func recordingRightWingWidth(baseWidth: CGFloat) -> CGFloat {
|
||||||
// Recording keeps the spectrum but should stay near the default width with a small inset.
|
// Keep recording pairings compact by reducing the width relative to the notch height.
|
||||||
return max(baseWidth + 18, 54)
|
let absoluteMin: CGFloat = 38
|
||||||
|
let preferredWidth = max(baseWidth * 0.6, 0)
|
||||||
|
let maxWidth = min(baseWidth - 6, 52)
|
||||||
|
let clampedPreferred = min(preferredWidth, maxWidth)
|
||||||
|
return min(baseWidth, max(absoluteMin, clampedPreferred))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func scaledWingWidth(baseWidth: CGFloat, centerBaseWidth: CGFloat, factor: CGFloat, extra: CGFloat) -> CGFloat {
|
private func scaledWingWidth(baseWidth: CGFloat, centerBaseWidth: CGFloat, factor: CGFloat, extra: CGFloat) -> CGFloat {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue