Commit d57be09e authored by Jü's avatar

Merge remote-tracking branch 'origin/fix/issue-21'

parents 3ad8a18b 45ee0ec1
......@@ -8,4 +8,5 @@ DerivedData/
*.xcuserstate
Breakpoints_v2.xcbkptlist
.vscode
*/xcuserdata/*
\ No newline at end of file
**/xcuserdata/*
.idea
\ No newline at end of file
......@@ -1628,7 +1628,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/XWallet/external-libs/monero_v0.12",
"$(PROJECT_DIR)/XWallet/external-libs/monero_v0.14",
"$(PROJECT_DIR)/XWallet/external-libs/openssl",
"$(PROJECT_DIR)/XWallet/external-libs/boost",
);
......@@ -1665,7 +1665,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/XWallet/external-libs/monero_v0.12",
"$(PROJECT_DIR)/XWallet/external-libs/monero_v0.14",
"$(PROJECT_DIR)/XWallet/external-libs/openssl",
"$(PROJECT_DIR)/XWallet/external-libs/boost",
);
......
......@@ -13,34 +13,30 @@ extension String {
public subscript(i: Int) -> Character {
return self[index(startIndex, offsetBy: i)]
}
public subscript(i: Int) -> String {
return String(self[i] as Character)
}
// public subscript(r: Range<Int>) -> String {
// let start = index(startIndex, offsetBy: r.lowerBound)
// let end = index(startIndex, offsetBy: r.upperBound)
// return String(self[Range(start ..< end)])
// }
public subscript(r: Range<Int>) -> String {
let start = index(startIndex, offsetBy: r.lowerBound)
let end = index(startIndex, offsetBy: r.upperBound)
return String(self[start..<end])
}
public subscript(r: ClosedRange<Int>) -> String {
let start = index(startIndex, offsetBy: r.lowerBound)
let end = index(startIndex, offsetBy: r.upperBound)
return String(self[start...end])
}
public func suffix(count: Int) -> String {
let startIndex = self.index(self.endIndex, offsetBy: -count)
let last = self[startIndex...]
return String(last)
}
/// Converts string to Double using locale decimal separator
// Converts string to Double using locale decimal separator
public func toDouble() -> Double? {
let nf = NumberFormatter()
nf.locale = Locale.current
......@@ -48,15 +44,15 @@ extension String {
return Double(truncating: d)
}
/// Checks if can be converted into a double
// Checks if can be converted into a double
public func isValidDouble() -> Bool {
guard let _ = self.toDouble() else { return false }
return true
}
/// Adds or removes leading zero
/// eg. "00" -> "0", ".123" -> "0.123", "" -> "0"
/// If value is not a valid double then returns nil
// Adds or removes leading zero
// eg. "00" -> "0", ".123" -> "0.123", "" -> "0"
// If value is not a valid double then returns nil
public func prettyPrintDouble() -> String? {
if self.isEmpty {
return "0"
......@@ -73,9 +69,9 @@ extension String {
if decimalSeparator.count < 1 {
return self.prettyPrintInt()
}
let split = self.split(separator: decimalSeparator[0], maxSplits: 1, omittingEmptySubsequences: false)
if split.count < 2 {
return self.prettyPrintInt()
}
......@@ -93,15 +89,3 @@ extension String {
return "\(asInt)"
}
}
......@@ -178,6 +178,7 @@ extension OnboardingServiceTests {
private class SecureStoreMock: SecureStoreProtocol {
var appPin: String?
var walletPassword: String?
var appleWatch2FAPassword: String?
var nodeUserId: String = ""
var nodePassword: String = ""
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment