Skip to content

Commit

Permalink
Update layout for CoinMajorHolders module
Browse files Browse the repository at this point in the history
  • Loading branch information
ealymbaev committed Mar 27, 2023
1 parent dd6ff97 commit 75f37bd
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9408,7 +9408,7 @@
repositoryURL = "https://github.com/horizontalsystems/Chart.Swift";
requirement = {
kind = exactVersion;
version = 1.0.4;
version = 1.0.5;
};
};
D3604E8028F03C6B0066C366 /* XCRemoteSwiftPackageReference "FeeRateKit" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class CoinAnalyticsViewController: ThemeViewController {
}

private func openMajorHolders(blockchain: Blockchain) {
let viewController = CoinMajorHoldersModule.viewController(coinUid: viewModel.coin.uid, blockchain: blockchain)
let viewController = CoinMajorHoldersModule.viewController(coin: viewModel.coin, blockchain: blockchain)
parentNavigationController?.present(viewController, animated: true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ class CoinMajorHolderChartCell: BaseThemeCell {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)

wrapperView.addSubview(countLabel)
countLabel.snp.makeConstraints { maker in
maker.leading.equalToSuperview().inset(CGFloat.margin16)
maker.top.equalToSuperview()
}

countLabel.font = .subhead2
countLabel.textColor = .themeGray

wrapperView.addSubview(percentLabel)
percentLabel.snp.makeConstraints { maker in
maker.leading.equalToSuperview().inset(CGFloat.margin16)
maker.top.equalToSuperview()
maker.top.equalTo(countLabel.snp.bottom).offset(CGFloat.margin12)
}

percentLabel.font = .headline1
Expand All @@ -31,15 +40,6 @@ class CoinMajorHolderChartCell: BaseThemeCell {
descriptionLabel.font = .subhead1
descriptionLabel.textColor = .themeGray
descriptionLabel.text = "coin_analytics.holders.in_top_10_addresses".localized

wrapperView.addSubview(countLabel)
countLabel.snp.makeConstraints { maker in
maker.leading.equalToSuperview().inset(CGFloat.margin16)
maker.top.equalTo(percentLabel.snp.bottom).offset(CGFloat.margin12)
}

countLabel.font = .subhead2
countLabel.textColor = .themeGray
}

required init?(coder aDecoder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import MarketKit

struct CoinMajorHoldersModule {

static func viewController(coinUid: String, blockchain: Blockchain) -> UIViewController {
let service = CoinMajorHoldersService(coinUid: coinUid, blockchain: blockchain, marketKit: App.shared.marketKit, evmLabelManager: App.shared.evmLabelManager)
static func viewController(coin: Coin, blockchain: Blockchain) -> UIViewController {
let service = CoinMajorHoldersService(coin: coin, blockchain: blockchain, marketKit: App.shared.marketKit, evmLabelManager: App.shared.evmLabelManager)
let viewModel = CoinMajorHoldersViewModel(service: service)
let urlManager = UrlManager(inApp: true)
let viewController = CoinMajorHoldersViewController(viewModel: viewModel, urlManager: urlManager)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import RxRelay
import MarketKit

class CoinMajorHoldersService {
private let coinUid: String
let coin: Coin
let blockchain: Blockchain
private let marketKit: Kit
private let evmLabelManager: EvmLabelManager
Expand All @@ -16,8 +16,8 @@ class CoinMajorHoldersService {
}
}

init(coinUid: String, blockchain: Blockchain, marketKit: Kit, evmLabelManager: EvmLabelManager) {
self.coinUid = coinUid
init(coin: Coin, blockchain: Blockchain, marketKit: Kit, evmLabelManager: EvmLabelManager) {
self.coin = coin
self.blockchain = blockchain
self.marketKit = marketKit
self.evmLabelManager = evmLabelManager
Expand All @@ -30,7 +30,7 @@ class CoinMajorHoldersService {

state = .loading

marketKit.tokenHoldersSingle(coinUid: coinUid, blockchainUid: blockchain.uid)
marketKit.tokenHoldersSingle(coinUid: coin.uid, blockchainUid: blockchain.uid)
.subscribeOn(ConcurrentDispatchQueueScheduler(qos: .userInitiated))
.subscribe(onSuccess: { [weak self] holders in
self?.state = .completed(holders)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ extension CoinMajorHoldersViewController: SectionsDataSource {
var sections: [SectionProtocol] = [
Section(
id: "info",
headerState: .margin(height: .margin16),
footerState: .margin(height: .margin16),
headerState: .margin(height: .margin12),
footerState: .margin(height: .margin12),
rows: [
Row<CoinMajorHolderChartCell>(
id: "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CoinMajorHoldersViewModel {
ViewItem(
order: "\(index + 1)",
percent: percentFormatter.string(from: (item.percentage / 100) as NSNumber),
quantity: ValueFormatter.instance.formatShort(value: item.balance),
quantity: ValueFormatter.instance.formatShort(value: item.balance, decimalCount: 0, symbol: service.coin.code),
labeledAddress: service.labeled(address: item.address),
address: item.address
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,8 @@ Go to Settings - > Unstoppable and allow access to the camera.";
"coin_analytics.holders.info1" = "Total number of unique addresses holding the token on various blockchains.";
"coin_analytics.holders.info2" = "Top 10 wallets holding the token on each blockchain.";
"coin_analytics.holders.tracked_blockchains" = "Tracked blockchains: Ethereum, Binance Smart Chain, Optimism, Arbitrum, Celo, Cronos, Avalanche, Fantom, Polygon";
"coin_analytics.holders.in_top_10_addresses" = "in top 10 addresses";
"coin_analytics.holders.count" = "Holders: %@";
"coin_analytics.holders.in_top_10_addresses" = "in top 10 holders";
"coin_analytics.holders.count" = "Total Holders: %@";
"coin_analytics.holders.see_all" = "See All";

"coin_analytics.project_tvl" = "Project TVL";
Expand Down

0 comments on commit 75f37bd

Please sign in to comment.