diff --git a/android/app/src/main/AndroidManifestBase.xml b/android/app/src/main/AndroidManifestBase.xml index f4023f53..8d94ba24 100644 --- a/android/app/src/main/AndroidManifestBase.xml +++ b/android/app/src/main/AndroidManifestBase.xml @@ -38,7 +38,7 @@ android:scheme="cakewallet" android:host="y.at" /> - + diff --git a/ios/Runner/InfoBase.plist b/ios/Runner/InfoBase.plist index ad8816ca..79439166 100644 --- a/ios/Runner/InfoBase.plist +++ b/ios/Runner/InfoBase.plist @@ -21,18 +21,48 @@ CFBundleSignature ???? CFBundleURLTypes - - - CFBundleTypeRole - Editor - CFBundleURLName - y.at - CFBundleURLSchemes - - cakewallet - - - + + + CFBundleTypeRole + Editor + CFBundleURLName + y.at + CFBundleURLSchemes + + cakewallet + + + + CFBundleTypeRole + Editor + CFBundleURLName + bitcoin + CFBundleURLSchemes + + bitcoin + + + + CFBundleTypeRole + Editor + CFBundleURLName + monero + CFBundleURLSchemes + + monero + + + + CFBundleTypeRole + Editor + CFBundleURLName + litecoin + CFBundleURLSchemes + + litecoin + + + CFBundleVersion $(CURRENT_PROJECT_VERSION) LSRequiresIPhoneOS diff --git a/lib/di.dart b/lib/di.dart index 9a554b25..3481d783 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -377,8 +377,8 @@ Future setup( getIt.get(), _transactionDescriptionBox)); - getIt.registerFactoryParam( - (PaymentRequest initialPaymentRequest, _) => SendPage( + getIt.registerFactoryParam( + (PaymentRequest? initialPaymentRequest, _) => SendPage( sendViewModel: getIt.get(), settingsViewModel: getIt.get(), initialPaymentRequest: initialPaymentRequest, diff --git a/lib/main.dart b/lib/main.dart index 7a3cc5ff..8e971ec4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -39,6 +39,8 @@ import 'package:cw_core/unspent_coins_info.dart'; import 'package:cake_wallet/monero/monero.dart'; import 'package:cake_wallet/wallet_type_utils.dart'; +import 'src/screens/auth/auth_page.dart'; + final navigatorKey = GlobalKey(); final rootKey = GlobalKey(); @@ -213,15 +215,15 @@ class AppState extends State with SingleTickerProviderStateMixin { super.dispose(); } - /// handle app links while the app is already started - be it in - /// the foreground or in the background. + /// handle app links while the app is already started + /// whether its in the foreground or in the background. Future initUniLinks() async { try { - stream = getUriLinksStream().listen((Uri uri) { + stream = uriLinkStream.listen((Uri? uri) { handleDeepLinking(uri); }); - final Uri initialUri = await getInitialUri(); + final Uri? initialUri = await getInitialUri(); handleDeepLinking(initialUri); } catch (e) { @@ -229,14 +231,21 @@ class AppState extends State with SingleTickerProviderStateMixin { } } - void handleDeepLinking(Uri uri) { + void handleDeepLinking(Uri? uri) { if (uri == null || !mounted) return; - Navigator.pushNamed( - navigatorKey.currentContext, - Routes.send, - arguments: PaymentRequest.fromUri(uri), - ); + Navigator.of(navigatorKey.currentContext!).pushNamed(Routes.auth, + arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) { + if (isAuthenticatedSuccessfully) { + auth.close(route: Routes.send, arguments: PaymentRequest.fromUri(uri)); + } + }); + + // Navigator.pushNamed( + // navigatorKey.currentContext!, + // Routes.send, + // arguments: PaymentRequest.fromUri(uri), + // ); } Future _handleInitialUri() async { diff --git a/lib/router.dart b/lib/router.dart index 08c91db2..065e91a3 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -210,7 +210,7 @@ Route createRoute(RouteSettings settings) { builder: (_) => getIt.get()); case Routes.send: - final initialPaymentRequest = settings.arguments as PaymentRequest; + final initialPaymentRequest = settings.arguments as PaymentRequest?; return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get( diff --git a/lib/src/screens/send/widgets/send_card.dart b/lib/src/screens/send/widgets/send_card.dart index acc53e78..07b33843 100644 --- a/lib/src/screens/send/widgets/send_card.dart +++ b/lib/src/screens/send/widgets/send_card.dart @@ -1,4 +1,3 @@ -import 'dart:ui'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/utils/payment_request.dart'; import 'package:cw_core/transaction_priority.dart'; @@ -44,7 +43,7 @@ class SendCardState extends State required this.output, required this.sendViewModel, this.initialPaymentRequest}) - : addressController = TextEditingController(text: initialPaymentRequest?.address?.toLowerCase()), + : addressController = TextEditingController(text: initialPaymentRequest?.address.toLowerCase()), cryptoAmountController = TextEditingController(text: initialPaymentRequest?.amount), fiatAmountController = TextEditingController(), noteController = TextEditingController(), @@ -77,8 +76,8 @@ class SendCardState extends State /// if the current wallet doesn't match the one in the qr code if (initialPaymentRequest != null && - sendViewModel.walletCurrencyName != initialPaymentRequest.scheme?.toLowerCase()) { - WidgetsBinding.instance?.addPostFrameCallback((timeStamp) { + sendViewModel.walletCurrencyName != initialPaymentRequest!.scheme.toLowerCase()) { + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { showPopUp( context: context, builder: (BuildContext context) { @@ -544,7 +543,7 @@ class SendCardState extends State addressController.text = output.address; } if (output.cryptoAmount.isNotEmpty || - sendViewModel.walletCurrencyName != initialPaymentRequest?.scheme?.toLowerCase()) { + sendViewModel.walletCurrencyName != initialPaymentRequest?.scheme.toLowerCase()) { cryptoAmountController.text = output.cryptoAmount; } fiatAmountController.text = output.fiatAmount; diff --git a/lib/utils/payment_request.dart b/lib/utils/payment_request.dart index 0a6306cd..88730f03 100644 --- a/lib/utils/payment_request.dart +++ b/lib/utils/payment_request.dart @@ -1,7 +1,7 @@ class PaymentRequest { - PaymentRequest(this.address, this.amount, this.note, {this.scheme}); + PaymentRequest(this.address, this.amount, this.note, this.scheme); - factory PaymentRequest.fromUri(Uri uri) { + factory PaymentRequest.fromUri(Uri? uri) { var address = ""; var amount = ""; var note = ""; @@ -15,7 +15,7 @@ class PaymentRequest { scheme = uri.scheme; } - return PaymentRequest(address, amount, note, scheme: scheme); + return PaymentRequest(address, amount, note, scheme); } final String address; diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index a17635a8..5632f885 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -137,7 +137,7 @@ abstract class SendViewModelBase with Store { PendingTransaction? pendingTransaction; @computed - String get balance => balanceViewModel.availableBalance ?? '0.0'; + String get balance => balanceViewModel.availableBalance; @computed bool get isReadyForSend => _wallet.syncStatus is SyncedSyncStatus; @@ -164,7 +164,7 @@ abstract class SendViewModelBase with Store { WalletType get walletType => _wallet.type; - String get walletCurrencyName => _wallet.currency.name.toLowerCase(); + String? get walletCurrencyName => _wallet.currency.name?.toLowerCase(); bool get hasCurrecyChanger => walletType == WalletType.haven;