Skip to content

Commit

Permalink
Fixed an issued that prevented Waypoints from triggering from AppleSc…
Browse files Browse the repository at this point in the history
…ript
  • Loading branch information
Jason Tratta committed Apr 26, 2016
1 parent c523277 commit 7c9b034
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
30 changes: 19 additions & 11 deletions ProgressScreen/AppDelegate.swift
@@ -1,3 +1,4 @@

//
// AppDelegate.swift
// ProgressScreen
Expand Down Expand Up @@ -85,17 +86,17 @@ class AppDelegate: NSObject, NSApplicationDelegate {

self.addObserver(self, forKeyPath: "configurations", options:.New, context: nil)

NSNotificationCenter.defaultCenter().addObserver(self, selector:"changeBuildTime:", name:PSBuildTimeNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:"changeHTMLURL:", name:PSURLChange, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:"changeCurrentTime:", name:PSCurrentTimeChange, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:"adjustFullScreen:", name:PSFullScreen, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:"hideQuitButton:", name:PSHideQuit, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(AppDelegate.changeBuildTime(_:)), name:PSBuildTimeNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(AppDelegate.changeHTMLURL(_:)), name:PSURLChange, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(AppDelegate.changeCurrentTime(_:)), name:PSCurrentTimeChange, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(AppDelegate.adjustFullScreen(_:)), name:PSFullScreen, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(AppDelegate.hideQuitButton(_:)), name:PSHideQuit, object: nil)

NSNotificationCenter.defaultCenter().addObserver(self, selector:"enableWayPointMethod:", name:PSHWayPointMethod, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:"setWaypointOne:", name:PSHWayPointOne, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:"setWaypointTwo:", name:PSHWayPointTwo, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:"setWaypointThree:", name:PSHWayPointThree, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:"setWaypointFour:", name:PSHWayPointFour, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(AppDelegate.enableWayPointMethod(_:)), name:PSHWayPointMethod, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(AppDelegate.setWaypointOne(_:)), name:PSHWayPointOne, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(AppDelegate.setWaypointTwo(_:)), name:PSHWayPointTwo, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(AppDelegate.setWaypointThree(_:)), name:PSHWayPointThree, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(AppDelegate.setWaypointFour(_:)), name:PSHWayPointFour, object: nil)

progressBar.hidden = false
progressBar.minValue = 0
Expand Down Expand Up @@ -212,6 +213,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
//Set the WayPoints from Scripting
func enableWayPointMethod(note: NSNotification) {



let object = note.object as! ConfigurationSettings
useWayPointMessages = object.useWayPointMethod

Expand All @@ -220,27 +223,31 @@ class AppDelegate: NSObject, NSApplicationDelegate {

func setWaypointOne(note: NSNotification) {


let object = note.object as! ConfigurationSettings
quarterProgress = object.wayPointOne

}

func setWaypointTwo(note: NSNotification) {


let object = note.object as! ConfigurationSettings
halfProgress = object.wayPointTwo

}

func setWaypointThree(note: NSNotification) {


let object = note.object as! ConfigurationSettings
threeQuartersProgress = object.wayPointThree

}

func setWaypointFour(note: NSNotification) {


let object = note.object as! ConfigurationSettings
lastPackage = object.wayPointFour

Expand All @@ -266,7 +273,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func progress() {

let timerInterval = NSTimeInterval(0.05)
theTimer = NSTimer.scheduledTimerWithTimeInterval(timerInterval, target: self, selector: "refreshData", userInfo: nil, repeats: true)
theTimer = NSTimer.scheduledTimerWithTimeInterval(timerInterval, target: self, selector: #selector(AppDelegate.refreshData), userInfo: nil, repeats: true)
theTimer.fire()

}
Expand Down Expand Up @@ -301,6 +308,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {

func updateWaypointMethod() {


let logString = logFileLastRecord()

if (logString.rangeOfString("Successfully installed " + quarterProgress) != nil) {
Expand Down
11 changes: 6 additions & 5 deletions ProgressScreen/ConfigurationSettings.m
Expand Up @@ -42,6 +42,7 @@




@implementation ConfigurationSettings


Expand All @@ -67,11 +68,11 @@ - (instancetype)init {
[self addObserver:self forKeyPath:@"currentTime" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
[self addObserver:self forKeyPath:@"fullscreen" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
[self addObserver:self forKeyPath:@"hideQuitButton" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
[self addObserver:self forKeyPath:@"PSHWayPointMethod" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
[self addObserver:self forKeyPath:@"PSHWayPointOne" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
[self addObserver:self forKeyPath:@"PSHWayPointTwo" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
[self addObserver:self forKeyPath:@"PSHWayPointThree" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
[self addObserver:self forKeyPath:@"PSHWayPointFour" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
[self addObserver:self forKeyPath:@"useWayPointMethod" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
[self addObserver:self forKeyPath:@"wayPointOne" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
[self addObserver:self forKeyPath:@"wayPointTwo" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
[self addObserver:self forKeyPath:@"wayPointThree" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
[self addObserver:self forKeyPath:@"wayPointFour" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];


return self;
Expand Down

0 comments on commit 7c9b034

Please sign in to comment.