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

Commit

Permalink
Merge pull request #110 from Shufflepuck/release/release-1.3.2
Browse files Browse the repository at this point in the history
Release 1.3.2
  • Loading branch information
damien-rivet authored Dec 11, 2018
2 parents d1263af + d28bf10 commit bbd3f4e
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 48 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
The format is based on [Keep a Changelog](http://keepachangelog.com) and this project adheres to [Semantic Versioning](http://semver.org).

## [1.3.2]

### Fixed

* Fixed the startup crash when using the User Input feature [[#108](https://github.com/Shufflepuck/SplashBuddy/issues/108)]

## [1.3.1]

Expand Down
6 changes: 5 additions & 1 deletion SplashBuddy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Amaris Technologies GmbH";
TargetAttributes = {
089D291C1D50D12200E58C6D = {
Expand Down Expand Up @@ -618,12 +618,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -673,12 +675,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down
4 changes: 2 additions & 2 deletions SplashBuddy/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.1</string>
<string>1.3.2</string>
<key>CFBundleVersion</key>
<string>25</string>
<string>26</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
Expand Down
2 changes: 2 additions & 0 deletions SplashBuddy/Resources/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@
"btn.quit" = "Beenden";
/* Variation of the Continue button. */
"btn.logout" = "Abmelden";
/* Variation of the Continue button. */
"btn.send" = "Senden";
2 changes: 2 additions & 0 deletions SplashBuddy/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@
"btn.quit" = "Quit";
/* Variation of the Continue button. */
"btn.logout" = "Logout";
/* Variation of the Continue button. */
"btn.send" = "Send";
2 changes: 2 additions & 0 deletions SplashBuddy/Resources/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@
"btn.quit" = "Dejar";
/* Variation of the Continue button. */
"btn.logout" = "Cerrar sesión";
/* Variation of the Continue button. */
"btn.send" = "Enviar";
2 changes: 2 additions & 0 deletions SplashBuddy/Resources/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@
"btn.quit" = "Quitter";
/* Variation of the Continue button. */
"btn.logout" = "Fermer la session";
/* Variation of the Continue button. */
"btn.send" = "Envoyer";
2 changes: 2 additions & 0 deletions SplashBuddy/Resources/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@
"btn.quit" = "Esci";
/* Variation of the Continue button. */
"btn.logout" = "Disconnettersi";
/* Variation of the Continue button. */
"btn.send" = "Inviare";
2 changes: 2 additions & 0 deletions SplashBuddy/Resources/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@
"btn.quit" = "終了";
/* Variation of the Continue button. */
"btn.logout" = "ログアウト";
/* Variation of the Continue button. */
"btn.send" = "送信";
2 changes: 2 additions & 0 deletions SplashBuddy/Resources/nl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@
"btn.quit" = "Beëindigen";
/* Variation of the Continue button. */
"btn.logout" = "Uitloggen";
/* Variation of the Continue button. */
"btn.send" = "Verzenden";
8 changes: 6 additions & 2 deletions SplashBuddy/Tools/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Preferences {
// MARK: - INIT
//-----------------------------------------------------------------------------------

init(nsUserDefaults: UserDefaults = UserDefaults.standard) {
private init(nsUserDefaults: UserDefaults = UserDefaults.standard) {
self.userDefaults = nsUserDefaults

// Do not change asset path (see comment on var assetPath: URL below)
Expand Down Expand Up @@ -148,7 +148,11 @@ class Preferences {
}

public var form: URL? {
return self.assetBundle?.url(forResource: "form", withExtension: "html")
guard let bundle = assetBundle else {
return nil
}

return bundle.url(forResource: "form", withExtension: "html")
}

//-----------------------------------------------------------------------------------
Expand Down
7 changes: 4 additions & 3 deletions SplashBuddy/Views/Main/Base.lproj/SplashBuddy.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="UoU-0S-EqW">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="UoU-0S-EqW">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.18"/>
<plugIn identifier="com.apple.WebKit2IBPlugin" version="14313.18"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<plugIn identifier="com.apple.WebKit2IBPlugin" version="14460.31"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -312,6 +312,7 @@
<outlet property="indeterminateProgressIndicator" destination="Are-bh-n7c" id="Y6v-o2-1td"/>
<outlet property="mainView" destination="VI7-LS-rJR" id="kli-bF-0SB"/>
<outlet property="sidebarView" destination="lkr-Fa-FkH" id="G6V-YO-w7K"/>
<outlet property="stackView" destination="qF2-Zf-dqr" id="lAY-yc-aVA"/>
<outlet property="statusLabel" destination="huH-bF-pmn" id="iYg-8d-2PX"/>
<outlet property="statusView" destination="9z5-8K-Bsy" id="Dvb-uX-9FO"/>
<outlet property="webView" destination="9lx-PG-aVf" id="nCG-R3-Otx"/>
Expand Down
104 changes: 68 additions & 36 deletions SplashBuddy/Views/Main/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,56 +112,52 @@ class MainViewController: NSViewController, NSTableViewDataSource {
"""

@IBOutlet var webView: WKWebView!
@IBOutlet var softwareTableView: NSTableView!
@IBOutlet var stackView: NSStackView!
@IBOutlet weak var indeterminateProgressIndicator: NSProgressIndicator!
@IBOutlet weak var continueButton: NSButton!
@IBOutlet weak var statusLabel: NSTextField!
@IBOutlet var mainView: NSView!
@IBOutlet weak var statusView: NSView!
@IBOutlet weak var sidebarView: NSView!

var sendButton = NSButton(title: NSLocalizedString("btn.send"), target: self, action: nil)

// Predicate used by Storyboard to filter which software to display
@objc let predicate = NSPredicate(format: "displayToUser = true")

private let enterKeyJS = """
window.onload = function() {
document.body.onkeydown = function(e){
if ( e.keyCode == "13" ) {
document.body.onkeydown = function(e) {
if (e.keyCode == "13") {
window.location.href = "formdone://";
}
}
}
"""

internal func formEnterKey() {
self.evalForm(self.sendButton)
evalForm(sendButton)
}

override func awakeFromNib() {
// https://developer.apple.com/library/content/qa/qa1871/_index.html

if self.representedObject == nil {
self.representedObject = SoftwareArray.sharedInstance
if representedObject == nil {
representedObject = SoftwareArray.sharedInstance
}
}

override func viewWillAppear() {
super.viewWillAppear()

// Setup the view
self.mainView.layer?.backgroundColor = NSColor.windowBackgroundColor.cgColor
self.mainView.layer?.cornerRadius = 10
self.mainView.layer?.shadowRadius = 2
self.mainView.layer?.borderWidth = 0.2
override func viewDidLoad() {
super.viewDidLoad()

// Setup the web view
self.webView.layer?.isOpaque = true
setupViews()
setupLayout()
}

// Setup the Continue Button
self.continueButton.title = Preferences.sharedInstance.continueAction.localizedName
override func viewWillAppear() {
super.viewWillAppear()

// Setup the Notifications

NotificationCenter.default.addObserver(self,
selector: #selector(MainViewController.errorWhileInstalling),
name: SoftwareArray.StateNotification.errorWhileInstalling.notification,
Expand Down Expand Up @@ -190,18 +186,20 @@ class MainViewController: NSViewController, NSTableViewDataSource {

override func viewDidAppear() {
// Setup the initial state of objects
self.setupInstalling()
setupInstalling()

// Display Alert if /var/log/jamf.log doesn't exist
guard Preferences.sharedInstance.logFileHandle != nil else {
let alert = NSAlert()

alert.alertStyle = .critical
alert.messageText = "Jamf is not installed correctly"
alert.informativeText = "/var/log/jamf.log is missing"
alert.addButton(withTitle: "Quit")
alert.beginSheetModal(for: self.view.window!) { (_) in
self.pressedContinueButton(self)
if let currentWindow = self.view.window {
let alert = NSAlert()

alert.alertStyle = .critical
alert.messageText = "Jamf is not installed correctly"
alert.informativeText = "/var/log/jamf.log is missing"
alert.addButton(withTitle: "Quit")
alert.beginSheetModal(for: currentWindow) { [unowned self] _ in
self.pressedContinueButton(self)
}
}

return
Expand All @@ -213,28 +211,62 @@ class MainViewController: NSViewController, NSTableViewDataSource {
return
}

DispatchQueue.main.async {
DispatchQueue.main.async { [unowned self] in
self.sendButton.isHidden = false
self.continueButton.isHidden = true
}
self.webView.loadFileURL(form, allowingReadAccessTo: Preferences.sharedInstance.assetPath)

webView.loadFileURL(form, allowingReadAccessTo: Preferences.sharedInstance.assetPath)

Log.write(string: "Injecting Javascript.", cat: "UserInput", level: .debug)
self.webView.evaluateJavaScript(self.enterKeyJS, completionHandler: nil)

webView.evaluateJavaScript(self.enterKeyJS, completionHandler: nil)
} else if let html = Preferences.sharedInstance.html {
if Preferences.sharedInstance.formDone {
Log.write(string: "Form already completed.", cat: "UserInput", level: .debug)
}
DispatchQueue.main.async {

DispatchQueue.main.async { [unowned self] in
self.continueButton.isHidden = Preferences.sharedInstance.continueAction.isHidden
}

self.webView.loadFileURL(html, allowingReadAccessTo: Preferences.sharedInstance.assetPath)
webView.loadFileURL(html, allowingReadAccessTo: Preferences.sharedInstance.assetPath)
} else {
self.webView.loadHTMLString(NSLocalizedString("error.create_missing_bundle"), baseURL: nil)
webView.loadHTMLString(NSLocalizedString("error.create_missing_bundle"), baseURL: nil)
}
}

@IBOutlet weak var sendButton: NSButton!
// MARK: - Functions

func setupViews() {
// Main view
mainView.layer?.backgroundColor = NSColor.windowBackgroundColor.cgColor
mainView.layer?.cornerRadius = 10
mainView.layer?.shadowRadius = 2
mainView.layer?.borderWidth = 0.2

// Web view
webView.layer?.isOpaque = true

// Continue Button
continueButton.title = Preferences.sharedInstance.continueAction.localizedName

// Send button
sendButton.isHidden = true
sendButton.action = #selector(evalForm)
view.addSubview(sendButton)
}

func setupLayout() {
sendButton.translatesAutoresizingMaskIntoConstraints = false

NSLayoutConstraint.activate([
sendButton.leadingAnchor.constraint(equalTo: stackView.trailingAnchor),
sendButton.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20),
sendButton.centerYAnchor.constraint(equalTo: stackView.centerYAnchor)
])
}

@IBAction func evalForm(_ sender: Any) {
webView.evaluateJavaScript(evaluationJavascript) { (data: Any?, error: Error?) in
if error != nil {
Expand All @@ -261,7 +293,7 @@ class MainViewController: NSViewController, NSTableViewDataSource {
FileManager.default.createFile(atPath: "\(item.key).txt", contents: (item.value as? String ?? "").data(using: .utf8), attributes: nil)
}

DispatchQueue.main.async {
DispatchQueue.main.async { [unowned self] in
self.sendButton.isHidden = true
self.continueButton.isHidden = false

Expand Down
4 changes: 2 additions & 2 deletions SplashBuddy/Views/Main/MainViewController_Actions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ extension MainViewController {
statusLabel.isHidden = false
statusLabel.stringValue = NSLocalizedString("actions.preparing_your_mac")

self.sidebarView.isHidden = Preferences.sharedInstance.sidebar
sidebarView.isHidden = Preferences.sharedInstance.sidebar

self.continueButton.isEnabled = false
continueButton.isEnabled = false
}

/// reset the status label to "We are preparing your Mac…"
Expand Down

0 comments on commit bbd3f4e

Please sign in to comment.