Merge branch 'staging' into ui-fixes

This commit is contained in:
ryleedavis 2022-12-30 17:27:31 -07:00
commit 2765bea4a9
19 changed files with 1171 additions and 1403 deletions

@ -1 +1 @@
Subproject commit de29931dacc9aefaf42a9ca139a8754a42adc40d
Subproject commit d636f16aa0079c7ef47f0c8547fba1635e5eb33b

View file

@ -2,10 +2,10 @@ FROM ubuntu:20.04 as base
COPY . /stack_wallet
WORKDIR /stack_wallet/scripts/linux
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y git=1:2.25.1-1ubuntu3.6 make=4.2.1-1.2 curl=7.68.0-1ubuntu2.14 cargo=0.62.0ubuntu0libgit2-0ubuntu0.20.04.1 \
file=1:5.38-4 ca-certificates=20211016~20.04.1 cmake=3.16.3-1ubuntu1.20.04.1 cmake-data=3.16.3-1ubuntu1.20.04.1 g++=4:9.3.0-1ubuntu2 libgmp-dev=2:6.2.0+dfsg-4ubuntu0.1 libssl-dev=1.1.1f-1ubuntu2.16 libclang-dev=1:10.0-50~exp1 \
unzip=6.0-25ubuntu1.1 python3=3.8.2-0ubuntu2 pkg-config=0.29.1-0ubuntu4 libglib2.0-dev=2.64.6-1~ubuntu20.04.4 libgcrypt20-dev=1.8.5-5ubuntu1.1 gettext-base=0.19.8.1-10build1 libgirepository1.0-dev=1.64.1-1~ubuntu20.04.1 \
valac=0.48.6-0ubuntu1 xsltproc=1.1.34-4ubuntu0.20.04.1 docbook-xsl=1.79.1+dfsg-2 python3-pip=20.0.2-5ubuntu1.6 ninja-build=1.10.0-1build1 clang=1:10.0-50~exp1 libgtk-3-dev=3.24.20-0ubuntu1.1 \
libunbound-dev=1.9.4-2ubuntu1.4 libzmq3-dev=4.3.2-2ubuntu1 libtool=2.4.6-14 autoconf=2.69-11.1 automake=1:1.16.1-4ubuntu6 bison=2:3.5.1+dfsg-1 \
file=1:5.38-4 ca-certificates=20211016ubuntu0.20.04.1 cmake=3.16.3-1ubuntu1.20.04.1 cmake-data=3.16.3-1ubuntu1.20.04.1 g++=4:9.3.0-1ubuntu2 libgmp-dev=2:6.2.0+dfsg-4ubuntu0.1 libssl-dev=1.1.1f-1ubuntu2.16 \
libclang-dev=1:10.0-50~exp1 unzip=6.0-25ubuntu1.1 python3=3.8.2-0ubuntu2 pkg-config=0.29.1-0ubuntu4 libglib2.0-dev=2.64.6-1~ubuntu20.04.4 libgcrypt20-dev=1.8.5-5ubuntu1.1 gettext-base=0.19.8.1-10build1 \
libgirepository1.0-dev=1.64.1-1~ubuntu20.04.1 valac=0.48.6-0ubuntu1 xsltproc=1.1.34-4ubuntu0.20.04.1 docbook-xsl=1.79.1+dfsg-2 python3-pip=20.0.2-5ubuntu1.6 ninja-build=1.10.0-1build1 clang=1:10.0-50~exp1 \
libgtk-3-dev=3.24.20-0ubuntu1.1 libunbound-dev=1.9.4-2ubuntu1.4 libzmq3-dev=4.3.2-2ubuntu1 libtool=2.4.6-14 autoconf=2.69-11.1 automake=1:1.16.1-4ubuntu6 bison=2:3.5.1+dfsg-1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --upgrade meson==0.64.1 markdown==3.4.1 markupsafe==2.1.1 jinja2==3.1.2 pygments==2.13.0 toml==0.10.2 typogrify==2.0.7 tomli==2.0.1 && cd .. && ./prebuild.sh && cd linux && ./build_all.sh

View file

@ -19,6 +19,7 @@ import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
@ -105,8 +106,25 @@ class _NewWalletRecoveryPhraseWarningViewState
)
],
),
body: Padding(
padding: EdgeInsets.all(isDesktop ? 0 : 16),
body: ConditionalParent(
condition: !isDesktop,
builder: (child) => LayoutBuilder(
builder: (context, constraints) {
return SingleChildScrollView(
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.maxHeight,
),
child: IntrinsicHeight(
child: Padding(
padding: const EdgeInsets.all(16),
child: child,
),
),
),
);
},
),
child: Column(
crossAxisAlignment: isDesktop
? CrossAxisAlignment.center
@ -315,10 +333,12 @@ class _NewWalletRecoveryPhraseWarningViewState
const SizedBox(
width: 20,
),
Text(
Expanded(
child: Text(
"Do not show them to anyone.",
style: STextStyles.navBarTitle(context),
),
),
],
),
],
@ -327,6 +347,10 @@ class _NewWalletRecoveryPhraseWarningViewState
),
),
if (!isDesktop) const Spacer(),
if (!isDesktop)
const SizedBox(
height: 16,
),
if (isDesktop)
const SizedBox(
height: 32,

View file

@ -23,8 +23,6 @@ import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
import 'package:stackwallet/widgets/rounded_date_picker/flutter_rounded_date_picker_widget.dart'
as datePicker;
import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:tuple/tuple.dart';
@ -154,10 +152,46 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
await Future<void>.delayed(const Duration(milliseconds: 125));
}
final date = await datePicker.showRoundedDatePicker(
final date = await showRoundedDatePicker(
context: context,
initialDate: DateTime.now(),
height: height * 0.5,
height: height / 3.0,
theme: ThemeData(
primarySwatch: Util.createMaterialColor(fetchedColor),
),
//TODO pick a better initial date
// 2007 chosen as that is just before bitcoin launched
firstDate: DateTime(2007),
lastDate: DateTime.now(),
borderRadius: Constants.size.circularBorderRadius * 2,
textPositiveButton: "SELECT",
styleDatePicker: _buildDatePickerStyle(),
styleYearPicker: _buildYearPickerStyle(),
);
if (date != null) {
_restoreFromDate = date;
_dateController.text = Format.formatDate(date);
}
}
Future<void> chooseDesktopDate() async {
final height = MediaQuery.of(context).size.height;
final fetchedColor =
Theme.of(context).extension<StackColors>()!.accentColorDark;
// check and hide keyboard
if (FocusScope.of(context).hasFocus) {
FocusScope.of(context).unfocus();
await Future<void>.delayed(const Duration(milliseconds: 125));
}
final now = DateTime.now();
final date = await showRoundedDatePicker(
context: context,
initialDate: DateTime.now(),
height: height / 3.0,
theme: ThemeData(
primarySwatch: Util.createMaterialColor(fetchedColor),
),
@ -283,15 +317,22 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
(coin == Coin.wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25))
// if (!isDesktop)
if (!isDesktop)
RestoreFromDatePicker(
onTap: chooseDate,
controller: _dateController,
),
// if (isDesktop)
// // TODO desktop date picker
if (coin == Coin.monero ||
coin == Coin.epicCash ||
(coin == Coin.wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25))
if (isDesktop)
// TODO desktop date picker
RestoreFromDatePicker(
onTap: chooseDesktopDate,
controller: _dateController,
),
if (coin == Coin.monero ||
coin == Coin.epicCash ||
(coin == Coin.wownero &&
@ -412,7 +453,6 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
isDesktop: isDesktop,
onPressed: _nextEnabled ? nextPressed : null,
),
if (isDesktop)
const Spacer(
flex: 15,

View file

@ -736,6 +736,8 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
child: Column(
children: [
TextFormField(
autocorrect: !isDesktop,
enableSuggestions: !isDesktop,
textCapitalization:
TextCapitalization.none,
key: Key(
@ -831,6 +833,8 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
child: Column(
children: [
TextFormField(
autocorrect: !isDesktop,
enableSuggestions: !isDesktop,
textCapitalization:
TextCapitalization.none,
key: Key(
@ -954,6 +958,8 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
padding:
const EdgeInsets.symmetric(vertical: 4),
child: TextFormField(
autocorrect: !isDesktop,
enableSuggestions: !isDesktop,
textCapitalization:
TextCapitalization.none,
key: Key("restoreMnemonicFormField_$i"),

View file

@ -409,8 +409,9 @@ class _GenerateUriQrCodeViewState extends State<GenerateUriQrCodeView> {
height: 1.8,
)
: STextStyles.field(context),
keyboardType:
const TextInputType.numberWithOptions(decimal: true),
keyboardType: Util.isDesktop
? null
: const TextInputType.numberWithOptions(decimal: true),
onChanged: (_) => setState(() {}),
decoration: standardInputDecoration(
"Amount",

View file

@ -1111,7 +1111,9 @@ class _SendViewState extends ConsumerState<SendView> {
const Key("amountInputFieldCryptoTextFieldKey"),
controller: cryptoAmountController,
focusNode: _cryptoFocus,
keyboardType: const TextInputType.numberWithOptions(
keyboardType: Util.isDesktop
? null
: const TextInputType.numberWithOptions(
signed: false,
decimal: true,
),
@ -1168,8 +1170,9 @@ class _SendViewState extends ConsumerState<SendView> {
const Key("amountInputFieldFiatTextFieldKey"),
controller: baseAmountController,
focusNode: _baseFocus,
keyboardType:
const TextInputType.numberWithOptions(
keyboardType: Util.isDesktop
? null
: const TextInputType.numberWithOptions(
signed: false,
decimal: true,
),

View file

@ -391,7 +391,8 @@ class _EpiBoxInfoFormState extends ConsumerState<EpicBoxInfoForm> {
enableSuggestions: Util.isDesktop ? false : true,
controller: portController,
decoration: const InputDecoration(hintText: "Port"),
keyboardType: const TextInputType.numberWithOptions(),
keyboardType:
Util.isDesktop ? null : const TextInputType.numberWithOptions(),
),
const SizedBox(
height: 8,

View file

@ -739,7 +739,9 @@ class _TransactionSearchViewState
controller: _amountTextEditingController,
focusNode: amountTextFieldFocusNode,
onChanged: (_) => setState(() {}),
keyboardType: const TextInputType.numberWithOptions(
keyboardType: Util.isDesktop
? null
: const TextInputType.numberWithOptions(
signed: false,
decimal: true,
),

View file

@ -42,6 +42,9 @@ class _ContactListItemState extends ConsumerState<ContactListItem> {
final contact = ref.watch(addressBookServiceProvider
.select((value) => value.getContactById(contactId)));
// hack fix until we use a proper database (not Hive)
int i = 0;
return RoundedWhiteContainer(
padding: const EdgeInsets.all(0),
borderColor: Theme.of(context).extension<StackColors>()!.background,
@ -70,7 +73,8 @@ class _ContactListItemState extends ConsumerState<ContactListItem> {
filterByCoin != null ? e.coin == filterByCoin! : true)
.map(
(e) => Column(
key: Key("contactAddress_${e.address}_${e.label}_key"),
key: Key(
"contactAddress_${e.address}_${e.label}_${++i}_key"),
mainAxisSize: MainAxisSize.min,
children: [
Container(

View file

@ -140,10 +140,9 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
const SizedBox(
height: 40,
),
Padding(
padding: const EdgeInsets.only(
right: 32,
),
Row(
children: [
Expanded(
child: SecondaryButton(
buttonHeight: ButtonHeight.l,
label: "Ok",
@ -152,6 +151,11 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
},
),
),
const SizedBox(
width: 32,
),
],
),
],
),
),
@ -319,13 +323,13 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
}
if (!wasCancelled && mounted) {
txData["note"] = _note ?? "";
txData["address"] = _address;
// pop building dialog
Navigator.of(
context,
rootNavigator: true,
).pop();
txData["note"] = _note;
txData["address"] = _address;
unawaited(
showDialog(
@ -394,14 +398,12 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
const SizedBox(
height: 40,
),
Padding(
padding: const EdgeInsets.only(
right: 32,
),
child: Expanded(
Row(
children: [
Expanded(
child: SecondaryButton(
buttonHeight: ButtonHeight.l,
label: "Yes",
label: "Ok",
onPressed: () {
Navigator.of(
context,
@ -410,6 +412,10 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
},
),
),
const SizedBox(
width: 32,
),
],
),
],
),
@ -1002,7 +1008,9 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
key: const Key("amountInputFieldCryptoTextFieldKey"),
controller: cryptoAmountController,
focusNode: _cryptoFocus,
keyboardType: const TextInputType.numberWithOptions(
keyboardType: Util.isDesktop
? null
: const TextInputType.numberWithOptions(
signed: false,
decimal: true,
),
@ -1056,7 +1064,9 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
key: const Key("amountInputFieldFiatTextFieldKey"),
controller: baseAmountController,
focusNode: _baseFocus,
keyboardType: const TextInputType.numberWithOptions(
keyboardType: Util.isDesktop
? null
: const TextInputType.numberWithOptions(
signed: false,
decimal: true,
),

View file

@ -2666,8 +2666,8 @@ class BitcoinCashWallet extends CoinServiceAPI {
], // dust limit is the minimum amount a change output should be
))["vSize"] as int;
//todo: check if print needed
debugPrint("vSizeForOneOutput $vSizeForOneOutput");
debugPrint("vSizeForTwoOutPuts $vSizeForTwoOutPuts");
// debugPrint("vSizeForOneOutput $vSizeForOneOutput");
// debugPrint("vSizeForTwoOutPuts $vSizeForTwoOutPuts");
// Assume 1 output, only for recipient and no change
var feeForOneOutput = estimateTxFee(

View file

@ -178,7 +178,7 @@ abstract class CoinServiceAPI {
walletId: walletId,
walletName: walletName,
coin: coin,
secureStore: secureStorageInterface,
secureStorage: secureStorageInterface,
// tracker: tracker,
);

File diff suppressed because it is too large Load diff

View file

@ -51,6 +51,7 @@ class NotesService extends ChangeNotifier {
_notes[txid] = note;
await DB.instance
.put<dynamic>(boxName: walletId, key: 'notes', value: _notes);
//todo: check if this is needed
Logging.instance.log("editOrAddNote: tx note saved", level: LogLevel.Info);
await _refreshNotes();
}

View file

@ -158,7 +158,7 @@ abstract class DefaultNodes {
isDown: false);
static NodeModel get bitcoinTestnet => NodeModel(
host: "electrumx-testnet.cypherstack.com",
host: "bitcoin-testnet.cypherstack.com",
port: 51002,
name: defaultName,
id: _nodeId(Coin.bitcoinTestNet),

View file

@ -4,6 +4,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/loading_indicator.dart';
class ExchangeTextField extends StatefulWidget {
@ -62,6 +63,8 @@ class _ExchangeTextFieldState extends State<ExchangeTextField> {
late final void Function(String)? onChanged;
late final void Function(String)? onSubmitted;
final isDesktop = Util.isDesktop;
@override
void initState() {
borderRadius = widget.borderRadius;
@ -100,7 +103,9 @@ class _ExchangeTextFieldState extends State<ExchangeTextField> {
enableSuggestions: false,
autocorrect: false,
readOnly: widget.readOnly,
keyboardType: const TextInputType.numberWithOptions(
keyboardType: isDesktop
? null
: const TextInputType.numberWithOptions(
signed: false,
decimal: true,
),

View file

@ -42,7 +42,7 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.11"
version: "3.3.0"
args:
dependency: transitive
description:
@ -63,7 +63,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
barcode_scan2:
dependency: "direct main"
description:
@ -190,14 +190,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.1"
checked_yaml:
dependency: transitive
description:
@ -218,7 +211,7 @@ packages:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
code_builder:
dependency: transitive
description:
@ -288,7 +281,7 @@ packages:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.5.0"
cross_file:
dependency: transitive
description:
@ -442,7 +435,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
ffi:
dependency: "direct main"
description:
@ -871,21 +864,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
mime:
dependency: transitive
description:
@ -997,7 +990,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
path_drawing:
dependency: transitive
description:
@ -1373,7 +1366,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
@ -1417,7 +1410,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
string_validator:
dependency: "direct main"
description:
@ -1431,35 +1424,35 @@ packages:
name: sync_http
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.3.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test:
dependency: transitive
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.21.1"
version: "1.21.4"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.4.12"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.13"
version: "0.4.16"
time:
dependency: transitive
description:
@ -1508,7 +1501,7 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
universal_io:
dependency: transitive
description:
@ -1592,7 +1585,7 @@ packages:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "8.2.2"
version: "9.0.0"
wakelock:
dependency: "direct main"
description:

View file

@ -1,3 +1,5 @@
#!/bin/bash
# Create template lib/external_api_keys.dart file if it doesn't already exist
KEYS=../lib/external_api_keys.dart
if ! test -f "$KEYS"; then
@ -6,13 +8,14 @@ if ! test -f "$KEYS"; then
fi
# Create template wallet test parameter files if they don't already exist
declare -a coins=("bitcoin" "bitcoincash" "dogecoin" "namecoin" "firo" "particl") # TODO add monero and wownero when those tests are updated to use the .gitignored test wallet setup: when doing that, make sure to update the test vectors for a new, private development seed
declare -a coins
coins=("bitcoin" "bitcoincash" "dogecoin" "namecoin" "firo" "particl") # TODO add monero and wownero when those tests are updated to use the .gitignored test wallet setup: when doing that, make sure to update the test vectors for a new, private development seed
for coin in "${coins[@]}"
do
WALLETTESTPARAMFILE="../test/services/coins/${coin}/${coin}_wallet_test_parameters.dart"
if ! test -f "$WALLETTESTPARAMFILE"; then
echo "prebuild.sh: creating template test/services/coins/${coin}/${coin}_wallet_test_parameters.dart file"
printf 'const TEST_MNEMONIC = "";\nconst ROOT_WIF = "";\nconst NODE_WIF_84 = "";\n' > $WALLETTESTPARAMFILE
printf 'const TEST_MNEMONIC = "";\nconst ROOT_WIF = "";\nconst NODE_WIF_84 = "";\n' > "$WALLETTESTPARAMFILE"
fi
done