From 998423cbe611252e87a7eb3c9e8dece6d0ecab3c Mon Sep 17 00:00:00 2001 From: Joonas Myhrberg Date: Sun, 26 Jul 2015 22:15:13 +0300 Subject: [PATCH 1/3] Changed user agent string --- Helium/Helium/WebViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Helium/Helium/WebViewController.swift b/Helium/Helium/WebViewController.swift index b252b42..5608903 100644 --- a/Helium/Helium/WebViewController.swift +++ b/Helium/Helium/WebViewController.swift @@ -25,7 +25,7 @@ class WebViewController: NSViewController, WKNavigationDelegate { webView.configuration.preferences.plugInsEnabled = true // Netflix support via Silverlight (HTML5 Netflix doesn't work for some unknown reason) - webView._customUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/600.5.17 (KHTML, like Gecko) Version/7.1.5 Safari/537.85.14" + webView._customUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12" // Setup magic URLs webView.navigationDelegate = self From 57646df0141cbafe9328964162f296d1533e77ce Mon Sep 17 00:00:00 2001 From: Joonas Myhrberg Date: Sun, 26 Jul 2015 22:32:32 +0300 Subject: [PATCH 2/3] Changed commenting --- Helium/Helium/WebViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Helium/Helium/WebViewController.swift b/Helium/Helium/WebViewController.swift index 5608903..08b6591 100644 --- a/Helium/Helium/WebViewController.swift +++ b/Helium/Helium/WebViewController.swift @@ -24,7 +24,7 @@ class WebViewController: NSViewController, WKNavigationDelegate { // Allow plug-ins such as silverlight webView.configuration.preferences.plugInsEnabled = true - // Netflix support via Silverlight (HTML5 Netflix doesn't work for some unknown reason) + // Custom user agent string for Netflix HTML5 support webView._customUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12" // Setup magic URLs From 4e6bd943172da01bdf0067cd484000c9dbdb7afc Mon Sep 17 00:00:00 2001 From: Joonas Myhrberg Date: Thu, 1 Oct 2015 20:51:55 +0300 Subject: [PATCH 3/3] Update to new swift syntax --- Helium/Helium.xcodeproj/project.pbxproj | 2 ++ Helium/Helium/AppDelegate.swift | 6 +++--- Helium/Helium/HeliumPanelController.swift | 6 +++--- Helium/Helium/WebViewController.swift | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Helium/Helium.xcodeproj/project.pbxproj b/Helium/Helium.xcodeproj/project.pbxproj index f67bb6d..c2d01c1 100644 --- a/Helium/Helium.xcodeproj/project.pbxproj +++ b/Helium/Helium.xcodeproj/project.pbxproj @@ -198,6 +198,8 @@ 4D867CA91AD6781200681331 /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftMigration = 0700; + LastSwiftUpdateCheck = 0700; LastUpgradeCheck = 0630; ORGANIZATIONNAME = "Jaden Geller"; TargetAttributes = { diff --git a/Helium/Helium/AppDelegate.swift b/Helium/Helium/AppDelegate.swift index afa28a3..ce02c24 100644 --- a/Helium/Helium/AppDelegate.swift +++ b/Helium/Helium/AppDelegate.swift @@ -41,12 +41,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate { // Called when the App opened via URL. func handleURLEvent(event: NSAppleEventDescriptor, withReply reply: NSAppleEventDescriptor) { if let urlString:String? = event.paramDescriptorForKeyword(AEKeyword(keyDirectObject))?.stringValue { - if let url:String? = urlString?.substringFromIndex(advance(urlString!.startIndex,9)){ - var urlObject:NSURL = NSURL(string:url!)! + if let url:String? = urlString?.substringFromIndex(urlString!.startIndex.advancedBy(9)){ + let urlObject:NSURL = NSURL(string:url!)! NSNotificationCenter.defaultCenter().postNotificationName("HeliumLoadURL", object: urlObject) }else { - println("No valid URL to handle") + print("No valid URL to handle") } diff --git a/Helium/Helium/HeliumPanelController.swift b/Helium/Helium/HeliumPanelController.swift index 7ff0ec0..f47331f 100644 --- a/Helium/Helium/HeliumPanelController.swift +++ b/Helium/Helium/HeliumPanelController.swift @@ -70,11 +70,11 @@ class HeliumPanelController : NSWindowController { @IBAction func percentagePress(sender: NSMenuItem) { for button in sender.menu!.itemArray{ - (button as! NSMenuItem).state = NSOffState + (button ).state = NSOffState } sender.state = NSOnState - let value = sender.title.substringToIndex(advance(sender.title.endIndex, -1)) - if let alpha = value.toInt() { + let value = sender.title.substringToIndex(sender.title.endIndex.advancedBy(-1)) + if let alpha = Int(value) { didUpdateAlpha(NSNumber(integer: alpha)) } } diff --git a/Helium/Helium/WebViewController.swift b/Helium/Helium/WebViewController.swift index 08b6591..08a3801 100644 --- a/Helium/Helium/WebViewController.swift +++ b/Helium/Helium/WebViewController.swift @@ -19,7 +19,7 @@ class WebViewController: NSViewController, WKNavigationDelegate { // Layout webview view.addSubview(webView) webView.frame = view.bounds - webView.autoresizingMask = NSAutoresizingMaskOptions.ViewHeightSizable | NSAutoresizingMaskOptions.ViewWidthSizable + webView.autoresizingMask = [NSAutoresizingMaskOptions.ViewHeightSizable, NSAutoresizingMaskOptions.ViewWidthSizable] // Allow plug-ins such as silverlight webView.configuration.preferences.plugInsEnabled = true @@ -149,7 +149,7 @@ class WebViewController: NSViewController, WKNavigationDelegate { } } - override func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer) { + override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer) { if object as! NSObject == webView && keyPath == "estimatedProgress" { if let progress = change["new"] as? Float {