Merge pull request #923 from AlphaWallet/remove-import-ticket-bubble

Remove import ticket bubble prompt when there are no tokens, in wallet tab
pull/925/head
James Sangalli 6 years ago committed by GitHub
commit 3f791ee617
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      AlphaWallet.xcodeproj/project.pbxproj
  2. 14
      AlphaWallet/Tokens/ViewControllers/TokensViewController.swift
  3. 75
      AlphaWallet/Tokens/Views/ImportWalletHelpBubbleView.swift

@ -264,7 +264,6 @@
5E7C71DBB4AD309920C45556 /* ConfirmSignMessageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C78421F01D14741DDF5BF /* ConfirmSignMessageViewController.swift */; };
5E7C71DC13B2040F5408BF3C /* ImportMagicTokenCardRowViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C781F82F9E4903C460E33 /* ImportMagicTokenCardRowViewModel.swift */; };
5E7C71F8050CCF990539B293 /* LockView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C79D674D45A07E694CE31 /* LockView.swift */; };
5E7C7208A83399C27AE57E44 /* ImportWalletHelpBubbleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C70CC85B337061151724E /* ImportWalletHelpBubbleView.swift */; };
5E7C724638271FD2FA0EB93C /* BaseTokenListFormatTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C734D61C0347C1638A1F7 /* BaseTokenListFormatTableViewCell.swift */; };
5E7C725AC96979DEF4DE8B85 /* ConvertSVGToPNG.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7BCCCFE7B99162518FB7 /* ConvertSVGToPNG.swift */; };
5E7C72670E16AFB8DAF64673 /* OnboardingPageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7E24936CC2190D2A16C2 /* OnboardingPageViewModel.swift */; };
@ -831,7 +830,6 @@
5E7C708DE897B6677EAD769B /* ScriptMessageProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScriptMessageProxy.swift; sourceTree = "<group>"; };
5E7C70A496987CAB2D76D7F5 /* ContractERC875Transfer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContractERC875Transfer.swift; sourceTree = "<group>"; };
5E7C70B7E1F621657184ABD0 /* DirectoryContentsWatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DirectoryContentsWatcher.swift; sourceTree = "<group>"; };
5E7C70CC85B337061151724E /* ImportWalletHelpBubbleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImportWalletHelpBubbleView.swift; sourceTree = "<group>"; };
5E7C70FB40612BB02594EC00 /* ChooseTokenCardTransferModeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChooseTokenCardTransferModeViewController.swift; sourceTree = "<group>"; };
5E7C7103135DCCCAB96EE5FC /* OnboardingPage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingPage.swift; sourceTree = "<group>"; };
5E7C7117B1DF438E213B406A /* History.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = History.swift; sourceTree = "<group>"; };
@ -1701,7 +1699,6 @@
5E7C7C58586099F082973073 /* WalletFilterView.swift */,
5E7C783E3ADA4CF9554A0E7D /* NonFungibleTokenViewCell.swift */,
5E7C7EE374A74F2B00013C18 /* EthTokenViewCell.swift */,
5E7C70CC85B337061151724E /* ImportWalletHelpBubbleView.swift */,
5E7C7F5C10E3895E805EA7E0 /* BaseTokenCardTableViewCell.swift */,
5E7C7CFDE7DEA8C06C4100AF /* TextField.swift */,
5E7C734D61C0347C1638A1F7 /* BaseTokenListFormatTableViewCell.swift */,
@ -3790,7 +3787,6 @@
5E7C75D46140FACBD12333BF /* EthTokenViewCell.swift in Sources */,
5E7C728CDF33FBDBA47F71A6 /* MarketplaceViewController.swift in Sources */,
5E7C71A7D2BD6FCE3980CC51 /* ImportWalletHelpBubbleViewViewModel.swift in Sources */,
5E7C7208A83399C27AE57E44 /* ImportWalletHelpBubbleView.swift in Sources */,
5E7C7E04D4DDD7D8881A2AB1 /* UniversalLinkCoordinator.swift in Sources */,
5E7C71A6B0BDF301747A49AE /* ScreenChecker.swift in Sources */,
5E7C72AF95DCE8BC65490BCA /* StatusViewController.swift in Sources */,

@ -25,7 +25,6 @@ class TokensViewController: UIViewController {
private let filterView = WalletFilterView()
private var importWalletView: UIView?
private var importWalletLayer = CAShapeLayer()
private var importWalletHelpBubbleView: ImportWalletHelpBubbleView?
private let tableView: UITableView
private let tableViewRefreshControl = UIRefreshControl()
private let collectiblesCollectionViewRefreshControl = UIRefreshControl()
@ -160,13 +159,11 @@ class TokensViewController: UIViewController {
private func hideImportWalletImage() {
importWalletView?.isHidden = true
importWalletHelpBubbleView?.isHidden = true
}
private func showImportWalletImage() {
if let importWalletView = importWalletView {
importWalletView.isHidden = false
importWalletHelpBubbleView?.isHidden = false
return
}
importWalletView = UIView()
@ -204,17 +201,6 @@ class TokensViewController: UIViewController {
stackView.centerYAnchor.constraint(equalTo: importWalletView.centerYAnchor),
])
}
importWalletHelpBubbleView = ImportWalletHelpBubbleView()
let sideMargin = CGFloat(7)
if let importWalletView = importWalletView, let importWalletHelpBubbleView = importWalletHelpBubbleView {
view.addSubview(importWalletHelpBubbleView)
NSLayoutConstraint.activate([
importWalletHelpBubbleView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: sideMargin),
importWalletHelpBubbleView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -sideMargin),
importWalletHelpBubbleView.topAnchor.constraint(equalTo: importWalletView.bottomAnchor, constant: 7),
])
}
}
required init?(coder aDecoder: NSCoder) {

@ -1,75 +0,0 @@
// Copyright © 2018 Stormbird PTE. LTD.
import UIKit
class ImportWalletHelpBubbleView: UIView {
private var importWalletHelpBubbleLayer = CAShapeLayer()
private let titleLabel = UILabel()
private let descriptionLabel = UILabel()
init() {
super.init(frame: .zero)
importWalletHelpBubbleLayer.path = createImportWalletHelpBubblePath().cgPath
importWalletHelpBubbleLayer.fillColor = Colors.appWhite.cgColor
importWalletHelpBubbleLayer.strokeColor = UIColor.clear.cgColor
layer.addSublayer(importWalletHelpBubbleLayer)
titleLabel.translatesAutoresizingMaskIntoConstraints = false
descriptionLabel.translatesAutoresizingMaskIntoConstraints = false
let stackView = [
titleLabel,
descriptionLabel,
].asStackView(axis: .vertical, spacing: 7, contentHuggingPriority: .required)
stackView.translatesAutoresizingMaskIntoConstraints = false
addSubview(stackView)
configure(viewModel: ImportWalletHelpBubbleViewViewModel())
let helpTextMargin = CGFloat(37)
translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
stackView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: helpTextMargin),
stackView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -helpTextMargin),
stackView.topAnchor.constraint(equalTo: topAnchor, constant: helpTextMargin),
stackView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -helpTextMargin),
])
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
importWalletHelpBubbleLayer.frame = bounds
importWalletHelpBubbleLayer.path = createImportWalletHelpBubblePath().cgPath
}
func createImportWalletHelpBubblePath() -> UIBezierPath {
let triangleWidth = CGFloat(20)
let triangleHeight = CGFloat(12)
let path = UIBezierPath(roundedRect: CGRect(x: 0, y: triangleHeight, width: bounds.size.width, height: bounds.size.height - triangleHeight), cornerRadius: 20)
let triangle = UIBezierPath()
triangle.move(to: CGPoint(x: bounds.size.width / 2, y: 0))
triangle.addLine(to: CGPoint(x: bounds.size.width / 2 - triangleWidth / 2, y: triangleHeight))
triangle.addLine(to: CGPoint(x: bounds.size.width / 2 + triangleWidth / 2, y: triangleHeight))
path.append(triangle)
return path
}
private func configure(viewModel: ImportWalletHelpBubbleViewViewModel) {
titleLabel.textAlignment = .center
titleLabel.textColor = viewModel.textColor
titleLabel.font = viewModel.textFont
titleLabel.text = R.string.localizable.aWalletImportWalletBubbleTitle()
descriptionLabel.numberOfLines = 0
descriptionLabel.textAlignment = .center
descriptionLabel.textColor = viewModel.descriptionColor
descriptionLabel.font = viewModel.descriptionFont
descriptionLabel.text = R.string.localizable.aWalletImportWalletBubbleDescription()
}
}
Loading…
Cancel
Save