mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
Update Branch to null safety
Add deep linking to iOS
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
android:scheme="cakewallet"
|
||||
android:host="y.at" />
|
||||
</intent-filter>
|
||||
<!-- bitcoin qr code scheme -->
|
||||
<!-- currencies qr code scheme -->
|
||||
<intent-filter android:autoVerify="true">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
+42
-12
@@ -21,18 +21,48 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>y.at</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>cakewallet</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>y.at</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>cakewallet</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>bitcoin</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>bitcoin</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>monero</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>monero</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>litecoin</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>litecoin</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
|
||||
+2
-2
@@ -377,8 +377,8 @@ Future setup(
|
||||
getIt.get<BalanceViewModel>(),
|
||||
_transactionDescriptionBox));
|
||||
|
||||
getIt.registerFactoryParam<SendPage, PaymentRequest, void>(
|
||||
(PaymentRequest initialPaymentRequest, _) => SendPage(
|
||||
getIt.registerFactoryParam<SendPage, PaymentRequest?, void>(
|
||||
(PaymentRequest? initialPaymentRequest, _) => SendPage(
|
||||
sendViewModel: getIt.get<SendViewModel>(),
|
||||
settingsViewModel: getIt.get<SettingsViewModel>(),
|
||||
initialPaymentRequest: initialPaymentRequest,
|
||||
|
||||
+19
-10
@@ -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<NavigatorState>();
|
||||
final rootKey = GlobalKey<RootState>();
|
||||
|
||||
@@ -213,15 +215,15 @@ class AppState extends State<App> 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<void> 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<App> 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<void> _handleInitialUri() async {
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
||||
builder: (_) => getIt.get<DashboardPage>());
|
||||
|
||||
case Routes.send:
|
||||
final initialPaymentRequest = settings.arguments as PaymentRequest;
|
||||
final initialPaymentRequest = settings.arguments as PaymentRequest?;
|
||||
|
||||
return CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true, builder: (_) => getIt.get<SendPage>(
|
||||
|
||||
@@ -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<SendCard>
|
||||
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<SendCard>
|
||||
|
||||
/// 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<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
@@ -544,7 +543,7 @@ class SendCardState extends State<SendCard>
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user