-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #684 from nova-wallet/develop
6.3.0 Community requested features
- Loading branch information
Showing
116 changed files
with
3,239 additions
and
437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
novawallet/Assets.xcassets/iconsSettings/iconApproveWithPin.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "approve-with-pin.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
.../Assets.xcassets/iconsSettings/iconApproveWithPin.imageset/approve-with-pin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions
12
novawallet/Assets.xcassets/iconsSettings/iconBiometricAuth.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "authentication.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...let/Assets.xcassets/iconsSettings/iconBiometricAuth.imageset/authentication.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
novawallet/Common/Extension/UIKit/UILayoutPriority+Custom.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import UIKit | ||
|
||
extension UILayoutPriority { | ||
static let high = UILayoutPriority(700) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
struct GenericLens<Whole, Part> { | ||
let get: (Whole) -> Part | ||
let set: (Part, Whole) -> Whole | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import Foundation | ||
import RobinHood | ||
|
||
enum SearchOperationFactory { | ||
private static func pointsForWord(title: String, word: String) -> UInt { | ||
if word.caseInsensitiveCompare(title) == .orderedSame { | ||
return 1000 | ||
} else if title.range(of: word, options: .caseInsensitive) != nil { | ||
return 1 | ||
} else { | ||
return 0 | ||
} | ||
} | ||
|
||
private static func pointsForPhrase(title: String, phrase: String) -> UInt { | ||
let pattern = phrase.replacingOccurrences(of: " ", with: ".*") | ||
guard let regex = try? NSRegularExpression(pattern: pattern) else { | ||
return 0 | ||
} | ||
let match = regex.firstMatch( | ||
in: title, | ||
range: NSRange(title.startIndex..., in: title) | ||
) | ||
return match != nil ? 1 : 0 | ||
} | ||
|
||
static func searchOperation<Model, Key>( | ||
text: String, | ||
in models: [Model], | ||
keyExtractor: @escaping (Model) -> Key, | ||
searchKeysExtractor: @escaping (Key) -> [String] | ||
) -> BaseOperation<[Model]> where Key: Hashable { | ||
ClosureOperation { | ||
guard !text.isEmpty else { | ||
return models | ||
} | ||
let calculatePoints = text.split( | ||
by: .space, | ||
maxSplits: 1 | ||
).count > 1 ? self.pointsForPhrase : self.pointsForWord | ||
|
||
let weights = models.reduce(into: [Key: UInt]()) { result, item in | ||
let key = keyExtractor(item) | ||
let searchWords = searchKeysExtractor(key) | ||
result[key] = searchWords.reduce(0) { | ||
$0 + calculatePoints($1, text) | ||
} | ||
} | ||
|
||
let result = models | ||
.filter { | ||
weights[keyExtractor($0), default: 0] > 0 | ||
} | ||
.sorted { | ||
weights[keyExtractor($0), default: 0] > weights[keyExtractor($1), default: 0] | ||
} | ||
|
||
return result | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
novawallet/Common/LocalAuthentication/NoBiometryAuth.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Foundation | ||
|
||
final class NoBiometryAuth: BiometryAuthProtocol { | ||
var availableBiometryType: AvailableBiometryType { .none } | ||
var supportedBiometryType: AvailableBiometryType { .none } | ||
|
||
func authenticate( | ||
localizedReason _: String, | ||
completionQueue: DispatchQueue, | ||
completionBlock: @escaping (Bool) -> Void | ||
) { | ||
dispatchInQueueWhenPossible(completionQueue) { | ||
completionBlock(false) | ||
} | ||
} | ||
} |
Oops, something went wrong.