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 /ZeroTier One | |
| parent | b51d68a419374289c3dc9aa60fed999d9f51a21d (diff) | |
| download | infinitytier-c6dba50e354e341c7f6a7a1ed6b5d2d2a5bee884.tar.gz infinitytier-c6dba50e354e341c7f6a7a1ed6b5d2d2a5bee884.zip | |
replace AboutViewController
Diffstat (limited to 'ZeroTier One')
| -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 |
5 files changed, 66 insertions, 46 deletions
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 |
