Skip to content

Commit 799bd95

Browse files
committed
[trello.com/c/vawidi4o] Add secret wallet item to the menu items.
1 parent f544814 commit 799bd95

File tree

7 files changed

+31
-3
lines changed

7 files changed

+31
-3
lines changed

Adamant/Modules/Account/AccountViewController/AccountViewController+Form.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extension AccountViewController {
3636

3737
enum Rows {
3838
case balance, sendTokens // Wallet
39-
case security, nodes, coinsNodes, theme, currency, language, about, visibleWallets, contribute, storage // Application
39+
case security, nodes, coinsNodes, theme, currency, language, about, visibleWallets, secretWallets, contribute, storage // Application
4040
case voteForDelegates, generateQr, generatePk, logout // Actions
4141
case stayIn, biometry, notifications // Security
4242

@@ -57,6 +57,7 @@ extension AccountViewController {
5757
case .biometry: return "biometry"
5858
case .notifications: return "notifications"
5959
case .visibleWallets: return "visibleWallets"
60+
case .secretWallets: return "secretWallets"
6061
case .contribute: return "contribute"
6162
case .coinsNodes: return "coinsNodes"
6263
case .language: return "language"
@@ -81,6 +82,7 @@ extension AccountViewController {
8182
case .biometry: return SecurityViewController.Rows.biometry.localized
8283
case .notifications: return SecurityViewController.Rows.notificationsMode.localized
8384
case .visibleWallets: return .localized("VisibleWallets.Title", comment: "Visible Wallets page: scene title")
85+
case .secretWallets: return .localized("SecretWallets.Row.Title", comment: "Secret wallets page: row title")
8486
case .contribute: return .localized("AccountTab.Row.Contribute", comment: "Account tab: 'Contribute' row")
8587
case .coinsNodes: return .adamant.coinsNodesList.title
8688
case .language: return .localized("AccountTab.Row.Language", comment: "Account tab: 'Language' row")
@@ -107,6 +109,7 @@ extension AccountViewController {
107109
case .biometry: image = nil // Determined by localAuth service
108110
case .notifications: image = .asset(named: "row_Notifications.png")
109111
case .visibleWallets: image = .asset(named: "row_balance")
112+
case .secretWallets: image = .asset(named: "row_security")
110113
case .contribute: image = .asset(named: "row_contribute")
111114
case .language: image = .asset(named: "row_language")
112115
case .storage: image = .asset(named: "row_storage")

Adamant/Modules/Account/AccountViewController/AccountViewController.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,23 @@ final class AccountViewController: FormViewController {
255255

256256
appSection.append(visibleWalletsRow)
257257

258+
// Secret Wallets
259+
let secretWalletsRow = LabelRow {
260+
$0.tag = Rows.secretWallets.tag
261+
$0.title = Rows.secretWallets.localized
262+
$0.cell.imageView?.image = Rows.secretWallets.image
263+
$0.cell.selectionStyle = .gray
264+
}.cellUpdate { (cell, row) in
265+
cell.accessoryType = .disclosureIndicator
266+
row.title = Rows.secretWallets.localized
267+
}.onCellSelection { [weak self] (cell, _) in
268+
guard let self = self else { return }
269+
self.secretWalletsAlertService.presentSecretWalletsActionSheet(from: cell)
270+
}
271+
272+
// Добавление строки в секцию
273+
appSection.append(secretWalletsRow)
274+
258275
// Node list
259276
let nodesRow = LabelRow {
260277
$0.title = Rows.nodes.localized

Adamant/Modules/SecretWallets/SecretWalletsAlertService.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ final class SecretWalletsAlertService {
2727

2828
for (index, wallet) in state.wallets.enumerated() {
2929
let isSelected = (index == state.currentActiveIndex)
30-
let suffix = isSelected ? "" : ""
30+
var walletName = wallet.name
31+
if isSelected {
32+
walletName.insert("[", at: walletName.index(walletName.startIndex, offsetBy: 0))
33+
walletName.insert("]", at: walletName.index(walletName.startIndex, offsetBy: index == 0 ? 2 : 3))
34+
}
3135

3236
let action = AdamantAlertAction(
33-
title: wallet.name + suffix,
37+
title: walletName,
3438
style: .default
3539
) { [weak self] in
3640
self?.secretWalletsViewModel.pickWallet(at: index)

CommonKit/Sources/CommonKit/Assets/Localization/de.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,3 +1396,4 @@
13961396
"SecretWallets.Menu.AddSecretWallet" = "Geheimen hinzufügen";
13971397
"SecretWallets.Menu.TellMeMore" = "Über Wallets";
13981398
"SecretWallets.Menu.Title" = "Aktive Wallets";
1399+
"SecretWallets.Row.Title" = "Geheime Geldbörsen";

CommonKit/Sources/CommonKit/Assets/Localization/en.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,3 +1372,4 @@
13721372
"SecretWallets.Menu.AddSecretWallet" = "🪄 Add secret wallet";
13731373
"SecretWallets.Menu.TellMeMore" = "💡 Tell me more";
13741374
"SecretWallets.Menu.Title" = "Active wallets";
1375+
"SecretWallets.Row.Title" = "Secret wallets";

CommonKit/Sources/CommonKit/Assets/Localization/ru.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,3 +1373,4 @@
13731373
"SecretWallets.Menu.AddSecretWallet" = "Добавить секретный";
13741374
"SecretWallets.Menu.TellMeMore" = "О кошельках";
13751375
"SecretWallets.Menu.Title" = "Активные кошельки";
1376+
"SecretWallets.Row.Title" = "Секретные кошельки";

CommonKit/Sources/CommonKit/Assets/Localization/zh.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,3 +1363,4 @@
13631363
"SecretWallets.Menu.AddSecretWallet" = "添加秘密";
13641364
"SecretWallets.Menu.TellMeMore" = "关于钱包";
13651365
"SecretWallets.Menu.Title" = "活动钱包";
1366+
"SecretWallets.Row.Title" = "秘密钱包";

0 commit comments

Comments
 (0)