|
|
@ -26,7 +26,6 @@ class TokensViewController: UIViewController { |
|
|
|
private let assetDefinitionStore: AssetDefinitionStore |
|
|
|
private let assetDefinitionStore: AssetDefinitionStore |
|
|
|
private let eventsDataStore: EventsDataStoreProtocol |
|
|
|
private let eventsDataStore: EventsDataStoreProtocol |
|
|
|
private let sections: [Section] = Section.allCases |
|
|
|
private let sections: [Section] = Section.allCases |
|
|
|
private var timeOfLastFetchBecauseViewAppears: Date? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private var viewModel: TokensViewModel { |
|
|
|
private var viewModel: TokensViewModel { |
|
|
|
didSet { |
|
|
|
didSet { |
|
|
@ -227,7 +226,7 @@ class TokensViewController: UIViewController { |
|
|
|
navigationController?.navigationBar.prefersLargeTitles = true |
|
|
|
navigationController?.navigationBar.prefersLargeTitles = true |
|
|
|
hidesBottomBarWhenPushed = false |
|
|
|
hidesBottomBarWhenPushed = false |
|
|
|
|
|
|
|
|
|
|
|
fetchWithThrottling() |
|
|
|
fetch() |
|
|
|
fixNavigationBarAndStatusBarBackgroundColorForiOS13Dot1() |
|
|
|
fixNavigationBarAndStatusBarBackgroundColorForiOS13Dot1() |
|
|
|
keyboardChecker.viewWillAppear() |
|
|
|
keyboardChecker.viewWillAppear() |
|
|
|
} |
|
|
|
} |
|
|
@ -244,7 +243,7 @@ class TokensViewController: UIViewController { |
|
|
|
@objc func pullToRefresh() { |
|
|
|
@objc func pullToRefresh() { |
|
|
|
tableViewRefreshControl.beginRefreshing() |
|
|
|
tableViewRefreshControl.beginRefreshing() |
|
|
|
collectiblesCollectionViewRefreshControl.beginRefreshing() |
|
|
|
collectiblesCollectionViewRefreshControl.beginRefreshing() |
|
|
|
fetchWithThrottling() |
|
|
|
fetch() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@objc func openConsole() { |
|
|
|
@objc func openConsole() { |
|
|
@ -256,23 +255,6 @@ class TokensViewController: UIViewController { |
|
|
|
tokenCollection.fetch() |
|
|
|
tokenCollection.fetch() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//To reduce chance of this error occurring: |
|
|
|
|
|
|
|
//Error Domain=NSPOSIXErrorDomain Code=28 "No space left on device" UserInfo={_kCFStreamErrorCodeKey=28, _kCFStreamErrorDomainKey=1} |
|
|
|
|
|
|
|
private func fetchWithThrottling() { |
|
|
|
|
|
|
|
let ttl: TimeInterval = 60 * 5 |
|
|
|
|
|
|
|
if let timeOfLastFetchBecauseViewAppears = timeOfLastFetchBecauseViewAppears { |
|
|
|
|
|
|
|
if Date().timeIntervalSince(timeOfLastFetchBecauseViewAppears) < ttl { |
|
|
|
|
|
|
|
//no-op |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
fetch() |
|
|
|
|
|
|
|
self.timeOfLastFetchBecauseViewAppears = Date() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
fetch() |
|
|
|
|
|
|
|
timeOfLastFetchBecauseViewAppears = Date() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override func viewDidLayoutSubviews() { |
|
|
|
override func viewDidLayoutSubviews() { |
|
|
|
//viewDidLayoutSubviews() is called many times |
|
|
|
//viewDidLayoutSubviews() is called many times |
|
|
|
configureSearchBarOnce() |
|
|
|
configureSearchBarOnce() |
|
|
|