mirror of
https://github.com/jwinterm/grim.git
synced 2026-11-30 01:43:54 +01:00
ui: txs limit and sort, wallet deletion from the list, fix tor conn on accounts and settings change
- Limit loading at tix list - Sort txs by confirmation status to show txs waiting for an action at top - Ability to delete wallet from the list without opening - Optimize Tor connection on account switch Reviewed-on: https://code.gri.mw/GUI/grim/pulls/53
This commit is contained in:
@@ -21,7 +21,7 @@ use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, TextEdit, View};
|
||||
use crate::gui::views::network::settings::NetworkSettings;
|
||||
use crate::gui::views::types::{ContentContainer, ModalPosition};
|
||||
use crate::gui::views::wallets::modals::WalletsModal;
|
||||
use crate::gui::views::wallets::modals::WalletListModal;
|
||||
use crate::node::{Node, NodeConfig};
|
||||
use crate::wallet::{WalletConfig, WalletList};
|
||||
|
||||
@@ -30,7 +30,7 @@ pub struct StratumSetup {
|
||||
/// Wallet list to select for mining rewards.
|
||||
wallets: WalletList,
|
||||
/// Wallets [`Modal`] content.
|
||||
wallets_modal: WalletsModal,
|
||||
wallets_modal: WalletListModal,
|
||||
|
||||
/// IP Addresses available at system.
|
||||
available_ips: Vec<String>,
|
||||
@@ -80,7 +80,7 @@ impl Default for StratumSetup {
|
||||
|
||||
Self {
|
||||
wallets: WalletList::default(),
|
||||
wallets_modal: WalletsModal::new(wallet_id, None, false),
|
||||
wallets_modal: WalletListModal::new(wallet_id, None, false),
|
||||
available_ips: NodeConfig::get_ip_addrs(),
|
||||
stratum_port_edit: port,
|
||||
stratum_port_available_edit: is_port_available,
|
||||
@@ -238,7 +238,7 @@ impl ContentContainer for StratumSetup {
|
||||
impl StratumSetup {
|
||||
/// Show wallet selection [`Modal`].
|
||||
fn show_wallets_modal(&mut self) {
|
||||
self.wallets_modal = WalletsModal::new(NodeConfig::get_stratum_wallet_id(), None, false);
|
||||
self.wallets_modal = WalletListModal::new(NodeConfig::get_stratum_wallet_id(), None, false);
|
||||
// Show modal.
|
||||
Modal::new(WALLET_SELECTION_MODAL)
|
||||
.position(ModalPosition::Center)
|
||||
|
||||
@@ -16,12 +16,13 @@ use std::time::Duration;
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use egui::{Align, CornerRadius, Id, Layout, Margin, RichText, ScrollArea, StrokeKind};
|
||||
use egui::os::OperatingSystem;
|
||||
use crate::gui::icons::{ARROW_LEFT, CARET_RIGHT, COMPUTER_TOWER, FOLDER_OPEN, FOLDER_PLUS, GEAR, GLOBE, GLOBE_SIMPLE, LOCK_KEY, PLUS, SIDEBAR_SIMPLE, SUITCASE};
|
||||
|
||||
use crate::gui::icons::{ARROW_LEFT, CARET_RIGHT, COMPUTER_TOWER, FOLDER_OPEN, FOLDER_PLUS, GEAR, GEAR_FINE, GLOBE, GLOBE_SIMPLE, LOCK_KEY, PLUS, SIDEBAR_SIMPLE, SUITCASE};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::settings::SettingsContent;
|
||||
use crate::gui::views::types::{ContentContainer, LinePosition, ModalPosition, TitleContentType, TitleType};
|
||||
use crate::gui::views::wallets::creation::WalletCreationContent;
|
||||
use crate::gui::views::wallets::modals::{AddWalletModal, OpenWalletModal, WalletConnectionModal, WalletsModal};
|
||||
use crate::gui::views::wallets::modals::{AddWalletModal, OpenWalletModal, WalletSettingsModal, WalletListModal};
|
||||
use crate::gui::views::wallets::wallet::types::{wallet_status_text, WalletContentContainer};
|
||||
use crate::gui::views::wallets::WalletContent;
|
||||
use crate::gui::views::{Content, Modal, TitlePanel, View};
|
||||
@@ -29,6 +30,7 @@ use crate::gui::Colors;
|
||||
use crate::wallet::types::{ConnectionMethod, WalletTask};
|
||||
use crate::wallet::{Wallet, WalletList};
|
||||
use crate::AppConfig;
|
||||
use crate::gui::views::wallets::wallet::RecoverySettings;
|
||||
|
||||
/// Wallets content.
|
||||
pub struct WalletsContent {
|
||||
@@ -39,10 +41,10 @@ pub struct WalletsContent {
|
||||
add_wallet_modal_content: AddWalletModal,
|
||||
/// Wallet opening [`Modal`] content.
|
||||
open_wallet_content: OpenWalletModal,
|
||||
/// Wallet connection selection [`Modal`] content.
|
||||
conn_selection_content: WalletConnectionModal,
|
||||
/// Wallet settings [`Modal`] content.
|
||||
wallet_settings_content: WalletSettingsModal,
|
||||
/// Wallet selection [`Modal`] content.
|
||||
wallet_selection_content: WalletsModal,
|
||||
wallet_selection_content: WalletListModal,
|
||||
|
||||
/// Selected [`Wallet`] content.
|
||||
wallet_content: WalletContent,
|
||||
@@ -53,19 +55,23 @@ pub struct WalletsContent {
|
||||
settings_content: Option<SettingsContent>,
|
||||
}
|
||||
|
||||
/// Identifier for [`Modal`] to add the wallet.
|
||||
const ADD_WALLET_MODAL: &'static str = "wallets_add_modal";
|
||||
/// Identifier for [`Modal`] to open the wallet.
|
||||
const OPEN_WALLET_MODAL: &'static str = "wallets_open_wallet";
|
||||
const SELECT_CONNECTION_MODAL: &'static str = "wallets_select_conn_modal";
|
||||
/// Identifier for wallet settings [`Modal`].
|
||||
const WALLET_SETTINGS_MODAL: &'static str = "wallets_settings_modal";
|
||||
/// Identifier for wallet selection [`Modal`].
|
||||
const SELECT_WALLET_MODAL: &'static str = "wallets_select_modal";
|
||||
|
||||
impl Default for WalletsContent {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
wallets: WalletList::default(),
|
||||
wallet_selection_content: WalletsModal::new(None, None, true),
|
||||
wallet_selection_content: WalletListModal::new(None, None, true),
|
||||
open_wallet_content: OpenWalletModal::new(),
|
||||
add_wallet_modal_content: AddWalletModal::default(),
|
||||
conn_selection_content: WalletConnectionModal::new(ConnectionMethod::Integrated),
|
||||
wallet_settings_content: WalletSettingsModal::new(ConnectionMethod::Integrated),
|
||||
wallet_content: WalletContent::default(),
|
||||
creation_content: None,
|
||||
settings_content: None,
|
||||
@@ -78,8 +84,9 @@ impl ContentContainer for WalletsContent {
|
||||
vec![
|
||||
ADD_WALLET_MODAL,
|
||||
OPEN_WALLET_MODAL,
|
||||
SELECT_CONNECTION_MODAL,
|
||||
WALLET_SETTINGS_MODAL,
|
||||
SELECT_WALLET_MODAL,
|
||||
Self::DELETE_CONFIRMATION_MODAL
|
||||
]
|
||||
}
|
||||
|
||||
@@ -103,8 +110,8 @@ impl ContentContainer for WalletsContent {
|
||||
true
|
||||
});
|
||||
},
|
||||
SELECT_CONNECTION_MODAL => {
|
||||
self.conn_selection_content.ui(ui, modal, cb, |conn| {
|
||||
WALLET_SETTINGS_MODAL => {
|
||||
self.wallet_settings_content.ui(ui, modal, cb, |conn| {
|
||||
if let Some(w) = self.wallets.selected().as_ref() {
|
||||
w.update_connection(&conn);
|
||||
}
|
||||
@@ -125,6 +132,11 @@ impl ContentContainer for WalletsContent {
|
||||
}
|
||||
}
|
||||
}
|
||||
Self::DELETE_CONFIRMATION_MODAL => {
|
||||
if let Some(w) = self.wallets.selected().as_ref() {
|
||||
RecoverySettings::deletion_modal_ui(ui, w);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@@ -314,6 +326,9 @@ impl ContentContainer for WalletsContent {
|
||||
}
|
||||
|
||||
impl WalletsContent {
|
||||
/// Identifier for wallet deletion confirmation [`Modal`].
|
||||
pub const DELETE_CONFIRMATION_MODAL: &'static str = "wallets_delete_confirmation_modal";
|
||||
|
||||
/// Called to navigate back, return `true` if action was not consumed.
|
||||
pub fn on_back(&mut self, cb: &dyn PlatformCallbacks) -> bool {
|
||||
if self.showing_settings() {
|
||||
@@ -377,7 +392,7 @@ impl WalletsContent {
|
||||
self.show_opening_modal(&w, data, cb);
|
||||
}
|
||||
} else {
|
||||
self.wallet_selection_content = WalletsModal::new(None, data, true);
|
||||
self.wallet_selection_content = WalletListModal::new(None, data, true);
|
||||
Modal::new(SELECT_WALLET_MODAL)
|
||||
.position(ModalPosition::Center)
|
||||
.title(t!("network_settings.choose_wallet"))
|
||||
@@ -548,14 +563,14 @@ impl WalletsContent {
|
||||
self.show_opening_modal(wallet, None, cb);
|
||||
});
|
||||
if !wallet.is_repairing() {
|
||||
View::item_button(ui, CornerRadius::default(), GLOBE, None, || {
|
||||
View::item_button(ui, CornerRadius::default(), GEAR_FINE, None, || {
|
||||
self.select_wallet(wallet, None, cb);
|
||||
self.conn_selection_content =
|
||||
WalletConnectionModal::new(wallet.get_current_connection());
|
||||
let conn = wallet.get_current_connection();
|
||||
self.wallet_settings_content = WalletSettingsModal::new(conn);
|
||||
// Show connection selection modal.
|
||||
Modal::new(SELECT_CONNECTION_MODAL)
|
||||
Modal::new(WALLET_SETTINGS_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("wallets.conn_method"))
|
||||
.title(t!("wallets.settings"))
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ use crate::wallet::types::ConnectionMethod;
|
||||
use crate::wallet::{Wallet, WalletList};
|
||||
|
||||
/// Wallet list [`Modal`] content
|
||||
pub struct WalletsModal {
|
||||
pub struct WalletListModal {
|
||||
/// Selected wallet id.
|
||||
selected_id: Option<i64>,
|
||||
|
||||
@@ -34,7 +34,7 @@ pub struct WalletsModal {
|
||||
can_open: bool,
|
||||
}
|
||||
|
||||
impl WalletsModal {
|
||||
impl WalletListModal {
|
||||
/// Create new content instance.
|
||||
pub fn new(selected_id: Option<i64>, data: Option<String>, can_open: bool) -> Self {
|
||||
Self { selected_id, data, can_open }
|
||||
@@ -12,11 +12,11 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
mod conn;
|
||||
pub use conn::*;
|
||||
mod settings;
|
||||
pub use settings::*;
|
||||
|
||||
mod wallets;
|
||||
pub use wallets::*;
|
||||
mod list;
|
||||
pub use list::*;
|
||||
|
||||
mod open;
|
||||
pub use open::*;
|
||||
|
||||
@@ -16,16 +16,18 @@ use egui::{RichText, ScrollArea};
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{CHECK, CHECK_FAT, PLUS_CIRCLE};
|
||||
use crate::gui::icons::{CHECK, CHECK_FAT, PLUS_CIRCLE, TRASH};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, View};
|
||||
use crate::gui::views::network::ConnectionsContent;
|
||||
use crate::gui::views::network::modals::ExternalConnectionModal;
|
||||
use crate::gui::views::types::ModalPosition;
|
||||
use crate::gui::views::wallets::WalletsContent;
|
||||
use crate::wallet::{ConnectionsConfig, ExternalConnection};
|
||||
use crate::wallet::types::ConnectionMethod;
|
||||
|
||||
/// Wallet connection selection [`Modal`] content.
|
||||
pub struct WalletConnectionModal {
|
||||
pub struct WalletSettingsModal {
|
||||
/// Current connection method.
|
||||
pub conn: ConnectionMethod,
|
||||
|
||||
@@ -33,7 +35,7 @@ pub struct WalletConnectionModal {
|
||||
new_ext_conn_content: Option<ExternalConnectionModal>
|
||||
}
|
||||
|
||||
impl WalletConnectionModal {
|
||||
impl WalletSettingsModal {
|
||||
/// Create from provided wallet connection.
|
||||
pub fn new(conn: ConnectionMethod) -> Self {
|
||||
Self {
|
||||
@@ -141,6 +143,21 @@ impl WalletConnectionModal {
|
||||
ui.add_space(2.0);
|
||||
View::horizontal_line(ui, Colors::item_stroke());
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
// Draw button to delete the wallet.
|
||||
View::colored_text_button(ui,
|
||||
format!("{} {}", TRASH, t!("wallets.delete")),
|
||||
Colors::red(),
|
||||
Colors::white_or_black(false), || {
|
||||
Modal::new(WalletsContent::DELETE_CONFIRMATION_MODAL)
|
||||
.position(ModalPosition::Center)
|
||||
.title(t!("confirmation"))
|
||||
.show();
|
||||
});
|
||||
});
|
||||
ui.add_space(6.0);
|
||||
View::horizontal_line(ui, Colors::item_stroke());
|
||||
ui.add_space(6.0);
|
||||
|
||||
// Show button to close modal.
|
||||
ui.vertical_centered_justified(|ui| {
|
||||
@@ -360,7 +360,11 @@ impl WalletContent {
|
||||
ui.style_mut().spacing.button_padding = egui::vec2(0.0, 4.0);
|
||||
|
||||
let has_wallet_data = wallet.get_data().is_some();
|
||||
let can_send = wallet.get_data().unwrap().info.amount_currently_spendable > 0;
|
||||
let can_send = if has_wallet_data {
|
||||
wallet.get_data().unwrap().info.amount_currently_spendable > 0
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
let tabs_amount = if can_send { 5 } else { 4 };
|
||||
ui.columns(tabs_amount, |columns| {
|
||||
@@ -435,7 +439,7 @@ impl WalletContent {
|
||||
/// Handle wallet task result.
|
||||
fn handle_task_result(&mut self, wallet: &Wallet) {
|
||||
let res = wallet.consume_task_result();
|
||||
if res.is_none() {
|
||||
if res.is_none() || wallet.get_data().is_none() {
|
||||
return;
|
||||
}
|
||||
let (id, t) = res.unwrap();
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use egui::{Id, RichText, ScrollArea};
|
||||
use grin_wallet_libwallet::{Error, PaymentProof};
|
||||
use grin_util::ToHex;
|
||||
use grin_wallet_libwallet::{Error, PaymentProof, TxLogEntryType};
|
||||
|
||||
use crate::gui::icons::{BROOM, CLIPBOARD_TEXT, COPY, FILE_TEXT, SEAL_CHECK};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{FilePickContent, FilePickContentType, Modal, View};
|
||||
use crate::gui::Colors;
|
||||
use crate::wallet::types::WalletTask;
|
||||
use crate::wallet::types::{WalletTask, WalletTransaction};
|
||||
use crate::wallet::Wallet;
|
||||
|
||||
pub struct PaymentProofContent {
|
||||
@@ -151,11 +152,19 @@ impl PaymentProofContent {
|
||||
}
|
||||
|
||||
/// Draw transaction payment proof content to share.
|
||||
pub fn share_ui(&mut self, ui: &mut egui::Ui, file_name: String, cb: &dyn PlatformCallbacks) {
|
||||
pub fn share_ui(&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
tx: &WalletTransaction,
|
||||
cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
let desc = format!("{} {}:", SEAL_CHECK, t!("wallets.payment_proof"));
|
||||
ui.label(RichText::new(desc).size(16.0).color(Colors::inactive_text()));
|
||||
let (desc_text, color) = if tx.data.tx_type == TxLogEntryType::TxReceived {
|
||||
(t!("wallets.payment_proof_valid"), Colors::green())
|
||||
} else {
|
||||
(format!("{}:", t!("wallets.payment_proof")), Colors::inactive_text())
|
||||
};
|
||||
let desc = format!("{} {}", SEAL_CHECK, desc_text);
|
||||
ui.label(RichText::new(desc).size(16.0).color(color));
|
||||
});
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
@@ -203,7 +212,7 @@ impl PaymentProofContent {
|
||||
share_text,
|
||||
Colors::blue(),
|
||||
Colors::white_or_black(false), || {
|
||||
let file_name = format!("{}.txt", file_name);
|
||||
let file_name = format!("{}.txt", tx.data.kernel_excess.unwrap().to_hex());
|
||||
let data = self.input_edit.as_bytes().to_vec();
|
||||
cb.share_data(file_name, data).unwrap_or_default();
|
||||
Modal::close();
|
||||
|
||||
@@ -59,7 +59,7 @@ impl WalletContentContainer for RecoverySettings {
|
||||
self.recovery_phrase_modal_ui(ui, wallet, modal, cb);
|
||||
}
|
||||
DELETE_CONFIRMATION_MODAL => {
|
||||
self.deletion_modal_ui(ui, wallet);
|
||||
Self::deletion_modal_ui(ui, wallet);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@@ -260,9 +260,7 @@ impl RecoverySettings {
|
||||
}
|
||||
|
||||
/// Draw wallet deletion [`Modal`] content.
|
||||
fn deletion_modal_ui(&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
wallet: &Wallet) {
|
||||
pub fn deletion_modal_ui(ui: &mut egui::Ui, wallet: &Wallet) {
|
||||
ui.add_space(8.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("wallets.delete_conf"))
|
||||
|
||||
@@ -88,6 +88,7 @@ impl WalletTransportContent {
|
||||
/// Navigate back on navigation stack.
|
||||
pub fn back(&mut self) {
|
||||
if self.settings_content.is_some() {
|
||||
Tor::restart_services();
|
||||
self.settings_content = None;
|
||||
} else if self.qr_address_content.is_some() {
|
||||
self.qr_address_content = None;
|
||||
@@ -134,25 +135,25 @@ impl WalletTransportContent {
|
||||
.with_max_size(320.0));
|
||||
});
|
||||
|
||||
// Draw button to enable/disable Tor listener for current wallet.
|
||||
let service_id = &wallet.identifier();
|
||||
if !Tor::is_service_starting(service_id) && wallet.foreign_api_port().is_some() &&
|
||||
wallet.secret_key().is_some() {
|
||||
if !Tor::is_service_running(service_id) {
|
||||
let r = CornerRadius::default();
|
||||
View::item_button(ui, r, POWER, Some(Colors::green()), || {
|
||||
let api_port = wallet.foreign_api_port().unwrap();
|
||||
let key = wallet.secret_key().unwrap();
|
||||
Tor::start_service(api_port, key, service_id);
|
||||
});
|
||||
} else {
|
||||
let r = CornerRadius::default();
|
||||
View::item_button(ui, r, POWER, Some(Colors::red()), || {
|
||||
Tor::stop_service(service_id);
|
||||
});
|
||||
// Draw button to enable/disable Tor listener for current wallet.
|
||||
if wallet.foreign_api_port().is_some() && wallet.secret_key().is_some() {
|
||||
let port = wallet.foreign_api_port().unwrap();
|
||||
let key = wallet.secret_key().unwrap();
|
||||
if !Tor::is_service_starting(service_id) {
|
||||
if !Tor::is_service_running(service_id) {
|
||||
let r = CornerRadius::default();
|
||||
View::item_button(ui, r, POWER, Some(Colors::green()), || {
|
||||
Tor::start_service(port, key.clone(), service_id);
|
||||
});
|
||||
} else {
|
||||
let r = CornerRadius::default();
|
||||
View::item_button(ui, r, POWER, Some(Colors::red()), || {
|
||||
Tor::stop_service(service_id);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw button to show Tor transport settings.
|
||||
let button_rounding = View::item_rounding(1, 3, true);
|
||||
View::item_button(ui, button_rounding, WRENCH, None, || {
|
||||
|
||||
@@ -25,13 +25,13 @@ use crate::wallet::Wallet;
|
||||
/// Wallet transport settings content.
|
||||
pub struct WalletTransportSettingsContent {
|
||||
/// Tor transport content settings.
|
||||
tor_settings_content: TorSettingsContent,
|
||||
pub tor_settings_content: TorSettingsContent,
|
||||
}
|
||||
|
||||
impl Default for WalletTransportSettingsContent {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
tor_settings_content: TorSettingsContent::default(),
|
||||
tor_settings_content: TorSettingsContent::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,19 +62,7 @@ impl WalletTransportSettingsContent {
|
||||
ui.add_space(8.0);
|
||||
ui.vertical_centered_justified(|ui| {
|
||||
View::button(ui, t!("close"), Colors::white_or_black(false), || {
|
||||
if self.tor_settings_content.settings_changed {
|
||||
// Restart running service or rebuild client.
|
||||
let service_id = &wallet.identifier();
|
||||
if Tor::is_service_running(service_id) {
|
||||
if let Some(key) = wallet.secret_key() {
|
||||
if let Some(api_port) = wallet.foreign_api_port() {
|
||||
Tor::restart_service(api_port, key, service_id);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Tor::rebuild_client();
|
||||
}
|
||||
}
|
||||
Tor::restart_services();
|
||||
on_close();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -130,11 +130,17 @@ impl WalletTransactionsContent {
|
||||
.can_refresh(!refresh && !wallet.syncing() && !txs.is_empty())
|
||||
.min_refresh_distance(70.0)
|
||||
.scroll_area_ui(ui, |ui| {
|
||||
let rows_size = if txs.is_empty() {
|
||||
0
|
||||
} else {
|
||||
// Last index is for list pagination.
|
||||
txs.len() + 1
|
||||
};
|
||||
ScrollArea::vertical()
|
||||
.id_salt(Id::from("wallet_tx_list_scroll").with(config.id))
|
||||
.scroll_bar_visibility(ScrollBarVisibility::AlwaysHidden)
|
||||
.auto_shrink([false; 2])
|
||||
.show_rows(ui, Self::TX_ITEM_HEIGHT, txs.len(), |ui, row_range| {
|
||||
.show_rows(ui, Self::TX_ITEM_HEIGHT, rows_size, |ui, row_range| {
|
||||
ui.add_space(1.0);
|
||||
View::max_width_ui(ui, Content::SIDE_PANEL_WIDTH * 1.3, |ui| {
|
||||
self.tx_list_ui(ui, row_range, &wallet, txs);
|
||||
@@ -159,6 +165,24 @@ impl WalletTransactionsContent {
|
||||
txs: &Vec<WalletTransaction>) {
|
||||
let data = wallet.get_data().unwrap();
|
||||
for index in row_range {
|
||||
if index == txs.len() && ui.is_visible() {
|
||||
// Load more txs when needed.
|
||||
if !wallet.more_txs_loading() {
|
||||
if let Some(data) = wallet.get_data() {
|
||||
if txs.len() as u32 >= data.txs_limit {
|
||||
wallet.load_more_txs();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Show loader when more txs are loading.
|
||||
if wallet.more_txs_loading() {
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.add_space(24.0);
|
||||
View::small_loading_spinner(ui);
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
let mut rect = ui.available_rect_before_wrap();
|
||||
rect.min += egui::emath::vec2(6.0, 0.0);
|
||||
rect.max -= egui::emath::vec2(6.0, 0.0);
|
||||
|
||||
@@ -102,14 +102,8 @@ impl WalletTransactionContent {
|
||||
self.share_ui(ui, wallet, tx, cb);
|
||||
} else {
|
||||
if let Some(proof_content) = self.proof_content.as_mut() {
|
||||
// Payment proof file name setup.
|
||||
let file_name = if let Some(slate_id) = tx.data.tx_slate_id {
|
||||
slate_id.to_string()
|
||||
} else {
|
||||
tx.data.id.to_string()
|
||||
};
|
||||
// Draw payment proof sharing content.
|
||||
proof_content.share_ui(ui, file_name, cb);
|
||||
proof_content.share_ui(ui, tx, cb);
|
||||
} else if tx.proof.is_some() && !tx.sending_tor() &&
|
||||
tx.action_error.is_none() {
|
||||
ui.vertical_centered(|ui| {
|
||||
|
||||
Reference in New Issue
Block a user