Skip to content

Commit 30692b7

Browse files
committed
fix: sparkle controller initialization
1 parent 7232837 commit 30692b7

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

ishare/App.swift

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,17 @@ class AppDelegate: NSObject, NSApplicationDelegate, SPUUpdaterDelegate {
4545
static var shared: AppDelegate { sharedInstance }
4646

4747
var recordGif = false
48-
var screenRecorder = ScreenRecorder()
49-
var updaterController: SPUStandardUpdaterController!
48+
let screenRecorder = ScreenRecorder()
49+
let updaterController: SPUStandardUpdaterController
50+
51+
override init() {
52+
self.updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)
53+
super.init()
54+
}
55+
56+
func applicationDidFinishLaunching(_: Notification) {
57+
NSLog("Application finished launching")
58+
}
5059

5160
func application(_: NSApplication, open urls: [URL]) {
5261
if urls.first!.isFileURL {
@@ -86,20 +95,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, SPUUpdaterDelegate {
8695
}
8796
}
8897

89-
func applicationDidFinishLaunching(_: Notification) {
90-
NSLog("Application finished launching")
91-
92-
Task {
93-
NSLog("Initializing screen recorder")
94-
screenRecorder = ScreenRecorder()
95-
}
96-
97-
#if GITHUB_RELEASE
98-
NSLog("Initializing updater controller for GitHub release")
99-
updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: self, userDriverDelegate: nil)
100-
#endif
101-
}
102-
10398
@MainActor
10499
func stopRecording() {
105100
let wasRecordingGif = recordGif
@@ -127,7 +122,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
127122
static var shared: AppDelegate { sharedInstance }
128123

129124
var recordGif = false
130-
var screenRecorder = ScreenRecorder()
125+
let screenRecorder = ScreenRecorder()
131126

132127
func application(_: NSApplication, open urls: [URL]) {
133128
if urls.first!.isFileURL {
@@ -161,10 +156,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
161156

162157
func applicationDidFinishLaunching(_: Notification) {
163158
NSLog("Application finished launching")
164-
165-
Task {
166-
screenRecorder = ScreenRecorder()
167-
}
168159
}
169160

170161
@MainActor

0 commit comments

Comments
 (0)