Merge branch 'main' of https://github.com/cake-tech/cake_wallet into MrCyjaneK-cyjan-monerodart

 Conflicts:
	cw_monero/ios/Classes/monero_api.cpp
This commit is contained in:
OmarHatem 2024-06-04 23:10:56 +03:00
commit dc41f072e9
19 changed files with 135 additions and 43 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?; time = status["block_time"] as int?;
final height = status["block_height"] as int? ?? 0; 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; if (tip > 0) confirmations = height > 0 ? tip - height + 1 : 0;
} else { } else {
final verboseTransaction = await electrumClient.getTransactionRaw(hash: hash); final verboseTransaction = await electrumClient.getTransactionRaw(hash: hash);
@ -1519,6 +1519,23 @@ abstract class ElectrumWalletBase
await fetchTransactionsForAddressType(historiesWithDetails, SegwitAddresType.p2wpkh); 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; return historiesWithDetails;
} catch (e) { } catch (e) {
print(e.toString()); print(e.toString());

View file

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

View file

@ -571,7 +571,7 @@ Future<void> setup({
getIt.registerFactory<Modify2FAPage>( getIt.registerFactory<Modify2FAPage>(
() => Modify2FAPage(setup2FAViewModel: getIt.get<Setup2FAViewModel>())); () => Modify2FAPage(setup2FAViewModel: getIt.get<Setup2FAViewModel>()));
getIt.registerFactory<DesktopSettingsPage>(() => DesktopSettingsPage()); getIt.registerFactory<DesktopSettingsPage>(() => DesktopSettingsPage(getIt.get<DashboardViewModel>()));
getIt.registerFactoryParam<ReceiveOptionViewModel, ReceivePageOption?, void>( getIt.registerFactoryParam<ReceiveOptionViewModel, ReceivePageOption?, void>(
(pageOption, _) => ReceiveOptionViewModel(getIt.get<AppStore>().wallet!, pageOption)); (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/themes/theme_base.dart';
import 'package:cake_wallet/utils/route_aware.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/di.dart';
@ -32,6 +33,14 @@ abstract class BasePage extends StatelessWidget {
Widget? get endDrawer => null; 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; AppBarStyle get appBarStyle => AppBarStyle.regular;
Widget Function(BuildContext, Widget)? get rootWrapper => null; Widget Function(BuildContext, Widget)? get rootWrapper => null;
@ -162,15 +171,21 @@ abstract class BasePage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final root = Scaffold( final root = RouteAwareWidget(
key: _scaffoldKey, child: Scaffold(
backgroundColor: pageBackgroundColor(context), key: _scaffoldKey,
resizeToAvoidBottomInset: resizeToAvoidBottomInset, backgroundColor: pageBackgroundColor(context),
extendBodyBehindAppBar: extendBodyBehindAppBar, resizeToAvoidBottomInset: resizeToAvoidBottomInset,
endDrawer: endDrawer, extendBodyBehindAppBar: extendBodyBehindAppBar,
appBar: appBar(context), endDrawer: endDrawer,
body: body(context), appBar: appBar(context),
floatingActionButton: floatingActionButton(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; return rootWrapper?.call(context, root) ?? root;
} }

View file

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

View file

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

View file

@ -38,6 +38,14 @@ class NewWalletPage extends BasePage {
@override @override
String get title => S.current.new_wallet; 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 @override
Widget body(BuildContext context) => WalletNameForm( Widget body(BuildContext context) => WalletNameForm(
_walletNewVM, _walletNewVM,

View file

@ -34,6 +34,14 @@ class NewWalletTypePage extends BasePage {
String get title => String get title =>
isCreate ? S.current.wallet_list_create_new_wallet : S.current.wallet_list_restore_wallet; 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 @override
Widget body(BuildContext context) => WalletTypeForm( Widget body(BuildContext context) => WalletTypeForm(
onTypeSelected: onTypeSelected, onTypeSelected: onTypeSelected,

View file

@ -21,6 +21,14 @@ class RestoreFromBackupPage extends BasePage {
@override @override
String get title => S.current.restore_title_from_backup; 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 @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
reaction((_) => restoreFromBackupViewModel.state, (ExecutionState state) { reaction((_) => restoreFromBackupViewModel.state, (ExecutionState state) {

View file

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

View file

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

View file

@ -32,6 +32,14 @@ class SendTemplatePage extends BasePage {
@override @override
AppBarStyle get appBarStyle => AppBarStyle.transparent; AppBarStyle get appBarStyle => AppBarStyle.transparent;
@override
Function(BuildContext)? get pushToNextWidget => (context) {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.focusedChild?.unfocus();
}
};
@override @override
Widget trailing(context) => Observer(builder: (_) { Widget trailing(context) => Observer(builder: (_) {
return sendTemplateViewModel.recipients.length > 1 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_action_button.dart';
import 'package:cake_wallet/src/widgets/setting_actions.dart'; import 'package:cake_wallet/src/widgets/setting_actions.dart';
import 'package:cake_wallet/typography.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:flutter/material.dart';
import 'package:cake_wallet/router.dart' as Router; import 'package:cake_wallet/router.dart' as Router;
import 'package:cake_wallet/themes/extensions/menu_theme.dart'; 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>(); final _settingsNavigatorKey = GlobalKey<NavigatorState>();
class DesktopSettingsPage extends StatefulWidget { class DesktopSettingsPage extends StatefulWidget {
const DesktopSettingsPage({super.key}); const DesktopSettingsPage(this.dashboardViewModel, {super.key});
final DashboardViewModel dashboardViewModel;
@override @override
State<DesktopSettingsPage> createState() => _DesktopSettingsPageState(); State<DesktopSettingsPage> createState() => _DesktopSettingsPageState();
@ -51,6 +54,12 @@ class _DesktopSettingsPageState extends State<DesktopSettingsPage> {
padding: EdgeInsets.only(top: 0), padding: EdgeInsets.only(top: 0),
itemBuilder: (_, index) { itemBuilder: (_, index) {
final item = SettingActions.desktopSettings[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; final isLastTile = index == itemCount - 1;
return SettingActionButton( return SettingActionButton(
isLastTile: isLastTile, isLastTile: isLastTile,

View file

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

View file

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

View file

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

View file

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

View file

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