Skip to content

Commit 55a3562

Browse files
committed
updating before launching app
1 parent c59eaa8 commit 55a3562

3 files changed

Lines changed: 25 additions & 24 deletions

File tree

native/app/Source/AppDelegate.swift

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,11 @@ import EmitterKit
1515
@NSApplicationMain
1616
class AppDelegate: NSObject, NSApplicationDelegate, SUUpdaterDelegate {
1717
var updater = SUUpdater(for: Bundle.main)!
18-
var updateFound = Event<Void>()
19-
var updateNotFound = Event<Void>()
20-
var updateCanceled = Event<Void>()
21-
18+
var updateProcessed = Event<Void>()
19+
var willBeDownloadingUpdate = false
2220
func applicationDidFinishLaunching(_ aNotification: Notification) {
2321
updater.delegate = self
24-
updateFound.once { _ in
25-
self.updateCanceled.once { _ in
26-
Application.start()
27-
}
28-
}
29-
30-
updateNotFound.once { _ in
22+
updateProcessed.once { _ in
3123
Application.start()
3224
}
3325
updater.checkForUpdatesInBackground()
@@ -51,29 +43,40 @@ class AppDelegate: NSObject, NSApplicationDelegate, SUUpdaterDelegate {
5143
}
5244

5345
func updaterDidNotFindUpdate(_ updater: SUUpdater) {
54-
updateNotFound.emit()
55-
}
56-
57-
func updater(_ updater: SUUpdater, didFindValidUpdate item: SUAppcastItem) {
58-
updateFound.emit()
46+
updateProcessed.emit()
5947
}
6048

6149
func updater(_ updater: SUUpdater, userDidSkipThisVersion item: SUAppcastItem) {
62-
updateCanceled.emit()
50+
updateProcessed.emit()
6351
}
6452

6553
func updater(_ updater: SUUpdater, didCancelInstallUpdateOnQuit item: SUAppcastItem) {
66-
updateCanceled.emit()
54+
updateProcessed.emit()
55+
}
56+
57+
func updater(_ updater: SUUpdater, willDownloadUpdate item: SUAppcastItem, with request: NSMutableURLRequest) {
58+
willBeDownloadingUpdate = true
6759
}
6860

6961
func updater(_ updater: SUUpdater, didDismissUpdateAlertPermanently permanently: Bool, for item: SUAppcastItem) {
70-
// updateCanceled.emit()
62+
Utilities.delay(500, completion: {
63+
if !self.willBeDownloadingUpdate {
64+
self.updateProcessed.emit()
65+
}
66+
})
7167
}
7268

7369
func userDidCancelDownload(_ updater: SUUpdater) {
74-
updateCanceled.emit()
70+
updateProcessed.emit()
71+
}
72+
73+
func updater(_ updater: SUUpdater, didAbortWithError error: Error) {
74+
updateProcessed.emit()
75+
}
76+
77+
func updater(_ updater: SUUpdater, failedToDownloadUpdate item: SUAppcastItem, error: Error) {
78+
updateProcessed.emit()
7579
}
76-
7780
}
7881

7982

ui/src/app/sections/effects/equalizers/advanced-equalizer/advanced-equalizer.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ export class AdvancedEqualizerComponent extends EqualizerComponent implements On
142142
protected setupEvents () {
143143
this.service.onPresetsChanged(presets => {
144144
if (!presets) return
145-
console.log('new presets', presets)
146145
this.presets = presets
147146
})
148147
this.service.onSelectedPresetChanged(preset => {

ui/src/app/sections/effects/equalizers/basic-equalizer/basic-equalizer.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class BasicEqualizerComponent extends EqualizerComponent implements OnIni
102102
setSelectedPresetsGains () {
103103
// TODO: Refactor this bollocks
104104
this.peakLimiter = this.selectedPreset.peakLimiter || false
105-
console.log(this.selectedPreset.peakLimiter, this.peakLimiter)
105+
106106
for (const [type, gain] of Object.entries(this.selectedPreset.gains)) {
107107
const currentGain: number = this.gains[type]
108108
if (currentGain !== gain) {
@@ -161,7 +161,6 @@ export class BasicEqualizerComponent extends EqualizerComponent implements OnIni
161161
async togglePeakLimiter () {
162162
this.peakLimiter = !this.peakLimiter
163163
this.selectedPreset.peakLimiter = this.peakLimiter
164-
console.log(this.selectedPreset.peakLimiter)
165164
await this.service.updatePreset(this.selectedPreset, {
166165
select: true
167166
})

0 commit comments

Comments
 (0)