Skip to content

Commit

Permalink
feat: Return error when user cancels the presentation #3207
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Dec 23, 2024
1 parent 3f71b3b commit 31f6f58
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:convert';

import 'package:altme/app/app.dart';
Expand Down Expand Up @@ -199,7 +200,15 @@ class _SelectiveDisclosurePickViewState
const SizedBox(height: 8),
MyOutlinedButton(
text: l10n.cancel,
onPressed: () => Navigator.of(context).pop(),
onPressed: () {
unawaited(
context.read<ScanCubit>().sendErrorToServer(
uri: widget.uri,
data: {'error': 'access_denied'},
),
);
Navigator.of(context).pop();
},
),
],
),
Expand Down Expand Up @@ -320,6 +329,12 @@ class _SelectiveDisclosurePickViewState
);

if (!authenticated) {
unawaited(
context.read<ScanCubit>().sendErrorToServer(
uri: widget.uri,
data: {'error': 'access_denied'},
),
);
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:altme/app/app.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/l10n/l10n.dart';
Expand Down Expand Up @@ -84,6 +86,12 @@ class _QueryByExamplePresentPageState extends State<QueryByExamplePresentPage> {
const SizedBox(height: 8),
MyOutlinedButton(
onPressed: () {
unawaited(
context.read<ScanCubit>().sendErrorToServer(
uri: widget.uri,
data: {'error': 'access_denied'},
),
);
Navigator.of(context).pop();
},
text: l10n.credentialPresentCancel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,8 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
'error_description': 'Invalid client_id',
};
unawaited(
scanCubit.sendErrorToServer(uri: state.uri!, data: error));
scanCubit.sendErrorToServer(uri: state.uri!, data: error),
);
throw ResponseMessage(data: error);
}
}
Expand Down

0 comments on commit 31f6f58

Please sign in to comment.