This commit is contained in:
Matthew Fosse 2024-05-31 09:30:11 -07:00
commit 010957ce6c
20 changed files with 135 additions and 44 deletions

View file

@ -1,2 +1 @@
Bitcoin Silent Payments
Bug fixes and generic enhancements
Bug fixes and generic enhancements

View file

@ -1465,7 +1465,7 @@ abstract class ElectrumWalletBase
time = status["block_time"] as int?;
final height = status["block_height"] as int? ?? 0;
final tip = await getCurrentChainTip();
final tip = await getUpdatedChainTip();
if (tip > 0) confirmations = height > 0 ? tip - height + 1 : 0;
} else {
final verboseTransaction = await electrumClient.getTransactionRaw(hash: hash);
@ -1519,6 +1519,23 @@ abstract class ElectrumWalletBase
await fetchTransactionsForAddressType(historiesWithDetails, SegwitAddresType.p2wpkh);
}
transactionHistory.transactions.values.forEach((tx) async {
final isPendingSilentPaymentUtxo =
(tx.isPending || tx.confirmations == 0) && historiesWithDetails[tx.id] == null;
if (isPendingSilentPaymentUtxo) {
final info =
await fetchTransactionInfo(hash: tx.id, height: tx.height, retryOnFailure: true);
if (info != null) {
tx.confirmations = info.confirmations;
tx.isPending = tx.confirmations == 0;
transactionHistory.addOne(tx);
await transactionHistory.save();
}
}
});
return historiesWithDetails;
} catch (e) {
print(e.toString());

View file

@ -793,8 +793,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: "sp_v1.0.0"
resolved-ref: a9a4c6d051f37a15a3a52cc2a0094f24c68b62c5
ref: "sp_v2.0.0"
resolved-ref: "62c152b9086cd968019128845371072f7e1168de"
url: "https://github.com/cake-tech/sp_scanner"
source: git
version: "0.0.1"

View file

@ -399,7 +399,6 @@ extern "C"
return false;
}
wallet->store(std::string(path));
change_current_wallet(wallet);
return true;
}

View file

@ -584,7 +584,7 @@ Future<void> setup({
getIt.registerFactory<Modify2FAPage>(
() => Modify2FAPage(setup2FAViewModel: getIt.get<Setup2FAViewModel>()));
getIt.registerFactory<DesktopSettingsPage>(() => DesktopSettingsPage());
getIt.registerFactory<DesktopSettingsPage>(() => DesktopSettingsPage(getIt.get<DashboardViewModel>()));
getIt.registerFactoryParam<ReceiveOptionViewModel, ReceivePageOption?, void>(
(pageOption, _) => ReceiveOptionViewModel(getIt.get<AppStore>().wallet!, pageOption));

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/utils/route_aware.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/di.dart';
@ -32,6 +33,14 @@ abstract class BasePage extends StatelessWidget {
Widget? get endDrawer => null;
Function(BuildContext context)? get pushToWidget => null;
Function(BuildContext context)? get pushToNextWidget => null;
Function(BuildContext context)? get popWidget => null;
Function(BuildContext context)? get popNextWidget => null;
AppBarStyle get appBarStyle => AppBarStyle.regular;
Widget Function(BuildContext, Widget)? get rootWrapper => null;
@ -162,15 +171,21 @@ abstract class BasePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final root = Scaffold(
key: _scaffoldKey,
backgroundColor: pageBackgroundColor(context),
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
extendBodyBehindAppBar: extendBodyBehindAppBar,
endDrawer: endDrawer,
appBar: appBar(context),
body: body(context),
floatingActionButton: floatingActionButton(context));
final root = RouteAwareWidget(
child: Scaffold(
key: _scaffoldKey,
backgroundColor: pageBackgroundColor(context),
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
extendBodyBehindAppBar: extendBodyBehindAppBar,
endDrawer: endDrawer,
appBar: appBar(context),
body: body(context),
floatingActionButton: floatingActionButton(context)),
pushToWidget: (context) => pushToWidget?.call(context),
pushToNextWidget: (context) => pushToNextWidget?.call(context),
popWidget: (context) => popWidget?.call(context),
popNextWidget: (context) => popNextWidget?.call(context),
);
return rootWrapper?.call(context, root) ?? root;
}

View file

@ -99,6 +99,14 @@ class ExchangePage extends BasePage {
@override
AppBarStyle get appBarStyle => AppBarStyle.transparent;
@override
Function(BuildContext)? get pushToNextWidget => (context) {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.focusedChild?.unfocus();
}
};
@override
Widget middle(BuildContext context) => Row(
mainAxisAlignment: MainAxisAlignment.center,

View file

@ -84,12 +84,7 @@ class IoniaGiftCardDetailPage extends BasePage {
}
});
return RouteAwareWidget(
pushToWidget: ()=> viewModel.increaseBrightness(),
pushToNextWidget: ()=> DeviceDisplayBrightness.setBrightness(viewModel.brightness),
popNextWidget: ()=> viewModel.increaseBrightness(),
popWidget: ()=> DeviceDisplayBrightness.setBrightness(viewModel.brightness),
child: ScrollableWithBottomSection(
return ScrollableWithBottomSection(
contentPadding: EdgeInsets.all(24),
content: Column(
children: [
@ -168,7 +163,7 @@ class IoniaGiftCardDetailPage extends BasePage {
},
),
),
));
);
}
Widget buildIoniaTile(BuildContext context, {required String title, required String subTitle}) {

View file

@ -38,6 +38,14 @@ class NewWalletPage extends BasePage {
@override
String get title => S.current.new_wallet;
@override
Function(BuildContext)? get pushToNextWidget => (context) {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.focusedChild?.unfocus();
}
};
@override
Widget body(BuildContext context) => WalletNameForm(
_walletNewVM,

View file

@ -34,6 +34,14 @@ class NewWalletTypePage extends BasePage {
String get title =>
isCreate ? S.current.wallet_list_create_new_wallet : S.current.wallet_list_restore_wallet;
@override
Function(BuildContext)? get pushToNextWidget => (context) {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.focusedChild?.unfocus();
}
};
@override
Widget body(BuildContext context) => WalletTypeForm(
onTypeSelected: onTypeSelected,

View file

@ -21,6 +21,14 @@ class RestoreFromBackupPage extends BasePage {
@override
String get title => S.current.restore_title_from_backup;
@override
Function(BuildContext)? get pushToNextWidget => (context) {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.focusedChild?.unfocus();
}
};
@override
Widget body(BuildContext context) {
reaction((_) => restoreFromBackupViewModel.state, (ExecutionState state) {

View file

@ -101,6 +101,14 @@ class WalletRestorePage extends BasePage {
// String? derivationPath = null;
DerivationInfo? derivationInfo;
@override
Function(BuildContext)? get pushToNextWidget => (context) {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.focusedChild?.unfocus();
}
};
@override
Widget body(BuildContext context) {
reaction((_) => walletRestoreViewModel.state, (ExecutionState state) {

View file

@ -66,6 +66,14 @@ class SendPage extends BasePage {
@override
bool get extendBodyBehindAppBar => true;
@override
Function(BuildContext)? get pushToNextWidget => (context) {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.focusedChild?.unfocus();
}
};
@override
Widget? leading(BuildContext context) {
final _backButton = Icon(

View file

@ -32,6 +32,14 @@ class SendTemplatePage extends BasePage {
@override
AppBarStyle get appBarStyle => AppBarStyle.transparent;
@override
Function(BuildContext)? get pushToNextWidget => (context) {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.focusedChild?.unfocus();
}
};
@override
Widget trailing(context) => Observer(builder: (_) {
return sendTemplateViewModel.recipients.length > 1

View file

@ -3,6 +3,7 @@ import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/widgets/setting_action_button.dart';
import 'package:cake_wallet/src/widgets/setting_actions.dart';
import 'package:cake_wallet/typography.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/router.dart' as Router;
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
@ -10,7 +11,9 @@ import 'package:cake_wallet/themes/extensions/menu_theme.dart';
final _settingsNavigatorKey = GlobalKey<NavigatorState>();
class DesktopSettingsPage extends StatefulWidget {
const DesktopSettingsPage({super.key});
const DesktopSettingsPage(this.dashboardViewModel, {super.key});
final DashboardViewModel dashboardViewModel;
@override
State<DesktopSettingsPage> createState() => _DesktopSettingsPageState();
@ -51,6 +54,12 @@ class _DesktopSettingsPageState extends State<DesktopSettingsPage> {
padding: EdgeInsets.only(top: 0),
itemBuilder: (_, index) {
final item = SettingActions.desktopSettings[index];
if (!widget.dashboardViewModel.hasSilentPayments &&
item.name(context) == S.of(context).silent_payments_settings) {
return Container();
}
final isLastTile = index == itemCount - 1;
return SettingActionButton(
isLastTile: isLastTile,

View file

@ -29,6 +29,7 @@ class SettingActions {
connectionSettingAction,
walletSettingAction,
addressBookSettingAction,
silentPaymentsSettingAction,
securityBackupSettingAction,
privacySettingAction,
displaySettingAction,

View file

@ -10,10 +10,10 @@ class RouteAwareWidget extends StatefulWidget {
this.popNextWidget});
final Widget child;
final Function()? pushToWidget;
final Function()? pushToNextWidget;
final Function()? popWidget;
final Function()? popNextWidget;
final Function(BuildContext context)? pushToWidget;
final Function(BuildContext context)? pushToNextWidget;
final Function(BuildContext context)? popWidget;
final Function(BuildContext context)? popNextWidget;
@override
State<RouteAwareWidget> createState() => RouteAwareWidgetState();
@ -35,28 +35,28 @@ class RouteAwareWidgetState extends State<RouteAwareWidget> with RouteAware {
@override
void didPush() {
if (widget.pushToWidget != null) {
widget.pushToWidget!();
widget.pushToWidget!(context);
}
}
@override
void didPushNext() {
if (widget.pushToNextWidget != null) {
widget.pushToNextWidget!();
widget.pushToNextWidget!(context);
}
}
@override
void didPop() {
if (widget.popWidget != null) {
widget.popWidget!();
widget.popWidget!(context);
}
}
@override
void didPopNext() {
if (widget.popNextWidget != null) {
widget.popNextWidget!();
widget.popNextWidget!(context);
}
}

View file

@ -15,15 +15,15 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
APP_ANDROID_TYPE=$1
MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.15.0"
MONERO_COM_BUILD_NUMBER=90
MONERO_COM_VERSION="1.15.1"
MONERO_COM_BUILD_NUMBER=91
MONERO_COM_BUNDLE_ID="com.monero.app"
MONERO_COM_PACKAGE="com.monero.app"
MONERO_COM_SCHEME="monero.com"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.18.0"
CAKEWALLET_BUILD_NUMBER=216
CAKEWALLET_VERSION="4.18.1"
CAKEWALLET_BUILD_NUMBER=217
CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"
CAKEWALLET_SCHEME="cakewallet"

View file

@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
APP_IOS_TYPE=$1
MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.15.0"
MONERO_COM_BUILD_NUMBER=88
MONERO_COM_VERSION="1.15.1"
MONERO_COM_BUILD_NUMBER=89
MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.18.0"
CAKEWALLET_BUILD_NUMBER=248
CAKEWALLET_VERSION="4.18.1"
CAKEWALLET_BUILD_NUMBER=249
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
HAVEN_NAME="Haven"

View file

@ -16,13 +16,13 @@ if [ -n "$1" ]; then
fi
MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.5.0"
MONERO_COM_BUILD_NUMBER=21
MONERO_COM_VERSION="1.5.1"
MONERO_COM_BUILD_NUMBER=22
MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="1.11.0"
CAKEWALLET_BUILD_NUMBER=78
CAKEWALLET_VERSION="1.11.1"
CAKEWALLET_BUILD_NUMBER=79
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then