Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates changes fixes #1079

Merged
merged 8 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PODS:
- connectivity_plus (0.0.1):
- Flutter
- ReachabilitySwift
- cs_monero_flutter_libs (0.0.1):
- cs_monero_flutter_libs_ios (0.0.1):
- Flutter
- device_info_plus (0.0.1):
- Flutter
Expand Down Expand Up @@ -87,8 +87,6 @@ PODS:
- "sqlite3 (3.46.0+1)":
- "sqlite3/common (= 3.46.0+1)"
- "sqlite3/common (3.46.0+1)"
- "sqlite3/dbstatvtab (3.46.0+1)":
- sqlite3/common
- "sqlite3/fts5 (3.46.0+1)":
- sqlite3/common
- "sqlite3/perf-threadsafe (3.46.0+1)":
Expand All @@ -97,8 +95,7 @@ PODS:
- sqlite3/common
- sqlite3_flutter_libs (0.0.1):
- Flutter
- "sqlite3 (~> 3.46.0+1)"
- sqlite3/dbstatvtab
- sqlite3 (~> 3.46.0)
- sqlite3/fts5
- sqlite3/perf-threadsafe
- sqlite3/rtree
Expand All @@ -117,7 +114,7 @@ DEPENDENCIES:
- barcode_scan2 (from `.symlinks/plugins/barcode_scan2/ios`)
- coinlib_flutter (from `.symlinks/plugins/coinlib_flutter/darwin`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- cs_monero_flutter_libs (from `.symlinks/plugins/cs_monero_flutter_libs/ios`)
- cs_monero_flutter_libs_ios (from `.symlinks/plugins/cs_monero_flutter_libs_ios/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- devicelocale (from `.symlinks/plugins/devicelocale/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
Expand Down Expand Up @@ -160,8 +157,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/coinlib_flutter/darwin"
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/ios"
cs_monero_flutter_libs:
:path: ".symlinks/plugins/cs_monero_flutter_libs/ios"
cs_monero_flutter_libs_ios:
:path: ".symlinks/plugins/cs_monero_flutter_libs_ios/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
devicelocale:
Expand Down Expand Up @@ -213,7 +210,7 @@ SPEC CHECKSUMS:
barcode_scan2: 0af2bb63c81b4565aab6cd78278e4c0fa136dbb0
coinlib_flutter: 9275e8255ef67d3da33beb6e117d09ced4f46eb5
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
cs_monero_flutter_libs: 43cda3474c2bc907f2b2b5bb26fd89cb864fcfc6
cs_monero_flutter_libs_ios: fd353631682247f72a36493ff060d4328d6f720d
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
devicelocale: 35ba84dc7f45f527c3001535d8c8d104edd5d926
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
Expand All @@ -231,14 +228,14 @@ SPEC CHECKSUMS:
lelantus: 417f0221260013dfc052cae9cf4b741b6479edba
local_auth_darwin: 66e40372f1c29f383a314c738c7446e2f7fdadc3
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
sqlite3: 292c3e1bfe89f64e51ea7fc7dab9182a017c8630
sqlite3_flutter_libs: c00457ebd31e59fa6bb830380ddba24d44fbcd3b
sqlite3_flutter_libs: 0d611efdf6d1c9297d5ab03dab21b75aeebdae31
stack_wallet_backup: 5b8563aba5d8ffbf2ce1944331ff7294a0ec7c03
SwiftProtobuf: 6ef3f0e422ef90d6605ca20b21a94f6c1324d6b3
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {

late final TextSelectionControls textSelectionControls;

bool _hideSeedWords = false;

Future<void> onControlsPaste(TextSelectionDelegate delegate) async {
final data = await widget.clipboard.getData(Clipboard.kTextPlain);
if (data?.text == null) {
Expand Down Expand Up @@ -212,6 +214,8 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {

Future<void> attemptRestore() async {
if (_formKey.currentState!.validate()) {
if (mounted) setState(() => _hideSeedWords = true);

String mnemonic = "";
for (final element in _controllers) {
mnemonic += " ${element.text.trim().toLowerCase()}";
Expand Down Expand Up @@ -282,6 +286,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
// TODO: do actual check to make sure it is a valid mnemonic for monero
if (bip39.validateMnemonic(mnemonic) == false &&
!(widget.coin is Monero || widget.coin is Wownero)) {
if (mounted) setState(() => _hideSeedWords = false);
unawaited(
showFloatingFlushBar(
type: FlushBarType.warning,
Expand Down Expand Up @@ -313,6 +318,8 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
onCancel: () async {
isRestoring = false;

if (mounted) setState(() => _hideSeedWords = false);

await ref.read(pWallets).deleteWallet(
info,
ref.read(secureStoreProvider),
Expand Down Expand Up @@ -471,6 +478,8 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
);
},
);

if (mounted) setState(() => _hideSeedWords = false);
}
}

Expand Down Expand Up @@ -868,6 +877,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
child: Column(
children: [
TextFormField(
obscureText: _hideSeedWords,
autocorrect: !isDesktop,
enableSuggestions: !isDesktop,
textCapitalization:
Expand Down Expand Up @@ -1001,6 +1011,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
child: Column(
children: [
TextFormField(
obscureText: _hideSeedWords,
autocorrect: !isDesktop,
enableSuggestions: !isDesktop,
textCapitalization:
Expand Down Expand Up @@ -1135,6 +1146,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
padding:
const EdgeInsets.symmetric(vertical: 4),
child: TextFormField(
obscureText: _hideSeedWords,
autocorrect: !isDesktop,
enableSuggestions: !isDesktop,
textCapitalization: TextCapitalization.none,
Expand Down
33 changes: 33 additions & 0 deletions lib/pages/settings_views/global_settings_view/hidden_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,39 @@ class HiddenSettings extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Consumer(
builder: (_, ref, __) {
return GestureDetector(
onTap: () async {
ref
.read(prefsChangeNotifierProvider)
.advancedFiroFeatures =
!ref
.read(prefsChangeNotifierProvider)
.advancedFiroFeatures;
},
child: RoundedWhiteContainer(
child: Text(
ref.watch(
prefsChangeNotifierProvider.select(
(s) => s.advancedFiroFeatures,
),
)
? "Hide advanced Firo features"
: "Show advanced Firo features",
style: STextStyles.button(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
),
),
);
},
),
const SizedBox(
height: 12,
),
Consumer(
builder: (_, ref, __) {
return GestureDetector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,27 @@
*
*/

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:wakelock_plus/wakelock_plus.dart';

import '../../../../providers/db/main_db_provider.dart';
import '../../../../providers/global/wallets_provider.dart';
import '../../../../themes/stack_colors.dart';
import '../../../../utilities/logger.dart';
import '../../../../utilities/show_loading.dart';
import '../../../../utilities/text_styles.dart';
import '../../../../utilities/util.dart';
import '../../../../wallets/isar/models/wallet_info.dart';
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
import '../../../../widgets/background.dart';
import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../../../widgets/custom_buttons/draggable_switch_button.dart';
import '../../../../widgets/desktop/primary_button.dart';
import '../../../../widgets/desktop/secondary_button.dart';
import '../../../../widgets/stack_dialog.dart';

class LelantusSettingsView extends ConsumerStatefulWidget {
const LelantusSettingsView({
Expand Down Expand Up @@ -50,12 +60,91 @@ class _LelantusSettingsViewState extends ConsumerState<LelantusSettingsView> {
},
isar: ref.read(mainDBProvider).isar,
);
if (newValue) {
await _doRescanMaybe();
}
} finally {
// ensure _isUpdatingLelantusScanning is set to false no matter what
_isUpdatingLelantusScanning = false;
}
}

Future<void> _doRescanMaybe() async {
final shouldRescan = await showDialog<bool>(
context: context,
builder: (context) {
return StackDialog(
title: "Rescan may be required",
message: "A blockchain rescan may be required to fully recover all "
"lelantus history. This may take a while.",
leftButton: SecondaryButton(
label: "Rescan now",
onPressed: () {
Navigator.of(context).pop(true);
},
),
rightButton: PrimaryButton(
label: "Later",
onPressed: () => Navigator.of(context).pop(false),
),
);
},
);

if (mounted && shouldRescan == true) {
try {
if (!Platform.isLinux) await WakelockPlus.enable();

Exception? e;
if (mounted) {
await showLoading(
whileFuture: ref.read(pWallets).getWallet(widget.walletId).recover(
isRescan: true,
),
context: context,
message: "Rescanning blockchain",
subMessage: "This may take a while."
"\nPlease do not exit this screen.",
rootNavigator: Util.isDesktop,
onException: (ex) => e = ex,
);

if (e != null) {
throw e!;
}
}
} catch (e, s) {
Logging.instance.log("$e\n$s", level: LogLevel.Error);
if (mounted) {
// show error
await showDialog<dynamic>(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) => StackDialog(
title: "Rescan failed",
message: e.toString(),
rightButton: TextButton(
style: Theme.of(context)
.extension<StackColors>()!
.getSecondaryEnabledButtonStyle(context),
child: Text(
"Ok",
style: STextStyles.itemSubtitle12(context),
),
onPressed: () {
Navigator.of(context, rootNavigator: Util.isDesktop).pop();
},
),
),
);
}
} finally {
if (!Platform.isLinux) await WakelockPlus.disable();
}
}
}

@override
Widget build(BuildContext context) {
return Background(
Expand Down
34 changes: 34 additions & 0 deletions lib/pages/wallet_view/wallet_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import '../../app_config.dart';
import '../../frost_route_generator.dart';
import '../../models/isar/exchange_cache/currency.dart';
import '../../notifications/show_flush_bar.dart';
import '../../pages_desktop_specific/lelantus_coins/lelantus_coins_view.dart';
import '../../pages_desktop_specific/spark_coins/spark_coins_view.dart';
import '../../providers/global/active_wallet_provider.dart';
import '../../providers/global/auto_swb_service_provider.dart';
import '../../providers/global/paynym_api_provider.dart';
Expand Down Expand Up @@ -1138,6 +1140,38 @@ class _WalletViewState extends ConsumerState<WalletView> {
);
},
),
if (wallet is FiroWallet &&
ref.watch(
prefsChangeNotifierProvider.select(
(value) => value.advancedFiroFeatures,
),
))
WalletNavigationBarItemData(
label: "Lelantus coins",
icon: const CoinControlNavIcon(),
onTap: () {
Navigator.of(context).pushNamed(
LelantusCoinsView.routeName,
arguments: widget.walletId,
);
},
),
if (wallet is FiroWallet &&
ref.watch(
prefsChangeNotifierProvider.select(
(value) => value.advancedFiroFeatures,
),
))
WalletNavigationBarItemData(
label: "Spark coins",
icon: const CoinControlNavIcon(),
onTap: () {
Navigator.of(context).pushNamed(
SparkCoinsView.routeName,
arguments: widget.walletId,
);
},
),
if (!viewOnly && wallet is PaynymInterface)
WalletNavigationBarItemData(
label: "PayNym",
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/wallets_view/wallets_overview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
updateWallets();

if (AppConfig.isSingleCoinApp) {
GlobalEventBus.instance.on<WalletAddedEvent>().listen((_) {
GlobalEventBus.instance.on<WalletsChangedEvent>().listen((_) {
updateWallets();
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
Expand Down
Loading
Loading