Skip to content

[trello.com/c/vawidi4o] Add UI for Secret Wallets and combine it with a new secret wallet service #715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 62 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
8a30c23
[trello.com/c/vawidi4o] Add UI for Secret Wallets and combine it with…
Lainaaa Mar 1, 2025
3703523
Merge branch 'develop'
Lainaaa Mar 6, 2025
615c1a3
[trello.com/c/vawidi4o] Code improvments. Add icons for the secret wa…
Lainaaa Mar 6, 2025
f544814
[trello.com/c/vawidi4o] Add localisations
Lainaaa Mar 6, 2025
799bd95
[trello.com/c/vawidi4o] Add secret wallet item to the menu items.
Lainaaa Mar 6, 2025
8603e31
[trello.com/c/vawidi4o] Change padding of wallet view controller titl…
Lainaaa Mar 6, 2025
837055d
[trello.com/c/vawidi4o] Update labels for secret wallet options in th…
Lainaaa Mar 7, 2025
c7e0284
[trello.com/c/vawidi4o] Change icon of secret wallet option in the menu
Lainaaa Mar 7, 2025
da92c60
[trello.com/c/vawidi4o] Change icon of secret wallet. Change caption …
Lainaaa Mar 13, 2025
a79e9b8
Merge branch 'develop' into trello.com/c/vawidi4o
Lainaaa Mar 13, 2025
ef9602b
[trello.com/c/vawidi4o] Remove unnecessary files
Lainaaa Mar 13, 2025
1c90f5a
[trello.com/c/vawidi4o] Setting secret wallet icon displaying.
Lainaaa Mar 14, 2025
f33ff89
Merge branch 'develop'
Lainaaa Mar 14, 2025
a4d95c1
[trello.com/c/vawidi4o] Remove secret wallets storing in KVS
Lainaaa Mar 14, 2025
aa0c2e3
[trello.com/c/MItbYG4c] Update PK generation for Secret wallets
Lainaaa Mar 14, 2025
fa2a825
Merge branch 'develop'
Lainaaa Mar 17, 2025
efc02d3
[trello.com/c/vawidi4o] Remove secret wallets storing in KVS
Lainaaa Mar 14, 2025
a88f45e
[trello.com/c/vawidi4o] Setting secret wallet icon and its badge disp…
Lainaaa Mar 17, 2025
c1c549e
[trello.com/c/vawidi4o] Fix a walletViewControllerBase view bug
Lainaaa Mar 17, 2025
c241018
[trello.com/c/hzqPFC5l] Update "Send Crypto" screen to use with secre…
Lainaaa Mar 17, 2025
a4fac39
[trello.com/c/vawidi4o] Self review/Refactoring
Lainaaa Mar 18, 2025
0ae6d61
[trello.com/c/vawidi4o] Update "Tell me more" button on a secret wall…
Lainaaa Mar 19, 2025
7aa750a
Merge branch 'develop' into trello.com/c/vawidi4o
Lainaaa Mar 20, 2025
82ca18b
Merge branch 'develop'
Lainaaa Mar 24, 2025
bd8cf28
[trello.com/c/vawidi4o] Localisation update
Lainaaa Mar 24, 2025
6efd38a
[trello.com/c/vawidi4o] A little refactoring of secret wallets factor…
Lainaaa Mar 24, 2025
fd834ea
Merge branch 'develop' into trello.com/c/vawidi4o
Lainaaa Mar 24, 2025
ae0a2e3
[trello.com/c/vawidi4o] Improvments after merging
Lainaaa Mar 25, 2025
7b46536
[trello.com/c/Aw0Vfnmd] {Secret wallets} UI: Show Transactions 🔐 1️⃣
Lainaaa Mar 19, 2025
c87b13d
[trello.com/c/Aw0Vfnmd] Handle case when user sends money from regula…
Lainaaa Mar 21, 2025
2472613
[trello.com/c/Aw0Vfnmd] Code review improvments.
Lainaaa Mar 26, 2025
b09d1fb
[trello.com/c/YsjIF3DY] (Secret wallets) Handle logout/login case
Lainaaa Mar 26, 2025
04fbcbb
[trello.com/c/YsjIF3DY] Code improvments
Lainaaa Mar 27, 2025
bda5013
Merge branch 'develop'
Lainaaa Mar 28, 2025
7e531f4
[trello.com/c/vawidi4o] Fix `storeInKVS` typo
Lainaaa Mar 28, 2025
8def2c7
[trello.com/c/vawidi4o] Replace lock mechanizm with @Atomic property …
Lainaaa Mar 31, 2025
eb33115
Merge branch 'develop'
Lainaaa Mar 31, 2025
384324e
Merge branch 'trello.com/c/vawidi4o'
Lainaaa Mar 31, 2025
3faeedc
Merge branch 'trello.com/c/vawidi4o'
Lainaaa Mar 31, 2025
dd7718e
Merge branch 'trello.com/c/vawidi4o'
Lainaaa Mar 31, 2025
e8a05ff
[trello.com/c/YsjIF3DY] Update after merge
Lainaaa Mar 31, 2025
2ce09c6
[trello.com/c/vawidi4o] Code review fix
Lainaaa Mar 31, 2025
7b96f7e
[trello.com/c/vawidi4o] Atoimc in secretWalletsManager improvments
Lainaaa Mar 31, 2025
9dd0bc0
[trello.com/c/vawidi4o] Update NSLayoutConstraint to SnapKit in accou…
Lainaaa Apr 1, 2025
7ce5fe3
Merge branch 'develop'
Lainaaa Apr 1, 2025
1155e52
Merge branch 'trello.com/c/vawidi4o'
Lainaaa Apr 1, 2025
9bc42f2
Merge branch 'trello.com/c/vawidi4o'
Lainaaa Apr 1, 2025
7f2db6f
Merge branch 'trello.com/c/vawidi4o'
Lainaaa Apr 1, 2025
0e3bc69
Merge pull request #759 from Adamant-im/trello.com/c/YsjIF3DY
Lainaaa Apr 3, 2025
db7551d
Merge pull request #741 from Adamant-im/trello.com/c/Aw0Vfnmd
Lainaaa Apr 3, 2025
995ad77
Merge pull request #733 from Adamant-im/trello.com/c/hzqPFC5l
Lainaaa Apr 3, 2025
f143a45
Merge branch 'develop' into trello.com/c/vawidi4o
Lainaaa Apr 7, 2025
a4c8ac8
[trello.com/c/1SZ08BQ6] Add appropriate naming related to secret wallets
Lainaaa Apr 8, 2025
0c47621
[trello.com/c/1SZ08BQ6] Handle right coins names
Lainaaa Apr 8, 2025
e03d451
Merge branch 'develop' into trello.com/c/vawidi4o
Lainaaa Apr 9, 2025
774189c
[trello.com/c/ONt29HWW] Save the index of the current selected crypto…
Lainaaa Apr 10, 2025
64e17f7
[trello.com/c/1SZ08BQ6] Fix typo
Lainaaa Apr 10, 2025
cc499aa
Merge pull request #791 from Adamant-im/trello.com/c/1SZ08BQ6
Lainaaa Apr 10, 2025
8bac0d3
Merge branch 'develop' into trello.com/c/vawidi4o
Lainaaa Apr 10, 2025
2c210b2
Merge pull request #793 from Adamant-im/trello.com/c/ONt29HWW
art-divin Apr 12, 2025
d186f45
Merge branch 'develop' into trello.com/c/vawidi4o
Lainaaa Apr 24, 2025
67ed02c
Merge branch 'develop' into trello.com/c/vawidi4o
Lainaaa Apr 29, 2025
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
3 changes: 2 additions & 1 deletion Adamant/Adamant.xcdatamodeld/Adamant.xcdatamodel/contents
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="23605" systemVersion="24D81" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="23605" systemVersion="24D70" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="BaseAccount" representedClassName="BaseAccount" isAbstract="YES" syncable="YES">
<attribute name="address" attributeType="String"/>
<attribute name="avatar" optional="YES" attributeType="String"/>
Expand Down Expand Up @@ -53,6 +53,7 @@
<attribute name="timestampMs" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="transactionId" attributeType="String" defaultValueString=""/>
<attribute name="transactionStatusRaw" attributeType="String" defaultValueString=""/>
<attribute name="uniqueId" optional="YES" attributeType="String"/>
<uniquenessConstraints>
<uniquenessConstraint>
<constraint value="transactionId"/>
Expand Down
15 changes: 13 additions & 2 deletions Adamant/App/DI/AppAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct AppAssembly: MainThreadAssembly {
SecretWalletsFactory(
visibleWalletsService: r.resolve(VisibleWalletsService.self)!,
accountService: r.resolve(AccountService.self)!,
SecureStore: r.resolve(SecureStore.self)!
container: container
)
}.inObjectScope(.container)

Expand All @@ -116,7 +116,18 @@ struct AppAssembly: MainThreadAssembly {
secretWalletsManager: r.resolve(SecretWalletsManagerProtocol.self)!
)
}.inObjectScope(.container)


container.register(SecretWalletsViewModel.self) { r in
SecretWalletsViewModel(secretWalletsManager: r.resolve(SecretWalletsManagerProtocol.self)!)
}.inObjectScope(.container)

container.register(SecretWalletsAlertMenuView.self) { r in
SecretWalletsAlertMenuView(
dialogService: r.resolve(DialogService.self)!,
secretWalletsViewModel: r.resolve(SecretWalletsViewModel.self)!
)
}.inObjectScope(.transient)

// MARK: IncreaseFeeService
container.register(IncreaseFeeService.self) { r in
AdamantIncreaseFeeService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extension CoinTransaction {
@NSManaged public var amount: NSDecimalNumber?
@NSManaged public var transactionId: String
@NSManaged public var coinId: String?
@NSManaged public var uniqueId: String?
@NSManaged public var senderId: String?
@NSManaged public var recipientId: String?
@NSManaged public var date: NSDate?
Expand Down
4 changes: 3 additions & 1 deletion Adamant/Modules/Account/AccountFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ struct AccountFactory {
languageService: assembler.resolve(LanguageStorageProtocol.self)!,
walletServiceCompose: assembler.resolve(WalletServiceCompose.self)!,
apiServiceCompose: assembler.resolve(ApiServiceComposeProtocol.self)!,
visibleWalletsService: assembler.resolve(VisibleWalletsService.self)!
visibleWalletsService: assembler.resolve(VisibleWalletsService.self)!,
secretWalletsAlertService: assembler.resolve(SecretWalletsAlertMenuView.self)!,
secretWalletsViewModel: assembler.resolve(SecretWalletsViewModel.self)!
)
}
}
21 changes: 16 additions & 5 deletions Adamant/Modules/Account/AccountHeader.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="dark"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
Expand Down Expand Up @@ -53,13 +53,22 @@
<rect key="frame" x="0.0" y="184" width="378" height="231"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="secret_wallets_regular" translatesAutoresizingMaskIntoConstraints="NO" id="Man-rA-gFA">
<rect key="frame" x="271.5" y="45" width="35" height="35"/>
<constraints>
<constraint firstAttribute="width" constant="35" id="45y-Er-QMf"/>
<constraint firstAttribute="height" constant="35" id="YhE-0q-neO"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="LHk-7R-5oq" firstAttribute="top" secondItem="6hF-gW-1fF" secondAttribute="bottom" constant="28" id="0d9-Ro-csQ"/>
<constraint firstItem="Man-rA-gFA" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="45" id="4Gw-op-P7G"/>
<constraint firstAttribute="bottom" secondItem="LHk-7R-5oq" secondAttribute="bottom" id="5u8-dI-fD1"/>
<constraint firstItem="6hF-gW-1fF" firstAttribute="top" secondItem="IVQ-4p-zci" secondAttribute="bottom" constant="13" id="EN0-a5-cHs"/>
<constraint firstAttribute="trailing" secondItem="LHk-7R-5oq" secondAttribute="trailing" id="FJv-73-Ayr"/>
<constraint firstItem="Man-rA-gFA" firstAttribute="leading" secondItem="IVQ-4p-zci" secondAttribute="trailing" constant="45" id="Uol-2s-20a"/>
<constraint firstItem="IVQ-4p-zci" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="25" id="Z7D-Q0-s2x"/>
<constraint firstItem="LHk-7R-5oq" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="eip-WC-PKw"/>
<constraint firstItem="6hF-gW-1fF" firstAttribute="centerX" secondItem="IVQ-4p-zci" secondAttribute="centerX" id="gMH-Q7-bMw"/>
Expand All @@ -69,13 +78,15 @@
<connections>
<outlet property="addressButton" destination="Iro-jA-X5P" id="u6V-wQ-5UR"/>
<outlet property="avatarImageView" destination="IVQ-4p-zci" id="FoL-e1-OKu"/>
<outlet property="secretWalletsImageView" destination="Man-rA-gFA" id="pbA-HV-NNe"/>
<outlet property="walletViewContainer" destination="LHk-7R-5oq" id="u0m-up-Zyy"/>
</connections>
<point key="canvasLocation" x="35" y="-95.5"/>
<point key="canvasLocation" x="33.600000000000001" y="-95.802098950524751"/>
</view>
</objects>
<resources>
<image name="avatar_placeholder" width="75" height="75"/>
<image name="square.and.arrow.up" catalog="system" width="115" height="128"/>
<image name="secret_wallets_regular" width="55.5" height="55.5"/>
<image name="square.and.arrow.up" catalog="system" width="110" height="128"/>
</resources>
</document>
130 changes: 128 additions & 2 deletions Adamant/Modules/Account/AccountHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import UIKit
@MainActor
protocol AccountHeaderViewDelegate: AnyObject {
func addressLabelTapped(from: UIView)
func walletsButtonTapped(from: UIView)
}

final class AccountHeaderView: UIView {
Expand All @@ -19,10 +20,135 @@ final class AccountHeaderView: UIView {
@IBOutlet weak var avatarImageView: UIImageView!
@IBOutlet weak var addressButton: UIButton!
@IBOutlet weak var walletViewContainer: UIView!

@IBOutlet weak var secretWalletsImageView: UIImageView!

private var circularBackgroundView: UIView?

weak var delegate: AccountHeaderViewDelegate?


override func awakeFromNib() {
super.awakeFromNib()

setWalletIcon(.regular, badgeCount: 0)
addPersistentOutline()

setupGestureRecognizers()
}

@IBAction func addressButtonTapped(_ sender: UIButton) {
delegate?.addressLabelTapped(from: sender)
}

@objc private func walletsButtonTapped() {
animateOutline()
delegate?.walletsButtonTapped(from: secretWalletsImageView)
}

override func layoutSubviews() {
super.layoutSubviews()
guard let bgView = circularBackgroundView else { return }

let iconFrame = secretWalletsImageView.frame
let bgWidth = iconFrame.width * 2
let bgHeight = iconFrame.height * 2
bgView.frame = CGRect(x: iconFrame.midX - bgWidth / 2,
y: iconFrame.midY - bgHeight / 2,
width: bgWidth,
height: bgHeight)
bgView.layer.cornerRadius = bgWidth / 2
}
}

extension AccountHeaderView {
func setWalletIcon(_ icon: WalletIcon, badgeCount: Int) {
secretWalletsImageView.tintColor = .adamant.secondary
secretWalletsImageView.image = .asset(named: icon.rawValue)?.withRenderingMode(.alwaysTemplate) ?? .init()
updateWalletBadge(count: badgeCount)
}
}

private extension AccountHeaderView {
func setupGestureRecognizers() {
secretWalletsImageView.isUserInteractionEnabled = true
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(walletsButtonTapped))
secretWalletsImageView.addGestureRecognizer(tapGesture)

guard self.circularBackgroundView != nil else { return }
circularBackgroundView!.isUserInteractionEnabled = true
let bgTapGesture = UITapGestureRecognizer(target: self, action: #selector(walletsButtonTapped))
circularBackgroundView!.addGestureRecognizer(bgTapGesture)
}

func updateWalletBadge(count: Int) {
guard let bgView = circularBackgroundView else { return }

bgView.viewWithTag(99)?.removeFromSuperview()

guard count > 0 else { return }

let badgeLabel = UILabel()
badgeLabel.tag = 99
badgeLabel.text = "\(count)"
badgeLabel.font = .systemFont(ofSize: 14, weight: .medium)
badgeLabel.textAlignment = .center
badgeLabel.textColor = UIColor { traitCollection in
return traitCollection.userInterfaceStyle == .light ? .white : .black
}
badgeLabel.backgroundColor = .adamant.secondary

let badgeSize: CGFloat = 24
badgeLabel.layer.cornerRadius = badgeSize / 2
badgeLabel.layer.masksToBounds = true

badgeLabel.translatesAutoresizingMaskIntoConstraints = false
bgView.addSubview(badgeLabel)

badgeLabel.snp.makeConstraints { make in
make.width.height.equalTo(badgeSize)
make.trailing.equalTo(bgView.snp.trailing)
make.bottom.equalTo(bgView.snp.bottom)
}
}

func addPersistentOutline() {
let bgView = UIView()
bgView.backgroundColor = UIColor { traitCollection in
return traitCollection.userInterfaceStyle == .light
? .adamant.secondBackgroundColor
: .adamant.background
}

secretWalletsImageView.superview?.insertSubview(bgView, belowSubview: secretWalletsImageView)
self.circularBackgroundView = bgView
}

func animateOutline() {
guard let bgView = circularBackgroundView else { return }

let originalColor = bgView.backgroundColor
let highlightColor = UIColor.systemGray5

UIView.animate(withDuration: 0.1, animations: {
bgView.backgroundColor = highlightColor
bgView.transform = CGAffineTransform(scaleX: 0.8, y: 0.8)
self.secretWalletsImageView.transform = CGAffineTransform(scaleX: 0.8, y: 0.8)
}, completion: { _ in
UIView.animate(withDuration: 0.1, animations: {
bgView.backgroundColor = originalColor
bgView.transform = .identity
self.secretWalletsImageView.transform = .identity
})
})
}
}

extension AccountHeaderView {
enum WalletIcon: String {
case regular = "secret_wallets_regular"
case secret = "secret_wallets_active"

func image() -> UIImage? {
return UIImage(named: self.rawValue)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ extension AccountViewController {
}

enum Rows {
case balance, sendTokens // Wallet
case security, nodes, coinsNodes, theme, currency, language, about, visibleWallets, contribute, storage // Application
case voteForDelegates, generateQr, generatePk, logout // Actions
case stayIn, biometry, notifications // Security

case balance, sendTokens // Wallet
case security, nodes, coinsNodes, theme, currency, language, about, visibleWallets, secretWallets, contribute, storage // Application
case voteForDelegates, generateQr, generatePk, logout // Actions
case stayIn, biometry, notifications // Security
var tag: String {
switch self {
case .balance: return "blnc"
Expand All @@ -57,6 +57,7 @@ extension AccountViewController {
case .biometry: return "biometry"
case .notifications: return "notifications"
case .visibleWallets: return "visibleWallets"
case .secretWallets: return "secretWallets"
case .contribute: return "contribute"
case .coinsNodes: return "coinsNodes"
case .language: return "language"
Expand All @@ -81,6 +82,7 @@ extension AccountViewController {
case .biometry: return SecurityViewController.Rows.biometry.localized
case .notifications: return SecurityViewController.Rows.notificationsMode.localized
case .visibleWallets: return .localized("VisibleWallets.Title", comment: "Visible Wallets page: scene title")
case .secretWallets: return .localized("SecretWallets.Row.Title", comment: "Secret wallets page: row title")
case .contribute: return .localized("AccountTab.Row.Contribute", comment: "Account tab: 'Contribute' row")
case .coinsNodes: return .adamant.coinsNodesList.title
case .language: return .localized("AccountTab.Row.Language", comment: "Account tab: 'Language' row")
Expand All @@ -107,6 +109,7 @@ extension AccountViewController {
case .biometry: image = nil // Determined by localAuth service
case .notifications: image = .asset(named: "row_Notifications.png")
case .visibleWallets: image = .asset(named: "row_balance")
case .secretWallets: image = .asset(named: "secret_wallets_active")
case .contribute: image = .asset(named: "row_contribute")
case .language: image = .asset(named: "row_language")
case .storage: image = .asset(named: "row_storage")
Expand Down
Loading