disable spark and lelantus features in view only wallets for the time being

This commit is contained in:
julian 2024-11-14 14:00:32 -06:00 committed by julian-CStack
parent e95d5a10b6
commit 98d77621b2
6 changed files with 18 additions and 12 deletions

View file

@ -282,11 +282,11 @@ class _WalletSettingsWalletSettingsViewState
),
),
),
if (wallet is LelantusInterface)
if (wallet is LelantusInterface && !wallet.isViewOnly)
const SizedBox(
height: 8,
),
if (wallet is LelantusInterface)
if (wallet is LelantusInterface && !wallet.isViewOnly)
RoundedWhiteContainer(
padding: const EdgeInsets.all(0),
child: RawMaterialButton(
@ -318,11 +318,11 @@ class _WalletSettingsWalletSettingsViewState
),
),
),
if (wallet is SparkInterface)
if (wallet is SparkInterface && !wallet.isViewOnly)
const SizedBox(
height: 8,
),
if (wallet is SparkInterface)
if (wallet is SparkInterface && !wallet.isViewOnly)
RoundedWhiteContainer(
padding: const EdgeInsets.all(0),
child: RawMaterialButton(
@ -369,7 +369,7 @@ class _WalletSettingsWalletSettingsViewState
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: const EdgeInsets.all(0),
onPressed: () {
showDialog(
showDialog<void>(
barrierDismissible: true,
context: context,
builder: (_) => StackDialog(

View file

@ -207,7 +207,7 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
// await firoWallet.anonymizeAllLelantus();
await firoWallet.anonymizeAllSpark();
shouldPop = true;
if (context.mounted) {
if (mounted) {
Navigator.of(context, rootNavigator: true).pop();
Navigator.of(context).popUntil(
ModalRoute.withName(DesktopWalletView.routeName),
@ -222,7 +222,7 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
}
} catch (e) {
shouldPop = true;
if (context.mounted) {
if (mounted) {
Navigator.of(context, rootNavigator: true).pop();
Navigator.of(context).popUntil(
ModalRoute.withName(DesktopWalletView.routeName),

View file

@ -321,11 +321,11 @@ class _MoreFeaturesDialogState extends ConsumerState<MoreFeaturesDialog> {
iconAsset: Assets.svg.churn,
onPressed: () async => widget.onChurnPressed?.call(),
),
if (wallet is SparkInterface)
if (wallet is SparkInterface && !isViewOnly)
_MoreFeaturesClearSparkCacheItem(
cryptoCurrency: wallet.cryptoCurrency,
),
if (wallet is LelantusInterface)
if (wallet is LelantusInterface && !isViewOnly)
_MoreFeaturesItemBase(
child: Row(
children: [

View file

@ -294,13 +294,14 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final coin = ref.watch(pWalletCoin(walletId));
final firoDebug = kDebugMode && (coin is Firo);
bool firoDebug = kDebugMode && (coin is Firo);
final wallet = ref.watch(pWallets).getWallet(walletId);
bool xpubEnabled = wallet is ExtendedKeysInterface;
if (wallet is ViewOnlyOptionInterface && wallet.isViewOnly) {
xpubEnabled = false;
firoDebug = false;
}
final bool canChangeRep = coin is NanoCurrency;

View file

@ -659,6 +659,11 @@ class FiroWallet<T extends ElectrumXCurrencyInterface> extends Bip39HDWallet<T>
@override
Future<void> recover({required bool isRescan}) async {
if (isViewOnly) {
await recoverViewOnly(isRescan: isRescan);
return;
}
// reset last checked values
await info.updateOtherData(
newEntries: {

View file

@ -665,7 +665,7 @@ abstract class Wallet<T extends CryptoCurrency> {
}
_checkAlive();
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.3, walletId));
if (this is SparkInterface) {
if (this is SparkInterface && !viewOnly) {
// this should be called before updateTransactions()
await (this as SparkInterface).refreshSparkData();
}
@ -702,7 +702,7 @@ abstract class Wallet<T extends CryptoCurrency> {
_checkAlive();
// TODO: [prio=low] handle this differently. Extra modification of this file for coin specific functionality should be avoided.
if (this is LelantusInterface) {
if (this is LelantusInterface && !viewOnly) {
if (info.otherData[WalletInfoKeys.enableLelantusScanning] as bool? ??
false) {
await (this as LelantusInterface).refreshLelantusData();