From 8fa8e50134561f382ecf44e7731c0bcae338c8ec Mon Sep 17 00:00:00 2001 From: Andrei Ashikhmin Date: Tue, 23 Jan 2024 18:54:19 +0700 Subject: [PATCH] chore: cleanup --- .../Sources/UI/Portal/Model/PortalModel.swift | 1 - .../UI/Portal/Model/ServiceDataProvider.swift | 30 +++++++++---------- DashWallet/dashwallet-Bridging-Header.h | 1 + 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/DashWallet/Sources/UI/Portal/Model/PortalModel.swift b/DashWallet/Sources/UI/Portal/Model/PortalModel.swift index 7e55c5fc3..7172bc6db 100644 --- a/DashWallet/Sources/UI/Portal/Model/PortalModel.swift +++ b/DashWallet/Sources/UI/Portal/Model/PortalModel.swift @@ -107,7 +107,6 @@ class PortalModel: NetworkReachabilityHandling { self?.items = items self?.delegate?.serviceItemsDidChange() } - serviceItemDataProvider.initializeDataSources() networkStatusDidChange = { [weak self] _ in self?.refreshData() diff --git a/DashWallet/Sources/UI/Portal/Model/ServiceDataProvider.swift b/DashWallet/Sources/UI/Portal/Model/ServiceDataProvider.swift index 45ce78946..f689c719d 100644 --- a/DashWallet/Sources/UI/Portal/Model/ServiceDataProvider.swift +++ b/DashWallet/Sources/UI/Portal/Model/ServiceDataProvider.swift @@ -20,7 +20,6 @@ import Foundation // MARK: - ServiceDataProvider protocol ServiceDataProvider { - func initializeDataSources() func listenForData(handler: @escaping (([ServiceItem]) -> Void)) func refresh() } @@ -28,8 +27,6 @@ protocol ServiceDataProvider { // MARK: - MookServiceDataProvider class MookServiceDataProvider: ServiceDataProvider { - func initializeDataSources() { } - func listenForData(handler: @escaping (([ServiceItem]) -> Void)) { handler([.init(status: .authorized, service: .uphold), .init(status: .idle, service: .coinbase)]) } @@ -45,7 +42,13 @@ class ServiceDataProviderImpl: ServiceDataProvider { private var upholdDataSource: ServiceDataSource = UpholdDataSource() private var coinbaseDataSource: ServiceDataSource = CoinbaseDataSource() - private var items: [ServiceItem] = [] + private var items: [ServiceItem] = [ + .init(status: .idle, service: .topper) // Topper item doesn't need a data source + ] + + init() { + initializeDataSources() + } func listenForData(handler: @escaping (([ServiceItem]) -> Void)) { self.handler = handler @@ -56,17 +59,14 @@ class ServiceDataProviderImpl: ServiceDataProvider { coinbaseDataSource.refresh() } - func initializeDataSources() { - updateService(with: .init(status: .idle, service: .topper)) // Topper item doesn't need a data source) - - // Disabled due to App Store review hold-up -// upholdDataSource.serviceDidUpdate = { [weak self] item in -// self?.updateService(with: item) -// } -// -// coinbaseDataSource.serviceDidUpdate = { [weak self] item in -// self?.updateService(with: item) -// } + private func initializeDataSources() { + upholdDataSource.serviceDidUpdate = { [weak self] item in + self?.updateService(with: item) + } + + coinbaseDataSource.serviceDidUpdate = { [weak self] item in + self?.updateService(with: item) + } } private func updateService(with item: ServiceItem) { diff --git a/DashWallet/dashwallet-Bridging-Header.h b/DashWallet/dashwallet-Bridging-Header.h index aaf0e423a..a2b6d3417 100644 --- a/DashWallet/dashwallet-Bridging-Header.h +++ b/DashWallet/dashwallet-Bridging-Header.h @@ -116,6 +116,7 @@ static const bool _SNAPSHOT = 0; #import "DWSeedPhraseModel.h" #import "UIImage+Utils.h" #import "NSData+Dash.h" +#import "DSChain+DashWallet.h" //MARK: Tabbar #import "DWHomeViewController.h"