feat(shopinbit): after payment, nav back to specific request if known
What changed, and why it matters
This commit changes the post-payment navigation in the ShopInBit feature of Stack Wallet. After a user pays, the app now tries to return them to the specific purchase request they came from, instead of always sending them to the general requests list. There is no security issue visible in this change.
No security action required. This is a routine UX/navigation improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors _navigateToTickets() in shopinbit_payment_view.dart into two route-aware helpers: _backToRequest() and _goToMyRequests(). It uses Navigator.popUntil() to unwind to a known named route (ShopInBitTicketDetail, ShopInBitTicketsView, or ServicesView) and, if the target is not already in the back stack, pushes the appropriate destination. The button label and callback are selected based on whether widget.apiTicketId is non-zero. No input validation, cryptographic, networking, or permission changes are present.
Changed components
lib/pages/shopinbit/shopinbit_payment_view.dartInspect captured patch +42 / −7
diff --git a/lib/pages/shopinbit/shopinbit_payment_view.dart b/lib/pages/shopinbit/shopinbit_payment_view.dart
index 7e43601..f3b7ccf 100644
--- a/lib/pages/shopinbit/shopinbit_payment_view.dart
+++ b/lib/pages/shopinbit/shopinbit_payment_view.dart
@@ -26,7 +26,10 @@ import '../../widgets/icon_widgets/copy_icon.dart';
import '../../widgets/qr.dart';
import '../../widgets/rounded_white_container.dart';
import '../../widgets/stack_dialog.dart';
+import '../more_view/services_view.dart';
import 'shopinbit_payment_shared.dart';
+import 'shopinbit_ticket_detail.dart';
+import 'shopinbit_tickets_view.dart';
class ShopInBitPaymentView extends ConsumerStatefulWidget {
const ShopInBitPaymentView({
@@ -247,11 +250,43 @@ class _ShopInBitPaymentViewState extends ConsumerState<ShopInBitPaymentView> {
Navigator.of(context).pop();
}
- void _navigateToTickets() {
- if (Util.isDesktop) {
- Navigator.of(context, rootNavigator: true).pop();
- } else {
- Navigator.of(context).popUntil((route) => route.isFirst);
+ bool get _canReturnToRequest => widget.apiTicketId != 0;
+ void _backToRequest() {
+ final navigator = Navigator.of(context);
+ bool landedOnRequest = false;
+ navigator.popUntil((route) {
+ final name = route.settings.name;
+ if (name == ShopInBitTicketDetail.routeName) {
+ landedOnRequest = true;
+ return true;
+ }
+ return name == ShopInBitTicketsView.routeName ||
+ name == ServicesView.routeName ||
+ route.isFirst;
+ });
+ if (!landedOnRequest) {
+ unawaited(
+ navigator.pushNamed(
+ ShopInBitTicketDetail.routeName,
+ arguments: widget.apiTicketId,
+ ),
+ );
+ }
+ }
+
+ void _goToMyRequests() {
+ final navigator = Navigator.of(context);
+ bool landedOnTickets = false;
+ navigator.popUntil((route) {
+ final name = route.settings.name;
+ if (name == ShopInBitTicketsView.routeName) {
+ landedOnTickets = true;
+ return true;
+ }
+ return name == ServicesView.routeName || route.isFirst;
+ });
+ if (!landedOnTickets) {
+ unawaited(navigator.pushNamed(ShopInBitTicketsView.routeName));
}
}
@@ -569,8 +604,8 @@ class _ShopInBitPaymentViewState extends ConsumerState<ShopInBitPaymentView> {
),
SizedBox(height: isDesktop ? 16 : 12),
PrimaryButton(
- label: "View My Requests",
- onPressed: _navigateToTickets,
+ label: _canReturnToRequest ? "Back to Request" : "View My Requests",
+ onPressed: _canReturnToRequest ? _backToRequest : _goToMyRequests,
),
],
SizedBox(height: isDesktop ? 24 : 16),
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.