CW-1130-add-app-shortcuts (#2599)

* add app shortcuts

* update icons

* Improve deep link and quick action navigation

* bypass auth when allowedCreate state is active

* remove spaces from file names [skip ci]

---------

Co-authored-by: Serhii-Borodenko <17529954+Serhii-Borodenko@users.noreply.github.com>
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
Serhii
2026-01-17 04:09:10 +01:00
committed by GitHub
co-authored by Serhii-Borodenko OmarHatem
parent cf795bcc48
commit 2dd6cdce1e
17 changed files with 241 additions and 15 deletions
+38 -4
View File
@@ -28,6 +28,8 @@ class LinkViewModel {
bool get _isValidPaymentUri => currentLink?.path.isNotEmpty ?? false;
bool get isWalletConnectLink => currentLink?.authority == 'wc';
bool get isNanoGptLink => currentLink?.scheme == 'nano-gpt';
bool get isQuickActionLink =>
currentLink?.scheme == 'cakewallet' && currentLink?.host == 'quickaction';
String? getRouteToGo() {
if (isWalletConnectLink) {
@@ -38,6 +40,19 @@ class LinkViewModel {
return Routes.walletConnectConnectionsListing;
}
// Check for a quick action first.
if (isQuickActionLink) {
final action = currentLink!.pathSegments.isNotEmpty ? currentLink!.pathSegments.first : null;
switch (action) {
case 'send':
return Routes.send;
case 'receive':
return Routes.addressPage;
default:
return null;
}
}
if (authenticationStore.state == AuthenticationState.uninitialized) {
return null;
}
@@ -65,6 +80,10 @@ class LinkViewModel {
return currentLink;
}
if (isQuickActionLink) {
return null;
}
if (isNanoGptLink) {
switch (currentLink?.authority ?? '') {
case "exchange":
@@ -113,16 +132,31 @@ class LinkViewModel {
return;
}
// Prevent navigating to the same route again.
if (appStore.currentRouteName == route) {
return;
}
if (isNanoGptLink) {
if (route == Routes.buySellPage || route == Routes.exchange) {
await _errorToast(S.current.nano_gpt_thanks_message, fontSize: 14);
}
}
// Quick actions must reset navigation to Dashboard → TargetPage
if (isQuickActionLink) {
currentLink = null;
navigatorKey.currentState?.pushNamedAndRemoveUntil(
route,
ModalRoute.withName(Routes.dashboard),
arguments: args,
);
return;
}
// Normal navigation flow
currentLink = null;
navigatorKey.currentState?.pushNamed(
route,
arguments: args,
);
navigatorKey.currentState?.pushNamed(route, arguments: args);
}
}
}