Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Commit cc795d3

Browse files
authored
Merge pull request #119 from Shufflepuck/hotfix/main-window-not-launching
Fix main window not showing
2 parents 4d13a9e + 74c2021 commit cc795d3

File tree

3 files changed

+31
-20
lines changed

3 files changed

+31
-20
lines changed

Sources/Views/Main/Base.lproj/SplashBuddy.storyboard

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,6 @@
298298
<constraint firstItem="SdF-5b-Pla" firstAttribute="top" secondItem="VI7-LS-rJR" secondAttribute="top" id="f0G-pr-kb9"/>
299299
<constraint firstAttribute="bottom" secondItem="SdF-5b-Pla" secondAttribute="bottom" id="mSG-zm-sdE"/>
300300
</constraints>
301-
<userDefinedRuntimeAttributes>
302-
<userDefinedRuntimeAttribute type="color" keyPath="backgroundColor">
303-
<color key="value" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
304-
</userDefinedRuntimeAttribute>
305-
<userDefinedRuntimeAttribute type="number" keyPath="layer.borderWidth">
306-
<integer key="value" value="4"/>
307-
</userDefinedRuntimeAttribute>
308-
</userDefinedRuntimeAttributes>
309301
</view>
310302
<connections>
311303
<outlet property="continueButton" destination="k7a-CL-x2G" id="7B2-Pa-6MA"/>

Sources/Views/Main/MainViewController.swift

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class MainViewController: NSViewController, NSTableViewDataSource {
190190

191191
// Display Alert if /var/log/jamf.log doesn't exist
192192
guard Preferences.sharedInstance.logFileHandle != nil else {
193-
if let currentWindow = self.view.window {
193+
if let currentWindow = view.window {
194194
let alert = NSAlert()
195195

196196
alert.alertStyle = .critical
@@ -211,9 +211,11 @@ class MainViewController: NSViewController, NSTableViewDataSource {
211211
return
212212
}
213213

214-
DispatchQueue.main.async { [unowned self] in
215-
self.sendButton.isHidden = false
216-
self.continueButton.isHidden = true
214+
DispatchQueue.main.async { [weak self] in
215+
guard let strongSelf = self else { return }
216+
217+
strongSelf.sendButton.isHidden = false
218+
strongSelf.continueButton.isHidden = true
217219
}
218220

219221
webView.loadFileURL(form, allowingReadAccessTo: Preferences.sharedInstance.assetPath)
@@ -226,8 +228,10 @@ class MainViewController: NSViewController, NSTableViewDataSource {
226228
Log.write(string: "Form already completed.", cat: "UserInput", level: .debug)
227229
}
228230

229-
DispatchQueue.main.async { [unowned self] in
230-
self.continueButton.isHidden = Preferences.sharedInstance.continueAction.isHidden
231+
DispatchQueue.main.async { [weak self] in
232+
guard let strongSelf = self else { return }
233+
234+
strongSelf.continueButton.isHidden = Preferences.sharedInstance.continueAction.isHidden
231235
}
232236

233237
webView.loadFileURL(html, allowingReadAccessTo: Preferences.sharedInstance.assetPath)
@@ -268,7 +272,9 @@ class MainViewController: NSViewController, NSTableViewDataSource {
268272
}
269273

270274
@IBAction func evalForm(_ sender: Any) {
271-
webView.evaluateJavaScript(evaluationJavascript) { (data: Any?, error: Error?) in
275+
webView.evaluateJavaScript(evaluationJavascript) { [weak self] (data: Any?, error: Error?) in
276+
guard let strongSelf = self else { return }
277+
272278
if error != nil {
273279
Log.write(string: "Error getting User Input", cat: "UserInput", level: .error)
274280
return
@@ -293,14 +299,14 @@ class MainViewController: NSViewController, NSTableViewDataSource {
293299
FileManager.default.createFile(atPath: "\(item.key).txt", contents: (item.value as? String ?? "").data(using: .utf8), attributes: nil)
294300
}
295301

296-
DispatchQueue.main.async { [unowned self] in
297-
self.sendButton.isHidden = true
298-
self.continueButton.isHidden = false
302+
DispatchQueue.main.async {
303+
strongSelf.sendButton.isHidden = true
304+
strongSelf.continueButton.isHidden = false
299305

300306
if let html = Preferences.sharedInstance.html {
301-
self.webView.loadFileURL(html, allowingReadAccessTo: Preferences.sharedInstance.assetPath)
307+
strongSelf.webView.loadFileURL(html, allowingReadAccessTo: Preferences.sharedInstance.assetPath)
302308
} else {
303-
self.webView.loadHTMLString(NSLocalizedString("error.create_missing_bundle"), baseURL: nil)
309+
strongSelf.webView.loadHTMLString(NSLocalizedString("error.create_missing_bundle"), baseURL: nil)
304310
}
305311
}
306312

SplashBuddy.xcodeproj/project.pbxproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
ED797C93229E6C8A00505E8C /* Tools.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED797C92229E6C8A00505E8C /* Tools.swift */; };
3939
ED797C95229E6EFB00505E8C /* ToolsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED797C94229E6EFB00505E8C /* ToolsTests.swift */; };
4040
ED797C99229E6FCF00505E8C /* SoftwareTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED797C98229E6FCF00505E8C /* SoftwareTests.swift */; };
41+
EDA7F21922A1628300C41354 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDA7F21822A1628300C41354 /* WebKit.framework */; };
4142
/* End PBXBuildFile section */
4243

4344
/* Begin PBXContainerItemProxy section */
@@ -132,13 +133,15 @@
132133
EDA78DAD20A03D2D00BBA14E /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = "<group>"; };
133134
EDA78DAE20A03D2D00BBA14E /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
134135
EDA78DAF20A03D2D00BBA14E /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/SplashBuddy.strings; sourceTree = "<group>"; };
136+
EDA7F21822A1628300C41354 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
135137
/* End PBXFileReference section */
136138

137139
/* Begin PBXFrameworksBuildPhase section */
138140
089D291A1D50D12200E58C6D /* Frameworks */ = {
139141
isa = PBXFrameworksBuildPhase;
140142
buildActionMask = 2147483647;
141143
files = (
144+
EDA7F21922A1628300C41354 /* WebKit.framework in Frameworks */,
142145
);
143146
runOnlyForDeploymentPostprocessing = 0;
144147
};
@@ -161,6 +164,7 @@
161164
089D291F1D50D12200E58C6D /* Sources */,
162165
08AC4F751D520A3200CAB019 /* SplashBuddyTestAssets */,
163166
089D292F1D50D12200E58C6D /* Tests */,
167+
EDA7F21722A1628300C41354 /* Frameworks */,
164168
);
165169
sourceTree = "<group>";
166170
};
@@ -398,6 +402,14 @@
398402
path = Tools;
399403
sourceTree = "<group>";
400404
};
405+
EDA7F21722A1628300C41354 /* Frameworks */ = {
406+
isa = PBXGroup;
407+
children = (
408+
EDA7F21822A1628300C41354 /* WebKit.framework */,
409+
);
410+
name = Frameworks;
411+
sourceTree = "<group>";
412+
};
401413
/* End PBXGroup section */
402414

403415
/* Begin PBXNativeTarget section */
@@ -773,6 +785,7 @@
773785
isa = XCBuildConfiguration;
774786
buildSettings = {
775787
BUNDLE_LOADER = "$(TEST_HOST)";
788+
CODE_SIGN_IDENTITY = "Mac Developer";
776789
COMBINE_HIDPI_IMAGES = YES;
777790
INFOPLIST_FILE = Configurations/SplashBuddyTests.plist;
778791
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";

0 commit comments

Comments
 (0)