mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
Merge remote-tracking branch 'origin/arti' into fusion
This commit is contained in:
commit
ef43bc802d
10 changed files with 274 additions and 191 deletions
|
@ -34,7 +34,9 @@ if (keystorePropertiesFile.exists()) {
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 33
|
compileSdkVersion 33
|
||||||
|
|
||||||
ndkVersion = "21.1.6352462"
|
// ndkVersion = "21.1.6352462"
|
||||||
|
// ndkVersion = "25.2.9519653"
|
||||||
|
ndkVersion = "23.1.7779620"
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main.java.srcDirs += 'src/main/kotlin'
|
main.java.srcDirs += 'src/main/kotlin'
|
||||||
|
@ -49,7 +51,9 @@ android {
|
||||||
applicationId "com.cypherstack.stackwallet"
|
applicationId "com.cypherstack.stackwallet"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 33
|
targetSdkVersion 33
|
||||||
ndkVersion = "21.1.6352462"
|
// ndkVersion = "21.1.6352462"
|
||||||
|
// ndkVersion = "25.2.9519653"
|
||||||
|
ndkVersion = "23.1.7779620"
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.7.10'
|
ext.kotlin_version = '1.8.0'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.3.0'
|
classpath 'com.android.tools.build:gradle:7.3.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -75,7 +75,7 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
|
||||||
useSafeArea: false,
|
useSafeArea: false,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return const StackDialog(
|
return StackDialog(
|
||||||
title: "What is Tor?",
|
title: "What is Tor?",
|
||||||
message:
|
message:
|
||||||
"Short for \"The Onion Router\", is an open-source software that enables internet communication"
|
"Short for \"The Onion Router\", is an open-source software that enables internet communication"
|
||||||
|
@ -83,6 +83,7 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
|
||||||
" to obscure the origin and destination of data.",
|
" to obscure the origin and destination of data.",
|
||||||
rightButton: SecondaryButton(
|
rightButton: SecondaryButton(
|
||||||
label: "Close",
|
label: "Close",
|
||||||
|
onPressed: Navigator.of(context).pop,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -144,7 +145,7 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
|
||||||
useSafeArea: false,
|
useSafeArea: false,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return const StackDialog(
|
return StackDialog(
|
||||||
title: "What is Tor killswitch?",
|
title: "What is Tor killswitch?",
|
||||||
message:
|
message:
|
||||||
"A security feature that protects your information from accidental exposure by"
|
"A security feature that protects your information from accidental exposure by"
|
||||||
|
@ -152,6 +153,8 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
|
||||||
" connection is disrupted or compromised.",
|
" connection is disrupted or compromised.",
|
||||||
rightButton: SecondaryButton(
|
rightButton: SecondaryButton(
|
||||||
label: "Close",
|
label: "Close",
|
||||||
|
onPressed:
|
||||||
|
Navigator.of(context).pop,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -243,54 +246,31 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Color _color(
|
Future<void> _playConnecting() async {
|
||||||
TorConnectionStatus status,
|
|
||||||
StackColors colors,
|
|
||||||
) {
|
|
||||||
switch (status) {
|
|
||||||
case TorConnectionStatus.disconnected:
|
|
||||||
return colors.textSubtitle3;
|
|
||||||
|
|
||||||
case TorConnectionStatus.connected:
|
|
||||||
return colors.accentColorGreen;
|
|
||||||
|
|
||||||
case TorConnectionStatus.connecting:
|
|
||||||
return colors.accentColorYellow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String _label(
|
|
||||||
TorConnectionStatus status,
|
|
||||||
) {
|
|
||||||
switch (status) {
|
|
||||||
case TorConnectionStatus.disconnected:
|
|
||||||
return "CONNECT";
|
|
||||||
|
|
||||||
case TorConnectionStatus.connected:
|
|
||||||
return "STOP";
|
|
||||||
|
|
||||||
case TorConnectionStatus.connecting:
|
|
||||||
return "CONNECTING";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _playConnecting() async {
|
|
||||||
await _play(
|
await _play(
|
||||||
from: "connection-start",
|
from: "connecting-start",
|
||||||
to: "connection-end",
|
to: "connecting-end",
|
||||||
repeat: true,
|
repeat: true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _playConnected() async {
|
Future<void> _playConnectingDone() async {
|
||||||
await _play(
|
await _play(
|
||||||
from: "connection-end",
|
from: "connecting-end",
|
||||||
to: "disconnection-start",
|
to: "connected-start",
|
||||||
|
repeat: false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _playConnected() async {
|
||||||
|
await _play(
|
||||||
|
from: "connected-start",
|
||||||
|
to: "connected-end",
|
||||||
repeat: true,
|
repeat: true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _playDisconnect() async {
|
Future<void> _playDisconnect() async {
|
||||||
await _play(
|
await _play(
|
||||||
from: "disconnection-start",
|
from: "disconnection-start",
|
||||||
to: "disconnection-end",
|
to: "disconnection-end",
|
||||||
|
@ -308,6 +288,8 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
|
||||||
final start = composition.getMarker(from)!.start;
|
final start = composition.getMarker(from)!.start;
|
||||||
final end = composition.getMarker(to)!.start;
|
final end = composition.getMarker(to)!.start;
|
||||||
|
|
||||||
|
controller1.value = start;
|
||||||
|
|
||||||
if (repeat) {
|
if (repeat) {
|
||||||
await controller1.repeat(
|
await controller1.repeat(
|
||||||
min: start,
|
min: start,
|
||||||
|
@ -348,19 +330,20 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
|
||||||
final width = MediaQuery.of(context).size.width / 1.5;
|
final width = MediaQuery.of(context).size.width / 1.5;
|
||||||
|
|
||||||
return TorSubscription(
|
return TorSubscription(
|
||||||
onTorStatusChanged: (status) {
|
onTorStatusChanged: (status) async {
|
||||||
_status = status;
|
_status = status;
|
||||||
switch (_status) {
|
switch (_status) {
|
||||||
case TorConnectionStatus.disconnected:
|
case TorConnectionStatus.disconnected:
|
||||||
_playDisconnect();
|
await _playDisconnect();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TorConnectionStatus.connected:
|
case TorConnectionStatus.connected:
|
||||||
_playConnected();
|
await _playConnectingDone();
|
||||||
|
await _playConnected();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TorConnectionStatus.connecting:
|
case TorConnectionStatus.connecting:
|
||||||
_playConnecting();
|
await _playConnecting();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -381,21 +364,8 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
|
||||||
// height: width,
|
// height: width,
|
||||||
onLoaded: (composition) {
|
onLoaded: (composition) {
|
||||||
_completer.complete(composition);
|
_completer.complete(composition);
|
||||||
// setState(() {
|
|
||||||
controller1.duration = composition.duration;
|
controller1.duration = composition.duration;
|
||||||
|
|
||||||
// TODO: clean up (waiting for updated onion lottie animation file)
|
|
||||||
// });
|
|
||||||
print(
|
|
||||||
"=======================================================");
|
|
||||||
|
|
||||||
composition.markers.forEach((e) {
|
|
||||||
print(e.name);
|
|
||||||
});
|
|
||||||
print(
|
|
||||||
"=======================================================");
|
|
||||||
//
|
|
||||||
|
|
||||||
if (_status == TorConnectionStatus.connected) {
|
if (_status == TorConnectionStatus.connected) {
|
||||||
_playConnected();
|
_playConnected();
|
||||||
} else if (_status == TorConnectionStatus.connecting) {
|
} else if (_status == TorConnectionStatus.connecting) {
|
||||||
|
@ -404,19 +374,7 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
const UpperCaseTorText(),
|
||||||
_label(
|
|
||||||
_status,
|
|
||||||
),
|
|
||||||
style: STextStyles.pageTitleH2(
|
|
||||||
context,
|
|
||||||
).copyWith(
|
|
||||||
color: _color(
|
|
||||||
_status,
|
|
||||||
Theme.of(context).extension<StackColors>()!,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -546,6 +504,78 @@ class _TorButtonState extends ConsumerState<TorButton> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class UpperCaseTorText extends ConsumerStatefulWidget {
|
||||||
|
const UpperCaseTorText({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
ConsumerState<UpperCaseTorText> createState() => _UpperCaseTorTextState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _UpperCaseTorTextState extends ConsumerState<UpperCaseTorText> {
|
||||||
|
late TorConnectionStatus _status;
|
||||||
|
|
||||||
|
Color _color(
|
||||||
|
TorConnectionStatus status,
|
||||||
|
StackColors colors,
|
||||||
|
) {
|
||||||
|
switch (status) {
|
||||||
|
case TorConnectionStatus.disconnected:
|
||||||
|
return colors.textSubtitle3;
|
||||||
|
|
||||||
|
case TorConnectionStatus.connected:
|
||||||
|
return colors.accentColorGreen;
|
||||||
|
|
||||||
|
case TorConnectionStatus.connecting:
|
||||||
|
return colors.accentColorYellow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _label(
|
||||||
|
TorConnectionStatus status,
|
||||||
|
) {
|
||||||
|
switch (status) {
|
||||||
|
case TorConnectionStatus.disconnected:
|
||||||
|
return "CONNECT";
|
||||||
|
|
||||||
|
case TorConnectionStatus.connected:
|
||||||
|
return "STOP";
|
||||||
|
|
||||||
|
case TorConnectionStatus.connecting:
|
||||||
|
return "CONNECTING";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_status = ref.read(pTorService).status;
|
||||||
|
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return TorSubscription(
|
||||||
|
onTorStatusChanged: (status) {
|
||||||
|
setState(() {
|
||||||
|
_status = status;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
_label(
|
||||||
|
_status,
|
||||||
|
),
|
||||||
|
style: STextStyles.pageTitleH2(
|
||||||
|
context,
|
||||||
|
).copyWith(
|
||||||
|
color: _color(
|
||||||
|
_status,
|
||||||
|
Theme.of(context).extension<StackColors>()!,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Connect to the Tor network.
|
/// Connect to the Tor network.
|
||||||
///
|
///
|
||||||
/// This method is called when the user taps the "Connect" button.
|
/// This method is called when the user taps the "Connect" button.
|
||||||
|
|
|
@ -219,8 +219,21 @@ class _TorSettingsState extends ConsumerState<TorSettings> {
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.end,
|
MainAxisAlignment
|
||||||
|
.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(
|
||||||
|
left: 32,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
"What is Tor?",
|
||||||
|
style:
|
||||||
|
STextStyles.desktopH2(
|
||||||
|
context),
|
||||||
|
),
|
||||||
|
),
|
||||||
DesktopDialogCloseButton(
|
DesktopDialogCloseButton(
|
||||||
onPressedOverride: () =>
|
onPressedOverride: () =>
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
|
@ -229,34 +242,24 @@ class _TorSettingsState extends ConsumerState<TorSettings> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.only(
|
||||||
child: Column(
|
top: 12,
|
||||||
mainAxisSize: MainAxisSize.max,
|
left: 32,
|
||||||
children: [
|
bottom: 32,
|
||||||
Text(
|
right: 32,
|
||||||
"What is Tor?",
|
),
|
||||||
style:
|
child: Text(
|
||||||
STextStyles.desktopH2(
|
"Short for \"The Onion Router\", is an open-source software that enables internet communication"
|
||||||
context),
|
" to remain anonymous by routing internet traffic through a series of layered nodes,"
|
||||||
),
|
" to obscure the origin and destination of data.",
|
||||||
const SizedBox(
|
style: STextStyles
|
||||||
height: 20,
|
.desktopTextMedium(
|
||||||
),
|
context)
|
||||||
Text(
|
.copyWith(
|
||||||
"Short for \"The Onion Router\", is an open-source software that enables internet communication"
|
color: Theme.of(context)
|
||||||
" to remain anonymous by routing internet traffic through a series of layered nodes,"
|
.extension<StackColors>()!
|
||||||
" to obscure the origin and destination of data.",
|
.textDark3,
|
||||||
style: STextStyles
|
),
|
||||||
.desktopTextMedium(
|
|
||||||
context)
|
|
||||||
.copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<
|
|
||||||
StackColors>()!
|
|
||||||
.textDark3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -289,21 +292,25 @@ class _TorSettingsState extends ConsumerState<TorSettings> {
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
RichText(
|
Column(
|
||||||
textAlign: TextAlign.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
text: TextSpan(
|
children: [
|
||||||
children: [
|
Text(
|
||||||
TextSpan(
|
"Tor killswitch",
|
||||||
text: "Tor killswitch",
|
style: STextStyles.desktopTextExtraExtraSmall(
|
||||||
style: STextStyles.desktopTextExtraExtraSmall(
|
context)
|
||||||
context)
|
.copyWith(
|
||||||
.copyWith(
|
color: Theme.of(context)
|
||||||
color: Theme.of(context)
|
.extension<StackColors>()!
|
||||||
.extension<StackColors>()!
|
.textDark),
|
||||||
.textDark),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
TextSpan(
|
height: 8,
|
||||||
text: "\nWhat is Tor killswitch?",
|
),
|
||||||
|
RichText(
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
text: TextSpan(
|
||||||
|
text: "What is Tor killswitch?",
|
||||||
style: STextStyles.richLink(context).copyWith(
|
style: STextStyles.richLink(context).copyWith(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
|
@ -321,8 +328,20 @@ class _TorSettingsState extends ConsumerState<TorSettings> {
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.end,
|
MainAxisAlignment
|
||||||
|
.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(
|
||||||
|
left: 32,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
"What is Tor killswitch?",
|
||||||
|
style: STextStyles
|
||||||
|
.desktopH2(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
DesktopDialogCloseButton(
|
DesktopDialogCloseButton(
|
||||||
onPressedOverride: () =>
|
onPressedOverride: () =>
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
|
@ -332,35 +351,25 @@ class _TorSettingsState extends ConsumerState<TorSettings> {
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.all(20),
|
const EdgeInsets.only(
|
||||||
child: Column(
|
top: 12,
|
||||||
mainAxisSize:
|
left: 32,
|
||||||
MainAxisSize.max,
|
bottom: 32,
|
||||||
children: [
|
right: 32,
|
||||||
Text(
|
),
|
||||||
"What is Tor killswitch?",
|
child: Text(
|
||||||
style: STextStyles
|
"A security feature that protects your information from accidental exposure by"
|
||||||
.desktopH2(context),
|
" disconnecting your device from the Tor network if the"
|
||||||
),
|
" connection is disrupted or compromised.",
|
||||||
const SizedBox(
|
style: STextStyles
|
||||||
height: 20,
|
.desktopTextMedium(
|
||||||
),
|
context)
|
||||||
Text(
|
.copyWith(
|
||||||
"A security feature that protects your information from accidental exposure by"
|
color: Theme.of(context)
|
||||||
" disconnecting your device from the Tor network if the"
|
.extension<
|
||||||
" connection is disrupted or compromised.",
|
StackColors>()!
|
||||||
style: STextStyles
|
.textDark3,
|
||||||
.desktopTextMedium(
|
),
|
||||||
context)
|
|
||||||
.copyWith(
|
|
||||||
color: Theme.of(
|
|
||||||
context)
|
|
||||||
.extension<
|
|
||||||
StackColors>()!
|
|
||||||
.textDark3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -370,8 +379,8 @@ class _TorSettingsState extends ConsumerState<TorSettings> {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -1662,9 +1662,11 @@ packages:
|
||||||
tor_ffi_plugin:
|
tor_ffi_plugin:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "crypto_plugins/tor"
|
path: "."
|
||||||
relative: true
|
ref: "8a26a160bdc4dcac2ba5a0350a151a345d1dead9"
|
||||||
source: path
|
resolved-ref: "8a26a160bdc4dcac2ba5a0350a151a345d1dead9"
|
||||||
|
url: "https://github.com/cypherstack/tor.git"
|
||||||
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
tuple:
|
tuple:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
|
|
|
@ -58,7 +58,9 @@ dependencies:
|
||||||
ref: 081ca1863c2feba00c35bb5b297902f12f499941
|
ref: 081ca1863c2feba00c35bb5b297902f12f499941
|
||||||
|
|
||||||
tor_ffi_plugin:
|
tor_ffi_plugin:
|
||||||
path: ./crypto_plugins/tor
|
git:
|
||||||
|
url: https://github.com/cypherstack/tor.git
|
||||||
|
ref: 8a26a160bdc4dcac2ba5a0350a151a345d1dead9
|
||||||
|
|
||||||
# Utility plugins
|
# Utility plugins
|
||||||
http: ^0.13.0
|
http: ^0.13.0
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
|
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
|
||||||
import 'package:stackwallet/electrumx_rpc/rpc.dart';
|
import 'package:stackwallet/electrumx_rpc/rpc.dart';
|
||||||
|
import 'package:stackwallet/services/event_bus/events/global/tor_connection_status_changed_event.dart';
|
||||||
import 'package:stackwallet/services/tor_service.dart';
|
import 'package:stackwallet/services/tor_service.dart';
|
||||||
import 'package:stackwallet/utilities/prefs.dart';
|
import 'package:stackwallet/utilities/prefs.dart';
|
||||||
|
|
||||||
|
@ -1528,7 +1529,8 @@ void main() {
|
||||||
.thenAnswer((_) => false); // Or true, shouldn't matter.
|
.thenAnswer((_) => false); // Or true, shouldn't matter.
|
||||||
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
|
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
|
||||||
final mockTorService = MockTorService();
|
final mockTorService = MockTorService();
|
||||||
when(mockTorService.enabled).thenAnswer((_) => false);
|
when(mockTorService.status)
|
||||||
|
.thenAnswer((_) => TorConnectionStatus.disconnected);
|
||||||
|
|
||||||
final client = ElectrumX(
|
final client = ElectrumX(
|
||||||
host: "some server",
|
host: "some server",
|
||||||
|
@ -1551,7 +1553,7 @@ void main() {
|
||||||
verify(mockPrefs.useTor).called(1);
|
verify(mockPrefs.useTor).called(1);
|
||||||
verifyNever(mockPrefs.torKillSwitch);
|
verifyNever(mockPrefs.torKillSwitch);
|
||||||
verifyNoMoreInteractions(mockPrefs);
|
verifyNoMoreInteractions(mockPrefs);
|
||||||
verifyNever(mockTorService.enabled);
|
verifyNever(mockTorService.status);
|
||||||
verifyNoMoreInteractions(mockTorService);
|
verifyNoMoreInteractions(mockTorService);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1575,8 +1577,9 @@ void main() {
|
||||||
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
|
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
|
||||||
|
|
||||||
final mockTorService = MockTorService();
|
final mockTorService = MockTorService();
|
||||||
when(mockTorService.enabled).thenAnswer((_) => false);
|
when(mockTorService.status)
|
||||||
when(mockTorService.proxyInfo).thenAnswer((_) => (
|
.thenAnswer((_) => TorConnectionStatus.disconnected);
|
||||||
|
when(mockTorService.getProxyInfo()).thenAnswer((_) => (
|
||||||
host: InternetAddress('1.2.3.4'),
|
host: InternetAddress('1.2.3.4'),
|
||||||
port: -1
|
port: -1
|
||||||
)); // Port is set to -1 until Tor is enabled.
|
)); // Port is set to -1 until Tor is enabled.
|
||||||
|
@ -1601,8 +1604,8 @@ void main() {
|
||||||
verify(mockPrefs.useTor).called(1);
|
verify(mockPrefs.useTor).called(1);
|
||||||
verify(mockPrefs.torKillSwitch).called(1);
|
verify(mockPrefs.torKillSwitch).called(1);
|
||||||
verifyNoMoreInteractions(mockPrefs);
|
verifyNoMoreInteractions(mockPrefs);
|
||||||
verify(mockTorService.enabled).called(1);
|
verify(mockTorService.status).called(1);
|
||||||
verifyNever(mockTorService.proxyInfo);
|
verifyNever(mockTorService.getProxyInfo());
|
||||||
verifyNoMoreInteractions(mockTorService);
|
verifyNoMoreInteractions(mockTorService);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1628,8 +1631,9 @@ void main() {
|
||||||
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
|
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
|
||||||
|
|
||||||
final mockTorService = MockTorService();
|
final mockTorService = MockTorService();
|
||||||
when(mockTorService.enabled).thenAnswer((_) => true);
|
when(mockTorService.status)
|
||||||
when(mockTorService.proxyInfo)
|
.thenAnswer((_) => TorConnectionStatus.connected);
|
||||||
|
when(mockTorService.getProxyInfo())
|
||||||
.thenAnswer((_) => (host: InternetAddress('1.2.3.4'), port: 42));
|
.thenAnswer((_) => (host: InternetAddress('1.2.3.4'), port: 42));
|
||||||
|
|
||||||
final client = ElectrumX(
|
final client = ElectrumX(
|
||||||
|
@ -1653,8 +1657,8 @@ void main() {
|
||||||
verify(mockPrefs.useTor).called(1);
|
verify(mockPrefs.useTor).called(1);
|
||||||
verifyNever(mockPrefs.torKillSwitch);
|
verifyNever(mockPrefs.torKillSwitch);
|
||||||
verifyNoMoreInteractions(mockPrefs);
|
verifyNoMoreInteractions(mockPrefs);
|
||||||
verify(mockTorService.enabled).called(1);
|
verify(mockTorService.status).called(1);
|
||||||
verify(mockTorService.proxyInfo).called(1);
|
verify(mockTorService.getProxyInfo()).called(1);
|
||||||
verifyNoMoreInteractions(mockTorService);
|
verifyNoMoreInteractions(mockTorService);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1685,7 +1689,8 @@ void main() {
|
||||||
when(mockPrefs.torKillSwitch).thenAnswer((_) => true);
|
when(mockPrefs.torKillSwitch).thenAnswer((_) => true);
|
||||||
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
|
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
|
||||||
final mockTorService = MockTorService();
|
final mockTorService = MockTorService();
|
||||||
when(mockTorService.enabled).thenAnswer((_) => false);
|
when(mockTorService.status)
|
||||||
|
.thenAnswer((_) => TorConnectionStatus.disconnected);
|
||||||
|
|
||||||
final client = ElectrumX(
|
final client = ElectrumX(
|
||||||
host: "some server",
|
host: "some server",
|
||||||
|
@ -1712,7 +1717,7 @@ void main() {
|
||||||
verify(mockPrefs.useTor).called(1);
|
verify(mockPrefs.useTor).called(1);
|
||||||
verify(mockPrefs.torKillSwitch).called(1);
|
verify(mockPrefs.torKillSwitch).called(1);
|
||||||
verifyNoMoreInteractions(mockPrefs);
|
verifyNoMoreInteractions(mockPrefs);
|
||||||
verify(mockTorService.enabled).called(1);
|
verify(mockTorService.status).called(1);
|
||||||
verifyNoMoreInteractions(mockTorService);
|
verifyNoMoreInteractions(mockTorService);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1740,7 +1745,8 @@ void main() {
|
||||||
when(mockPrefs.torKillSwitch).thenAnswer((_) => false);
|
when(mockPrefs.torKillSwitch).thenAnswer((_) => false);
|
||||||
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
|
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
|
||||||
final mockTorService = MockTorService();
|
final mockTorService = MockTorService();
|
||||||
when(mockTorService.enabled).thenAnswer((_) => false);
|
when(mockTorService.status)
|
||||||
|
.thenAnswer((_) => TorConnectionStatus.disconnected);
|
||||||
|
|
||||||
final client = ElectrumX(
|
final client = ElectrumX(
|
||||||
host: "some server",
|
host: "some server",
|
||||||
|
@ -1763,7 +1769,7 @@ void main() {
|
||||||
verify(mockPrefs.useTor).called(1);
|
verify(mockPrefs.useTor).called(1);
|
||||||
verify(mockPrefs.torKillSwitch).called(1);
|
verify(mockPrefs.torKillSwitch).called(1);
|
||||||
verifyNoMoreInteractions(mockPrefs);
|
verifyNoMoreInteractions(mockPrefs);
|
||||||
verify(mockTorService.enabled).called(1);
|
verify(mockTorService.status).called(1);
|
||||||
verifyNoMoreInteractions(mockTorService);
|
verifyNoMoreInteractions(mockTorService);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,13 +9,15 @@ import 'dart:ui' as _i10;
|
||||||
|
|
||||||
import 'package:mockito/mockito.dart' as _i1;
|
import 'package:mockito/mockito.dart' as _i1;
|
||||||
import 'package:stackwallet/electrumx_rpc/rpc.dart' as _i2;
|
import 'package:stackwallet/electrumx_rpc/rpc.dart' as _i2;
|
||||||
|
import 'package:stackwallet/services/event_bus/events/global/tor_connection_status_changed_event.dart'
|
||||||
|
as _i12;
|
||||||
import 'package:stackwallet/services/tor_service.dart' as _i11;
|
import 'package:stackwallet/services/tor_service.dart' as _i11;
|
||||||
import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i8;
|
import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i8;
|
||||||
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i7;
|
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i7;
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i9;
|
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i9;
|
||||||
import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i6;
|
import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i6;
|
||||||
import 'package:stackwallet/utilities/prefs.dart' as _i5;
|
import 'package:stackwallet/utilities/prefs.dart' as _i5;
|
||||||
import 'package:tor_ffi_plugin/tor_ffi_plugin.dart' as _i12;
|
import 'package:tor_ffi_plugin/tor_ffi_plugin.dart' as _i13;
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
// ignore_for_file: avoid_redundant_argument_values
|
// ignore_for_file: avoid_redundant_argument_values
|
||||||
|
@ -659,27 +661,40 @@ class MockTorService extends _i1.Mock implements _i11.TorService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get enabled => (super.noSuchMethod(
|
_i12.TorConnectionStatus get status => (super.noSuchMethod(
|
||||||
Invocation.getter(#enabled),
|
Invocation.getter(#status),
|
||||||
returnValue: false,
|
returnValue: _i12.TorConnectionStatus.disconnected,
|
||||||
) as bool);
|
) as _i12.TorConnectionStatus);
|
||||||
@override
|
@override
|
||||||
({_i3.InternetAddress host, int port}) get proxyInfo => (super.noSuchMethod(
|
({_i3.InternetAddress host, int port}) getProxyInfo() => (super.noSuchMethod(
|
||||||
Invocation.getter(#proxyInfo),
|
Invocation.method(
|
||||||
|
#getProxyInfo,
|
||||||
|
[],
|
||||||
|
),
|
||||||
returnValue: (
|
returnValue: (
|
||||||
host: _FakeInternetAddress_2(
|
host: _FakeInternetAddress_2(
|
||||||
this,
|
this,
|
||||||
Invocation.getter(#proxyInfo),
|
Invocation.method(
|
||||||
|
#getProxyInfo,
|
||||||
|
[],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
port: 0
|
port: 0
|
||||||
),
|
),
|
||||||
) as ({_i3.InternetAddress host, int port}));
|
) as ({_i3.InternetAddress host, int port}));
|
||||||
@override
|
@override
|
||||||
void init({_i12.Tor? mockableOverride}) => super.noSuchMethod(
|
void init({
|
||||||
|
required String? torDataDirPath,
|
||||||
|
_i13.Tor? mockableOverride,
|
||||||
|
}) =>
|
||||||
|
super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#init,
|
#init,
|
||||||
[],
|
[],
|
||||||
{#mockableOverride: mockableOverride},
|
{
|
||||||
|
#torDataDirPath: torDataDirPath,
|
||||||
|
#mockableOverride: mockableOverride,
|
||||||
|
},
|
||||||
),
|
),
|
||||||
returnValueForMissingStub: null,
|
returnValueForMissingStub: null,
|
||||||
);
|
);
|
||||||
|
@ -695,7 +710,7 @@ class MockTorService extends _i1.Mock implements _i11.TorService {
|
||||||
@override
|
@override
|
||||||
_i4.Future<void> disable() => (super.noSuchMethod(
|
_i4.Future<void> disable() => (super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#stop,
|
#disable,
|
||||||
[],
|
[],
|
||||||
),
|
),
|
||||||
returnValue: _i4.Future<void>.value(),
|
returnValue: _i4.Future<void>.value(),
|
||||||
|
|
|
@ -12,6 +12,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5;
|
||||||
import 'package:mockito/mockito.dart' as _i1;
|
import 'package:mockito/mockito.dart' as _i1;
|
||||||
import 'package:stackwallet/models/node_model.dart' as _i18;
|
import 'package:stackwallet/models/node_model.dart' as _i18;
|
||||||
import 'package:stackwallet/services/coins/manager.dart' as _i6;
|
import 'package:stackwallet/services/coins/manager.dart' as _i6;
|
||||||
|
import 'package:stackwallet/services/event_bus/events/global/tor_connection_status_changed_event.dart'
|
||||||
|
as _i20;
|
||||||
import 'package:stackwallet/services/node_service.dart' as _i3;
|
import 'package:stackwallet/services/node_service.dart' as _i3;
|
||||||
import 'package:stackwallet/services/tor_service.dart' as _i19;
|
import 'package:stackwallet/services/tor_service.dart' as _i19;
|
||||||
import 'package:stackwallet/services/wallets.dart' as _i9;
|
import 'package:stackwallet/services/wallets.dart' as _i9;
|
||||||
|
@ -23,7 +25,7 @@ import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i15;
|
||||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
|
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
|
||||||
as _i7;
|
as _i7;
|
||||||
import 'package:stackwallet/utilities/prefs.dart' as _i13;
|
import 'package:stackwallet/utilities/prefs.dart' as _i13;
|
||||||
import 'package:tor_ffi_plugin/tor_ffi_plugin.dart' as _i20;
|
import 'package:tor_ffi_plugin/tor_ffi_plugin.dart' as _i21;
|
||||||
import 'package:tuple/tuple.dart' as _i11;
|
import 'package:tuple/tuple.dart' as _i11;
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
|
@ -1025,27 +1027,40 @@ class MockTorService extends _i1.Mock implements _i19.TorService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get enabled => (super.noSuchMethod(
|
_i20.TorConnectionStatus get status => (super.noSuchMethod(
|
||||||
Invocation.getter(#enabled),
|
Invocation.getter(#status),
|
||||||
returnValue: false,
|
returnValue: _i20.TorConnectionStatus.disconnected,
|
||||||
) as bool);
|
) as _i20.TorConnectionStatus);
|
||||||
@override
|
@override
|
||||||
({_i8.InternetAddress host, int port}) get proxyInfo => (super.noSuchMethod(
|
({_i8.InternetAddress host, int port}) getProxyInfo() => (super.noSuchMethod(
|
||||||
Invocation.getter(#proxyInfo),
|
Invocation.method(
|
||||||
|
#getProxyInfo,
|
||||||
|
[],
|
||||||
|
),
|
||||||
returnValue: (
|
returnValue: (
|
||||||
host: _FakeInternetAddress_5(
|
host: _FakeInternetAddress_5(
|
||||||
this,
|
this,
|
||||||
Invocation.getter(#proxyInfo),
|
Invocation.method(
|
||||||
|
#getProxyInfo,
|
||||||
|
[],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
port: 0
|
port: 0
|
||||||
),
|
),
|
||||||
) as ({_i8.InternetAddress host, int port}));
|
) as ({_i8.InternetAddress host, int port}));
|
||||||
@override
|
@override
|
||||||
void init({_i20.Tor? mockableOverride}) => super.noSuchMethod(
|
void init({
|
||||||
|
required String? torDataDirPath,
|
||||||
|
_i21.Tor? mockableOverride,
|
||||||
|
}) =>
|
||||||
|
super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#init,
|
#init,
|
||||||
[],
|
[],
|
||||||
{#mockableOverride: mockableOverride},
|
{
|
||||||
|
#torDataDirPath: torDataDirPath,
|
||||||
|
#mockableOverride: mockableOverride,
|
||||||
|
},
|
||||||
),
|
),
|
||||||
returnValueForMissingStub: null,
|
returnValueForMissingStub: null,
|
||||||
);
|
);
|
||||||
|
@ -1061,7 +1076,7 @@ class MockTorService extends _i1.Mock implements _i19.TorService {
|
||||||
@override
|
@override
|
||||||
_i12.Future<void> disable() => (super.noSuchMethod(
|
_i12.Future<void> disable() => (super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#stop,
|
#disable,
|
||||||
[],
|
[],
|
||||||
),
|
),
|
||||||
returnValue: _i12.Future<void>.value(),
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
|
Loading…
Reference in a new issue