mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 19:39:22 +00:00
Merge branch 'staging' into fusion
This commit is contained in:
commit
f17c6a0875
23 changed files with 521 additions and 148 deletions
BIN
assets/gif/stacy_onion.gif
Normal file
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
|
|
@ -46,6 +46,7 @@ class DB {
|
|||
// in use (keep for now)
|
||||
static const String boxNameDBInfo = "dbInfo";
|
||||
static const String boxNamePrefs = "prefs";
|
||||
static const String boxNameOneTimeDialogsShown = "oneTimeDialogsShown";
|
||||
|
||||
String _boxNameTxCache({required Coin coin}) => "${coin.name}_txCache";
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ 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/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/stack_dialog.dart';
|
||||
|
||||
|
@ -129,19 +130,9 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
|||
|
||||
ref.read(notificationsProvider).startCheckingWatchedNotifications();
|
||||
|
||||
/// todo change to watch tor network
|
||||
// if (ref.read(managerProvider).isRefreshing) {
|
||||
// _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;
|
||||
// }
|
||||
// }
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
showOneTimeTorHasBeenAddedDialogIfRequired(context);
|
||||
});
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
|
|
@ -12,13 +12,20 @@ import 'dart:async';
|
|||
|
||||
import 'package:flutter/material.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/providers/global/debug_service_provider.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.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';
|
||||
|
||||
class HiddenSettings extends StatelessWidget {
|
||||
|
@ -32,9 +39,29 @@ class HiddenSettings extends StatelessWidget {
|
|||
child: Scaffold(
|
||||
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
||||
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(
|
||||
"Not so secret anymore",
|
||||
"Dev options",
|
||||
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(
|
||||
// height: 12,
|
||||
// ),
|
||||
|
|
|
@ -225,11 +225,11 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
|
|||
// Connect or disconnect when the user taps the status.
|
||||
switch (_status) {
|
||||
case TorConnectionStatus.disconnected:
|
||||
await _connectTor(ref, context);
|
||||
await connectTor(ref, context);
|
||||
break;
|
||||
|
||||
case TorConnectionStatus.connected:
|
||||
await _disconnectTor(ref, context);
|
||||
await disconnectTor(ref, context);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -246,9 +246,17 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _playConnecting() async {
|
||||
Future<void> _playPlug() async {
|
||||
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",
|
||||
repeat: true,
|
||||
);
|
||||
|
@ -256,7 +264,7 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
|
|||
|
||||
Future<void> _playConnectingDone() async {
|
||||
await _play(
|
||||
from: "connecting-end",
|
||||
from: "${controller1.value}",
|
||||
to: "connected-start",
|
||||
repeat: false,
|
||||
);
|
||||
|
@ -285,7 +293,7 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
|
|||
required bool repeat,
|
||||
}) async {
|
||||
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;
|
||||
|
||||
controller1.value = start;
|
||||
|
@ -326,7 +334,6 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: modify size (waiting for updated onion lottie animation file)
|
||||
final width = MediaQuery.of(context).size.width / 1.5;
|
||||
|
||||
return TorSubscription(
|
||||
|
@ -343,6 +350,7 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
|
|||
break;
|
||||
|
||||
case TorConnectionStatus.connecting:
|
||||
await _playPlug();
|
||||
await _playConnecting();
|
||||
break;
|
||||
}
|
||||
|
@ -435,11 +443,11 @@ class _TorButtonState extends ConsumerState<TorButton> {
|
|||
// Connect or disconnect when the user taps the status.
|
||||
switch (_status) {
|
||||
case TorConnectionStatus.disconnected:
|
||||
await _connectTor(ref, context);
|
||||
await connectTor(ref, context);
|
||||
break;
|
||||
|
||||
case TorConnectionStatus.connected:
|
||||
await _disconnectTor(ref, context);
|
||||
await disconnectTor(ref, context);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -583,7 +591,7 @@ class _UpperCaseTorTextState extends ConsumerState<UpperCaseTorText> {
|
|||
/// Throws an exception if the Tor service fails to start.
|
||||
///
|
||||
/// 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 {
|
||||
// Init the Tor service if it hasn't already been.
|
||||
final torDir = await StackFileSystem.applicationTorDirectory();
|
||||
|
@ -600,8 +608,6 @@ Future<void> _connectTor(WidgetRef ref, BuildContext context) async {
|
|||
);
|
||||
// TODO: show dialog with error message
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/// 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.
|
||||
///
|
||||
/// 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.
|
||||
try {
|
||||
await ref.read(pTorService).disable();
|
||||
|
|
|
@ -16,6 +16,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.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/tor_settings/tor_settings_view.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/rescanning_dialog.dart';
|
||||
|
@ -35,8 +36,6 @@ import 'package:stackwallet/themes/stack_colors.dart';
|
|||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.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/util.dart';
|
||||
import 'package:stackwallet/widgets/animated_text.dart';
|
||||
|
@ -100,6 +99,26 @@ class _WalletNetworkSettingsViewState
|
|||
/// The current status of the Tor connection.
|
||||
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 {
|
||||
if (!Platform.isLinux) await Wakelock.enable();
|
||||
|
||||
|
@ -477,17 +496,14 @@ class _WalletNetworkSettingsViewState
|
|||
? STextStyles.desktopTextExtraExtraSmall(context)
|
||||
: STextStyles.smallMed12(context),
|
||||
),
|
||||
GestureDetector(
|
||||
CustomTextButton(
|
||||
text: "Resync",
|
||||
onTap: () {
|
||||
ref
|
||||
.read(walletsChangeNotifierProvider)
|
||||
.getManager(widget.walletId)
|
||||
.refresh();
|
||||
},
|
||||
child: Text(
|
||||
"Resync",
|
||||
style: STextStyles.link2(context),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -769,55 +785,13 @@ class _WalletNetworkSettingsViewState
|
|||
? STextStyles.desktopTextExtraExtraSmall(context)
|
||||
: STextStyles.smallMed12(context),
|
||||
),
|
||||
if (ref.watch(
|
||||
prefsChangeNotifierProvider.select((value) => value.useTor)))
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
// Stop the Tor service.
|
||||
try {
|
||||
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),
|
||||
),
|
||||
),
|
||||
CustomTextButton(
|
||||
text: ref.watch(prefsChangeNotifierProvider
|
||||
.select((value) => value.useTor))
|
||||
? "Disconnect"
|
||||
: "Connect",
|
||||
onTap: onTorTapped,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
|
|
|
@ -47,7 +47,7 @@ class TxIcon extends ConsumerWidget {
|
|||
|
||||
if (isReceived) {
|
||||
if (isCancelled) {
|
||||
return assets.receive;
|
||||
return assets.receiveCancelled;
|
||||
}
|
||||
if (isPending) {
|
||||
return assets.receivePending;
|
||||
|
|
|
@ -30,6 +30,7 @@ import 'package:stackwallet/route_generator.dart';
|
|||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
import 'package:stackwallet/widgets/onetime_popups/tor_has_been_add_dialog.dart';
|
||||
|
||||
final currentWalletIdProvider = StateProvider<String?>((_) => null);
|
||||
|
||||
|
@ -53,6 +54,11 @@ class _DesktopHomeViewState extends ConsumerState<DesktopHomeView> {
|
|||
onGenerateRoute: RouteGenerator.generateRoute,
|
||||
initialRoute: MyStackView.routeName,
|
||||
);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
showOneTimeTorHasBeenAddedDialogIfRequired(context);
|
||||
});
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,11 +13,13 @@ import 'dart:io';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.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_desktop_specific/my_stack_view/my_wallets.dart';
|
||||
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.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/desktop/desktop_app_bar.dart';
|
||||
|
||||
|
@ -52,27 +54,77 @@ class _MyStackViewState extends ConsumerState<MyStackView> {
|
|||
}
|
||||
}
|
||||
|
||||
class DesktopMyStackTitle extends ConsumerWidget {
|
||||
const DesktopMyStackTitle({Key? key}) : super(key: key);
|
||||
class DesktopMyStackTitle extends ConsumerStatefulWidget {
|
||||
const DesktopMyStackTitle({super.key});
|
||||
|
||||
@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(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 24,
|
||||
),
|
||||
SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: SvgPicture.file(
|
||||
File(
|
||||
ref.watch(
|
||||
themeProvider.select(
|
||||
(value) => value.assets.stackIcon,
|
||||
GestureDetector(
|
||||
onTap: _hiddenOptions,
|
||||
child: RotateIcon(
|
||||
icon: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: SvgPicture.file(
|
||||
File(
|
||||
ref.watch(
|
||||
themeProvider.select(
|
||||
(value) => value.assets.stackIcon,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
curve: Curves.easeInOutCubic,
|
||||
rotationPercent: 1.0,
|
||||
controller: _rotateIconController,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
|
|
|
@ -21,6 +21,7 @@ abstract class Assets {
|
|||
static const socials = _SOCIALS();
|
||||
static const exchange = _EXCHANGE();
|
||||
static const buy = _BUY();
|
||||
static const gif = _GIF();
|
||||
}
|
||||
|
||||
class _SOCIALS {
|
||||
|
@ -264,3 +265,9 @@ class _ANIMATIONS {
|
|||
String get arrowRotate => "assets/lottie/arrow_rotate.json";
|
||||
String get onionTor => "assets/lottie/onion_animation.json";
|
||||
}
|
||||
|
||||
class _GIF {
|
||||
const _GIF();
|
||||
|
||||
String get stacyOnion => "assets/gif/stacy_onion.gif";
|
||||
}
|
||||
|
|
|
@ -120,50 +120,56 @@ class _DesktopTorStatusButtonState extends ConsumerState<DesktopTorStatusButton>
|
|||
.extension<StackColors>()!
|
||||
.getDesktopMenuButtonStyle(context),
|
||||
onPressed: widget.onPressed,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 16,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: widget.transitionDuration,
|
||||
width: _iconOnly ? 0 : 16,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 16,
|
||||
),
|
||||
SvgPicture.asset(
|
||||
Assets.svg.tor,
|
||||
color: _color(_torConnectionStatus),
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
AnimatedOpacity(
|
||||
duration: widget.transitionDuration,
|
||||
opacity: _iconOnly ? 0 : 1.0,
|
||||
child: SizeTransition(
|
||||
sizeFactor: animationController,
|
||||
axis: Axis.horizontal,
|
||||
axisAlignment: -1,
|
||||
child: SizedBox(
|
||||
width: labelLength,
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Text(
|
||||
_torConnectionStatus.name.capitalize(),
|
||||
style: STextStyles.smallMed12(context).copyWith(
|
||||
color: _color(_torConnectionStatus),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: widget.transitionDuration,
|
||||
width: _iconOnly ? 0 : 16,
|
||||
),
|
||||
SvgPicture.asset(
|
||||
Assets.svg.tor,
|
||||
color: _color(_torConnectionStatus),
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
AnimatedOpacity(
|
||||
duration: widget.transitionDuration,
|
||||
opacity: _iconOnly ? 0 : 1.0,
|
||||
child: SizeTransition(
|
||||
sizeFactor: animationController,
|
||||
axis: Axis.horizontal,
|
||||
axisAlignment: -1,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
Text(
|
||||
_torConnectionStatus.name.capitalize(),
|
||||
style: STextStyles.smallMed12(context).copyWith(
|
||||
color: _color(_torConnectionStatus),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 21,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
177
lib/widgets/onetime_popups/tor_has_been_add_dialog.dart
Normal file
177
lib/widgets/onetime_popups/tor_has_been_add_dialog.dart
Normal 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,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1663,8 +1663,8 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: "7123505a9e5f702dba1c0c9aa12b289b5dfbb3bf"
|
||||
resolved-ref: "7123505a9e5f702dba1c0c9aa12b289b5dfbb3bf"
|
||||
ref: c8b97bc118c7bbfe1027d0442cfadea44dc285aa
|
||||
resolved-ref: c8b97bc118c7bbfe1027d0442cfadea44dc285aa
|
||||
url: "https://github.com/cypherstack/tor.git"
|
||||
source: git
|
||||
version: "0.0.1"
|
||||
|
|
|
@ -11,7 +11,7 @@ description: Stack Wallet
|
|||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
version: 1.7.20+188
|
||||
version: 1.8.0+190
|
||||
|
||||
environment:
|
||||
sdk: ">=3.0.2 <4.0.0"
|
||||
|
@ -60,7 +60,7 @@ dependencies:
|
|||
tor_ffi_plugin:
|
||||
git:
|
||||
url: https://github.com/cypherstack/tor.git
|
||||
ref: 7123505a9e5f702dba1c0c9aa12b289b5dfbb3bf
|
||||
ref: c8b97bc118c7bbfe1027d0442cfadea44dc285aa
|
||||
|
||||
# Utility plugins
|
||||
http: ^0.13.0
|
||||
|
@ -378,6 +378,9 @@ flutter:
|
|||
# buy
|
||||
- assets/svg/buy/
|
||||
|
||||
# gif
|
||||
- assets/gif/
|
||||
|
||||
# lottie animations
|
||||
# basic
|
||||
- assets/lottie/test2.json
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# libepiccash requires old rust
|
||||
source ../rust_version.sh
|
||||
set_rust_to_1671
|
||||
|
||||
mkdir build
|
||||
. ./config.sh
|
||||
./install_ndk.sh
|
||||
|
@ -10,3 +16,7 @@ mkdir build
|
|||
|
||||
wait
|
||||
echo "Done building"
|
||||
|
||||
# set rust (back) to a more recent stable release to allow stack wallet to build tor
|
||||
set_rust_to_1720
|
||||
|
||||
|
|
|
@ -1,8 +1,25 @@
|
|||
#!/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_libepiccash/scripts/ios && ./build_all.sh ) &
|
||||
(cd ../../crypto_plugins/flutter_libmonero/scripts/ios/ && ./build_all.sh ) &
|
||||
|
||||
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
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# libepiccash requires old rust
|
||||
source ../rust_version.sh
|
||||
set_rust_to_1671
|
||||
|
||||
# for arm
|
||||
# flutter-elinux clean
|
||||
# flutter-elinux pub get
|
||||
|
@ -12,3 +18,7 @@ mkdir -p build
|
|||
|
||||
wait
|
||||
echo "Done building"
|
||||
|
||||
# set rust (back) to a more recent stable release to allow stack wallet to build tor
|
||||
set_rust_to_1720
|
||||
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
#!/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_libepiccash/scripts/macos && ./build_all.sh ) &
|
||||
(cd ../../crypto_plugins/flutter_libmonero/scripts/macos/ && ./build_all.sh ) &
|
||||
|
||||
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
19
scripts/rust_version.sh
Executable 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
|
||||
}
|
|
@ -1,9 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# libepiccash requires old rust
|
||||
source ../rust_version.sh
|
||||
set_rust_to_1671
|
||||
|
||||
mkdir -p build
|
||||
(cd ../../crypto_plugins/flutter_libepiccash/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
|
||||
echo "Done building"
|
||||
|
||||
# set rust (back) to a more recent stable release to allow stack wallet to build tor
|
||||
set_rust_to_1720
|
||||
|
|
|
@ -20,6 +20,13 @@ add_executable(${BINARY_NAME} WIN32
|
|||
# that need different build settings.
|
||||
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.
|
||||
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
|
||||
|
||||
|
|
|
@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
|
|||
// Version
|
||||
//
|
||||
|
||||
#ifdef FLUTTER_BUILD_NUMBER
|
||||
#define VERSION_AS_NUMBER 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_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
|
||||
#else
|
||||
#define VERSION_AS_NUMBER 1,0,0
|
||||
#define VERSION_AS_NUMBER 1,0,0,0
|
||||
#endif
|
||||
|
||||
#ifdef FLUTTER_BUILD_NAME
|
||||
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
|
||||
#if defined(FLUTTER_VERSION)
|
||||
#define VERSION_AS_STRING FLUTTER_VERSION
|
||||
#else
|
||||
#define VERSION_AS_STRING "1.0.0"
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue