Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions MobileWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@
F899FBD62E548C9C00653B5A /* View+AutoheightDetents.swift in Sources */ = {isa = PBXBuildFile; fileRef = F899FBD52E548C9600653B5A /* View+AutoheightDetents.swift */; };
F899FBD82E548D1500653B5A /* View+ObservableFrame.swift in Sources */ = {isa = PBXBuildFile; fileRef = F899FBD72E548D0F00653B5A /* View+ObservableFrame.swift */; };
F899FBDC2E54901100653B5A /* FeeInfoSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = F899FBDB2E54901100653B5A /* FeeInfoSheet.swift */; };
F8A536702F2379B400F69E64 /* NoActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8A5366F2F2379B400F69E64 /* NoActivity.swift */; };
F8BA7D232E1D75DE00BDBEF1 /* AppTabs.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BA7D222E1D75DE00BDBEF1 /* AppTabs.swift */; };
F8C065242E2A554D009BFC8F /* TransactionHistory.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C065232E2A554D009BFC8F /* TransactionHistory.swift */; };
F8C065382E2E7220009BFC8F /* Text+Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C065372E2E721B009BFC8F /* Text+Style.swift */; };
Expand Down Expand Up @@ -1155,6 +1156,7 @@
F899FBD52E548C9600653B5A /* View+AutoheightDetents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+AutoheightDetents.swift"; sourceTree = "<group>"; };
F899FBD72E548D0F00653B5A /* View+ObservableFrame.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+ObservableFrame.swift"; sourceTree = "<group>"; };
F899FBDB2E54901100653B5A /* FeeInfoSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeeInfoSheet.swift; sourceTree = "<group>"; };
F8A5366F2F2379B400F69E64 /* NoActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoActivity.swift; sourceTree = "<group>"; };
F8BA7D222E1D75DE00BDBEF1 /* AppTabs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppTabs.swift; sourceTree = "<group>"; };
F8C065232E2A554D009BFC8F /* TransactionHistory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionHistory.swift; sourceTree = "<group>"; };
F8C065372E2E721B009BFC8F /* Text+Style.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Text+Style.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2055,6 +2057,7 @@
F82150472E0D78F4003EBB25 /* TransactionItem.swift */,
F8C0653E2E37C3A5009BFC8F /* ConnectionStatus.swift */,
F82888A52EBCA4770085A103 /* SwapInProgressItem.swift */,
F8A5366F2F2379B400F69E64 /* NoActivity.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -3563,6 +3566,7 @@
3ACFA5EA2937532A00E1455A /* SplashViewConstructor.swift in Sources */,
3AB136D62906643700A5373D /* ICloudBackupService.swift in Sources */,
3A8473C428EC55B10015E63A /* TariTransactionsService.swift in Sources */,
F8A536702F2379B400F69E64 /* NoActivity.swift in Sources */,
71F94EC52DA32D0B00D3F2AC /* ReceiveView.swift in Sources */,
3A386F3727A7FC6C0027FED4 /* ErrorMessageManager.swift in Sources */,
3AE138C928044A1800443D34 /* PopUpComponentsFactory.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ final class TariTransactionsService: CoreTariService {
func transaction(id: UInt64) -> Transaction? {
all.first { (try? $0.identifier) == id }
}

func minedTari() -> UInt64 {
completed
.filter { (try? $0.isCoinbase) == true }
.compactMap { try? $0.amount }
.reduce(0, +)
}
}

extension TariTransactionsService {
Expand Down
12 changes: 1 addition & 11 deletions MobileWallet/Screens/Home/Home/Scenes/Home.swift
Original file line number Diff line number Diff line change
Expand Up @@ -324,22 +324,12 @@ private extension Home {
} else if isLoadingTransactions {
ProgressView()
} else {
noActivity
NoActivity()
}
}
.frame(maxWidth: .infinity)
}

var noActivity: some View {
VStack(spacing: 0) {
Text("You don’t have any activity yet.")
.headingLarge()
Text("Once you receive some tXTM, you’ll see it here.")
.body2()
}
.foregroundStyle(.primaryText)
}

var formattedBalance: String {
isBalanceHidden ? "*******" : "\(totalBalance)"
}
Expand Down
57 changes: 57 additions & 0 deletions MobileWallet/Screens/Home/Home/Views/NoActivity.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// NoActivity.swift

/*
Package MobileWallet
Created by Tomas Hakel on 23.01.2026
Using Swift 6.0
Running on macOS 26.2

Copyright 2019 The Tari Project

Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of
its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import SwiftUI

struct NoActivity: View {
var body: some View {
VStack(spacing: 0) {
Text("You don’t have any activity yet.")
.headingLarge()
Text("Once you receive some XTM, you’ll see it here.")
.body2()
Comment on lines +46 to +49
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The strings "You don’t have any activity yet." and "Once you receive some XTM, you’ll see it here." are hardcoded. For better maintainability and to support internationalization, these strings should be extracted into a localization file (e.g., Localizable.strings). SwiftUI's Text initializer can then use the localization keys directly.

Suggested change
Text("You don’t have any activity yet.")
.headingLarge()
Text("Once you receive some XTM, you’ll see it here.")
.body2()
Text("no_activity.title", comment: "Title for empty activity list")
.headingLarge()
Text("no_activity.subtitle.xtm", comment: "Subtitle for empty activity list")
.body2()

}
.foregroundStyle(.primaryText)
}
}

#Preview {
NoActivity()
}
2 changes: 2 additions & 0 deletions MobileWallet/Screens/Profile/NewProfileModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ final class NewProfileModel {
@Published private(set) var errorMessage: MessageModel?

@Published private(set) var state: State = .Initial

@Published private(set) var isAirdropSupported = false

// MARK: - Properties
private var cancellables = Set<AnyCancellable>()
Expand Down
185 changes: 114 additions & 71 deletions MobileWallet/Screens/Profile/NewProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ final class GaugeView: DynamicThemeView {
}

final class NewProfileView: DynamicThemeView {
public var isAirdropSupported = false

public var onLoginButtonTap: (() -> Void)? {
didSet {
Expand Down Expand Up @@ -418,6 +419,27 @@ final class NewProfileView: DynamicThemeView {
label.isHidden = true
return label
}()

@TariView private var noActivityView: UIStackView = {
let vstack = UIStackView()
vstack.axis = .vertical
vstack.alignment = .center
vstack.distribution = .fill
vstack.spacing = 0
vstack.translatesAutoresizingMaskIntoConstraints = false
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line is likely redundant. Other views in this file that are decorated with the @TariView property wrapper do not set translatesAutoresizingMaskIntoConstraints = false explicitly, which suggests that the property wrapper handles this configuration. To maintain consistency, please verify and remove this line.


let title = UILabel()
title.text = "You don’t have any activity yet."
title.font = .Poppins.SemiBold.withSize(16)
vstack.addArrangedSubview(title)

let subtitle = UILabel()
subtitle.text = "Once you receive some XTM, you’ll see it here."
subtitle.font = .Poppins.Medium.withSize(12)
vstack.addArrangedSubview(subtitle)
Comment on lines +430 to +438
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The text for the title and subtitle labels is hardcoded. To support internationalization and improve maintainability, these strings should be localized using NSLocalizedString. This also helps in keeping the text consistent with the SwiftUI NoActivity view by sharing localization keys.

Suggested change
let title = UILabel()
title.text = "You don’t have any activity yet."
title.font = .Poppins.SemiBold.withSize(16)
vstack.addArrangedSubview(title)
let subtitle = UILabel()
subtitle.text = "Once you receive some XTM, you’ll see it here."
subtitle.font = .Poppins.Medium.withSize(12)
vstack.addArrangedSubview(subtitle)
let title = UILabel()
title.text = NSLocalizedString("no_activity.title", comment: "Title for empty activity list")
title.font = .Poppins.SemiBold.withSize(16)
vstack.addArrangedSubview(title)
let subtitle = UILabel()
subtitle.text = NSLocalizedString("no_activity.subtitle.xtm", comment: "Subtitle for empty activity list")
subtitle.font = .Poppins.Medium.withSize(12)
vstack.addArrangedSubview(subtitle)


return vstack
}()

func setupViews() {
backgroundColor = .Background.secondary
Expand All @@ -433,76 +455,96 @@ final class NewProfileView: DynamicThemeView {
}

func setupConstraints() {

[containerView, loginView].forEach(addSubview)
[minedGaugeView, gemsGaugeView].forEach(gaugesContainerView.addSubview)
[usernameLabel, gaugesContainerView, inviteView, noInvitesView, logoutButton].forEach(containerView.addSubview)
[loginBanner, loginTitleLabel, loginDescriptionLabel, loginButton, loadingIndicator, loadingLabel].forEach(loginView.addSubview)

NSLayoutConstraint.activate([
containerView.topAnchor.constraint(equalTo: topAnchor),
containerView.centerXAnchor.constraint(equalTo: centerXAnchor),
containerView.widthAnchor.constraint(lessThanOrEqualToConstant: 400),
containerView.bottomAnchor.constraint(equalTo: bottomAnchor),

loginView.leadingAnchor.constraint(equalTo: leadingAnchor),
loginView.trailingAnchor.constraint(equalTo: trailingAnchor),
loginView.bottomAnchor.constraint(equalTo: bottomAnchor),
loginView.topAnchor.constraint(equalTo: topAnchor),

// loginBanner.topAnchor.constraint(equalTo: topAnchor, constant: 170),
loginBanner.widthAnchor.constraint(equalToConstant: 362),
loginBanner.heightAnchor.constraint(equalToConstant: 275),
loginBanner.centerXAnchor.constraint(equalTo: centerXAnchor),
loginBanner.bottomAnchor.constraint(equalTo: centerYAnchor, constant: 40),

loginTitleLabel.topAnchor.constraint(equalTo: loginBanner.bottomAnchor, constant: 25),
loginTitleLabel.leftAnchor.constraint(equalTo: loginBanner.leftAnchor),

loginDescriptionLabel.topAnchor.constraint(equalTo: loginTitleLabel.bottomAnchor, constant: 30),
loginDescriptionLabel.leftAnchor.constraint(equalTo: loginBanner.leftAnchor),
loginDescriptionLabel.rightAnchor.constraint(equalTo: loginBanner.rightAnchor),

loginButton.centerXAnchor.constraint(equalTo: loginView.centerXAnchor),
loginButton.widthAnchor.constraint(equalToConstant: 362),
loginButton.heightAnchor.constraint(equalToConstant: 50),
loginButton.bottomAnchor.constraint(equalTo: loginView.bottomAnchor, constant: -50),

// usernameLabel.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 124),
usernameLabel.centerXAnchor.constraint(equalTo: containerView.centerXAnchor),
usernameLabel.bottomAnchor.constraint(equalTo: gaugesContainerView.topAnchor, constant: -40),
gaugesContainerView.leftAnchor.constraint(equalTo: containerView.leftAnchor, constant: 21),
gaugesContainerView.rightAnchor.constraint(equalTo: containerView.rightAnchor, constant: -21),
gaugesContainerView.widthAnchor.constraint(lessThanOrEqualToConstant: 370),
minedGaugeView.topAnchor.constraint(equalTo: gaugesContainerView.topAnchor),
minedGaugeView.leadingAnchor.constraint(equalTo: gaugesContainerView.leadingAnchor),
minedGaugeView.bottomAnchor.constraint(equalTo: gaugesContainerView.bottomAnchor),
minedGaugeView.widthAnchor.constraint(equalToConstant: 164),
minedGaugeView.heightAnchor.constraint(equalToConstant: 120),
gemsGaugeView.topAnchor.constraint(equalTo: gaugesContainerView.topAnchor),
gemsGaugeView.rightAnchor.constraint(equalTo: gaugesContainerView.rightAnchor),
gemsGaugeView.widthAnchor.constraint(equalToConstant: 164),
gemsGaugeView.heightAnchor.constraint(equalToConstant: 120),

gaugesContainerView.bottomAnchor.constraint(equalTo: inviteView.topAnchor, constant: -30),
inviteView.topAnchor.constraint(equalTo: centerYAnchor, constant: -30),
inviteView.leftAnchor.constraint(equalTo: gaugesContainerView.leftAnchor),
inviteView.rightAnchor.constraint(equalTo: gaugesContainerView.rightAnchor),
inviteView.heightAnchor.constraint(equalToConstant: 220),
inviteView.widthAnchor.constraint(lessThanOrEqualToConstant: 370),

logoutButton.centerXAnchor.constraint(equalTo: containerView.centerXAnchor),
logoutButton.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: -50),
logoutButton.widthAnchor.constraint(equalToConstant: 362),
logoutButton.heightAnchor.constraint(equalToConstant: 50),

loadingIndicator.centerXAnchor.constraint(equalTo: loginView.centerXAnchor),
loadingIndicator.centerYAnchor.constraint(equalTo: loginView.centerYAnchor),

loadingLabel.topAnchor.constraint(equalTo: loadingIndicator.bottomAnchor, constant: 16),
loadingLabel.centerXAnchor.constraint(equalTo: loginView.centerXAnchor),
loadingLabel.widthAnchor.constraint(equalToConstant: 362)
])
if isAirdropSupported {
[containerView, loginView].forEach(addSubview)
[minedGaugeView, gemsGaugeView].forEach(gaugesContainerView.addSubview)
[usernameLabel, gaugesContainerView, inviteView, noInvitesView, logoutButton].forEach(containerView.addSubview)
[loginBanner, loginTitleLabel, loginDescriptionLabel, loginButton, loadingIndicator, loadingLabel].forEach(loginView.addSubview)

NSLayoutConstraint.activate([
containerView.topAnchor.constraint(equalTo: topAnchor),
containerView.centerXAnchor.constraint(equalTo: centerXAnchor),
containerView.widthAnchor.constraint(lessThanOrEqualToConstant: 400),
containerView.bottomAnchor.constraint(equalTo: bottomAnchor),

loginView.leadingAnchor.constraint(equalTo: leadingAnchor),
loginView.trailingAnchor.constraint(equalTo: trailingAnchor),
loginView.bottomAnchor.constraint(equalTo: bottomAnchor),
loginView.topAnchor.constraint(equalTo: topAnchor),

// loginBanner.topAnchor.constraint(equalTo: topAnchor, constant: 170),
loginBanner.widthAnchor.constraint(equalToConstant: 362),
loginBanner.heightAnchor.constraint(equalToConstant: 275),
loginBanner.centerXAnchor.constraint(equalTo: centerXAnchor),
loginBanner.bottomAnchor.constraint(equalTo: centerYAnchor, constant: 40),

loginTitleLabel.topAnchor.constraint(equalTo: loginBanner.bottomAnchor, constant: 25),
loginTitleLabel.leftAnchor.constraint(equalTo: loginBanner.leftAnchor),

loginDescriptionLabel.topAnchor.constraint(equalTo: loginTitleLabel.bottomAnchor, constant: 30),
loginDescriptionLabel.leftAnchor.constraint(equalTo: loginBanner.leftAnchor),
loginDescriptionLabel.rightAnchor.constraint(equalTo: loginBanner.rightAnchor),

loginButton.centerXAnchor.constraint(equalTo: loginView.centerXAnchor),
loginButton.widthAnchor.constraint(equalToConstant: 362),
loginButton.heightAnchor.constraint(equalToConstant: 50),
loginButton.bottomAnchor.constraint(equalTo: loginView.bottomAnchor, constant: -50),

// usernameLabel.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 124),
usernameLabel.centerXAnchor.constraint(equalTo: containerView.centerXAnchor),
usernameLabel.bottomAnchor.constraint(equalTo: gaugesContainerView.topAnchor, constant: -40),
gaugesContainerView.leftAnchor.constraint(equalTo: containerView.leftAnchor, constant: 21),
gaugesContainerView.rightAnchor.constraint(equalTo: containerView.rightAnchor, constant: -21),
gaugesContainerView.widthAnchor.constraint(lessThanOrEqualToConstant: 370),
minedGaugeView.topAnchor.constraint(equalTo: gaugesContainerView.topAnchor),
minedGaugeView.leadingAnchor.constraint(equalTo: gaugesContainerView.leadingAnchor),
minedGaugeView.bottomAnchor.constraint(equalTo: gaugesContainerView.bottomAnchor),
minedGaugeView.widthAnchor.constraint(equalToConstant: 164),
minedGaugeView.heightAnchor.constraint(equalToConstant: 120),
gemsGaugeView.topAnchor.constraint(equalTo: gaugesContainerView.topAnchor),
gemsGaugeView.rightAnchor.constraint(equalTo: gaugesContainerView.rightAnchor),
gemsGaugeView.widthAnchor.constraint(equalToConstant: 164),
gemsGaugeView.heightAnchor.constraint(equalToConstant: 120),

gaugesContainerView.bottomAnchor.constraint(equalTo: inviteView.topAnchor, constant: -30),
inviteView.topAnchor.constraint(equalTo: centerYAnchor, constant: -30),
inviteView.leftAnchor.constraint(equalTo: gaugesContainerView.leftAnchor),
inviteView.rightAnchor.constraint(equalTo: gaugesContainerView.rightAnchor),
inviteView.heightAnchor.constraint(equalToConstant: 220),
inviteView.widthAnchor.constraint(lessThanOrEqualToConstant: 370),

logoutButton.centerXAnchor.constraint(equalTo: containerView.centerXAnchor),
logoutButton.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: -50),
logoutButton.widthAnchor.constraint(equalToConstant: 362),
logoutButton.heightAnchor.constraint(equalToConstant: 50),

loadingIndicator.centerXAnchor.constraint(equalTo: loginView.centerXAnchor),
loadingIndicator.centerYAnchor.constraint(equalTo: loginView.centerYAnchor),

loadingLabel.topAnchor.constraint(equalTo: loadingIndicator.bottomAnchor, constant: 16),
loadingLabel.centerXAnchor.constraint(equalTo: loginView.centerXAnchor),
loadingLabel.widthAnchor.constraint(equalToConstant: 362)
])
} else {
[containerView].forEach(addSubview)
[noActivityView, minedGaugeView].forEach(containerView.addSubview)

NSLayoutConstraint.activate([
containerView.topAnchor.constraint(equalTo: topAnchor),
containerView.centerXAnchor.constraint(equalTo: centerXAnchor),
containerView.widthAnchor.constraint(lessThanOrEqualToConstant: 400),
containerView.bottomAnchor.constraint(equalTo: bottomAnchor),

minedGaugeView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 32),
minedGaugeView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
minedGaugeView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
minedGaugeView.heightAnchor.constraint(equalToConstant: 120),

noActivityView.topAnchor.constraint(equalTo: minedGaugeView.bottomAnchor, constant: 20),
noActivityView.leftAnchor.constraint(equalTo: containerView.leftAnchor),
noActivityView.rightAnchor.constraint(equalTo: containerView.rightAnchor),
])
}
}

override func update(theme: AppTheme) {
Expand All @@ -522,8 +564,9 @@ final class NewProfileView: DynamicThemeView {
invitedLabel.text = "Invited Friends " + "(0)"
}

func update(mined: String) {
func update(mined: String, value: UInt64) {
minedGaugeView.setAmount(amount: mined)
noActivityView.isHidden = value != 0
}

func showLoading() {
Expand Down
Loading