Skip to content

Commit

Permalink
Release/0.15.1 - Master (#771)
Browse files Browse the repository at this point in the history
- Replaced old connection indicator (dot) with new one (image/button)
- The indicator will show a different image depends on the connection state
- Replaced old details screen (tooltip bubble) with standardised popup
- The new details screen now will show the status of network, tor, base node connection and data sync status
- Tiles and cells on UTXOs Wallet scene no will be semitransparent when they are pending/unconfirmed and selection mode is turned on.
  • Loading branch information
TruszczynskiA authored Jul 28, 2022
1 parent 0b7bf29 commit a1a1faf
Show file tree
Hide file tree
Showing 37 changed files with 1,161 additions and 586 deletions.
62 changes: 49 additions & 13 deletions MobileWallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x44",
"green" : "0x2C",
"red" : "0xD3"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "icon-internet.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "icon-sync.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
15 changes: 15 additions & 0 deletions MobileWallet/Assets.xcassets/Icons/icon-tor.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "icon-tor.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "network-full.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "network-limited.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "network-off.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ final class WalletTransactionsManager {

private func waitForConnection(result: @escaping (Result<Void, TransactionError>) -> Void) {

let connectionState = ConnectionMonitor.shared.state
let connectionState = LegacyConnectionMonitor.shared.state

switch connectionState.reachability {
case .offline, .unknown:
Expand Down
12 changes: 12 additions & 0 deletions MobileWallet/Common/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,11 @@ struct Images: Loopable {
let settingsWalletBackupsIcon = UIImage(named: "icon-wallet-backups")
let settingsYatIcon = UIImage(named: "icon-yat")

// Connection Details Icons
let connectionInternetIcon = UIImage(named: "icon-internet")
let connectionTorIcon = UIImage(named: "icon-tor")
let connectionSyncIcon = UIImage(named: "icon-sync")

// UTXOs Wallet

let utxoTick = UIImage(named: "tick")
Expand All @@ -362,6 +367,12 @@ struct Images: Loopable {
let speedometerLow = UIImage(named: "speedometer-low")
let speedometerMid = UIImage(named: "speedometer-mid")
let speedometerHigh = UIImage(named: "speedometer-high")

// Connection Indicator

let connectionIndicatorConnectedIcon = UIImage(named: "network-full")
let connectionIndicatorLimitedConnectonIcon = UIImage(named: "network-limited")
let connectionIndicatorDisconnectedIcon = UIImage(named: "network-off")
}

struct Fonts: Loopable {
Expand Down Expand Up @@ -550,6 +561,7 @@ extension UIColor {
enum system {
static var green: UIColor? { UIColor(named: "Green") }
static var orange: UIColor? { UIColor(named: "Orange") }
static var red: UIColor? { UIColor(named: "Red") }
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions MobileWallet/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

// Remove badges from push notifications
UIApplication.shared.applicationIconBadgeNumber = 0
ConnectionMonitor.shared.start()
LegacyConnectionMonitor.shared.start()
TariLib.shared.startTor()
// Only starts the wallet if it was stopped. Else wallet is started on the splash screen.
if TariLib.shared.isWalletExist {
Expand All @@ -147,7 +147,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

// Save changes in the application's managed object context when the application transitions to the background.
(UIApplication.shared.delegate as? AppDelegate)?.saveContext()
ConnectionMonitor.shared.stop()
LegacyConnectionMonitor.shared.stop()
TariLib.shared.stopWallet()
TariLib.shared.stopTor()
ICloudBackup.shared.backgroundBackupWallet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ extension UIViewController: MFMailComposeViewControllerDelegate {
footer.append("<br/>\(key): \(value)")
}
footer.append("<br/>")
footer.append(ConnectionMonitor.shared.state.formattedDisplayItems.joined(separator: "<br/>"))
footer.append(LegacyConnectionMonitor.shared.state.formattedDisplayItems.joined(separator: "<br/>"))
footer.append("</i></p>")

return footer
Expand Down Expand Up @@ -283,10 +283,10 @@ extension UIViewController: MFMailComposeViewControllerDelegate {
private func showConnectionStatusPopUp() {

let headerSection = PopUpComponentsFactory.makeHeaderView(title: "Connection status")
let contentSection = PopUpComponentsFactory.makeContentView(message: ConnectionMonitor.shared.state.formattedDisplayItems.joined(separator: "\n\n"))
let contentSection = PopUpComponentsFactory.makeContentView(message: LegacyConnectionMonitor.shared.state.formattedDisplayItems.joined(separator: "\n\n"))

let event = TariEventBus.events(forType: .connectionMonitorStatusChanged)
.sink { [weak contentSection] _ in contentSection?.label.text = ConnectionMonitor.shared.state.formattedDisplayItems.joined(separator: "\n\n") }
.sink { [weak contentSection] _ in contentSection?.label.text = LegacyConnectionMonitor.shared.state.formattedDisplayItems.joined(separator: "\n\n") }

let buttonsSection = PopUpComponentsFactory.makeButtonsView(models: [PopUpDialogButtonModel(title: localized("common.close"), type: .text, callback: { event.cancel() })])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ final class HomeView: UIView {
view.tintColor = .white
return view
}()

let connectionIndicatorView: ConnectionIndicatorView = {
let view = ConnectionIndicatorView()
view.translatesAutoresizingMaskIntoConstraints = false

@View private var connectionStatusButton: BaseButton = {
let view = BaseButton()
return view
}()

Expand All @@ -130,32 +129,38 @@ final class HomeView: UIView {
return view
}()

let tooltipView: TooltipView = {
let view = TooltipView()
view.alpha = 0.0
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()

let topToolbar: HomeViewToolbar = {
let view = HomeViewToolbar()
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()

// MARK: - Properties

var connectionStatusIcon: UIImage? {
get { connectionStatusButton.image(for: .normal) }
set {
UIView.transition(with: connectionStatusButton, duration: 0.5, options: .transitionCrossDissolve) {
self.connectionStatusButton.setImage(newValue, for: .normal)
}
}
}

var onOnCloseButtonTap: (() -> Void)? {
get { topToolbar.onOnCloseButtonTap }
set { topToolbar.onOnCloseButtonTap = newValue }
}

var onConnectionStatusButtonTap: (() -> Void)? {
get { connectionStatusButton.onTap }
set { connectionStatusButton.onTap = newValue }
}

var onAmountHelpButtonTap: (() -> Void)?

private(set) var toolbarBottomConstraint: NSLayoutConstraint?
private(set) var toolbarHeightConstraint: NSLayoutConstraint?

@Published var isTooltipVisible: Bool = false
private var cancelables: Set<AnyCancellable> = []

// MARK: - Initializers
Expand All @@ -164,7 +169,6 @@ final class HomeView: UIView {
super.init(frame: .zero)
setupLayers()
setupConstraints()
setupFeedbacks()
}

required init?(coder: NSCoder) {
Expand All @@ -183,7 +187,7 @@ final class HomeView: UIView {

private func setupConstraints() {

[balanceTitleLabel, tariIconView, balanceValueLabel, avaiableFoundsTitleLabel, avaiableFoundsValueLabel, amountHelpButton, connectionIndicatorView, utxosWalletButton, tooltipView, topToolbar].forEach(addSubview)
[balanceTitleLabel, tariIconView, balanceValueLabel, avaiableFoundsTitleLabel, avaiableFoundsValueLabel, amountHelpButton, connectionStatusButton, utxosWalletButton, topToolbar].forEach(addSubview)

let toolbarBottomConstraint = topToolbar.bottomAnchor.constraint(equalTo: topAnchor)
let toolbarHeightConstraint = topToolbar.heightAnchor.constraint(equalToConstant: 0.0)
Expand All @@ -201,26 +205,22 @@ final class HomeView: UIView {
tariIconView.centerYAnchor.constraint(equalTo: balanceValueLabel.centerYAnchor),
balanceValueLabel.topAnchor.constraint(equalTo: balanceTitleLabel.bottomAnchor, constant: -7.0),
balanceValueLabel.leadingAnchor.constraint(equalTo: tariIconView.trailingAnchor, constant: 8.0),
balanceValueLabel.trailingAnchor.constraint(equalTo: connectionIndicatorView.leadingAnchor),
avaiableFoundsTitleLabel.topAnchor.constraint(equalTo: balanceValueLabel.bottomAnchor, constant: -1.0),
avaiableFoundsTitleLabel.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 30.0),
avaiableFoundsValueLabel.topAnchor.constraint(equalTo: avaiableFoundsTitleLabel.bottomAnchor),
avaiableFoundsValueLabel.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 30.0),
avaiableFoundsValueLabel.trailingAnchor.constraint(equalTo: connectionIndicatorView.leadingAnchor),
amountHelpButton.leadingAnchor.constraint(equalTo: avaiableFoundsTitleLabel.trailingAnchor, constant: 4.0),
amountHelpButton.centerYAnchor.constraint(equalTo: avaiableFoundsTitleLabel.centerYAnchor),
amountHelpButton.heightAnchor.constraint(equalToConstant: 18.0),
amountHelpButton.widthAnchor.constraint(equalToConstant: 18.0),
connectionStatusButton.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -26.0),
connectionStatusButton.centerYAnchor.constraint(equalTo: balanceValueLabel.centerYAnchor),
connectionStatusButton.heightAnchor.constraint(equalToConstant: 22.0),
connectionStatusButton.widthAnchor.constraint(equalToConstant: 22.0),
utxosWalletButton.topAnchor.constraint(equalTo: connectionStatusButton.bottomAnchor, constant: 8.0),
utxosWalletButton.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -26.0),
utxosWalletButton.centerYAnchor.constraint(equalTo: balanceValueLabel.centerYAnchor),
utxosWalletButton.heightAnchor.constraint(equalToConstant: 22.0),
utxosWalletButton.widthAnchor.constraint(equalToConstant: 22.0),
connectionIndicatorView.topAnchor.constraint(equalTo: utxosWalletButton.bottomAnchor),
connectionIndicatorView.centerXAnchor.constraint(equalTo: utxosWalletButton.centerXAnchor),
tooltipView.tipXAnchor.constraint(equalTo: connectionIndicatorView.centerXAnchor),
tooltipView.tipYAnchor.constraint(equalTo: connectionIndicatorView.centerYAnchor),
tooltipView.leadingAnchor.constraint(greaterThanOrEqualTo: leadingAnchor, constant: 12.0),
tooltipView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -12.0),
topToolbar.leadingAnchor.constraint(equalTo: leadingAnchor),
topToolbar.trailingAnchor.constraint(equalTo: trailingAnchor),
toolbarBottomConstraint,
Expand All @@ -230,23 +230,6 @@ final class HomeView: UIView {
NSLayoutConstraint.activate(constraints)
}

private func setupFeedbacks() {
$isTooltipVisible
.sink { [weak self] in self?.updateTooltipState(isVisible: $0) }
.store(in: &cancelables)

amountHelpButton.addTarget(self, action: #selector(onAmountHelpButtonTapAction), for: .touchUpInside)
}

// MARK: - Actions

private func updateTooltipState(isVisible: Bool) {
bringSubviewToFront(tooltipView)
UIView.animate(withDuration: 0.3, delay: 0.0, options: .beginFromCurrentState) {
self.tooltipView.alpha = isVisible ? 1.0 : 0.0
}
}

// MARK: - Action Targets

@objc private func onAmountHelpButtonTapAction() {
Expand Down
Loading

0 comments on commit a1a1faf

Please sign in to comment.