| 12 | styleUrls: ['app.component.scss'], |
| 13 | }) |
| 14 | export class AppComponent implements OnInit { |
| 15 | constructor(public auth: AuthService, private ngZone: NgZone) {} |
| 16 | |
| 17 | ngOnInit(): void { |
| 18 | App.addListener('appUrlOpen', ({ url }) => { |
| 19 | // Must run inside an NgZone for Angular to pick up the changes |
| 20 | // https://capacitorjs.com/docs/guides/angular |
| 21 | this.ngZone.run(() => { |
| 22 | if (url?.startsWith(callbackUri)) { |
| 23 | if ( |
| 24 | url.includes('state=') && |
| 25 | (url.includes('error=') || url.includes('code=')) |
| 26 | ) { |
| 27 | this.auth |
| 28 | .handleRedirectCallback(url) |
| 29 | .pipe(mergeMap(() => Browser.close())) |
| 30 | .subscribe(); |
| 31 | } else { |
| 32 | Browser.close(); |
| 33 | } |
| 34 | } |
| 35 | }); |
| 36 | }); |
| 37 | } |
| 38 | } |
nothing calls this directly
no outgoing calls
no test coverage detected