Skip to content

Commit

Permalink
Update ~1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Hudson Graeme authored Feb 15, 2018
1 parent 1c87cf1 commit 6e3bed0
Show file tree
Hide file tree
Showing 11 changed files with 392 additions and 675 deletions.
32 changes: 32 additions & 0 deletions Nanoget/Nanoget/About.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// About.swift
// Nanoget
//
// Created by s on 2018-02-08.
// Copyright © 2018 Hudson Graeme. All rights reserved.
//

import Cocoa

class About: NSViewController {

override func viewDidLoad() {
super.viewDidLoad()
// Do view setup here.
self.view.window?.styleMask.remove(NSWindow.StyleMask.resizable)
self.Icon.image = NSApplication.shared.applicationIconImage
}
@IBOutlet weak var PayPal: NSButton!
@IBOutlet weak var Patreon: NSButton!
@IBOutlet weak var Icon: NSImageView!
@IBOutlet weak var Txt: NSScrollView!

@IBAction func PayPal(_ sender: Any) {
NSWorkspace.shared.open(URL(string: "https://www.paypal.me/SpencerGraham")!)
}
@IBAction func Patreon(_ sender: Any) {
NSWorkspace.shared.open(URL(string: "https://www.patreon.com/OSXSpencer")!)
}


}
128 changes: 128 additions & 0 deletions Nanoget/Nanoget/AddressController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
//
// ViewController.swift
// Nanoget
//
// Created by s on 2018-01-10.
// Copyright © 2018 Carspotter Daily. All rights reserved.
//

import Cocoa
import Alamofire
import SwiftyJSON

class AddressController: NSViewController {

@IBOutlet weak var Lbl: NSTextField!
@IBOutlet weak var Addr: NSTextField!
@IBOutlet weak var Btn: NSButton!

override func viewDidLoad() {
super.viewDidLoad()
if let acc = UserDefaults.standard.string(forKey: "Acc") {
Addr.stringValue = acc
}
let area = NSTrackingArea.init(rect: Btn.bounds, options: [.mouseEnteredAndExited, .activeAlways], owner: self, userInfo: nil)
Btn.addTrackingArea(area)
self.Btn.wantsLayer = true
self.Btn.layer?.backgroundColor = NSColor.systemBlue.cgColor
self.view.wantsLayer = true
self.view.layer?.backgroundColor = NSColor.lightGray.cgColor
}

override func mouseEntered(with event: NSEvent) {
self.Btn.layer?.backgroundColor = NSColor.blue.blended(withFraction: 0.5, of: .systemBlue)?.cgColor
}

override func mouseExited(with event: NSEvent) {
self.Btn.layer?.backgroundColor = NSColor.systemBlue.cgColor

}


@IBAction func Btn(_ sender: Any) {

if(Addr.stringValue.count == 42) {
Addr.textColor = NSColor.orange
Addr.stringValue = Addr.stringValue.replacingOccurrences(of: "0x", with: "")
HandleCoins(suspectedCoin: "eth")
}
else if(Addr.stringValue.contains("etn")) {
Addr.textColor = NSColor.black
HandleCoins(suspectedCoin: "etn")
}
else if(Addr.stringValue.count == 40&&Addr.stringValue.contains("0x") != true){
Addr.textColor = NSColor.orange
HandleCoins(suspectedCoin: "eth")
}
else if(Addr.stringValue.count == 76) {
Addr.textColor = NSColor.green
HandleCoins(suspectedCoin: "sia")
}
else if(Addr.stringValue.count == 8) {
Addr.textColor = NSColor.yellow
HandleCoins(suspectedCoin: "pasc")
}
else if(Addr.stringValue.count == 95) {
Addr.textColor = NSColor.gray
HandleCoins(suspectedCoin: "xmr")
}
else if(Addr.stringValue.count == 35) {
Addr.textColor = NSColor.systemBlue
HandleCoins(suspectedCoin: "zec")
}
else {
Addr.textColor = NSColor.red
Addr.stringValue = "Invalid Address"
}
}

func HandleCoins(suspectedCoin coin:String) {
if(coin == "eth"){
Go(Addr.stringValue, coin)
Go(Addr.stringValue, "etc")
}
else {
Go(Addr.stringValue, coin)
}
}
var canload: Bool = false
func Go(_ Address:String, _ coin: String){
UserDefaults.standard.set(Address, forKey: "Acc")
Alamofire.request("https://api.nanopool.org/v1/\(coin)/balance/\(Address)") .responseJSON { response in
let data = response.data
if(response.result.isSuccess) {
if let result = response.result.value {
print(result)

let json = JSON(data: data!)
if(json["status"].intValue == 1) {
self.canload = true
self.YorN(coin)
}
else {
self.canload = false
self.Btn.title = "Error.. Try again."
self.YorN(coin)
}

}
}
else {
print("Failure")
self.canload = false
self.YorN(coin)
}
}
}
func YorN(_ coin: String) {
if(self.canload == true) {
UserDefaults.standard.set(coin, forKey: "Coin")
self.performSegue(withIdentifier:NSStoryboardSegue.Identifier(rawValue: "ToMain"), sender: self)
self.view.window?.close()
}
else {
print("nope")
}
}
}

6 changes: 6 additions & 0 deletions Nanoget/Nanoget/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
21 changes: 21 additions & 0 deletions Nanoget/Nanoget/Assets.xcassets/Patreon.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "downloads_wordmark_navy.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Nanoget/Nanoget/Assets.xcassets/PayPal.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "580b57fcd9996e24bc43c530.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading

0 comments on commit 6e3bed0

Please sign in to comment.