create and use TextTimeHelpers
MODIFY
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/SearchPasswordViewModel.cs
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/SearchPasswordViewModel.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Reactive.Disposables;
using System.Threading;
using System.Threading.Tasks;
+using WalletWasabi.Fluent.Helpers;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Wallets.PasswordFinder;
@@ -73,13 +74,9 @@ namespace WalletWasabi.Fluent.ViewModels.Login.PasswordFinder
RemainingMin = remainingTime.Minutes;
RemainingSec = remainingTime.Seconds;
- HourText = $" hour{AddSIfPlural(RemainingHour)}{CloseSentenceIfZero(RemainingMin,RemainingSec)}";
- MinText = $" minute{AddSIfPlural(RemainingMin)}{CloseSentenceIfZero(RemainingSec)}";
- SecText = $" second{AddSIfPlural(RemainingSec)}.";
+ HourText = $" hour{TextTimeHelpers.AddSIfPlural(RemainingHour)}{TextTimeHelpers.CloseSentenceIfZero(RemainingMin,RemainingSec)}";
+ MinText = $" minute{TextTimeHelpers.AddSIfPlural(RemainingMin)}{TextTimeHelpers.CloseSentenceIfZero(RemainingSec)}";
+ SecText = $" second{TextTimeHelpers.AddSIfPlural(RemainingSec)}.";
}
-
- private static string AddSIfPlural(int n) => n > 1 ? "s" : "";
-
- private static string CloseSentenceIfZero(params int[] counts) => counts.All(x => x == 0) ? "." : " ";
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
@@ -76,6 +76,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
if (x > 0)
{
_transactionInfo.FeeRate = new FeeRate(GetYAxisValueFromXAxisCurrentValue(x));
+ _transactionInfo.ConfirmationTimeSpan = TimeSpan.FromMinutes((int) Math.Ceiling(x / 10.0) * 10);
}
});

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionInfo.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionInfo.cs
+using System;
using System.Collections.Generic;
using NBitcoin;
using WalletWasabi.Blockchain.Analysis.Clustering;
@@ -15,6 +16,8 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
public FeeRate FeeRate { get; set; }
+ public TimeSpan ConfirmationTimeSpan { get; set; }
+
public IEnumerable<SmartCoin> Coins { get; set; }
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
+using System;
using System.Linq;
using NBitcoin;
using ReactiveUI;
@@ -30,7 +31,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
AddressText = info.Address.ToString();
- ConfirmationTimeText = "~20 minutes ";
+ ConfirmationTimeText = $"~{TextTimeHelpers.TimeSpanToFriendlyString(info.ConfirmationTimeSpan)} ";
BtcFeeText = $"{fee.ToDecimal(MoneyUnit.Satoshi)} satoshis ";

create and use TextTimeHelpers