wallet: accounts selection, fix config access from different threads
This commit is contained in:
@@ -145,7 +145,7 @@ impl WalletsContent {
|
||||
let list = self.wallets.mut_list();
|
||||
for wallet in list {
|
||||
// Show content for selected wallet.
|
||||
if selected_id == Some(wallet.config.id) {
|
||||
if selected_id == Some(wallet.get_config().id) {
|
||||
// Setup wallet content width.
|
||||
let mut rect = ui.available_rect_before_wrap();
|
||||
let mut width = ui.available_width();
|
||||
@@ -345,7 +345,7 @@ impl WalletsContent {
|
||||
// Check if wallet reopen is needed.
|
||||
if !wallet.is_open() && wallet.reopen_needed() {
|
||||
wallet.set_reopen(false);
|
||||
self.wallets.select(Some(wallet.config.id));
|
||||
self.wallets.select(Some(wallet.get_config().id));
|
||||
self.show_open_wallet_modal(cb);
|
||||
}
|
||||
|
||||
@@ -371,7 +371,8 @@ impl WalletsContent {
|
||||
ui: &mut egui::Ui,
|
||||
wallet: &Wallet,
|
||||
cb: &dyn PlatformCallbacks) {
|
||||
let id = wallet.config.id;
|
||||
let config = wallet.get_config();
|
||||
let id = config.id;
|
||||
let is_selected = self.wallets.selected_id == Some(id);
|
||||
let is_current = wallet.is_open() && is_selected;
|
||||
|
||||
@@ -422,7 +423,7 @@ impl WalletsContent {
|
||||
ui.add_space(3.0);
|
||||
// Setup wallet name text.
|
||||
let name_color = if is_selected { Colors::BLACK } else { Colors::TITLE };
|
||||
View::ellipsize_text(ui, wallet.config.name.to_owned(), 18.0, name_color);
|
||||
View::ellipsize_text(ui, config.name, 18.0, name_color);
|
||||
|
||||
// Setup wallet connection text.
|
||||
let conn_text = if let Some(id) = wallet.get_current_ext_conn_id() {
|
||||
|
||||
@@ -75,17 +75,18 @@ impl CommonSetup {
|
||||
self.modal_content_ui(ui, wallet, cb);
|
||||
|
||||
ui.vertical_centered(|ui| {
|
||||
let wallet_name = wallet.get_config().name;
|
||||
// Show wallet name.
|
||||
ui.add_space(2.0);
|
||||
ui.label(RichText::new(t!("wallets.name")).size(16.0).color(Colors::GRAY));
|
||||
ui.add_space(2.0);
|
||||
ui.label(RichText::new(wallet.config.name.clone()).size(16.0).color(Colors::BLACK));
|
||||
ui.label(RichText::new(wallet_name.clone()).size(16.0).color(Colors::BLACK));
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Show wallet name setup.
|
||||
let name_text = format!("{} {}", PENCIL, t!("change"));
|
||||
View::button(ui, name_text, Colors::BUTTON, || {
|
||||
self.name_edit = wallet.config.name.clone();
|
||||
self.name_edit = wallet_name;
|
||||
// Show wallet name modal.
|
||||
Modal::new(NAME_EDIT_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
@@ -125,9 +126,10 @@ impl CommonSetup {
|
||||
ui.add_space(6.0);
|
||||
|
||||
// Show minimum amount of confirmations value setup.
|
||||
let min_conf_text = format!("{} {}", CLOCK_COUNTDOWN, wallet.config.min_confirmations);
|
||||
let min_confirmations = wallet.get_config().min_confirmations;
|
||||
let min_conf_text = format!("{} {}", CLOCK_COUNTDOWN, min_confirmations);
|
||||
View::button(ui, min_conf_text, Colors::BUTTON, || {
|
||||
self.min_confirmations_edit = wallet.config.min_confirmations.to_string();
|
||||
self.min_confirmations_edit = min_confirmations.to_string();
|
||||
// Show minimum amount of confirmations value modal.
|
||||
Modal::new(MIN_CONFIRMATIONS_EDIT_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
@@ -187,7 +189,7 @@ impl CommonSetup {
|
||||
|
||||
// Draw wallet name edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.name_edit)
|
||||
.id(Id::from(modal.id).with(wallet.config.id))
|
||||
.id(Id::from(modal.id).with(wallet.get_config().id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(ui.available_width())
|
||||
.cursor_at_end(true)
|
||||
@@ -216,8 +218,7 @@ impl CommonSetup {
|
||||
// Save button callback.
|
||||
let mut on_save = || {
|
||||
if !self.name_edit.is_empty() {
|
||||
wallet.config.name = self.name_edit.clone();
|
||||
wallet.config.save();
|
||||
wallet.change_name(self.name_edit.clone());
|
||||
cb.hide_keyboard();
|
||||
modal.close();
|
||||
}
|
||||
@@ -240,6 +241,8 @@ impl CommonSetup {
|
||||
wallet: &mut Wallet,
|
||||
modal: &Modal,
|
||||
cb: &dyn PlatformCallbacks) {
|
||||
let wallet_id = wallet.get_config().id;
|
||||
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("wallets.current_pass"))
|
||||
@@ -260,7 +263,7 @@ impl CommonSetup {
|
||||
ui.allocate_ui_with_layout(layout_size, Layout::left_to_right(Align::Center), |ui| {
|
||||
// Draw current wallet password text edit.
|
||||
let old_pass_resp = egui::TextEdit::singleline(&mut self.current_pass_edit)
|
||||
.id(Id::from(modal.id).with(wallet.config.id).with("old_pass"))
|
||||
.id(Id::from(modal.id).with(wallet_id).with("old_pass"))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(ui.available_width())
|
||||
.cursor_at_end(true)
|
||||
@@ -297,7 +300,7 @@ impl CommonSetup {
|
||||
ui.allocate_ui_with_layout(layout_size, Layout::left_to_right(Align::Center), |ui| {
|
||||
// Draw new wallet password text edit.
|
||||
let new_pass_resp = egui::TextEdit::singleline(&mut self.new_pass_edit)
|
||||
.id(Id::from(modal.id).with(wallet.config.id).with("new_pass"))
|
||||
.id(Id::from(modal.id).with(wallet_id).with("new_pass"))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(ui.available_width())
|
||||
.cursor_at_end(true)
|
||||
@@ -426,7 +429,7 @@ impl CommonSetup {
|
||||
// Save button callback.
|
||||
let mut on_save = || {
|
||||
if let Ok(min_conf) = self.min_confirmations_edit.parse::<u64>() {
|
||||
wallet.config.min_confirmations = min_conf;
|
||||
wallet.update_min_confirmations(min_conf);
|
||||
cb.hide_keyboard();
|
||||
modal.close();
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ impl ConnectionSetup {
|
||||
}
|
||||
|
||||
// Setup connection value from provided wallet.
|
||||
match wallet.config.ext_conn_id {
|
||||
match wallet.get_config().ext_conn_id {
|
||||
None => self.method = ConnectionMethod::Integrated,
|
||||
Some(id) => self.method = ConnectionMethod::External(id)
|
||||
}
|
||||
@@ -112,25 +112,25 @@ impl ConnectionSetup {
|
||||
self.ui(ui, frame, cb);
|
||||
|
||||
// Setup wallet connection value after change.
|
||||
let config = wallet.get_config();
|
||||
let changed = match self.method {
|
||||
ConnectionMethod::Integrated => {
|
||||
let changed = wallet.config.ext_conn_id.is_some();
|
||||
let changed = config.ext_conn_id.is_some();
|
||||
if changed {
|
||||
wallet.config.ext_conn_id = None;
|
||||
wallet.update_ext_conn_id(None);
|
||||
}
|
||||
changed
|
||||
}
|
||||
ConnectionMethod::External(id) => {
|
||||
let changed = wallet.config.ext_conn_id != Some(id);
|
||||
let changed = config.ext_conn_id != Some(id);
|
||||
if changed {
|
||||
wallet.config.ext_conn_id = Some(id);
|
||||
wallet.update_ext_conn_id(Some(id));
|
||||
}
|
||||
changed
|
||||
}
|
||||
};
|
||||
|
||||
if changed {
|
||||
wallet.config.save();
|
||||
// Show reopen confirmation modal.
|
||||
Modal::new(REOPEN_WALLET_CONFIRMATION_MODAL)
|
||||
.position(ModalPosition::Center)
|
||||
|
||||
@@ -204,7 +204,7 @@ impl RecoverySetup {
|
||||
ui.allocate_ui_with_layout(layout_size, Layout::left_to_right(Align::Center), |ui| {
|
||||
// Draw current wallet password text edit.
|
||||
let pass_resp = egui::TextEdit::singleline(&mut self.pass_edit)
|
||||
.id(Id::from(modal.id).with(wallet.config.id).with("recovery_phrase"))
|
||||
.id(Id::from(modal.id).with(wallet.get_config().id).with("recovery_phrase"))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(ui.available_width())
|
||||
.cursor_at_end(true)
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use egui::{Align, Id, Layout, Margin, RichText, Rounding, TextStyle, Widget};
|
||||
use egui::{Align, Id, Layout, Margin, RichText, Rounding, ScrollArea, TextStyle, Widget};
|
||||
use grin_chain::SyncStatus;
|
||||
use grin_core::core::amount_to_hr_string;
|
||||
|
||||
use crate::AppConfig;
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{DOWNLOAD, FILE_ARCHIVE, GEAR_FINE, LIST, PACKAGE, PLUS, POWER, REPEAT, UPLOAD, WALLET};
|
||||
use crate::gui::icons::{CHECK, CHECK_FAT, CREDIT_CARD, DOWNLOAD, FILE_ARCHIVE, GEAR_FINE, LIST, PACKAGE, PLUS, POWER, REPEAT, UPLOAD, WALLET};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, Root, View};
|
||||
use crate::gui::views::types::ModalPosition;
|
||||
@@ -28,14 +28,17 @@ use crate::gui::views::wallets::{WalletInfo, WalletReceive, WalletSend, WalletSe
|
||||
use crate::gui::views::wallets::types::{WalletTab, WalletTabType};
|
||||
use crate::node::Node;
|
||||
use crate::wallet::{Wallet, WalletConfig};
|
||||
use crate::wallet::types::WalletData;
|
||||
use crate::wallet::types::{GRIN, WalletAccount, WalletData};
|
||||
|
||||
/// Selected and opened wallet content.
|
||||
pub struct WalletContent {
|
||||
/// List of wallet accounts for [`Modal`].
|
||||
accounts: Vec<WalletAccount>,
|
||||
|
||||
/// Account label [`Modal`] value.
|
||||
pub account_label_edit: String,
|
||||
account_label_edit: String,
|
||||
/// Flag to check if error occurred during account creation at [`Modal`].
|
||||
pub account_creation_error: bool,
|
||||
account_creation_error: bool,
|
||||
|
||||
/// Current tab content to show.
|
||||
pub current_tab: Box<dyn WalletTab>,
|
||||
@@ -44,6 +47,7 @@ pub struct WalletContent {
|
||||
impl Default for WalletContent {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
accounts: vec![],
|
||||
account_label_edit: "".to_string(),
|
||||
account_creation_error: false,
|
||||
current_tab: Box::new(WalletInfo::default())
|
||||
@@ -53,6 +57,8 @@ impl Default for WalletContent {
|
||||
|
||||
/// Identifier for account creation [`Modal`].
|
||||
const CREATE_ACCOUNT_MODAL: &'static str = "create_account_modal";
|
||||
/// Identifier for account list [`Modal`].
|
||||
const ACCOUNT_LIST_MODAL: &'static str = "account_list_modal";
|
||||
|
||||
impl WalletContent {
|
||||
pub fn ui(&mut self,
|
||||
@@ -90,7 +96,7 @@ impl WalletContent {
|
||||
ui.vertical_centered(|ui| {
|
||||
// Draw wallet tabs.
|
||||
View::max_width_ui(ui, Root::SIDE_PANEL_WIDTH * 1.35, |ui| {
|
||||
Self::account_ui(ui, data.as_ref().unwrap(), &wallet.config.account, cb);
|
||||
self.account_ui(ui, wallet, data.unwrap(), cb);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -149,6 +155,11 @@ impl WalletContent {
|
||||
Modal::ui(ui.ctx(), |ui, modal| {
|
||||
self.create_account_modal_ui(ui, wallet, modal, cb);
|
||||
});
|
||||
},
|
||||
ACCOUNT_LIST_MODAL => {
|
||||
Modal::ui(ui.ctx(), |ui, modal| {
|
||||
self.account_list_modal_ui(ui, wallet, modal);
|
||||
});
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@@ -157,9 +168,10 @@ impl WalletContent {
|
||||
}
|
||||
|
||||
/// Draw wallet account content.
|
||||
fn account_ui(ui: &mut egui::Ui,
|
||||
data: &WalletData,
|
||||
account: &String,
|
||||
fn account_ui(&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
wallet: &Wallet,
|
||||
data: WalletData,
|
||||
cb: &dyn PlatformCallbacks) {
|
||||
let mut rect = ui.available_rect_before_wrap();
|
||||
rect.set_height(75.0);
|
||||
@@ -182,8 +194,14 @@ impl WalletContent {
|
||||
});
|
||||
|
||||
// Draw button to show list of accounts.
|
||||
View::item_button(ui, Rounding::none(), LIST, None, || {
|
||||
//TODO: accounts list modal
|
||||
View::item_button(ui, Rounding::ZERO, LIST, None, || {
|
||||
// Load accounts.
|
||||
self.accounts = wallet.accounts();
|
||||
// Show account list modal.
|
||||
Modal::new(ACCOUNT_LIST_MODAL)
|
||||
.position(ModalPosition::Center)
|
||||
.title(t!("wallets.accounts"))
|
||||
.show();
|
||||
});
|
||||
|
||||
let layout_size = ui.available_size();
|
||||
@@ -193,18 +211,19 @@ impl WalletContent {
|
||||
ui.add_space(3.0);
|
||||
// Show spendable amount.
|
||||
let amount = amount_to_hr_string(data.info.amount_currently_spendable, false);
|
||||
let amount_text = format!("{} ツ", amount);
|
||||
let amount_text = format!("{} {}", amount, GRIN);
|
||||
ui.label(RichText::new(amount_text).size(18.0).color(Colors::BLACK));
|
||||
ui.add_space(-2.0);
|
||||
|
||||
// Show account label.
|
||||
let default_acc_label = &WalletConfig::DEFAULT_ACCOUNT_LABEL.to_string();
|
||||
let account = wallet.get_config().account;
|
||||
let default_acc_label = WalletConfig::DEFAULT_ACCOUNT_LABEL.to_string();
|
||||
let acc_label = if account == default_acc_label {
|
||||
t!("wallets.default_account")
|
||||
} else {
|
||||
account.to_owned()
|
||||
};
|
||||
let acc_text = format!("{} {}", FILE_ARCHIVE, acc_label);
|
||||
ui.add_space(-2.0);
|
||||
View::ellipsize_text(ui, acc_text, 15.0, Colors::TEXT);
|
||||
|
||||
// Show confirmed height.
|
||||
@@ -215,6 +234,43 @@ impl WalletContent {
|
||||
});
|
||||
}
|
||||
|
||||
/// Draw account list [`Modal`] content.
|
||||
fn account_list_modal_ui(&mut self, ui: &mut egui::Ui, wallet: &mut Wallet, modal: &Modal) {
|
||||
ui.add_space(3.0);
|
||||
|
||||
// Show list of accounts.
|
||||
let size = self.accounts.len();
|
||||
ScrollArea::vertical()
|
||||
.max_height(300.0)
|
||||
.id_source("account_list_modal_scroll")
|
||||
.auto_shrink([true; 2])
|
||||
.show_rows(ui, ACCOUNT_ITEM_HEIGHT, size, |ui, row_range| {
|
||||
for index in row_range {
|
||||
// Add space before the first item.
|
||||
if index == 0 {
|
||||
ui.add_space(4.0);
|
||||
}
|
||||
let acc = self.accounts.get(index).unwrap();
|
||||
account_item_ui(ui, modal, wallet, acc, index, size);
|
||||
if index == size - 1 {
|
||||
ui.add_space(4.0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ui.add_space(2.0);
|
||||
View::horizontal_line(ui, Colors::STROKE);
|
||||
ui.add_space(6.0);
|
||||
|
||||
ui.vertical_centered_justified(|ui| {
|
||||
View::button(ui, t!("close"), Colors::WHITE, || {
|
||||
// Close modal.
|
||||
modal.close();
|
||||
});
|
||||
ui.add_space(6.0);
|
||||
});
|
||||
}
|
||||
|
||||
/// Draw account creation [`Modal`] content.
|
||||
fn create_account_modal_ui(&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
@@ -230,7 +286,7 @@ impl WalletContent {
|
||||
|
||||
// Draw account name edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.account_label_edit)
|
||||
.id(Id::from(modal.id).with(wallet.config.id))
|
||||
.id(Id::from(modal.id).with(wallet.get_config().id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(ui.available_width())
|
||||
.cursor_at_end(true)
|
||||
@@ -240,15 +296,16 @@ impl WalletContent {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Show error occurred during account creation..
|
||||
if self.account_creation_error {
|
||||
ui.add_space(2.0);
|
||||
ui.label(RichText::new(t!("error"))
|
||||
.size(17.0)
|
||||
.color(Colors::RED));
|
||||
}
|
||||
});
|
||||
|
||||
// Show error occurred during account creation..
|
||||
if self.account_creation_error {
|
||||
ui.add_space(2.0);
|
||||
ui.label(RichText::new(t!("error"))
|
||||
.size(17.0)
|
||||
.color(Colors::RED));
|
||||
}
|
||||
ui.add_space(12.0);
|
||||
|
||||
// Show modal buttons.
|
||||
@@ -270,12 +327,10 @@ impl WalletContent {
|
||||
if !self.account_label_edit.is_empty() {
|
||||
let label = &self.account_label_edit;
|
||||
match wallet.create_account(label) {
|
||||
Ok(_) => match wallet.set_active_account(label) {
|
||||
Ok(_) => {
|
||||
cb.hide_keyboard();
|
||||
modal.close();
|
||||
}
|
||||
Err(_) => self.account_creation_error = true
|
||||
Ok(_) => {
|
||||
let _ = wallet.set_active_account(label);
|
||||
cb.hide_keyboard();
|
||||
modal.close();
|
||||
},
|
||||
Err(_) => self.account_creation_error = true
|
||||
};
|
||||
@@ -299,7 +354,7 @@ impl WalletContent {
|
||||
// Setup spacing between tabs.
|
||||
ui.style_mut().spacing.item_spacing = egui::vec2(4.0, 0.0);
|
||||
// Setup vertical padding inside tab button.
|
||||
ui.style_mut().spacing.button_padding = egui::vec2(0.0, 8.0);
|
||||
ui.style_mut().spacing.button_padding = egui::vec2(0.0, 4.0);
|
||||
|
||||
// Draw tab buttons.
|
||||
let current_type = self.current_tab.get_type();
|
||||
@@ -407,6 +462,7 @@ impl WalletContent {
|
||||
let integrated_node = wallet.get_current_ext_conn_id().is_none();
|
||||
let integrated_node_ready = Node::get_sync_status() == Some(SyncStatus::NoSync);
|
||||
let info_progress = wallet.info_sync_progress();
|
||||
|
||||
if wallet.is_closing() {
|
||||
t!("wallets.wallet_closing")
|
||||
} else if integrated_node && !integrated_node_ready {
|
||||
@@ -436,4 +492,66 @@ impl WalletContent {
|
||||
ui.label(RichText::new(text).size(16.0).color(Colors::INACTIVE_TEXT));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const ACCOUNT_ITEM_HEIGHT: f32 = 75.0;
|
||||
|
||||
/// Draw account item.
|
||||
fn account_item_ui(ui: &mut egui::Ui,
|
||||
modal: &Modal,
|
||||
wallet: &mut Wallet,
|
||||
acc: &WalletAccount,
|
||||
index: usize,
|
||||
size: usize) {
|
||||
// Setup layout size.
|
||||
let mut rect = ui.available_rect_before_wrap();
|
||||
rect.set_height(ACCOUNT_ITEM_HEIGHT);
|
||||
|
||||
// Draw round background.
|
||||
let bg_rect = rect.clone();
|
||||
let item_rounding = View::item_rounding(index, size, false);
|
||||
ui.painter().rect(bg_rect, item_rounding, Colors::FILL, View::ITEM_STROKE);
|
||||
|
||||
ui.vertical(|ui| {
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
// Draw button to select account.
|
||||
let is_current_account = wallet.get_config().account == acc.label;
|
||||
if !is_current_account {
|
||||
let button_rounding = View::item_rounding(index, size, true);
|
||||
View::item_button(ui, button_rounding, CHECK, None, || {
|
||||
let _ = wallet.set_active_account(&acc.label);
|
||||
modal.close();
|
||||
});
|
||||
} else {
|
||||
ui.add_space(12.0);
|
||||
ui.label(RichText::new(CHECK_FAT).size(20.0).color(Colors::GREEN));
|
||||
}
|
||||
|
||||
let layout_size = ui.available_size();
|
||||
ui.allocate_ui_with_layout(layout_size, Layout::left_to_right(Align::Center), |ui| {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical(|ui| {
|
||||
ui.add_space(4.0);
|
||||
// Show spendable amount.
|
||||
let amount = amount_to_hr_string(acc.spendable_amount, false);
|
||||
let amount_text = format!("{} {}", amount, GRIN);
|
||||
ui.label(RichText::new(amount_text).size(18.0).color(Colors::BLACK));
|
||||
ui.add_space(-2.0);
|
||||
|
||||
// Show account name.
|
||||
let default_acc_label = WalletConfig::DEFAULT_ACCOUNT_LABEL.to_string();
|
||||
let acc_label = if acc.label == default_acc_label {
|
||||
t!("wallets.default_account")
|
||||
} else {
|
||||
acc.label.to_owned()
|
||||
};
|
||||
View::ellipsize_text(ui, acc_label, 15.0, Colors::TEXT);
|
||||
|
||||
// Show account BIP32 derivation path.
|
||||
ui.label(RichText::new(acc.path.to_owned()).size(15.0).color(Colors::GRAY));
|
||||
ui.add_space(3.0);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -133,7 +133,7 @@ impl WalletInfo {
|
||||
ui.add_space(3.0);
|
||||
ScrollArea::vertical()
|
||||
.scroll_bar_visibility(ScrollBarVisibility::AlwaysVisible)
|
||||
.id_source(Id::from("txs_content").with(wallet.config.id))
|
||||
.id_source(Id::from("txs_content").with(wallet.get_config().id))
|
||||
.auto_shrink([false; 2])
|
||||
.show_rows(ui, TX_ITEM_HEIGHT, txs_size, |ui, row_range| {
|
||||
ui.add_space(4.0);
|
||||
@@ -244,12 +244,13 @@ fn tx_item_ui(ui: &mut egui::Ui,
|
||||
}
|
||||
} else {
|
||||
let tx_height = tx.kernel_lookup_min_height.unwrap_or(0);
|
||||
let min_confirmations = wallet.get_config().min_confirmations;
|
||||
match tx.tx_type {
|
||||
TxLogEntryType::ConfirmedCoinbase => {
|
||||
format!("{} {}", CHECK_CIRCLE, t!("wallets.tx_confirmed"))
|
||||
},
|
||||
TxLogEntryType::TxReceived => {
|
||||
if last_height - tx_height > wallet.config.min_confirmations {
|
||||
if last_height - tx_height > min_confirmations {
|
||||
format!("{} {}", ARROW_CIRCLE_DOWN, t!("wallets.tx_received"))
|
||||
} else {
|
||||
format!("{} {}",
|
||||
@@ -258,7 +259,7 @@ fn tx_item_ui(ui: &mut egui::Ui,
|
||||
}
|
||||
},
|
||||
TxLogEntryType::TxSent => {
|
||||
if last_height - tx_height > wallet.config.min_confirmations {
|
||||
if last_height - tx_height > min_confirmations {
|
||||
format!("{} {}", ARROW_CIRCLE_DOWN, t!("wallets.tx_sent"))
|
||||
} else {
|
||||
format!("{} {}", DOTS_THREE_CIRCLE, t!("wallets.tx_confirming"))
|
||||
|
||||
@@ -117,7 +117,7 @@ impl WalletReceive {
|
||||
ui.add_space(3.0);
|
||||
ScrollArea::vertical()
|
||||
.max_height(128.0)
|
||||
.id_source(Id::from("receive_input").with(wallet.config.id))
|
||||
.id_source(Id::from("receive_input").with(wallet.get_config().id))
|
||||
.auto_shrink([false; 2])
|
||||
.show(ui, |ui| {
|
||||
ui.add_space(7.0);
|
||||
|
||||
@@ -75,7 +75,7 @@ impl WalletTab for WalletSettings {
|
||||
})
|
||||
.show_inside(ui, |ui| {
|
||||
ScrollArea::vertical()
|
||||
.id_source(Id::from("wallet_settings_scroll").with(wallet.config.id))
|
||||
.id_source(Id::from("wallet_settings_scroll").with(wallet.get_config().id))
|
||||
.auto_shrink([false; 2])
|
||||
.show(ui, |ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
|
||||
Reference in New Issue
Block a user