-
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 #319 from nova-wallet/release/3.3.0
v3.3.0
- Loading branch information
Showing
118 changed files
with
4,521 additions
and
2,569 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
novawallet/Assets.xcassets/iconSearchButton.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" : "iconSearchButton.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+2 KB
novawallet/Assets.xcassets/iconSearchButton.imageset/iconSearchButton.pdf
Binary file not shown.
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
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 Foundation | ||
|
||
extension Bool { | ||
var intValue: Int { self ? 1 : 0 } | ||
} |
37 changes: 37 additions & 0 deletions
37
novawallet/Common/Extension/Foundation/ChainModel+Comparator.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,37 @@ | ||
import Foundation | ||
|
||
enum ChainModelCompator { | ||
static func priorityAndTestnetComparator(chain1: ChainModel, chain2: ChainModel) -> ComparisonResult { | ||
let priority1 = chainPriority(for: chain1.chainId) | ||
let priority2 = chainPriority(for: chain2.chainId) | ||
|
||
if priority1 != priority2 { | ||
return priority1 < priority2 ? .orderedAscending : .orderedDescending | ||
} else if chain1.isTestnet != chain2.isTestnet { | ||
return chain1.isTestnet.intValue < chain2.isTestnet.intValue ? .orderedAscending : .orderedDescending | ||
} | ||
|
||
return .orderedSame | ||
} | ||
|
||
static func defaultComparator(chain1: ChainModel, chain2: ChainModel) -> Bool { | ||
let priorityAndTestResult = priorityAndTestnetComparator(chain1: chain1, chain2: chain2) | ||
|
||
if priorityAndTestResult != .orderedSame { | ||
return priorityAndTestResult == .orderedAscending | ||
} else { | ||
return chain1.name.lexicographicallyPrecedes(chain2.name) | ||
} | ||
} | ||
|
||
private static func chainPriority(for chainId: ChainModel.Id) -> UInt8 { | ||
switch chainId { | ||
case KnowChainId.polkadot: | ||
return 0 | ||
case KnowChainId.kusama: | ||
return 1 | ||
default: | ||
return 2 | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Foundation | ||
import Kingfisher | ||
|
||
final class FilterImageProcessor: ImageProcessor { | ||
var identifier: String { proccessor.identifier } | ||
|
||
func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? { | ||
switch item { | ||
case let .image(kFCrossPlatformImage): | ||
guard filterClosure(kFCrossPlatformImage) else { | ||
return kFCrossPlatformImage | ||
} | ||
|
||
return proccessor.process(item: item, options: options) | ||
case .data: | ||
return proccessor.process(item: item, options: options) | ||
} | ||
} | ||
|
||
let filterClosure: (KFCrossPlatformImage) -> Bool | ||
let proccessor: ImageProcessor | ||
|
||
init(proccessor: ImageProcessor, filter: @escaping (KFCrossPlatformImage) -> Bool) { | ||
self.proccessor = proccessor | ||
filterClosure = filter | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import Foundation | ||
|
||
enum SearchMatch<T> { | ||
case full(T) | ||
case prefix(T) | ||
case inclusion(T) | ||
|
||
var item: T { | ||
switch self { | ||
case let .full(item): | ||
return item | ||
case let .prefix(item): | ||
return item | ||
case let .inclusion(item): | ||
return item | ||
} | ||
} | ||
|
||
var isFull: Bool { | ||
switch self { | ||
case .full: | ||
return true | ||
default: | ||
return false | ||
} | ||
} | ||
} | ||
|
||
extension SearchMatch { | ||
static func matchString<T>(for query: String, recordField: String, record: T) -> SearchMatch<T>? { | ||
if let match = matchFullString(for: query, recordField: recordField, record: record) { | ||
return match | ||
} | ||
|
||
if let match = matchPrefix(for: query, recordField: recordField, record: record) { | ||
return match | ||
} | ||
|
||
if let match = matchInclusion(for: query, recordField: recordField, record: record) { | ||
return match | ||
} | ||
|
||
return nil | ||
} | ||
|
||
static func matchFullString<T>(for query: String, recordField: String, record: T) -> SearchMatch<T>? { | ||
isFullMatch(query: query.lowercased(), field: recordField.lowercased()) ? .full(record) : nil | ||
} | ||
|
||
static func isFullMatch(query: String, field: String) -> Bool { | ||
field == query | ||
} | ||
|
||
static func matchPrefix<T>(for query: String, recordField: String, record: T) -> SearchMatch<T>? { | ||
isPrefixMatch(query: query.lowercased(), field: recordField.lowercased()) ? .prefix(record) : nil | ||
} | ||
|
||
static func isPrefixMatch(query: String, field: String) -> Bool { | ||
field.hasPrefix(query) | ||
} | ||
|
||
static func matchInclusion<T>(for query: String, recordField: String, record: T) -> SearchMatch<T>? { | ||
isInclusionMatch(query: query.lowercased(), field: recordField.lowercased()) ? .inclusion(record) : nil | ||
} | ||
|
||
static func isInclusionMatch(query: String, field: String) -> Bool { | ||
field.contains(query) | ||
} | ||
} |
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
Oops, something went wrong.