Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix reloading apps when token is renewed #634

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

<div class="scrollable-div">
<mat-list class="appitems-container">
<mat-list-item *ngFor="let app of applications$ | async" class="">
<mat-list-item
*ngFor="let app of applications$ | async; trackBy: trackByFn"
class=""
>
<iframe
*ngIf="app.loadInBackground"
aria-hidden="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ export class ApplicationListComponent implements OnInit, OnChanges, OnDestroy {
return url;
}

trackByFn(index, item) {
return item.id;
}

ngOnDestroy() {
this.unsubscribe$.next(null);
this.unsubscribe$.complete();
Expand Down
18 changes: 8 additions & 10 deletions src/app/components/player/focused-app/focused-app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FocusedAppService } from '../../../services/focused-app/focused-app.ser
import { SafeUrl, DomSanitizer } from '@angular/platform-browser';
import { combineLatest, Observable, Subject } from 'rxjs';
import { ComnAuthQuery, Theme } from '@cmusei/crucible-common';
import { map, shareReplay } from 'rxjs/operators';
import { distinctUntilChanged, map, shareReplay } from 'rxjs/operators';

@Component({
selector: 'app-focused-app',
Expand All @@ -23,10 +23,6 @@ export class FocusedAppComponent implements OnDestroy {
private sanitizer: DomSanitizer,
private authQuery: ComnAuthQuery
) {
this.focusedAppUrl$ = this.focusedAppService.focusedAppUrl.pipe(
map((url) => this.sanitizer.bypassSecurityTrustResourceUrl(url))
);

this.focusedAppUrl$ = combineLatest([
this.focusedAppService.focusedAppUrl,
this.authQuery.userTheme$,
Expand All @@ -47,12 +43,14 @@ export class FocusedAppComponent implements OnDestroy {
themedUrl =
url.substring(0, themeIndex) + themeText + theme + urlEnding;
}
return this.sanitizer.bypassSecurityTrustResourceUrl(themedUrl);

return themedUrl;
}),
shareReplay(1)
// share({
// connector: () => new ReplaySubject(1),
// })
shareReplay(1),
distinctUntilChanged(),
map((themedUrl) =>
this.sanitizer.bypassSecurityTrustResourceUrl(themedUrl)
)
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/assets/config/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"response_type": "code",
"scope": "openid profile player",
"automaticSilentRenew": true,
"silent_redirect_uri": "http://localhost:4301/auth-callback-silent",
"silent_redirect_uri": "http://localhost:4301/auth-callback-silent.html",
"redirectMethod": "replace"
},
"NotificationsSettings": {
Expand Down
Loading