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

View file

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

View file

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

View file

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

View file

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

View file

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