Merge branch 'staging' into fusion

This commit is contained in:
sneurlax 2023-09-21 14:55:09 -05:00
commit f17c6a0875
23 changed files with 521 additions and 148 deletions

BIN
assets/gif/stacy_onion.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 MiB

@ -1 +1 @@
Subproject commit e48952185556a10f182184fd572bcb04365f5831 Subproject commit 34a20002095cda70b81460d2aa4654a8280fbf0c

View file

@ -46,6 +46,7 @@ class DB {
// in use (keep for now) // in use (keep for now)
static const String boxNameDBInfo = "dbInfo"; static const String boxNameDBInfo = "dbInfo";
static const String boxNamePrefs = "prefs"; static const String boxNamePrefs = "prefs";
static const String boxNameOneTimeDialogsShown = "oneTimeDialogsShown";
String _boxNameTxCache({required Coin coin}) => "${coin.name}_txCache"; String _boxNameTxCache({required Coin coin}) => "${coin.name}_txCache";

View file

@ -33,6 +33,7 @@ import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/widgets/animated_widgets/rotate_icon.dart'; import 'package:stackwallet/widgets/animated_widgets/rotate_icon.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/onetime_popups/tor_has_been_add_dialog.dart';
import 'package:stackwallet/widgets/small_tor_icon.dart'; import 'package:stackwallet/widgets/small_tor_icon.dart';
import 'package:stackwallet/widgets/stack_dialog.dart'; import 'package:stackwallet/widgets/stack_dialog.dart';
@ -129,19 +130,9 @@ class _HomeViewState extends ConsumerState<HomeView> {
ref.read(notificationsProvider).startCheckingWatchedNotifications(); ref.read(notificationsProvider).startCheckingWatchedNotifications();
/// todo change to watch tor network WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
// if (ref.read(managerProvider).isRefreshing) { showOneTimeTorHasBeenAddedDialogIfRequired(context);
// _currentSyncStatus = WalletSyncStatus.syncing; });
// _currentNodeStatus = NodeConnectionStatus.connected;
// } else {
// _currentSyncStatus = WalletSyncStatus.synced;
// if (ref.read(managerProvider).isConnected) {
// _currentNodeStatus = NodeConnectionStatus.connected;
// } else {
// _currentNodeStatus = NodeConnectionStatus.disconnected;
// _currentSyncStatus = WalletSyncStatus.unableToSync;
// }
// }
super.initState(); super.initState();
} }

View file

@ -12,13 +12,20 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:stackwallet/db/hive/db.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart'; import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/providers/global/debug_service_provider.dart'; import 'package:stackwallet/providers/global/debug_service_provider.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/onetime_popups/tor_has_been_add_dialog.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
class HiddenSettings extends StatelessWidget { class HiddenSettings extends StatelessWidget {
@ -32,9 +39,29 @@ class HiddenSettings extends StatelessWidget {
child: Scaffold( child: Scaffold(
backgroundColor: Theme.of(context).extension<StackColors>()!.background, backgroundColor: Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar( appBar: AppBar(
leading: Container(), leading: Util.isDesktop
? Padding(
padding: const EdgeInsets.all(8.0),
child: AppBarIconButton(
size: 32,
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
shadows: const [],
icon: SvgPicture.asset(
Assets.svg.arrowLeft,
width: 18,
height: 18,
color: Theme.of(context)
.extension<StackColors>()!
.topNavIconPrimary,
),
onPressed: Navigator.of(context).pop,
),
)
: Container(),
title: Text( title: Text(
"Not so secret anymore", "Dev options",
style: STextStyles.navBarTitle(context), style: STextStyles.navBarTitle(context),
), ),
), ),
@ -146,6 +173,48 @@ class HiddenSettings extends StatelessWidget {
), ),
); );
}), }),
const SizedBox(
height: 12,
),
Consumer(builder: (_, ref, __) {
return GestureDetector(
onTap: () async {
await showOneTimeTorHasBeenAddedDialogIfRequired(
context,
);
},
child: RoundedWhiteContainer(
child: Text(
"Test tor stacy popup",
style: STextStyles.button(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark),
),
),
);
}),
const SizedBox(
height: 12,
),
Consumer(builder: (_, ref, __) {
return GestureDetector(
onTap: () async {
final box = await Hive.openBox<bool>(
DB.boxNameOneTimeDialogsShown);
await box.clear();
},
child: RoundedWhiteContainer(
child: Text(
"Reset tor stacy popup",
style: STextStyles.button(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark),
),
),
);
}),
// const SizedBox( // const SizedBox(
// height: 12, // height: 12,
// ), // ),

View file

@ -225,11 +225,11 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
// Connect or disconnect when the user taps the status. // Connect or disconnect when the user taps the status.
switch (_status) { switch (_status) {
case TorConnectionStatus.disconnected: case TorConnectionStatus.disconnected:
await _connectTor(ref, context); await connectTor(ref, context);
break; break;
case TorConnectionStatus.connected: case TorConnectionStatus.connected:
await _disconnectTor(ref, context); await disconnectTor(ref, context);
break; break;
@ -246,9 +246,17 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
} }
} }
Future<void> _playConnecting() async { Future<void> _playPlug() async {
await _play( await _play(
from: "connecting-start", from: "0.0",
to: "connecting-start",
repeat: false,
);
}
Future<void> _playConnecting({double? start}) async {
await _play(
from: start?.toString() ?? "connecting-start",
to: "connecting-end", to: "connecting-end",
repeat: true, repeat: true,
); );
@ -256,7 +264,7 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
Future<void> _playConnectingDone() async { Future<void> _playConnectingDone() async {
await _play( await _play(
from: "connecting-end", from: "${controller1.value}",
to: "connected-start", to: "connected-start",
repeat: false, repeat: false,
); );
@ -285,7 +293,7 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
required bool repeat, required bool repeat,
}) async { }) async {
final composition = await _completer.future; final composition = await _completer.future;
final start = composition.getMarker(from)!.start; final start = double.tryParse(from) ?? composition.getMarker(from)!.start;
final end = composition.getMarker(to)!.start; final end = composition.getMarker(to)!.start;
controller1.value = start; controller1.value = start;
@ -326,7 +334,6 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// TODO: modify size (waiting for updated onion lottie animation file)
final width = MediaQuery.of(context).size.width / 1.5; final width = MediaQuery.of(context).size.width / 1.5;
return TorSubscription( return TorSubscription(
@ -343,6 +350,7 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
break; break;
case TorConnectionStatus.connecting: case TorConnectionStatus.connecting:
await _playPlug();
await _playConnecting(); await _playConnecting();
break; break;
} }
@ -435,11 +443,11 @@ class _TorButtonState extends ConsumerState<TorButton> {
// Connect or disconnect when the user taps the status. // Connect or disconnect when the user taps the status.
switch (_status) { switch (_status) {
case TorConnectionStatus.disconnected: case TorConnectionStatus.disconnected:
await _connectTor(ref, context); await connectTor(ref, context);
break; break;
case TorConnectionStatus.connected: case TorConnectionStatus.connected:
await _disconnectTor(ref, context); await disconnectTor(ref, context);
break; break;
@ -583,7 +591,7 @@ class _UpperCaseTorTextState extends ConsumerState<UpperCaseTorText> {
/// Throws an exception if the Tor service fails to start. /// Throws an exception if the Tor service fails to start.
/// ///
/// Returns a Future that completes when the Tor service has started. /// Returns a Future that completes when the Tor service has started.
Future<void> _connectTor(WidgetRef ref, BuildContext context) async { Future<void> connectTor(WidgetRef ref, BuildContext context) async {
try { try {
// Init the Tor service if it hasn't already been. // Init the Tor service if it hasn't already been.
final torDir = await StackFileSystem.applicationTorDirectory(); final torDir = await StackFileSystem.applicationTorDirectory();
@ -600,8 +608,6 @@ Future<void> _connectTor(WidgetRef ref, BuildContext context) async {
); );
// TODO: show dialog with error message // TODO: show dialog with error message
} }
return;
} }
/// Disconnect from the Tor network. /// Disconnect from the Tor network.
@ -611,7 +617,7 @@ Future<void> _connectTor(WidgetRef ref, BuildContext context) async {
/// Throws an exception if the Tor service fails to stop. /// Throws an exception if the Tor service fails to stop.
/// ///
/// Returns a Future that completes when the Tor service has stopped. /// Returns a Future that completes when the Tor service has stopped.
Future<void> _disconnectTor(WidgetRef ref, BuildContext context) async { Future<void> disconnectTor(WidgetRef ref, BuildContext context) async {
// Stop the Tor service. // Stop the Tor service.
try { try {
await ref.read(pTorService).disable(); await ref.read(pTorService).disable();

View file

@ -16,6 +16,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart'; import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart';
import 'package:stackwallet/pages/settings_views/sub_widgets/nodes_list.dart'; import 'package:stackwallet/pages/settings_views/sub_widgets/nodes_list.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/confirm_full_rescan.dart'; import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/confirm_full_rescan.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/rescanning_dialog.dart'; import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/rescanning_dialog.dart';
@ -35,8 +36,6 @@ import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/stack_file_system.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/animated_text.dart'; import 'package:stackwallet/widgets/animated_text.dart';
@ -100,6 +99,26 @@ class _WalletNetworkSettingsViewState
/// The current status of the Tor connection. /// The current status of the Tor connection.
late TorConnectionStatus _torConnectionStatus; late TorConnectionStatus _torConnectionStatus;
bool _buttonLockTor = false;
Future<void> onTorTapped() async {
if (_buttonLockTor) {
return;
}
_buttonLockTor = true;
try {
if (ref.read(prefsChangeNotifierProvider).useTor) {
await disconnectTor(ref, context);
} else {
await connectTor(ref, context);
}
} catch (_) {
// Nothing. Just using finally to ensure button lock is reset in case
// some unexpected error happens
} finally {
_buttonLockTor = false;
}
}
Future<void> _attemptRescan() async { Future<void> _attemptRescan() async {
if (!Platform.isLinux) await Wakelock.enable(); if (!Platform.isLinux) await Wakelock.enable();
@ -477,17 +496,14 @@ class _WalletNetworkSettingsViewState
? STextStyles.desktopTextExtraExtraSmall(context) ? STextStyles.desktopTextExtraExtraSmall(context)
: STextStyles.smallMed12(context), : STextStyles.smallMed12(context),
), ),
GestureDetector( CustomTextButton(
text: "Resync",
onTap: () { onTap: () {
ref ref
.read(walletsChangeNotifierProvider) .read(walletsChangeNotifierProvider)
.getManager(widget.walletId) .getManager(widget.walletId)
.refresh(); .refresh();
}, },
child: Text(
"Resync",
style: STextStyles.link2(context),
),
), ),
], ],
), ),
@ -769,54 +785,12 @@ class _WalletNetworkSettingsViewState
? STextStyles.desktopTextExtraExtraSmall(context) ? STextStyles.desktopTextExtraExtraSmall(context)
: STextStyles.smallMed12(context), : STextStyles.smallMed12(context),
), ),
if (ref.watch( CustomTextButton(
prefsChangeNotifierProvider.select((value) => value.useTor))) text: ref.watch(prefsChangeNotifierProvider
GestureDetector( .select((value) => value.useTor))
onTap: () async { ? "Disconnect"
// Stop the Tor service. : "Connect",
try { onTap: onTorTapped,
await ref.read(pTorService).disable();
// Toggle the useTor preference on success.
ref.read(prefsChangeNotifierProvider).useTor = false;
} catch (e, s) {
Logging.instance.log(
"Error stopping tor: $e\n$s",
level: LogLevel.Error,
);
}
},
child: Text(
"Disconnect",
style: STextStyles.link2(context),
),
),
if (!ref.watch(
prefsChangeNotifierProvider.select((value) => value.useTor)))
GestureDetector(
onTap: () async {
try {
// Init the Tor service if it hasn't already been.
final torDir =
await StackFileSystem.applicationTorDirectory();
ref.read(pTorService).init(torDataDirPath: torDir.path);
// Start the Tor service.
await ref.read(pTorService).start();
// Toggle the useTor preference on success.
ref.read(prefsChangeNotifierProvider).useTor = true;
} catch (e, s) {
Logging.instance.log(
"Error starting tor: $e\n$s",
level: LogLevel.Error,
);
// TODO: show dialog with error message
}
},
child: Text(
"Connect",
style: STextStyles.link2(context),
),
), ),
], ],
), ),

View file

@ -47,7 +47,7 @@ class TxIcon extends ConsumerWidget {
if (isReceived) { if (isReceived) {
if (isCancelled) { if (isCancelled) {
return assets.receive; return assets.receiveCancelled;
} }
if (isPending) { if (isPending) {
return assets.receivePending; return assets.receivePending;

View file

@ -30,6 +30,7 @@ import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart'; import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/onetime_popups/tor_has_been_add_dialog.dart';
final currentWalletIdProvider = StateProvider<String?>((_) => null); final currentWalletIdProvider = StateProvider<String?>((_) => null);
@ -53,6 +54,11 @@ class _DesktopHomeViewState extends ConsumerState<DesktopHomeView> {
onGenerateRoute: RouteGenerator.generateRoute, onGenerateRoute: RouteGenerator.generateRoute,
initialRoute: MyStackView.routeName, initialRoute: MyStackView.routeName,
); );
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
showOneTimeTorHasBeenAddedDialogIfRequired(context);
});
super.initState(); super.initState();
} }

View file

@ -13,11 +13,13 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/hidden_settings.dart';
import 'package:stackwallet/pages/wallets_view/sub_widgets/empty_wallets.dart'; import 'package:stackwallet/pages/wallets_view/sub_widgets/empty_wallets.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/my_wallets.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/my_wallets.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart'; import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/themes/theme_providers.dart'; import 'package:stackwallet/themes/theme_providers.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/widgets/animated_widgets/rotate_icon.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart'; import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
@ -52,17 +54,62 @@ class _MyStackViewState extends ConsumerState<MyStackView> {
} }
} }
class DesktopMyStackTitle extends ConsumerWidget { class DesktopMyStackTitle extends ConsumerStatefulWidget {
const DesktopMyStackTitle({Key? key}) : super(key: key); const DesktopMyStackTitle({super.key});
@override @override
Widget build(BuildContext context, WidgetRef ref) { ConsumerState<DesktopMyStackTitle> createState() =>
_DesktopMyStackTitleState();
}
class _DesktopMyStackTitleState extends ConsumerState<DesktopMyStackTitle> {
late final RotateIconController _rotateIconController;
DateTime _hiddenTime = DateTime.now();
int _hiddenCount = 0;
void _hiddenOptions() {
_rotateIconController.reset?.call();
_rotateIconController.forward?.call();
if (_hiddenCount == 5) {
Navigator.of(context).pushNamed(HiddenSettings.routeName);
}
final now = DateTime.now();
const timeout = Duration(seconds: 1);
if (now.difference(_hiddenTime) < timeout) {
_hiddenCount++;
} else {
_hiddenCount = 0;
}
_hiddenTime = now;
}
@override
void initState() {
_rotateIconController = RotateIconController();
super.initState();
}
@override
dispose() {
_rotateIconController.forward = null;
_rotateIconController.reverse = null;
_rotateIconController.reset = null;
super.dispose();
}
@override
Widget build(BuildContext context) {
return Row( return Row(
children: [ children: [
const SizedBox( const SizedBox(
width: 24, width: 24,
), ),
SizedBox( GestureDetector(
onTap: _hiddenOptions,
child: RotateIcon(
icon: SizedBox(
width: 32, width: 32,
height: 32, height: 32,
child: SvgPicture.file( child: SvgPicture.file(
@ -75,6 +122,11 @@ class DesktopMyStackTitle extends ConsumerWidget {
), ),
), ),
), ),
curve: Curves.easeInOutCubic,
rotationPercent: 1.0,
controller: _rotateIconController,
),
),
const SizedBox( const SizedBox(
width: 12, width: 12,
), ),

View file

@ -21,6 +21,7 @@ abstract class Assets {
static const socials = _SOCIALS(); static const socials = _SOCIALS();
static const exchange = _EXCHANGE(); static const exchange = _EXCHANGE();
static const buy = _BUY(); static const buy = _BUY();
static const gif = _GIF();
} }
class _SOCIALS { class _SOCIALS {
@ -264,3 +265,9 @@ class _ANIMATIONS {
String get arrowRotate => "assets/lottie/arrow_rotate.json"; String get arrowRotate => "assets/lottie/arrow_rotate.json";
String get onionTor => "assets/lottie/onion_animation.json"; String get onionTor => "assets/lottie/onion_animation.json";
} }
class _GIF {
const _GIF();
String get stacyOnion => "assets/gif/stacy_onion.gif";
}

View file

@ -120,7 +120,10 @@ class _DesktopTorStatusButtonState extends ConsumerState<DesktopTorStatusButton>
.extension<StackColors>()! .extension<StackColors>()!
.getDesktopMenuButtonStyle(context), .getDesktopMenuButtonStyle(context),
onPressed: widget.onPressed, onPressed: widget.onPressed,
child: Padding( child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
vertical: 16, vertical: 16,
), ),
@ -144,9 +147,8 @@ class _DesktopTorStatusButtonState extends ConsumerState<DesktopTorStatusButton>
sizeFactor: animationController, sizeFactor: animationController,
axis: Axis.horizontal, axis: Axis.horizontal,
axisAlignment: -1, axisAlignment: -1,
child: SizedBox(
width: labelLength,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
const SizedBox( const SizedBox(
width: 12, width: 12,
@ -157,14 +159,18 @@ class _DesktopTorStatusButtonState extends ConsumerState<DesktopTorStatusButton>
color: _color(_torConnectionStatus), color: _color(_torConnectionStatus),
), ),
), ),
], const SizedBox(
width: 21,
), ),
],
), ),
), ),
), ),
], ],
), ),
), ),
],
),
); );
} }
} }

View file

@ -0,0 +1,177 @@
import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:stackwallet/db/hive/db.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
const _kOneTimeTorHasBeenAddedDialogWasShown =
"oneTimeTorHasBeenAddedDialogWasShown";
Future<void> showOneTimeTorHasBeenAddedDialogIfRequired(
BuildContext context) async {
final box = await Hive.openBox<bool>(DB.boxNameOneTimeDialogsShown);
if (!box.get(
_kOneTimeTorHasBeenAddedDialogWasShown,
defaultValue: false,
)! &&
context.mounted) {
await showDialog<void>(
context: context,
barrierDismissible: false,
builder: (_) => const _TorHasBeenAddedDialog(),
);
}
}
class _TorHasBeenAddedDialog extends StatefulWidget {
const _TorHasBeenAddedDialog({super.key});
@override
State<_TorHasBeenAddedDialog> createState() => _TorHasBeenAddedDialogState();
}
class _TorHasBeenAddedDialogState extends State<_TorHasBeenAddedDialog> {
bool _lock = false;
void setDoNotShowAgain() async {
if (_lock) {
return;
}
_lock = true;
try {
final box = await Hive.openBox<bool>(DB.boxNameOneTimeDialogsShown);
await box.put(_kOneTimeTorHasBeenAddedDialogWasShown, true);
} catch (_) {
//
} finally {
_lock = false;
}
}
@override
Widget build(BuildContext context) {
return ConditionalParent(
condition: Util.isDesktop,
builder: (child) => DesktopDialog(
maxHeight: double.infinity,
maxWidth: 450,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(left: 32),
child: Text(
"",
style: STextStyles.desktopH3(context),
),
),
DesktopDialogCloseButton(
onPressedOverride: () {
setDoNotShowAgain();
Navigator.of(context).pop();
},
),
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: child,
),
Padding(
padding: const EdgeInsets.all(32),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
PrimaryButton(
buttonHeight: ButtonHeight.l,
width: 180,
label: "Ok",
onPressed: () {
setDoNotShowAgain();
Navigator.of(context).pop();
},
),
],
),
)
],
),
),
child: ConditionalParent(
condition: !Util.isDesktop,
builder: (child) => StackDialogBase(
child: Column(
children: [
child,
const SizedBox(
height: 28,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: MediaQuery.of(context).size.width / 2,
child: PrimaryButton(
label: "Ok",
onPressed: () {
setDoNotShowAgain();
Navigator.of(context).pop();
},
),
),
],
),
],
),
),
child: Column(
children: [
const StacyOnion(),
SizedBox(
height: Util.isDesktop ? 24 : 16,
),
Text(
"Tor has been added to help keep your connections private and secure!",
style: Util.isDesktop
? STextStyles.desktopTextMedium(context)
: STextStyles.smallMed14(context),
),
SizedBox(
height: Util.isDesktop ? 24 : 16,
),
Text(
"Note: Tor does NOT yet work for Monero or Epic Cash wallets. "
"Opening one of these will leak your IP address.",
style: Util.isDesktop
? STextStyles.desktopTextMedium(context)
: STextStyles.smallMed14(context),
),
],
),
),
);
}
}
class StacyOnion extends StatelessWidget {
const StacyOnion({super.key});
@override
Widget build(BuildContext context) {
return Image(
height: 200,
image: AssetImage(
Assets.gif.stacyOnion,
),
);
}
}

View file

@ -1663,8 +1663,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "."
ref: "7123505a9e5f702dba1c0c9aa12b289b5dfbb3bf" ref: c8b97bc118c7bbfe1027d0442cfadea44dc285aa
resolved-ref: "7123505a9e5f702dba1c0c9aa12b289b5dfbb3bf" resolved-ref: c8b97bc118c7bbfe1027d0442cfadea44dc285aa
url: "https://github.com/cypherstack/tor.git" url: "https://github.com/cypherstack/tor.git"
source: git source: git
version: "0.0.1" version: "0.0.1"

View file

@ -11,7 +11,7 @@ description: Stack Wallet
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.7.20+188 version: 1.8.0+190
environment: environment:
sdk: ">=3.0.2 <4.0.0" sdk: ">=3.0.2 <4.0.0"
@ -60,7 +60,7 @@ dependencies:
tor_ffi_plugin: tor_ffi_plugin:
git: git:
url: https://github.com/cypherstack/tor.git url: https://github.com/cypherstack/tor.git
ref: 7123505a9e5f702dba1c0c9aa12b289b5dfbb3bf ref: c8b97bc118c7bbfe1027d0442cfadea44dc285aa
# Utility plugins # Utility plugins
http: ^0.13.0 http: ^0.13.0
@ -378,6 +378,9 @@ flutter:
# buy # buy
- assets/svg/buy/ - assets/svg/buy/
# gif
- assets/gif/
# lottie animations # lottie animations
# basic # basic
- assets/lottie/test2.json - assets/lottie/test2.json

View file

@ -1,5 +1,11 @@
#!/bin/bash #!/bin/bash
set -e
# libepiccash requires old rust
source ../rust_version.sh
set_rust_to_1671
mkdir build mkdir build
. ./config.sh . ./config.sh
./install_ndk.sh ./install_ndk.sh
@ -10,3 +16,7 @@ mkdir build
wait wait
echo "Done building" echo "Done building"
# set rust (back) to a more recent stable release to allow stack wallet to build tor
set_rust_to_1720

View file

@ -1,8 +1,25 @@
#!/bin/bash #!/bin/bash
set -e
# libepiccash requires old rust
source ../rust_version.sh
set_rust_to_1671
# ensure ios rust triples are there
rustup target add aarch64-apple-ios
rustup target add x86_64-apple-ios
(cd ../../crypto_plugins/flutter_liblelantus/scripts/ios && ./build_all.sh ) & (cd ../../crypto_plugins/flutter_liblelantus/scripts/ios && ./build_all.sh ) &
(cd ../../crypto_plugins/flutter_libepiccash/scripts/ios && ./build_all.sh ) & (cd ../../crypto_plugins/flutter_libepiccash/scripts/ios && ./build_all.sh ) &
(cd ../../crypto_plugins/flutter_libmonero/scripts/ios/ && ./build_all.sh ) & (cd ../../crypto_plugins/flutter_libmonero/scripts/ios/ && ./build_all.sh ) &
wait wait
echo "Done building" echo "Done building"
# set rust (back) to a more recent stable release to allow stack wallet to build tor
set_rust_to_1720
# ensure ios rust triples are there
rustup target add aarch64-apple-ios
rustup target add x86_64-apple-ios

View file

@ -1,5 +1,11 @@
#!/bin/bash #!/bin/bash
set -e
# libepiccash requires old rust
source ../rust_version.sh
set_rust_to_1671
# for arm # for arm
# flutter-elinux clean # flutter-elinux clean
# flutter-elinux pub get # flutter-elinux pub get
@ -12,3 +18,7 @@ mkdir -p build
wait wait
echo "Done building" echo "Done building"
# set rust (back) to a more recent stable release to allow stack wallet to build tor
set_rust_to_1720

View file

@ -1,8 +1,17 @@
#!/bin/bash #!/bin/bash
set -e
# libepiccash requires old rust
source ../rust_version.sh
set_rust_to_1671
(cd ../../crypto_plugins/flutter_liblelantus/scripts/macos && ./build_all.sh ) & (cd ../../crypto_plugins/flutter_liblelantus/scripts/macos && ./build_all.sh ) &
(cd ../../crypto_plugins/flutter_libepiccash/scripts/macos && ./build_all.sh ) & (cd ../../crypto_plugins/flutter_libepiccash/scripts/macos && ./build_all.sh ) &
(cd ../../crypto_plugins/flutter_libmonero/scripts/macos/ && ./build_all.sh ) & (cd ../../crypto_plugins/flutter_libmonero/scripts/macos/ && ./build_all.sh ) &
wait wait
echo "Done building" echo "Done building"
# set rust (back) to a more recent stable release to allow stack wallet to build tor
set_rust_to_1720

19
scripts/rust_version.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
set_rust_to_1671() {
if rustup toolchain list | grep -q "1.67.1"; then
rustup default 1.67.1
else
echo "Rust version 1.67.1 is not installed. Please install it using 'rustup install 1.67.1'." >&2
exit 1
fi
}
set_rust_to_1720() {
if rustup toolchain list | grep -q "1.72.0"; then
rustup default 1.72.0
else
echo "Rust version 1.72.0 is not installed. Please install it using 'rustup install 1.72.0'." >&2
exit 1
fi
}

View file

@ -1,9 +1,18 @@
#!/bin/bash #!/bin/bash
set -e
# libepiccash requires old rust
source ../rust_version.sh
set_rust_to_1671
mkdir -p build mkdir -p build
(cd ../../crypto_plugins/flutter_libepiccash/scripts/windows && ./build_all.sh ) & (cd ../../crypto_plugins/flutter_libepiccash/scripts/windows && ./build_all.sh ) &
(cd ../../crypto_plugins/flutter_liblelantus/scripts/windows && ./build_all.sh ) & (cd ../../crypto_plugins/flutter_liblelantus/scripts/windows && ./build_all.sh ) &
# (cd ../../crypto_plugins/flutter_libmonero/scripts/windows && ./build_all.sh) & (cd ../../crypto_plugins/flutter_libmonero/scripts/windows && ./build_all.sh) &
wait wait
echo "Done building" echo "Done building"
# set rust (back) to a more recent stable release to allow stack wallet to build tor
set_rust_to_1720

View file

@ -20,6 +20,13 @@ add_executable(${BINARY_NAME} WIN32
# that need different build settings. # that need different build settings.
apply_standard_settings(${BINARY_NAME}) apply_standard_settings(${BINARY_NAME})
# Add preprocessor definitions for the build version.
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
# Disable Windows macros that collide with C++ standard library functions. # Disable Windows macros that collide with C++ standard library functions.
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")

View file

@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
// Version // Version
// //
#ifdef FLUTTER_BUILD_NUMBER #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
#else #else
#define VERSION_AS_NUMBER 1,0,0 #define VERSION_AS_NUMBER 1,0,0,0
#endif #endif
#ifdef FLUTTER_BUILD_NAME #if defined(FLUTTER_VERSION)
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME #define VERSION_AS_STRING FLUTTER_VERSION
#else #else
#define VERSION_AS_STRING "1.0.0" #define VERSION_AS_STRING "1.0.0"
#endif #endif