Skip to content

Commit

Permalink
Popup presentationrequest#1729 (#1730)
Browse files Browse the repository at this point in the history
* check for message if scan cubit has message then show it

* show response messge for 212 and 412
  • Loading branch information
TalebRafiepour authored Jul 18, 2023
1 parent c47c3fc commit 453765d
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 15 deletions.
6 changes: 5 additions & 1 deletion lib/app/shared/alert_message/alert_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ class AlertMessage {
String message = '';

if (messageHandler != null) {
message = messageHandler.getMessage(context, messageHandler);
if (messageHandler is NetworkException && messageHandler.data is String) {
message = messageHandler.data as String;
} else {
message = messageHandler.getMessage(context, messageHandler);
}
}

if (stringMessage != null) {
Expand Down
5 changes: 4 additions & 1 deletion lib/connection_bridge/model/ethereum_transaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class EthereumTransaction {

@override
String toString() {
return 'WCEthereumTransaction(from: $from, to: $to, nonce: $nonce, gasPrice: $gasPrice, maxFeePerGas: $maxFeePerGas, maxPriorityFeePerGas: $maxPriorityFeePerGas, gas: $gas, gasLimit: $gasLimit, value: $value, data: $data)';
return 'WCEthereumTransaction(from: $from, to: $to, nonce: $nonce,'
' gasPrice: $gasPrice, maxFeePerGas: $maxFeePerGas, maxPriorityFeePerGas: '
'$maxPriorityFeePerGas, gas: $gas, gasLimit: $gasLimit,'
' value: $value, data: $data)';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ class CredentialManifestOfferPickView extends StatelessWidget {
} else {
LoadingView().hide();
}
if (scanState.message != null) {
AlertMessage.showStateMessage(
context: context,
stateMessage: scanState.message!,
);
}
},
child: credentialManifestState.filteredCredentialList.isEmpty
? const RequiredCredentialNotFound()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ class QueryByExampleCredentialPickView extends StatelessWidget {
} else {
LoadingView().hide();
}
if (scanState.message != null) {
AlertMessage.showStateMessage(
context: context,
stateMessage: scanState.message!,
);
}
},
child: BasePage(
title: l10n.credentialPickTitle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ class _CredentialsReceivePageState extends State<CredentialsReceivePage> {
} else {
LoadingView().hide();
}
if (state.message != null) {
AlertMessage.showStateMessage(
context: context,
stateMessage: state.message!,
);
}
},
builder: (context, state) {
final credentialModel = CredentialModel.fromJson(widget.preview);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ class _QrCodeScanPageState extends State<QrCodeScanPage> {
} else {
LoadingView().hide();
}
if (state.status == ScanStatus.success &&
state.message != null) {
AlertMessage.showStateMessage(
context: context,
stateMessage: state.message!,
);
}
},
),
],
Expand Down
17 changes: 12 additions & 5 deletions lib/scan/cubit/scan_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -323,21 +323,28 @@ class ScanCubit extends Cubit<ScanState> {
'presentation': presentation,
});

await client.post(url, data: formData);
final result = await client.post(url, data: formData);

await presentationActivity(
credentialModels: credentialsToBePresented,
issuer: issuer,
);

String? responseMessage;
if (result is String?) {
responseMessage = result;
}
emit(
state.copyWith(
status: ScanStatus.success,
message: StateMessage.success(
messageHandler: ResponseMessage(
ResponseString
.RESPONSE_STRING_SUCCESSFULLY_PRESENTED_YOUR_CREDENTIAL,
),
stringMessage: responseMessage,
messageHandler: responseMessage != null
? null
: ResponseMessage(
ResponseString
.RESPONSE_STRING_SUCCESSFULLY_PRESENTED_YOUR_CREDENTIAL,
),
),
),
);
Expand Down
16 changes: 8 additions & 8 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,10 @@ packages:
dependency: transitive
description:
name: ffigen
sha256: "94587f4c9699a4d0a25da95dc0b41903ddc69201d9bac3ca128ade8e67d56015"
sha256: "4bbf1fa19723a90578e991b9a95afca43bea856809890a26609618fa29087427"
url: "https://pub.dev"
source: hosted
version: "7.2.10"
version: "7.2.11"
file:
dependency: transitive
description:
Expand Down Expand Up @@ -1094,10 +1094,10 @@ packages:
dependency: transitive
description:
name: get_it
sha256: "290fde3a86072e4b37dbb03c07bec6126f0ecc28dad403c12ffe2e5a2d751ab7"
sha256: "529de303c739fca98cd7ece5fca500d8ff89649f1bb4b4e94fb20954abcd7468"
url: "https://pub.dev"
source: hosted
version: "7.2.0"
version: "7.6.0"
glob:
dependency: transitive
description:
Expand Down Expand Up @@ -1995,10 +1995,10 @@ packages:
dependency: transitive
description:
name: sembast
sha256: "24829715d11c2c437e67b413f29ff91b5325daa9632f851d44deeea7a29bde9e"
sha256: da8dd3774b6001bde09378da28e94c40bd4daecde32adb44837517c12e991321
url: "https://pub.dev"
source: hosted
version: "3.4.3+1"
version: "3.4.9"
share_plus:
dependency: "direct main"
description:
Expand Down Expand Up @@ -2617,10 +2617,10 @@ packages:
dependency: transitive
description:
name: yaml_edit
sha256: "0b968021754d8fbd3e9c83563b538ee417d88b2cc587606da5615546b7ee033b"
sha256: "1579d4a0340a83cf9e4d580ea51a16329c916973bffd5bd4b45e911b25d46bfd"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.1.1"
sdks:
dart: ">=3.0.0 <3.7.0"
flutter: ">=3.10.0"

0 comments on commit 453765d

Please sign in to comment.