diff options
author | Grant Limberg <glimberg@gmail.com> | 2016-08-07 15:18:32 -0700 |
---|---|---|
committer | Grant Limberg <glimberg@gmail.com> | 2016-08-07 15:18:32 -0700 |
commit | c6dba50e354e341c7f6a7a1ed6b5d2d2a5bee884 (patch) | |
tree | 9c5d23dc37911b10c15e4ca99cc114cae5ee3792 | |
parent | b51d68a419374289c3dc9aa60fed999d9f51a21d (diff) | |
download | infinitytier-c6dba50e354e341c7f6a7a1ed6b5d2d2a5bee884.tar.gz infinitytier-c6dba50e354e341c7f6a7a1ed6b5d2d2a5bee884.zip |
replace AboutViewController
-rw-r--r-- | ZeroTier One.xcodeproj/project.pbxproj | 10 | ||||
-rw-r--r-- | ZeroTier One/AboutViewController.h | 23 | ||||
-rw-r--r-- | ZeroTier One/AboutViewController.m | 40 | ||||
-rw-r--r-- | ZeroTier One/AboutViewController.swift | 44 | ||||
-rw-r--r-- | ZeroTier One/AboutViewController.xib | 2 | ||||
-rw-r--r-- | ZeroTier One/ZeroTier One-Bridging-Header.h | 3 |
6 files changed, 72 insertions, 50 deletions
diff --git a/ZeroTier One.xcodeproj/project.pbxproj b/ZeroTier One.xcodeproj/project.pbxproj index a5993315..c9a4dac8 100644 --- a/ZeroTier One.xcodeproj/project.pbxproj +++ b/ZeroTier One.xcodeproj/project.pbxproj @@ -11,7 +11,6 @@ 932D472F1D1CD499004BCFE2 /* ZeroTierIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 932D472E1D1CD499004BCFE2 /* ZeroTierIcon.icns */; }; 932D47321D1CD861004BCFE2 /* PreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 932D47301D1CD861004BCFE2 /* PreferencesViewController.swift */; }; 932D47331D1CD861004BCFE2 /* PreferencesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 932D47311D1CD861004BCFE2 /* PreferencesViewController.xib */; }; - 932D47361D1CDC9B004BCFE2 /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 932D47341D1CDC9B004BCFE2 /* AboutViewController.swift */; }; 932D47371D1CDC9B004BCFE2 /* AboutViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 932D47351D1CDC9B004BCFE2 /* AboutViewController.xib */; }; 932D473A1D220D63004BCFE2 /* LaunchAtLoginController.m in Sources */ = {isa = PBXBuildFile; fileRef = 932D47391D220D63004BCFE2 /* LaunchAtLoginController.m */; }; 9330F13B1CF534E500687EC8 /* NetworkInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9330F13A1CF534E500687EC8 /* NetworkInfoCell.swift */; }; @@ -25,6 +24,7 @@ 93D1675F1D54191C00330C99 /* NodeStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D1675E1D54191C00330C99 /* NodeStatus.m */; }; 93D167621D541BC200330C99 /* ServiceCom.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D167611D541BC200330C99 /* ServiceCom.m */; }; 93D167661D54308200330C99 /* Network.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D167651D54308200330C99 /* Network.m */; }; + 93D167691D57E7EA00330C99 /* AboutViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D167681D57E7EA00330C99 /* AboutViewController.m */; }; 93DAFB271D3F0BEE004D5417 /* about.html in Resources */ = {isa = PBXBuildFile; fileRef = 93DAFB261D3F0BEE004D5417 /* about.html */; }; 93DAFE4B1CFE53CA00547CC4 /* AuthtokenCopy.m in Sources */ = {isa = PBXBuildFile; fileRef = 93DAFE4A1CFE53CA00547CC4 /* AuthtokenCopy.m */; }; /* End PBXBuildFile section */ @@ -34,7 +34,6 @@ 932D472E1D1CD499004BCFE2 /* ZeroTierIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = ZeroTierIcon.icns; sourceTree = "<group>"; }; 932D47301D1CD861004BCFE2 /* PreferencesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesViewController.swift; sourceTree = "<group>"; }; 932D47311D1CD861004BCFE2 /* PreferencesViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreferencesViewController.xib; sourceTree = "<group>"; }; - 932D47341D1CDC9B004BCFE2 /* AboutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = "<group>"; }; 932D47351D1CDC9B004BCFE2 /* AboutViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AboutViewController.xib; sourceTree = "<group>"; }; 932D47381D220D63004BCFE2 /* LaunchAtLoginController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LaunchAtLoginController.h; sourceTree = "<group>"; }; 932D47391D220D63004BCFE2 /* LaunchAtLoginController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LaunchAtLoginController.m; sourceTree = "<group>"; }; @@ -54,6 +53,8 @@ 93D167611D541BC200330C99 /* ServiceCom.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ServiceCom.m; sourceTree = "<group>"; }; 93D167641D54308200330C99 /* Network.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Network.h; sourceTree = "<group>"; }; 93D167651D54308200330C99 /* Network.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Network.m; sourceTree = "<group>"; }; + 93D167671D57E7EA00330C99 /* AboutViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AboutViewController.h; sourceTree = "<group>"; }; + 93D167681D57E7EA00330C99 /* AboutViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AboutViewController.m; sourceTree = "<group>"; }; 93DAFB261D3F0BEE004D5417 /* about.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = about.html; sourceTree = "<group>"; }; 93DAFE491CFE53C900547CC4 /* ZeroTier One-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ZeroTier One-Bridging-Header.h"; sourceTree = "<group>"; }; 93DAFE4A1CFE53CA00547CC4 /* AuthtokenCopy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthtokenCopy.m; sourceTree = "<group>"; }; @@ -106,7 +107,6 @@ 932D472C1D138B0C004BCFE2 /* NetworkMonitor.swift */, 932D47301D1CD861004BCFE2 /* PreferencesViewController.swift */, 932D47311D1CD861004BCFE2 /* PreferencesViewController.xib */, - 932D47341D1CDC9B004BCFE2 /* AboutViewController.swift */, 932D47351D1CDC9B004BCFE2 /* AboutViewController.xib */, 932D47381D220D63004BCFE2 /* LaunchAtLoginController.h */, 932D47391D220D63004BCFE2 /* LaunchAtLoginController.m */, @@ -117,6 +117,8 @@ 93D167611D541BC200330C99 /* ServiceCom.m */, 93D167641D54308200330C99 /* Network.h */, 93D167651D54308200330C99 /* Network.m */, + 93D167671D57E7EA00330C99 /* AboutViewController.h */, + 93D167681D57E7EA00330C99 /* AboutViewController.m */, ); path = "ZeroTier One"; sourceTree = "<group>"; @@ -207,7 +209,7 @@ 93326BEA1CE7D9B9005CA2AC /* JoinNetworkViewController.swift in Sources */, 93326BEE1CE7DA30005CA2AC /* ShowNetworksViewController.swift in Sources */, 93D1675F1D54191C00330C99 /* NodeStatus.m in Sources */, - 932D47361D1CDC9B004BCFE2 /* AboutViewController.swift in Sources */, + 93D167691D57E7EA00330C99 /* AboutViewController.m in Sources */, 93D167661D54308200330C99 /* Network.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/ZeroTier One/AboutViewController.h b/ZeroTier One/AboutViewController.h new file mode 100644 index 00000000..4260419e --- /dev/null +++ b/ZeroTier One/AboutViewController.h @@ -0,0 +1,23 @@ +// +// AboutViewController.h +// ZeroTier One +// +// Created by Grant Limberg on 8/7/16. +// Copyright © 2016 ZeroTier, Inc. All rights reserved. +// + +#import <Cocoa/Cocoa.h> +#import <WebKit/WebKit.h> + +@interface AboutViewController : NSViewController <WebPolicyDelegate> + +@property (nonatomic, weak) IBOutlet WebView *webView; + +- (void)viewDidLoad; + +- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation + request:(NSURLRequest *)request + frame:(WebFrame *)frame +decisionListener:(id<WebPolicyDecisionListener>)listener; + +@end diff --git a/ZeroTier One/AboutViewController.m b/ZeroTier One/AboutViewController.m new file mode 100644 index 00000000..f6862d26 --- /dev/null +++ b/ZeroTier One/AboutViewController.m @@ -0,0 +1,40 @@ +// +// AboutViewController.m +// ZeroTier One +// +// Created by Grant Limberg on 8/7/16. +// Copyright © 2016 ZeroTier, Inc. All rights reserved. +// + +#import "AboutViewController.h" + +@interface AboutViewController () + +@end + +@implementation AboutViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + NSBundle *bundle = [NSBundle mainBundle]; + NSURL *path = [bundle URLForResource:@"about" withExtension:@"html"]; + if(path) { + [self.webView.mainFrame loadRequest:[NSURLRequest requestWithURL:path]]; + } +} + +- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation + request:(NSURLRequest *)request + frame:(WebFrame *)frame +decisionListener:(id<WebPolicyDecisionListener>)listener +{ + if(request.URL != nil && request.URL.host != nil) { + [[NSWorkspace sharedWorkspace] openURL:request.URL]; + } + else { + [listener use]; + } +} + +@end diff --git a/ZeroTier One/AboutViewController.swift b/ZeroTier One/AboutViewController.swift deleted file mode 100644 index 2e24e54d..00000000 --- a/ZeroTier One/AboutViewController.swift +++ /dev/null @@ -1,44 +0,0 @@ -// -// AboutViewController.swift -// ZeroTier One -// -// Created by Grant Limberg on 6/23/16. -// Copyright © 2016 ZeroTier, Inc. All rights reserved. -// - -import Cocoa -import WebKit - -class AboutViewController: NSViewController, WebPolicyDelegate { - - - @IBOutlet var webView: WebView! - - override func viewDidLoad() { - super.viewDidLoad() - - webView.policyDelegate = self - // Do view setup here. - let bundle = NSBundle.mainBundle() - let path = bundle.URLForResource("about", withExtension: "html") - - if let url = path { - webView.mainFrame.loadRequest(NSURLRequest(URL: url)) - } - } - - - func webView(webView: WebView!, - decidePolicyForNavigationAction actionInformation: [NSObject : AnyObject]!, - request: NSURLRequest!, - frame: WebFrame!, - decisionListener listener: WebPolicyDecisionListener!) { - if (request.URL?.host) != nil { - NSWorkspace.sharedWorkspace().openURL(request.URL!) - } - else { - listener.use() - } - } - -} diff --git a/ZeroTier One/AboutViewController.xib b/ZeroTier One/AboutViewController.xib index 46c70155..ec0712c2 100644 --- a/ZeroTier One/AboutViewController.xib +++ b/ZeroTier One/AboutViewController.xib @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10116" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10116" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> <dependencies> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/> <plugIn identifier="com.apple.WebKitIBPlugin" version="10116"/> diff --git a/ZeroTier One/ZeroTier One-Bridging-Header.h b/ZeroTier One/ZeroTier One-Bridging-Header.h index 78d5264d..958806c9 100644 --- a/ZeroTier One/ZeroTier One-Bridging-Header.h +++ b/ZeroTier One/ZeroTier One-Bridging-Header.h @@ -6,4 +6,5 @@ #import "LaunchAtLoginController.h" #import "NodeStatus.h" #import "Network.h" -#import "ServiceCom.h"
\ No newline at end of file +#import "ServiceCom.h" +#import "AboutViewController.h"
\ No newline at end of file |