diff --git a/package-lock.json b/package-lock.json index 2a18f2f7..6455dd3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "eudistack-wallet-ui", - "version": "2.0.11", + "version": "2.0.12", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "eudistack-wallet-ui", - "version": "2.0.11", + "version": "2.0.12", "dependencies": { "@angular/common": "^18.2.2", "@angular/core": "^18.2.2", diff --git a/package.json b/package.json index d43d90bc..7c49d3d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eudistack-wallet-ui", - "version": "2.0.11", + "version": "2.0.12", "author": "Ionic Framework", "homepage": "https://ionicframework.com/", "scripts": { diff --git a/src/app/pages/credentials/credentials.page.ts b/src/app/pages/credentials/credentials.page.ts index 13ebdd14..2f2e136b 100644 --- a/src/app/pages/credentials/credentials.page.ts +++ b/src/app/pages/credentials/credentials.page.ts @@ -192,6 +192,7 @@ export class CredentialsPage implements OnInit, ViewWillLeave { }), catchError((error: ExtendedHttpErrorResponse) => { + this.websocket.closeNotificationConnection(); this.handleContentExecutionError(error); return of(null); }) @@ -200,26 +201,41 @@ export class CredentialsPage implements OnInit, ViewWillLeave { } public sameDeviceVcActivationFlow(): void { - this.websocket.connectPinSocket() - .then(() => { - console.info('Requesting Credential Offer via same-device flow.'); - this.walletService.requestOpenidCredentialOffer(this.credentialOfferUri).subscribe({ - next: () => { - this.handleActivationSuccess().subscribe(() => { - this.router.navigate(['/tabs/credentials']); - this.websocket.closePinConnection(); - }); - }, - error: (err) => { - console.error(err); - this.websocket.closePinConnection(); - }, - }); - }) - .catch(err => { - this.handleContentExecutionError(err) - }) + const socketsToConnect: Promise[] = [ + this.websocket.connectPinSocket(), + this.websocket.connectNotificationSocket(), + ]; + + from(Promise.all(socketsToConnect)) + .pipe( + tap(() => { + console.info('Requesting Credential Offer via same-device flow.'); + }), + + switchMap(() => + this.walletService.requestOpenidCredentialOffer(this.credentialOfferUri) + ), + + switchMap(() => this.handleActivationSuccess()), + + switchMap(() => + from(this.router.navigate(['/tabs/credentials'])) + ), + + finalize(() => { + this.websocket.closePinConnection(); + }), + + catchError((err: ExtendedHttpErrorResponse) => { + console.error(err); + this.websocket.closeNotificationConnection(); + this.handleContentExecutionError(err); + return of(null); + }) + ) + .subscribe(); } + private handleActivationSuccess(): Observable { this.loader.addLoadingProcess(); @@ -254,6 +270,7 @@ export class CredentialsPage implements OnInit, ViewWillLeave { } } return cred; + }); // todo avoid this this.cdr.detectChanges(); diff --git a/src/theme/customAlert.scss b/src/theme/customAlert.scss index 4fcbed0b..6257c024 100644 --- a/src/theme/customAlert.scss +++ b/src/theme/customAlert.scss @@ -76,13 +76,19 @@ ion-alert.custom-alert-error .alert-wrapper { font-weight: bold; } - ion-alert .cred-preview { + ion-alert .alert-message div.cred-preview { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; } + @media (min-width: 768px) { + ion-alert .alert-message .cred-preview { + align-items: flex-start; + } + } + ion-alert.custom-alert-credential .cred-row { display: grid; grid-template-columns: max-content 1fr;