Replace NodeStatus object with Obj-C Class

This commit is contained in:
Grant Limberg 2016-08-04 17:55:57 -07:00
parent a08246ce5d
commit 7a12d8193b
5 changed files with 63 additions and 63 deletions

View file

@ -14,7 +14,6 @@
932D47361D1CDC9B004BCFE2 /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 932D47341D1CDC9B004BCFE2 /* AboutViewController.swift */; }; 932D47361D1CDC9B004BCFE2 /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 932D47341D1CDC9B004BCFE2 /* AboutViewController.swift */; };
932D47371D1CDC9B004BCFE2 /* AboutViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 932D47351D1CDC9B004BCFE2 /* AboutViewController.xib */; }; 932D47371D1CDC9B004BCFE2 /* AboutViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 932D47351D1CDC9B004BCFE2 /* AboutViewController.xib */; };
932D473A1D220D63004BCFE2 /* LaunchAtLoginController.m in Sources */ = {isa = PBXBuildFile; fileRef = 932D47391D220D63004BCFE2 /* LaunchAtLoginController.m */; }; 932D473A1D220D63004BCFE2 /* LaunchAtLoginController.m in Sources */ = {isa = PBXBuildFile; fileRef = 932D47391D220D63004BCFE2 /* LaunchAtLoginController.m */; };
932D473C1D261ED4004BCFE2 /* NodeStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 932D473B1D261ED4004BCFE2 /* NodeStatus.swift */; };
9330F1351CEAB4C400687EC8 /* ServiceCom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9330F1341CEAB4C400687EC8 /* ServiceCom.swift */; }; 9330F1351CEAB4C400687EC8 /* ServiceCom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9330F1341CEAB4C400687EC8 /* ServiceCom.swift */; };
9330F1371CEBF87200687EC8 /* Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9330F1361CEBF87200687EC8 /* Network.swift */; }; 9330F1371CEBF87200687EC8 /* Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9330F1361CEBF87200687EC8 /* Network.swift */; };
9330F13B1CF534E500687EC8 /* NetworkInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9330F13A1CF534E500687EC8 /* NetworkInfoCell.swift */; }; 9330F13B1CF534E500687EC8 /* NetworkInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9330F13A1CF534E500687EC8 /* NetworkInfoCell.swift */; };
@ -25,6 +24,7 @@
93326BEB1CE7D9B9005CA2AC /* JoinNetworkViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93326BE91CE7D9B9005CA2AC /* JoinNetworkViewController.xib */; }; 93326BEB1CE7D9B9005CA2AC /* JoinNetworkViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93326BE91CE7D9B9005CA2AC /* JoinNetworkViewController.xib */; };
93326BEE1CE7DA30005CA2AC /* ShowNetworksViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93326BEC1CE7DA30005CA2AC /* ShowNetworksViewController.swift */; }; 93326BEE1CE7DA30005CA2AC /* ShowNetworksViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93326BEC1CE7DA30005CA2AC /* ShowNetworksViewController.swift */; };
93326BEF1CE7DA30005CA2AC /* ShowNetworksViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93326BED1CE7DA30005CA2AC /* ShowNetworksViewController.xib */; }; 93326BEF1CE7DA30005CA2AC /* ShowNetworksViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93326BED1CE7DA30005CA2AC /* ShowNetworksViewController.xib */; };
93D1675F1D54191C00330C99 /* NodeStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D1675E1D54191C00330C99 /* NodeStatus.m */; };
93DAFB271D3F0BEE004D5417 /* about.html in Resources */ = {isa = PBXBuildFile; fileRef = 93DAFB261D3F0BEE004D5417 /* about.html */; }; 93DAFB271D3F0BEE004D5417 /* about.html in Resources */ = {isa = PBXBuildFile; fileRef = 93DAFB261D3F0BEE004D5417 /* about.html */; };
93DAFE4B1CFE53CA00547CC4 /* AuthtokenCopy.m in Sources */ = {isa = PBXBuildFile; fileRef = 93DAFE4A1CFE53CA00547CC4 /* AuthtokenCopy.m */; }; 93DAFE4B1CFE53CA00547CC4 /* AuthtokenCopy.m in Sources */ = {isa = PBXBuildFile; fileRef = 93DAFE4A1CFE53CA00547CC4 /* AuthtokenCopy.m */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@ -38,7 +38,6 @@
932D47351D1CDC9B004BCFE2 /* AboutViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AboutViewController.xib; 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>"; }; 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>"; }; 932D47391D220D63004BCFE2 /* LaunchAtLoginController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LaunchAtLoginController.m; sourceTree = "<group>"; };
932D473B1D261ED4004BCFE2 /* NodeStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NodeStatus.swift; sourceTree = "<group>"; };
9330F1341CEAB4C400687EC8 /* ServiceCom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceCom.swift; sourceTree = "<group>"; }; 9330F1341CEAB4C400687EC8 /* ServiceCom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceCom.swift; sourceTree = "<group>"; };
9330F1361CEBF87200687EC8 /* Network.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Network.swift; sourceTree = "<group>"; }; 9330F1361CEBF87200687EC8 /* Network.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Network.swift; sourceTree = "<group>"; };
9330F13A1CF534E500687EC8 /* NetworkInfoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkInfoCell.swift; sourceTree = "<group>"; }; 9330F13A1CF534E500687EC8 /* NetworkInfoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkInfoCell.swift; sourceTree = "<group>"; };
@ -51,6 +50,8 @@
93326BE91CE7D9B9005CA2AC /* JoinNetworkViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = JoinNetworkViewController.xib; sourceTree = "<group>"; }; 93326BE91CE7D9B9005CA2AC /* JoinNetworkViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = JoinNetworkViewController.xib; sourceTree = "<group>"; };
93326BEC1CE7DA30005CA2AC /* ShowNetworksViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShowNetworksViewController.swift; sourceTree = "<group>"; }; 93326BEC1CE7DA30005CA2AC /* ShowNetworksViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShowNetworksViewController.swift; sourceTree = "<group>"; };
93326BED1CE7DA30005CA2AC /* ShowNetworksViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShowNetworksViewController.xib; sourceTree = "<group>"; }; 93326BED1CE7DA30005CA2AC /* ShowNetworksViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShowNetworksViewController.xib; sourceTree = "<group>"; };
93D1675D1D54191C00330C99 /* NodeStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeStatus.h; sourceTree = "<group>"; };
93D1675E1D54191C00330C99 /* NodeStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NodeStatus.m; sourceTree = "<group>"; };
93DAFB261D3F0BEE004D5417 /* about.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = about.html; 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>"; }; 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>"; }; 93DAFE4A1CFE53CA00547CC4 /* AuthtokenCopy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthtokenCopy.m; sourceTree = "<group>"; };
@ -109,8 +110,9 @@
932D47351D1CDC9B004BCFE2 /* AboutViewController.xib */, 932D47351D1CDC9B004BCFE2 /* AboutViewController.xib */,
932D47381D220D63004BCFE2 /* LaunchAtLoginController.h */, 932D47381D220D63004BCFE2 /* LaunchAtLoginController.h */,
932D47391D220D63004BCFE2 /* LaunchAtLoginController.m */, 932D47391D220D63004BCFE2 /* LaunchAtLoginController.m */,
932D473B1D261ED4004BCFE2 /* NodeStatus.swift */,
93DAFB261D3F0BEE004D5417 /* about.html */, 93DAFB261D3F0BEE004D5417 /* about.html */,
93D1675D1D54191C00330C99 /* NodeStatus.h */,
93D1675E1D54191C00330C99 /* NodeStatus.m */,
); );
path = "ZeroTier One"; path = "ZeroTier One";
sourceTree = "<group>"; sourceTree = "<group>";
@ -196,11 +198,11 @@
932D47321D1CD861004BCFE2 /* PreferencesViewController.swift in Sources */, 932D47321D1CD861004BCFE2 /* PreferencesViewController.swift in Sources */,
932D473A1D220D63004BCFE2 /* LaunchAtLoginController.m in Sources */, 932D473A1D220D63004BCFE2 /* LaunchAtLoginController.m in Sources */,
93326BDC1CE7C816005CA2AC /* AppDelegate.swift in Sources */, 93326BDC1CE7C816005CA2AC /* AppDelegate.swift in Sources */,
932D473C1D261ED4004BCFE2 /* NodeStatus.swift in Sources */,
93DAFE4B1CFE53CA00547CC4 /* AuthtokenCopy.m in Sources */, 93DAFE4B1CFE53CA00547CC4 /* AuthtokenCopy.m in Sources */,
9330F13B1CF534E500687EC8 /* NetworkInfoCell.swift in Sources */, 9330F13B1CF534E500687EC8 /* NetworkInfoCell.swift in Sources */,
93326BEA1CE7D9B9005CA2AC /* JoinNetworkViewController.swift in Sources */, 93326BEA1CE7D9B9005CA2AC /* JoinNetworkViewController.swift in Sources */,
93326BEE1CE7DA30005CA2AC /* ShowNetworksViewController.swift in Sources */, 93326BEE1CE7DA30005CA2AC /* ShowNetworksViewController.swift in Sources */,
93D1675F1D54191C00330C99 /* NodeStatus.m in Sources */,
932D47361D1CDC9B004BCFE2 /* AboutViewController.swift in Sources */, 932D47361D1CDC9B004BCFE2 /* AboutViewController.swift in Sources */,
9330F1351CEAB4C400687EC8 /* ServiceCom.swift in Sources */, 9330F1351CEAB4C400687EC8 /* ServiceCom.swift in Sources */,
); );

25
ZeroTier One/NodeStatus.h Normal file
View file

@ -0,0 +1,25 @@
//
// NodeStatus.h
// ZeroTier One
//
// Created by Grant Limberg on 8/4/16.
// Copyright © 2016 ZeroTier, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NodeStatus : NSObject
@property (readonly) NSString *address;
@property (readonly) NSString *publicIdentity;
@property (readonly) BOOL online;
@property (readonly) BOOL tcpFallbackActive;
@property (readonly) int versionMajor;
@property (readonly) int versionMinor;
@property (readonly) int versionRev;
@property (readonly) NSString *version;
@property (readonly) UInt64 clock;
- (id)initWithJsonData:(NSDictionary*)jsonData;
@end

31
ZeroTier One/NodeStatus.m Normal file
View file

@ -0,0 +1,31 @@
//
// NodeStatus.m
// ZeroTier One
//
// Created by Grant Limberg on 8/4/16.
// Copyright © 2016 ZeroTier, Inc. All rights reserved.
//
#import "NodeStatus.h"
@implementation NodeStatus
- (id)initWithJsonData:(NSDictionary*)jsonData
{
self = [super init];
if(self) {
_address = (NSString*)[jsonData objectForKey:@"address"];
_publicIdentity = (NSString*)[jsonData objectForKey:@"publicIdentity"];
_online = [(NSNumber*)[jsonData objectForKey:@"online"] boolValue];
_tcpFallbackActive = [(NSNumber*)[jsonData objectForKey:@"tcpFallbackActive"] boolValue];
_versionMajor = [(NSNumber*)[jsonData objectForKey:@"versionMajor"] intValue];
_versionMinor = [(NSNumber*)[jsonData objectForKey:@"versionMinor"] intValue];
_versionRev = [(NSNumber*)[jsonData objectForKey:@"versionRev"] intValue];
_version = (NSString*)[jsonData objectForKey:@"version"];
_clock = [(NSNumber*)[jsonData objectForKey:@"clock"] unsignedLongLongValue];
}
return self;
}
@end

View file

@ -1,59 +0,0 @@
//
// NodeStatus.swift
// ZeroTier One
//
// Created by Grant Limberg on 6/30/16.
// Copyright © 2016 ZeroTier, Inc. All rights reserved.
//
import Cocoa
class NodeStatus: NSObject {
var address: String = ""
var publicIdentity: String = ""
var online: Bool = false
var tcpFallbackActive: Bool = false
var versionMajor: Int = 0
var versionMinor: Int = 0
var versionRev: Int = 0
var version: String = ""
var clock: UInt64 = 0
init(jsonData: [String: AnyObject]) {
if let a = jsonData["address"] as? String {
self.address = a
}
if let p = jsonData["publicIdentity"] as? String {
self.publicIdentity = p
}
if let o = jsonData["online"] as? NSNumber {
self.online = o.boolValue
}
if let t = jsonData["tcpFallbackActive"] as? NSNumber {
self.tcpFallbackActive = t.boolValue
}
if let v = jsonData["versionMajor"] as? NSNumber {
self.versionMajor = v.integerValue
}
if let v = jsonData["versionMinor"] as? NSNumber {
self.versionMinor = v.integerValue
}
if let v = jsonData["versionRev"] as? NSNumber {
self.versionRev = v.integerValue
}
if let v = jsonData["version"] as? String {
self.version = v
}
if let c = jsonData["version"] as? NSNumber {
self.clock = c.unsignedLongLongValue
}
}
}

View file

@ -4,3 +4,4 @@
#import "AuthtokenCopy.h" #import "AuthtokenCopy.h"
#import "LaunchAtLoginController.h" #import "LaunchAtLoginController.h"
#import "NodeStatus.h"