Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Syn-McJ committed Jan 23, 2024
1 parent db01fe3 commit 8fa8e50
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
1 change: 0 additions & 1 deletion DashWallet/Sources/UI/Portal/Model/PortalModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ class PortalModel: NetworkReachabilityHandling {
self?.items = items
self?.delegate?.serviceItemsDidChange()
}
serviceItemDataProvider.initializeDataSources()

networkStatusDidChange = { [weak self] _ in
self?.refreshData()
Expand Down
30 changes: 15 additions & 15 deletions DashWallet/Sources/UI/Portal/Model/ServiceDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ import Foundation
// MARK: - ServiceDataProvider

protocol ServiceDataProvider {
func initializeDataSources()
func listenForData(handler: @escaping (([ServiceItem]) -> Void))
func refresh()
}

// MARK: - MookServiceDataProvider

class MookServiceDataProvider: ServiceDataProvider {
func initializeDataSources() { }

func listenForData(handler: @escaping (([ServiceItem]) -> Void)) {
handler([.init(status: .authorized, service: .uphold), .init(status: .idle, service: .coinbase)])
}
Expand All @@ -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
Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions DashWallet/dashwallet-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 8fa8e50

Please sign in to comment.