Skip to content
This repository has been archived by the owner on Mar 13, 2020. It is now read-only.

Fix property name #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Example-Point/Example-Point/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="15G1108" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -112,8 +112,8 @@
</constraints>
</view>
<connections>
<outlet property="backImg" destination="Mc5-0m-SEM" id="zyD-ww-utG"/>
<outlet property="nameField" destination="9RD-8F-hCY" id="SEE-rp-iYR"/>
<outlet property="backImageView" destination="Mc5-0m-SEM" id="veZ-0d-afz"/>
<outlet property="nameTextField" destination="9RD-8F-hCY" id="BhH-g5-q3C"/>
<outlet property="registerButton" destination="Jlm-hu-IxQ" id="LyW-QM-M4R"/>
</connections>
</viewController>
Expand All @@ -134,7 +134,7 @@
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="eto-8A-W6g" id="pCZ-ae-nks">
<rect key="frame" x="0.0" y="0.0" width="375" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
Expand Down Expand Up @@ -246,9 +246,9 @@
<tabBarItem key="tabBarItem" title="Send" image="tab_send" id="Fae-0B-3Oo"/>
<navigationItem key="navigationItem" title="Send" id="zeH-PV-FF2"/>
<connections>
<outlet property="amountField" destination="fdr-LS-TFB" id="klW-Wr-lVt"/>
<outlet property="amountTextField" destination="fdr-LS-TFB" id="QIZ-5h-7x1"/>
<outlet property="sendButton" destination="NF7-b1-4Xu" id="8t5-wh-uOC"/>
<outlet property="toField" destination="DUn-0x-B03" id="LPO-EV-AKf"/>
<outlet property="toTextField" destination="DUn-0x-B03" id="rUU-rx-cAU"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="d8e-4U-E89" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down Expand Up @@ -280,7 +280,7 @@
</constraints>
</view>
<connections>
<outlet property="cameraRegion" destination="ZWH-Wf-iZZ" id="Yct-rx-Gez"/>
<outlet property="cameraRegionImageView" destination="ZWH-Wf-iZZ" id="AkD-Bo-jzZ"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="f8p-zj-lkG" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down Expand Up @@ -342,7 +342,7 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</textField>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="96F85B43-354E-4613-AB61-07746312C388" translatesAutoresizingMaskIntoConstraints="NO" id="HhX-lD-UDx">
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="1E29DE24-A2C2-4F53-AE72-24964E0441A4" translatesAutoresizingMaskIntoConstraints="NO" id="HhX-lD-UDx">
<rect key="frame" x="67" y="54" width="240" height="240"/>
<constraints>
<constraint firstAttribute="width" secondItem="HhX-lD-UDx" secondAttribute="height" multiplier="1:1" id="jdc-Ty-fHY"/>
Expand Down Expand Up @@ -414,11 +414,11 @@
<navigationItem key="navigationItem" id="pdw-VC-Xug"/>
<connections>
<outlet property="accountLabel" destination="dpl-XX-eiI" id="flI-U5-hPA"/>
<outlet property="amountField" destination="fn8-xC-v4W" id="nMU-BO-Sgt"/>
<outlet property="headerback" destination="xwM-ID-6aY" id="7UK-v8-cBv"/>
<outlet property="property" destination="np1-kc-Xvv" id="JvQ-hd-epf"/>
<outlet property="pubkey" destination="dpl-XX-eiI" id="DSo-SN-Bhm"/>
<outlet property="qrImg" destination="HhX-lD-UDx" id="v09-ts-ZSE"/>
<outlet property="amountTextField" destination="fn8-xC-v4W" id="dTY-MB-wfT"/>
<outlet property="headerbackView" destination="xwM-ID-6aY" id="dV8-uC-1cc"/>
<outlet property="propertyLabel" destination="np1-kc-Xvv" id="XG5-xW-gNQ"/>
<outlet property="pubkeyTextField" destination="dpl-XX-eiI" id="krk-O1-5Y9"/>
<outlet property="qrImageView" destination="HhX-lD-UDx" id="hcJ-zJ-wk3"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="sAv-Kb-3pi" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down Expand Up @@ -480,7 +480,7 @@
</scene>
</scenes>
<resources>
<image name="96F85B43-354E-4613-AB61-07746312C388" width="237" height="237">
<image name="1E29DE24-A2C2-4F53-AE72-24964E0441A4" width="237" height="237">
<mutableData key="keyedArchiveRepresentation">
YnBsaXN0MDDUAQIDBAUGPT5YJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoK4HCBMU
GR4fIyQrLjE3OlUkbnVsbNUJCgsMDQ4PEBESVk5TU2l6ZVYkY2xhc3NcTlNJbWFnZUZsYWdzVk5TUmVw
Expand Down
8 changes: 4 additions & 4 deletions Example-Point/Example-Point/QRViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import PMAlertController
class QRViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate{


@IBOutlet weak var cameraRegion: UIImageView!
@IBOutlet weak var cameraRegionImageView: UIImageView!
var captureSession: AVCaptureSession!
var previewLayer: AVCaptureVideoPreviewLayer?
var captureDevice: AVCaptureDevice?
Expand All @@ -46,7 +46,7 @@ class QRViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
cameraRegion.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
cameraRegionImageView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
self.tabBarController?.tabBar.isHidden = true

cameraSetting()
Expand Down Expand Up @@ -81,7 +81,7 @@ class QRViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate
}

self.previewLayer = AVCaptureVideoPreviewLayer(session: self.captureSession)
self.previewLayer!.frame = self.cameraRegion.frame
self.previewLayer!.frame = self.cameraRegionImageView.frame
self.previewLayer!.videoGravity = AVLayerVideoGravityResizeAspectFill

self.view.layer.addSublayer(self.previewLayer!)
Expand All @@ -93,7 +93,7 @@ class QRViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate
self.output.metadataObjectTypes = [AVMetadataObjectTypeQRCode];

self.captureSession.startRunning()
self.view.sendSubview(toBack: self.cameraRegion)
self.view.sendSubview(toBack: self.cameraRegionImageView)

}
func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [Any]!, from connection: AVCaptureConnection!) {
Expand Down
32 changes: 16 additions & 16 deletions Example-Point/Example-Point/ReceiveViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import Toast_Swift
class ReceiveViewController: UIViewController, UITextFieldDelegate {

@IBOutlet weak var accountLabel: UITextField!
@IBOutlet weak var property: UILabel!
@IBOutlet weak var qrImg: UIImageView!
@IBOutlet weak var pubkey: UITextField!
@IBOutlet weak var amountField: HoshiTextField!
@IBOutlet weak var headerback: UIView!
@IBOutlet weak var propertyLabel: UILabel!
@IBOutlet weak var qrImageView: UIImageView!
@IBOutlet weak var pubkeyTextField: UITextField!
@IBOutlet weak var amountTextField: HoshiTextField!
@IBOutlet weak var headerbackView: UIView!

var qr:UIImage?
let qrstr = "{\"account\":\"\(KeychainManager.instance.keychain["publicKey"]!)\","
Expand All @@ -44,31 +44,31 @@ class ReceiveViewController: UIViewController, UITextFieldDelegate {
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.white]
self.navigationController?.topViewController!.navigationItem.title = "Receive"
self.tabBarController?.tabBar.tintColor = UIColor.irohaGreen
property.text = "\(DataManager.instance.property) \(unit)"
propertyLabel.text = "\(DataManager.instance.propertyLabel) \(unit)"


}

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
headerback.backgroundColor = UIColor.hex(hex: color, alpha: 1)
amountField.delegate = self
headerbackView.backgroundColor = UIColor.hex(hex: color, alpha: 1)
amountTextField.delegate = self
NotificationCenter.default.addObserver(self, selector: #selector(changeTextField), name: NSNotification.Name.UITextFieldTextDidChange, object: nil)

let pub = KeychainManager.instance.keychain["publicKey"]!
pubkey.text = pub
pubkeyTextField.text = pub
let qrmsg = "\(qrstr)\"amount\":0}"
qr = createQRCode(message: qrmsg)
qrImg.image = qr
qrImageView.image = qr

let keyboardHeader = UIToolbar(frame: CGRect(x: 0, y: 0, width: 320, height: 40))
keyboardHeader.barStyle = UIBarStyle.default
keyboardHeader.sizeToFit()
let spacer = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.flexibleSpace, target: self, action: nil)
let commitButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.done, target: self, action: Selector("commitButtonTapped"))
keyboardHeader.items = [spacer, commitButton]
amountField.inputAccessoryView = keyboardHeader
amountTextField.inputAccessoryView = keyboardHeader
GetUserInfo()

accountLabel.isUserInteractionEnabled = true
Expand All @@ -86,8 +86,8 @@ class ReceiveViewController: UIViewController, UITextFieldDelegate {
APIManager.GetUserInfo(userId: KeychainManager.instance.keychain["uuid"]!, completionHandler: { JSON in
if (JSON["status"] as! Int) == 200 {
var dicarr: [Dictionary<String, AnyObject>] = (JSON["assets"] as! NSArray) as! [Dictionary<String, AnyObject>]
DataManager.instance.property = dicarr[0]["value"] as! Int
self.property.text = "\(DataManager.instance.property) \(self.unit)"
DataManager.instance.propertyLabel = dicarr[0]["value"] as! Int
self.propertyLabel.text = "\(DataManager.instance.propertyLabel) \(self.unit)"

alertVC.dismiss(animated: false, completion: nil)
}else{
Expand All @@ -111,7 +111,7 @@ class ReceiveViewController: UIViewController, UITextFieldDelegate {
}

func changeTextField (sender: NSNotification) {
if sender.object as! UITextField == amountField{
if sender.object as! UITextField == amountTextField{
let text = (sender.object as! UITextField).text
var qrmsg = ""
if text == "" {
Expand All @@ -120,7 +120,7 @@ class ReceiveViewController: UIViewController, UITextFieldDelegate {
qrmsg = "\(qrstr)\"amount\":\(text!)}"
}
qr = createQRCode(message: qrmsg)
qrImg.image = qr
qrImageView.image = qr
}
}

Expand All @@ -139,7 +139,7 @@ class ReceiveViewController: UIViewController, UITextFieldDelegate {
}

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if amountField.text == "" && string == "0" {
if amountTextField.text == "" && string == "0" {
return false
}
return true
Expand Down
12 changes: 6 additions & 6 deletions Example-Point/Example-Point/RegisterViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ import PMAlertController

class RegisterViewController: UIViewController {

@IBOutlet weak var backImg: UIImageView!
@IBOutlet weak var backImageView: UIImageView!


@IBOutlet weak var nameField: HoshiTextField!
@IBOutlet weak var nameTextField: HoshiTextField!
@IBOutlet weak var registerButton: UIButton!


override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
rotateView(targetView: backImg)
rotateView(targetView: backImageView)
registerButton.layer.borderColor = UIColor.white.cgColor
registerButton.addTarget(self, action: #selector(Register), for: .touchUpInside)
}
Expand All @@ -49,14 +49,14 @@ class RegisterViewController: UIViewController {
let keychain = KeychainManager.instance.keychain
let keypair = IrohaSwift.createKeyPair()

if nameField.text != "" {
if nameTextField.text != "" {
if CheckReachability(host_name: "google.com") {
let alertVC = PMAlertController(title: "登録中", description: "登録しています", image: UIImage(named: ""), style: .alert)
self.present(alertVC, animated: true, completion: {
APIManager.Register(name: self.nameField.text!, pub: keypair.publicKey, completionHandler: { JSON in
APIManager.Register(name: self.nameTextField.text!, pub: keypair.publicKey, completionHandler: { JSON in
print(JSON)
if (JSON["status"] as! Int) == 200 {
keychain["username"] = self.nameField.text
keychain["username"] = self.nameTextField.text
keychain["publicKey"] = keypair.publicKey
keychain["privateKey"] = keypair.privateKey
keychain["uuid"] = JSON["uuid"] as! String
Expand Down
Loading