Skip to content

Commit

Permalink
Fix some issues with bws and currency input, add paperkey view and re…
Browse files Browse the repository at this point in the history
…lease 0.11
  • Loading branch information
SwenVanZanten committed Dec 2, 2018
1 parent 9b21d62 commit 5aca7ba
Show file tree
Hide file tree
Showing 15 changed files with 153 additions and 37 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<p align="center">
<a href="https://travis-ci.org/vergecurrency/vIOS" target="_blank"><img src="https://travis-ci.org/vergecurrency/vIOS.svg?branch=master"></a>
<img src="https://img.shields.io/badge/status-development-red.svg">
<img src="https://img.shields.io/badge/latest build-0.10.1-lightgrey.svg">
<img src="https://img.shields.io/badge/latest build-0.11-lightgrey.svg">
<img src="https://img.shields.io/badge/iOS-^11.4-green.svg">
<img src="https://img.shields.io/badge/license-MIT-blue.svg">
</p>
Expand Down
4 changes: 4 additions & 0 deletions VergeiOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
A338E6C62110FB31000D44EE /* SendViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A338E6C52110FB31000D44EE /* SendViewController.swift */; };
A338E6CA2110FC2D000D44EE /* ReceiveViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A338E6C92110FC2D000D44EE /* ReceiveViewController.swift */; };
A338E6CE21110A0A000D44EE /* QRCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A338E6CD21110A09000D44EE /* QRCode.framework */; };
A339393421B352B50010CC4A /* PaperkeyShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A339393321B352B50010CC4A /* PaperkeyShowViewController.swift */; };
A33B759421A22F5A00030CCF /* CryptoSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A33B759321A22F5A00030CCF /* CryptoSwift.framework */; };
A33B759E21A5CDD400030CCF /* BitcoinKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A33B759D21A5CDD400030CCF /* BitcoinKit.framework */; };
A33B75C021A61A3500030CCF /* CurrencyInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = A33B75BF21A61A3500030CCF /* CurrencyInput.swift */; };
Expand Down Expand Up @@ -296,6 +297,7 @@
A338E6C52110FB31000D44EE /* SendViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendViewController.swift; sourceTree = "<group>"; };
A338E6C92110FC2D000D44EE /* ReceiveViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiveViewController.swift; sourceTree = "<group>"; };
A338E6CD21110A09000D44EE /* QRCode.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QRCode.framework; path = Carthage/Build/iOS/QRCode.framework; sourceTree = "<group>"; };
A339393321B352B50010CC4A /* PaperkeyShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaperkeyShowViewController.swift; sourceTree = "<group>"; };
A33B759321A22F5A00030CCF /* CryptoSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CryptoSwift.framework; path = Carthage/Build/iOS/CryptoSwift.framework; sourceTree = "<group>"; };
A33B759D21A5CDD400030CCF /* BitcoinKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BitcoinKit.framework; path = Carthage/Build/iOS/BitcoinKit.framework; sourceTree = "<group>"; };
A33B75BF21A61A3500030CCF /* CurrencyInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyInput.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -772,6 +774,7 @@
A3AA22032165706C00160576 /* TorConnectionTableViewController.swift */,
B2BD70361646D756C13B826D /* DonateTableViewController.swift */,
B2BD7BF3055148691DE401AD /* PaperkeyViewController.swift */,
A339393321B352B50010CC4A /* PaperkeyShowViewController.swift */,
);
path = Settings;
sourceTree = "<group>";
Expand Down Expand Up @@ -1323,6 +1326,7 @@
B2BD7216E5E949A43C2B4FC4 /* TxOutput.swift in Sources */,
B2BD7A0E400CB0DA33EE2634 /* TxChangeAddress.swift in Sources */,
B2BD7BC57336DE95804E4B72 /* TxTransponder.swift in Sources */,
A339393421B352B50010CC4A /* PaperkeyShowViewController.swift in Sources */,
A386CA99219E28ED00FBF465 /* SendingView.swift in Sources */,
B2BD7D87D41E757FCBBF6D75 /* AppDelegate+NotificationCenter.swift in Sources */,
B2BD76C55CCA3241E93A1A2B /* WalletTicker.swift in Sources */,
Expand Down
22 changes: 18 additions & 4 deletions VergeiOS/Components/UI/Inputs/CurrencyInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ class CurrencyInput: UITextField {
return NSNumber(value: Double(text) ?? 0.0)
}

public func setAmount(_ amount: NSNumber) {
let amountString = String(amount.doubleValue)

if let decimal = formatter.decimalSeparator {
text = amountString.replacingOccurrences(of: ".", with: decimal)
format()
}
}

public func format() {
handleFormatting()

Expand All @@ -70,8 +79,13 @@ class CurrencyInput: UITextField {
return
}

let formatter = NumberFormatter()
formatter.numberStyle = .currencyAccounting
// If the last character isn't a number we remove it and add the decimal separator.
if text.last?.description != nil && !CharacterSet.decimalDigits.isSuperset(
of: CharacterSet(charactersIn: text.last!.description)
) {
text.removeLast()
text = "\(text)\(formatter.decimalSeparator.description)"
}

text = text.replacingOccurrences(of: formatter.groupingSeparator, with: "")

Expand All @@ -91,10 +105,10 @@ class CurrencyInput: UITextField {
// Group the numbers above the decimal separator.
var counted = 0
var newText = ""
let includesDecimalSeparator = String(text).contains(".")
let includesDecimalSeparator = String(text).contains(formatter.decimalSeparator)

for number in String(text).reversed() {
if includesDecimalSeparator && !newText.contains(".") {
if includesDecimalSeparator && !newText.contains(formatter.decimalSeparator) {
newText.insert(number, at: String.Index.init(encodedOffset: 0))
continue
}
Expand Down
4 changes: 2 additions & 2 deletions VergeiOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.10.1</string>
<string>0.11</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>0.10.1</string>
<string>0.11</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSRequiresIPhoneOS</key>
Expand Down
1 change: 1 addition & 0 deletions VergeiOS/Kernel/ApplicationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ class ApplicationManager {
}

func reset() {
TransactionManager.shared.removeAll()
userDefaults.removePersistentDomain(forName: Bundle.main.bundleIdentifier!)
userDefaults.synchronize()
keychain.clear()
Expand Down
5 changes: 3 additions & 2 deletions VergeiOS/Kernel/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ struct Config {

static let fetchWalletTimeout: Double = 30
static let fetchPriceTimeout: Double = 150
static let satoshiDivider: Double = 1000000.0
static let satoshiDivider: Double = 100000000.0
static let fee: Double = 0.0

static let website: String = "https://vergecurrency.com/"
static let iOSRepo: String = "https://github.com/vergecurrency/vIOS"
static let blockchainExlorer: String = "https://verge-blockchain.info/"
static let bwsEndpoint: String = "https://load.vergecoreteam.com/bws/api/"
static let bwsEndpoint: String = "https://bws2.swenvanzanten.com:3232/bws/api/"
static let priceDataEndpoint: String = "https://usxvglw.vergecoreteam.com/price/api/v1/price/"
static let chartDataEndpoint: String = "https://graphs2.coinmarketcap.com/currencies/"
static let ipCheckEndpoint: String = "http://api.ipstack.com/check?access_key=e95ebddbee9137302b3cf50b39a33362&format=1"
Expand Down
4 changes: 4 additions & 0 deletions VergeiOS/Kernel/TransactionManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ class TransactionManager {
completion(self.transactionRepository.all())
}
}

public func removeAll() {
transactionRepository.removeAll()
}
}
8 changes: 8 additions & 0 deletions VergeiOS/Kernel/TransactionRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ class TransactionRepository {
}
}

func removeAll() {
let txs = all()

for tx in txs {
remove(tx: tx)
}
}

private func transform(entity: TransactionType?) -> TxHistory {
let transaction = TxHistory(
txid: entity?.txid ?? "",
Expand Down
5 changes: 0 additions & 5 deletions VergeiOS/Storyboards/Send.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,6 @@ Please increase you're balance.</string>
<constraint firstItem="9p4-gg-a9I" firstAttribute="leading" secondItem="KeC-Cu-FEB" secondAttribute="leading" id="tDh-5e-uyv"/>
</constraints>
<viewLayoutGuide key="safeArea" id="KeC-Cu-FEB"/>
<variation key="default">
<mask key="subviews">
<exclude reference="9p4-gg-a9I"/>
</mask>
</variation>
</view>
<tabBarItem key="tabBarItem" title="Send" image="Payment" selectedImage="Payment" id="nUu-cc-weU"/>
<navigationItem key="navigationItem" title="Send" id="bg6-ol-xdW"/>
Expand Down
Loading

0 comments on commit 5aca7ba

Please sign in to comment.