Skip to content

Commit

Permalink
Add bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rurza committed Nov 29, 2024
1 parent 05fab51 commit f01a560
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
19 changes: 12 additions & 7 deletions BatFiKit/Sources/App/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ public final class BatFi: StatusItemManagerDelegate, HelperConnectionManagerDele
}

public func openOnboarding() {
Task {
Task { [weak self] in
guard let self else { return }
await dockIcon.show(true)

if onboardingWindow == nil {
Expand Down Expand Up @@ -161,9 +162,13 @@ public final class BatFi: StatusItemManagerDelegate, HelperConnectionManagerDele
persistenceManager.setUpObserving()
await magSafeColorManager.setUpObserving()

notificationsManager = NotificationsManager()
statusItemManager = StatusItemManager()
statusItemManager?.delegate = self
if notificationsManager == nil {
notificationsManager = NotificationsManager()
}
if statusItemManager == nil {
statusItemManager = StatusItemManager()
statusItemManager?.delegate = self
}
}

private func runMigration() async {
Expand Down Expand Up @@ -193,9 +198,9 @@ public final class BatFi: StatusItemManagerDelegate, HelperConnectionManagerDele
let window = ArrowWindow(arrowSize: NSSize(width: 40, height: 120), statusItem: statusItem)
arrowWindow = window
window.show()
Task {
try await clock.sleep(for: .seconds(7))
arrowWindow?.close()
Task { [weak self] in
try await self?.clock.sleep(for: .seconds(7))
self?.arrowWindow?.close()
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion BatFiKit/Sources/AppCore/StatusItemManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,15 @@ public final class StatusItemManager {
}

private func observeMenuState() {
menuStateTask = Task { [weak self] in
Task { [weak self] in
guard let self else { return }
if let result = try? await self.powerModeClient.getCurrentPowerMode() {
self.lastPowerMode = result.0
self.showHighPowerMode = result.1
}
}
menuStateTask = Task { [weak self] in
guard let self else { return }
for await ((state, showDebugMenu, showPowerModeOptions), (showChart, showPowerDiagram, showHighEnergyImpactProcesses), powerMode) in combineLatest(
combineLatest(
appChargingState.appChargingModeDidChage(),
Expand Down

0 comments on commit f01a560

Please sign in to comment.